Eric Rock CS 525 (Winter 2015) Presentation 1 (Week 4) Equivalence of Single-Tape and Multi-Tape Turing Machines 1/30/2015 1
Turing Machine (Definition 3.3) Formal Definition: (Q, Σ, Γ, δ, q 0, q accept, q reject ) Q = Set of states Σ = input alphabet (minus the blank symbol) Γ = tape alphabet (subset of Σ, includes blank) δ = transition function (Q x Γ -> Q x Γ x {L, R}) q 0 = start state (member of Q) q accept = accepting state (member of Q) q reject = rejecting state (member of Q) 1/30/2015 Eric Rock 2
Turing Machine Informal Definition: Model of computation making use of infinite, single dimensional, readable, writable tape for memory Contains a tape head resting on a single element of the tape at a time (tape head starts at first index) Tape head can move left / right (but not further left than the beginning of the input string) Any single action consists of reading an input symbol, writing an output symbol, and changing to a new state in addition to moving the tape head one position to the left or right Simple, versatile model of computation Many variants of the machine (multi-tape, multi-move, etc) are equivalent (recognize the same class of languages) 1/30/2015 Eric Rock 3
Multi-Tape Turing Machine Formal Definition: (Q, Σ, Γ, δ, q 0, q accept, q reject ) Q = Set of states Σ = input alphabet (minus the blank symbol) Γ = tape alphabet (subset of Σ, includes blank) δ = transition function (Q x Γ k -> Q x Γ k x {L, R, S} k ) q 0 = start state (member of Q) q accept = accepting state (member of Q) q reject = rejecting state (member of Q) 1/30/2015 Eric Rock 4
Multi-Tape Turing Machine Informal Definition: Variant of the turing machine consisting of multiple tapes and multiple read/write heads Each tape has own read/write head, position index Each tape head moves independently of other heads Any single action for a MTTTM containing k tapes consists of reading up to k input symbols, writing the same number of output symbols, and changing to a new state in addition to moving the same number of tape heads one position to the left or right, or remaining in the same position 1/30/2015 Eric Rock 5
Theorem 3.13 Every multi-tape Turing machine has an equivalent single-tape Turing machine We offer a proof by construction broken into a few smaller pieces 1/30/2015 Eric Rock 6
Proof of Theorem 3.13 - Methodology We seek to prove that we may construct a singletape Turing machine from a description of any multi-tape Turing machine Assume we are given a description of a k-tape Turing machine : (Q, Σ, Γ, δ, q 0, q accept, q reject ) Idea is to simulate k tapes and k read-write heads on a single tape and single head Perform reads in one stage, writes/shifts in another 1/30/2015 Eric Rock 7
Proof of Theorem 3.13 Tape Format A single-tape Turing machine stores its input identically to the k-tape Turing machine the first n positions of its first/only tape Any Turing machine tape is infinitely long, and as such a single tape may contain/simulate an infinite number of tapes We store each tape sequentially, separated by markers writes/reads beyond any tape causes a shift v ^ 0 0 1 0 1 0 1 1 0 1 0 1 0 0 1 $ 1/30/2015 Eric Rock 8
Motivation: Tape Markers We may supplement our tape alphabet to include markers These markers consist of dotted symbols the original symbol with a dot on top of it Addition of markers no more than doubles the current size of the tape alphabet Placing a mark consists of replacing the original symbol with the marked version Removing a mark consists of replacing the marked symbol with the orignal 1/30/2015 Eric Rock 9
Motivation: Multiple Tape Storage Since each tape is infinitely long, and all tapes are equally infinitely long, any single tape may represent any finite representation of another tape Tapes are separated by a special marker (text uses #) Read head of each tape is indicated by a marked symbol Each tape is stored in a finite amount of space Bounded by the position of the next end marker Any unexpected read of an end marker results in a shift of all subsequent data rightward All subsequent tapes from the first begin empty (no adjacent # symbols) The first tape begins with a # (first step is to shift all elements rightward to accommodate) 1/30/2015 Eric Rock 10
Motivation: Shifting All Elements Rightward In order to support multi-tape simulation, tape shifting is a required element of our solution Methodology is as follows: Replace # with _ (empty symbol), move right Replace current symbol with marked #, move right For each symbol read, replace it with the previously read symbol (controlled by states, one state per element of our tape alphabet) and move right When End of Tape is written (special symbol, inserted as first step) move left until marked # encountered Replace marked # with # and continue as before 1/30/2015 Eric Rock 11
Theorem 3.13 - Construction Given k-tape Turing machine M: (Q, Σ, Γ, δ, q 0, q accept, q reject ) Mark start and end symbols of tape with distinct symbols (shifting elements right when necessary) Create k-1 simulated tapes at the end of input (each tape begins with a single _ symbol) Stage 1: Transition Determination Start at tape starting marker Read through each tape, determine symbol under each head Combination of symbols read determines action (refer to δ) Stage 2: Action Start at tape starting marker Read/update each read/write head symbol and position Shift elements rightward when necessary (read end of tape) Return to Stage 1 1/30/2015 Eric Rock 12
Theorem 3.13 Every multi-tape Turing machine has an equivalent single-tape Turing machine Proof by construction as in previous slide 1/30/2015 Eric Rock 13
Corollary 3.15 A language is Turing-recognizable iff some multitape Turing machine recognizes it For k=1, a single-tape Turing machine is a valid k-tape Turing machine For k=n, construct a single-tape Turing machine as in Theorem 3.13 for k tapes Single-Tape TM Multi-Tape TM 1/30/2015 Eric Rock 14
Questions 1/30/2015 Eric Rock 15