1 / 96

www.nskinfo.com && www.nsksofttch.com Department of nskinfo-i education

www.nskinfo.com && www.nsksofttch.com Department of nskinfo-i education. CS2303-THEORY OF COMPUTATION. TURING MACHINE. Turing’s thesis (1930):. Any computation carried out by mechanical means can be performed by a Turing Machine. When we say:. There exists an algorithm. We mean:.

kolton
Télécharger la présentation

www.nskinfo.com && www.nsksofttch.com Department of nskinfo-i education

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. www.nskinfo.com && www.nsksofttch.comDepartment of nskinfo-i education CS2303-THEORY OF COMPUTATION TURING MACHINE

  2. Turing’s thesis (1930): Any computation carried out by mechanical means can be performed by a Turing Machine

  3. When we say: There exists an algorithm We mean: There exists a Turing Machine that executes the algorithm

  4. Variationsof theTuring Machine

  5. The Standard Model Infinite Tape Read-Write Head (Left or Right) Control Unit Deterministic

  6. Variations of the Standard Model Turing machines with: • Stay-Option • Semi-Infinite Tape • Off-Line • Multitape • Multidimensional • Nondeterministic Different Turing MachineClasses

  7. Turing Machines with Stay-Option The head can stay in the same position Left, Right, Stay L,R,S: possible head moves

  8. Example: Time 1 Time 2

  9. Theorem: Stay-Option machines have the same power with Standard Turing machines Proof: 1. Stay-Option Machines simulate Standard Turing machines 2. Standard Turing machines simulate Stay-Option machines

  10. 1. Stay-Option Machines simulate Standard Turing machines Trivial: any standard Turing machine is also a Stay-Option machine

  11. 2. Standard Turing machines simulate Stay-Option machines We need to simulate the stay head option with two head moves, one left and one right

  12. Stay-Option Machine Simulation in Standard Machine For every possible tape symbol

  13. For other transitions nothing changes Stay-Option Machine Simulation in Standard Machine Similar for Right moves

  14. example of simulation Stay-Option Machine: 1 2 Simulation in Standard Machine: 1 2 3 END OF PROOF

  15. Multiple Track Tape A useful trick to perform more complicated simulations One Tape track 1 track 2 One head One symbol

  16. track 1 track 2 track 1 track 2

  17. Semi-Infinite Tape The head extends infinitely only to the right ......... • Initial position is the leftmost cell • When the head moves left from the border, • it returns to the same position

  18. Theorem: Semi-Infinite machines have the same power with Standard Turing machines Proof: 1. Standard Turing machines simulate Semi-Infinite machines 2. Semi-Infinite Machines simulate Standard Turing machines

  19. 1. Standard Turing machines simulate Semi-Infinite machines: Standard Turing Machine a. insert special symbol at left of input string b.Add a self-loop to every state (except states with no outgoing transitions)

  20. 2. Semi-Infinite tape machines simulate Standard Turing machines: Standard machine ......... ......... Semi-Infinite tape machine ......... Squeeze infinity of both directions in one direction

  21. Standard machine ......... ......... reference point Semi-Infinite tape machine with two tracks Right part ......... Left part

  22. Standard machine Semi-Infinite tape machine Left part Right part

  23. Standard machine Semi-Infinite tape machine Right part Left part For all tape symbols

  24. Time 1 Standard machine ......... ......... Semi-Infinite tape machine Right part ......... Left part

  25. Time 2 Standard machine ......... ......... Semi-Infinite tape machine Right part ......... Left part

  26. At the border: Semi-Infinite tape machine Right part Left part

  27. Semi-Infinite tape machine Time 1 Right part ......... Left part Time 2 Right part ......... Left part END OF PROOF

  28. The Off-Line Machine Input File read-only (once) Input string Appears on input file only Input string Control Unit (state machine) Tape read-write

  29. Theorem: Off-Line machines have the same power with Standard Turing machines Proof: 1. Off-Line machines simulate Standard Turing machines 2. Standard Turing machines simulate Off-Line machines

  30. 1. Off-line machines simulate Standard Turing Machines Off-line machine: 1. Copy input file to tape 2. Continue computation as in Standard Turing machine

  31. Standard machine Off-line machine Tape Input File 1. Copy input file to tape

  32. Standard machine Off-line machine Tape Input File 2. Do computations as in Turing machine

  33. 2. Standard Turing machines simulate Off-Line machines: Use a Standard machine with a four-track tape to keep track of the Off-line input file and tape contents

  34. Off-line Machine Tape Input File Standard Machine -- Four track tape Input File head position Tape head position

  35. Reference point (uses special symbol # ) Input File head position Tape head position Repeat for each state transition: • Return to reference point • Find current input file symbol • Find current tape symbol • Make transition END OF PROOF

  36. Multitape Turing Machines • A multitape Turing machine is like an ordinary TM but it has several tapes instead of one tape. • Initially the input starts on tape 1 and the other tapes are blank. • The transition function is changed to allow for reading, writing, and moving the heads on all the tapes simultaneously. • This means we could read on multiples tape and move in different directions on each tape as well as write a different symbol on each tape, all in one move.

  37. Multitape Turing Machine • Theorem: A multitape TM is equivalent in power to an ordinary TM. Recall that two TM’s are equivalent if they recognize the same language. We can show how to convert a multitape TM, M, to a single tape TM, S: • Say that M has k tapes. • Create the TM S to simulate having k tapes by interleaving the information on each of the k tapes on its single tape • Use a new symbol # as a delimiter to separate the contents of each tape • S must also keep track of the location on each of the simulated heads • Write a type symbol with a * to mark the place where the head on the tape would be • The * symbols are new tape symbols that don’t exist with M • The finite control must have the proper logic to distinguish say, x* and x and realize both refer to the same thing, but one is the current tape symbol.

  38. Multitape Machine Equivalent Single Tape Machine:

  39. Single Tape Equivalent • One final detail • If at any point S moves one of the virtual tape heads onto a #, then this action signifies that M has moved the corresponding head onto the previously unread blank portion of that tape. • To accommodate this situation, S writes a blank symbol on this tape cell and shifts the tape contents to the rightmost # by one, adds a new #, and then continues back where it left off

  40. Multi-tape Turing Machines Control unit (state machine) Tape 1 Tape 2 Input string Input string appears on Tape 1

  41. Tape 1 Time 1 Tape 2 Tape 1 Time 2 Tape 2

  42. Theorem: Multi-tape machines have the same power with Standard Turing machines Proof: 1. Multi-tape machines simulate Standard Turing machines 2. Standard Turing machines simulate Multi-tape machines

  43. 1. Multi-tape machines simulate Standard Turing Machines: Trivial: Use just one tape

  44. 2. Standard Turing machines simulate Multi-tape machines: Standard machine: • Uses a multi-track tape to simulate • the multiple tapes • A tape of the Multi-tape machine • corresponds to a pair of tracks

  45. Multi-tape Machine Tape 1 Tape 2 Standard machine with four track tape Tape 1 head position Tape 2 head position

  46. Reference point Tape 1 head position Tape 2 head position Repeat for each state transition: • Return to reference point • Find current symbol in Tape 1 • Find current symbol in Tape 2 • Make transition END OF PROOF

  47. Same power doesn’t imply same speed: Standard Turing machine: time Go back and forth times to match the a’s with the b’s time 2-tape machine: 1. Copy to tape 2 ( steps) 2. Compare on tape 1 and tape 2 ( steps)

  48. Multidimensional Turing Machines 2-dimensional tape MOVES: L,R,U,D HEAD U: up D: down Position: +2, -1

  49. Theorem: Multidimensional machines have the same power with Standard Turing machines Proof: 1. Multidimensional machines simulate Standard Turing machines 2. Standard Turing machines simulate Multi-Dimensional machines

  50. 1. Multidimensional machines simulate Standard Turing machines Trivial: Use one dimension

More Related