300 likes | 686 Views
Variants of Turing Machines. Lecture 26 Section 3.2 Mon, Oct 22, 2007. Increasing the Power of a Turing Machine. It is hard to believe that something as simple as a Turing machine could be powerful enough for complicated problems. Increasing the Power of a Turing Machine.
E N D
Variants of Turing Machines Lecture 26 Section 3.2 Mon, Oct 22, 2007
Increasing the Power of a Turing Machine • It is hard to believe that something as simple as a Turing machine could be powerful enough for complicated problems.
Increasing the Power of a Turing Machine • We can imagine a number of improvements. • Multiple tapes • Two-way infinite tape • Two-dimensional tape • Addressable memory • Nondeterminism • etc.
Multiple Tapes • Would a Turing machine with k tapes, k > 1, be more powerful than a standard Turing machine? • Each tape could be processed independently of the others.
Multiple Tapes • In other words, each transition would read each tape, write to each tape, and move left or right independently on each tape.
Multiple Tapes • Theorem: Any language that is accepted by a multitape Turing machine is also accepted by a standard Turing machine.
Multiple Tapes • Sketch of the proof: • On a single tape, we could write the contents of all k tapes. • If tape i contains xi1xi2xi3…, for each i, then write #x11x21…xk1#x12x22…xk2#... on the single tape.
Multiple Tapes • To show the current location on each tape, put a special mark on one of that tapes symbols: #x11x21…xk1#x12x22…xk2#... • Now the Turing machine scans the tape, locating the current symbol on each “tape.”
Multiple Tapes • It then makes the appropriate transition. • Write a symbol over each of the current symbols. • Move the location of the current symbol one space left or right for each “tape.” • Of course, the devil is in the details.
Two-way Infinite Tape • We can use a two-tape machine to simiulate the two-way infinite tape. • The right half of the two-way tape is stored on tape 1. • The left half is stored on tape 2. • Transitions are modified to handle the transition from tape 1 to tape 2.
Two-way Infinite Tape • Theorem: Any language accepted by a two-way infinite tape is also accepted by a standard Turing machine.
Other Variants • Metatheorem: Any language accepted by a Turing machine with any variant that anyone has ever thought of is also accepted by a standard Turing machine.
Nondeterminism • A nondeterministic Turing machine is defined like a standard Turing machine except for the transition function. : Q(Q {L, R}) where Q = Q – {qacc, qrej}.
Nondeterminism • That is, (q, a) may result in any of a number of actions. • If any sequence of transitions leads to the accept state, then the input is accepted. • If all sequences of transitions lead to the reject state or to looping, then the input is not accepted.
Nondeterminism • Theorem: Any language accepted by a nondeterministic Turing machine is also accepted by a standard Turing machine.
Nondeterminism • Proof: • We may use a three-tape machine to simulate a nondeterministic Turing machine. • Tape 1 preserves a copy of the original input. • Tape 2 contains a “working” copy of the input. • Tape 3 keeps track of the current state in the nondeterministic machine.
Nondeterminism • Start with the input w on Tape 1 and with Tapes 2 and 3 empty. • Copy w from Tape 1 to Tape 2. • For Tape 3, imagine the transitions starting from the start state as forming a tree. • Each state has child states.
Nondeterminism • Let b be the largest number of children of any node. • Number the children of each state using the numbers 1, 2, …, b (as many as needed).
Nondeterminism • Now each finite string of numbers from {1, 2, …, b} represents a particular path through the nondeterministic Turing machine, or else represents no path at all. • Beginning by writing the empty string on Tape 3, representing no moves at all.
Nondeterminism • If that leads to acceptance, then quit. • If not, then replace with its lexicographical successor. • For that string, follow the sequence of transitions that it describes.
Nondeterminism • If that sequence leads to acceptance, then quit and accept. • If not, then continue in the same manner.
Nondeterminism • If w is accepted by the nondeterministic Turing machine, then some sequence of transitions leads to the accept state. • Eventually that sequence will be written on Tape 3 and tried.
Nondeterminism • On the other hand, if no sequence of transitions leads to the accept state, then the deterministic Turing machine will loop.