3.2 Variants of Turing Machines Multitape Turing Machines What's a Multitape Turing Machine? TM with several tapes each tape has its own head What's the content of the tapes when a multitape machine starts? tape 1 contains the input string other tapes are blank What's the domain of a multitape machine's transition function? current state plus a read symbol for each tape What's the range of a multitape machine's transition function? new state plus write and move for each tape What's the result of executing the transition on a 3-tape machine? (q1,a,a,b) -> (q2,b,b,a,L,R,R) How do Multitape Turing Machines compare to single-tape TMs? multitape TMs are equivalent to single-tape TMs How do you show that every single-tape TM has an equivalent multitape TM? simulate single-tape TM on multitape TM using only 1 tape ignore other tapes How do you show that every multitape TM has an equivalent single-tape TM? simulate multitape machine on single tape machine Where does the single-tape machine store the multitape machine's k tapes? store k tapes on single tape separated by # How does the single-tape machine keep track of k head positions? write tape symbol with dot above to mark head location How does the single-tape machine initialize the tape? add k+1 # markers and head markers #w# # ... # How does the single-tape machine simulate choosing the correct transition? scan the tape remembering symbols at tape head locations How does the single-tape machine simulate changes to the k tapes? scan the tape writing symbols and marking new head positions What does the machine do if a simulated tape head moves onto a # symbol? insert a blank on the tape before the # Nondeterministic Turing Machines What's a Nondeterministic Turing Machine? What's the domain of a nondeterministic machine's transition function? same as a regular TM What's the range of a nondeterministic machine's transition function? sets of (state,write,move) triples instead of a single triple How do Nondeterministic Turing Machines compare to deterministic TMs? nondeterministic TMs are equivalent to deterministic TMs How do you show that every deterministic TM has an equivalent nondeterministic TM? a deterministic TM is a nondeterministic TM by definition How do you show that every nondeterministic TM has an equivalent deterministic TM? build a machine that trys all possible choices in the nondeterministic TM accept if any branch of choices reaches an accept state How does the machine try all possible paths through the nondeterministic TM? How can a sequence of numbers represent a path through a TM? number the possible choices leaving a state from 1 to b b is the maximum number of choices at any state in the machine each number in the sequence tells the choice to make next What does the sequence 2131 tell the machine to do? What happens if the sequence contains an invalid choice? How does the machine create sequences of numbers that cover all possible paths? Does the order in which sequences are generated matter? generate all sequences of length 1 then all sequences of length 2, etc get the next sequence by incrementing the previous sequence What does the machine need to store on tape? use 3 tapes tape 1 always contains the input string (unaltered) tape 2 contains the simulated tape for one branch of computation tape 3 contains the sequence of choices for the simulation to use What are the steps of the machine? 1. copy tape 1 (input) to tape 2 (working tape) 2. simulate the nondeterministic machine on tape 2 use tape 3 to select choices in the nondeterministic machine if the simulation reaches an accepting configuration, accept if tape 3 has an invalid choice or if tape 3 has no more symbols or if the simulation reaches a rejecting configuration go to 3 3. increment the sequence of numbers on tape 3 repeat at step 1