Lecture 20 Variations on the Turing Machines COT 4420 Theory of Computation Section 10.1, 10.2 Slides from Prof. Busch The Standard Model Infinite Tape ☐☐ a a b a b b c a c a ☐☐☐ Read-Write Head (Left or Right) Control Unit Deterministic Standard Turing Machine M = <Q, Σ, Γ, δ, q0, ☐, F> • • • • • • • Q: a finite set of internal states Σ: is the input alphabet ( Σ ⊆ Γ-{☐} ) Γ: finite set of symbols called the tape alphabet δ: transition function (Q × Γ Q × Γ × {L, R} ) q0: the initial state (q0 ∈ Q) ☐: is a special symbol called blank (☐ ∈ Γ) F: a set of final/accepting states (F ⊆ Q) Variations of the Standard Model Turing machines with: • Stay-Option • Semi-Infinite Tape •Off-line • Multitape • Multidimensional • Nondeterministic Same Power of two machine classes: both classes accept the same set of languages We will prove: each new class has the same power with Standard Turing Machine (accept Turing-Recognizable Languages) Same Power of two classes: • Two automata are equivalent if they accept the same language. For any machine M1 of first class there is a machine M2 of second class such that: L(M1) = L(M2) and vice versa. Simulation: A technique to prove same power. Simulate the machine of one class with a machine of the other class Configurations in the original machine M1 have corresponding configurations in the simulation machine M2 If machine M1 has the sequence of computations: d0 ⊢ d1 ⊢ … ⊢ dn Then M2 simulates this computation: * * * d’0 ⊢ d’1 ⊢ … ⊢ d’n Turing Machines with Stay-Option The head can stay in the same position ☐☐ a a b a b b c a c a ☐☐☐ Left, Right, Stay L,R,S: possible head moves Example: ☐☐ a a b a b b c a c a☐☐☐ q1 q1 ☐ ☐b q2 a → b, S q2 a b a b b c a c a ☐☐☐ Theorem: Stay-Option machines have the same power with Standard Turing machines Proof – part 1 • Stay-option machines simulate Standard Turing machines • Proof: A Standard machine is also a Stayoption machine (that never uses the S move). Proof – part 2 • Standard Turing machines simulate Stayoption machines Proof: We need to simulate the stay head option with two head moves, one left and one right For transitions with L and R moves, nothing changes Stay-Option Machine q1 a → b, L q2 Simulation in Standard Machine q1 a → b, L Similar for Right moves q2 Stay-Option Machine q1 a → b, S q2 Simulation in Standard Machine q1 a → b, L x → x, R For every possible tape symbol q2 x Example Stay-Option Machine: b S a , → q1 q2 1 aaba ☐ ☐ q1 ☐ 2 baba ☐ q2 Simulation in Standard Machine: ☐ 1 aaba q1 ☐ ☐ 2 baba q3 ☐ ☐ 3 baba q2 ☐ Standard Machine – Multiple Track Tape : a useful trick One Tape ☐☐ ☐☐ a b a b b a c d ☐ track 1 ☐ track 2 One head One symbol ( a, b) It is a standard Turing machine, but each tape alphabet symbol describes a pair of actual useful symbols ☐ ☐ ☐☐ a b a b b a c d ☐ track 1 ☐ track 2 ☐ track 1 ☐ track 2 q1 ☐☐ ☐☐ a c a b b d c d q2 q1 (b, a ) → (c, d ), L q2 Semi-Infinite Tape The tape extends infinitely only to the right a b a c ☐ ☐ ......... • Initial position is the leftmost cell • No left move is permitted when the read-write head is at the boundary Theorem: Semi-Infinite machines have the same power as standard Turing machines Proof: 1. Standard Turing machines Simulate semi-infinite machines 2. Semi-Infinite Machines simulate Standard Turing machines 1. Standard Turing machines simulate Semi-Infinite machines: Trivial 2. Semi-Infinite tape machines simulate Standard Turing machines: ......... Standard machine ......... Semi-Infinite tape machine ......... Squeeze infinity of both directions to one direction Standard machine ......... ☐ a b c d e ☐ ☐ ......... reference point Semi-Infinite tape machine with two tracks Right part Left part # d e ☐ # c b a ☐ ☐ ☐ ☐ ......... Standard machine q1 q2 Semi-Infinite tape machine Left part q1L q2L Right part q1R q2R Time 1 ......... Standard machine ☐ a b c d e ☐ ☐ ......... q1 Semi-Infinite tape machine Right part Left part # d e ☐ # c b a L q1 ☐ ☐ ☐ ☐ ......... Standard machine q1 a → g, R q2 Semi-Infinite tape machine Right part R ( a, x ) → ( g , x ), R q1 Left part L q1 ( x, a ) → ( x, g ), L For all tape symbols x R q2 L q2 Time 2 ......... Standard machine ☐ g b c d e ☐ ☐ ......... q2 Semi-Infinite tape machine Right part Left part # d e ☐ g c b # L q2 ☐ ☐ ☐ ☐ ......... At the border: Semi-Infinite tape machine Right part R (# , # ) → (# , # ), R q1 L q1 Left part L (# , # ) → (# , # ), R q1 R q1 Right part Left part Semi-Infinite tape machine Time 1 # d e ☐ # c b g ☐ ☐ ......... ☐ ☐ L q1 Right part Left part Time 2 # d e ☐ # c b g R q1 ☐ ☐ ☐ ☐ ......... The Off-Line Machine Input File a b c read-only (once) Control Unit Tape ☐ ☐ read-write g d e ☐ ☐ Theorem: Proof: Off-Line machines have the same power with Standard Turing machines 1. Off-Line machines simulate Standard Turing machines 2. Standard Turing machines simulate Off-Line machines 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 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 Off-line Machine Tape Input File ☐ ☐ a b c d e f g ☐ Standard Machine -- Four track tape # a # 0 e 0 b 0 f 1 c d 1 0 g 0 Input File head position Tape head position Reference point # # # # a 0 e 0 b 0 f 1 (uses special symbol # ) c d 1 0 g 0 Input File head position Tape head position Repeat for each state transition: 1. Search track 2 for the marked cell 2. Remember the symbol in the corresponding cell of track 1 3. Search track 4 for the head position 4. Remember the symbol in the corresponding cell of track 3 5. Change all 4 tracks according to the transition 6. Return to the standard starting position Multi-tape Turing Machines Control unit (state machine) Tape 1 ☐ a b c Tape 2 ☐ Input string Input string appears on Tape 1 ☐ e f g ☐ Tape 1 ☐ Time 1 a b c Tape 2 ☐ ☐ e f g q1 q1 Tape 1 ☐ Time 2 a g c ☐ Tape 2 ☐ e d g q2 q2 q1 ☐ (b, f ) → ( g , d ), L, R q2 ☐ Theorem: Proof: Multi-tape machines have the same power with Standard Turing machines 1. Multi-tape machines simulate Standard Turing machines 2. Standard Turing machines simulate Multi-tape machines 1. Multi-tape machines simulate Standard Turing Machines: Trivial: Use one tape 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 Multi-tape Machine Tape 1 Tape 2 ☐ a b c ☐ ☐ e f g h ☐ Standard machine with four track tape a 0 e 0 b 1 f 0 c 0 g h 1 0 Tape 1 head position Tape 2 head position Reference point # # # # a 0 e 0 b 1 f 0 c 0 g h 1 0 Tape 1 head position Tape 2 head position Repeat for each Multi-tape state transition: 1. 2. 3. 4. Return to reference point Find current symbol in Track 1 and update Return to reference point Find current symbol in Tape 2 and update