turing machine recap
play

Turing machine recap A Turing machine TM is a tuple M = ( , Q , ) - PowerPoint PPT Presentation

Turing machine recap A Turing machine TM is a tuple M = ( , Q , ) where : set of symbols that TM s tapes can contain. Universal Turing Machines and Undecidability Q : possible states TM can be in. q start : the TM starts in this state


  1. Turing machine recap A Turing machine TM is a tuple M = (Γ , Q , δ ) where Γ: set of symbols that TM ’s tapes can contain. Universal Turing Machines and Undecidability Q : possible states TM can be in. q start : the TM starts in this state Nabil Mustafa q halt : the TM halts when this state is reached Storage for TM : Computability and Complexity A special register stores the current state. 1 input tape, 1 output tape and 1 work tape Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability Robustness of TM Alphabet size doesn’t matter Many details of our TM quite arbitrary Claim Does restricting the alphabet Γ to { 0 , 1 , � , ⊲ } matter? If function f is computable by a TM M using alphabet Γ , then it is computable in time 4 log | Γ | T ( n ) by a TM M ′ using the No! alphabet { 0 , 1 , � , ⊲ } . If function f is computable by a TM using alphabet Γ, then it is computable in time 4 log | Γ | T ( n ) by a TM using the alphabet Have to decide: { 0 , 1 , � , ⊲ } . Does using more work tapes make everything much faster? How to represent each symbol of Γ using { 0 , 1 , � , ⊲ } . No! Use binary encoding. Each symbol encoded by log | Γ | bits. If function f is computable by a TM using k tapes, then it is computable in time 5 kT ( n ) 2 by a TM using a single work tape. How to simulate each step of M . Read the encoded symbol via log | Γ | bits. Problem: remember the bits read. Church-Turing Hypothesis Every physically realizable computation device can be simulated by Modify the transition table appropriately a TM . Lookup the (remembered) read bits in the (modified) table Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability

  2. Remembering bits read Lets say that i → 01001 and j → 01010. Then, Q Γ Q Γ { L , S , R } q 0 q 0 0 R Problem: How to remember the bits read? 1 1 R q 0 q 01 0 0 R q 01 q 010 q ′ q j R y j i n x i b 3 0 0 R q 010 q 0100 1 1 L q 0100 qb 1 . 01001 − − L qb 1 . 01001 qb 2 . 01001 q q 0 0 0 R − − L qb 2 . 01001 qb 3 . 01001 − − L q 0 q 01 R qb 3 . 01001 qb 4 . 01001 1 1 y 0 1 b − − S 1 0 0 qb 4 . 01001 qw 1 . 01001 q 01 q 010 0 0 R qw 1 . 01001 − qw 2 . 01001 0 R q 010 q 0100 qw 2 . 01001 − qw 3 . 01001 1 R 0 0 R qw 3 . 01001 − qw 4 . 01001 0 R q ′ q 0100 1 1 R qw 4 . 01001 − qw 5 . 01001 1 R q ′ qw 5 . 01001 − 0 R Note: need to move back 2 log | Γ | steps as well! Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability Total time required More work tapes do not make much difference Claim What is the number of states in M ′ ? If a function f is computable by a TM M using k tapes, then its Each line in the transition table of M creates 4 log | Γ | states. computable in time 5 kT ( n ) 2 by a TM using a single work tape. log | Γ | steps to read the symbol encoding. log | Γ | steps to go back to the start of the symbol encoding. Proof log | Γ | steps to write the new symbol encoding. 2 log | Γ | in case the tape-head moves to the left. Lets consider that a TM M computes the function f and has k tapes (plus additional input and output tapes) What is the size of the transition table? Next we consider a single work tape Turing machine ˆ M | Q | · | Γ | ˆ M encodes the k tapes of M on a single tape by using locations 1 , k + 1 , 2 k + 1 , . . . to encode the first tape, Total number of states required: | Q || Γ | 4 log | Γ | . locations 2 , k + 2 , 2 k + 2 , . . . to encode the second tape etc. For every symbol a in M ’s alphabet, ˆ M will contain both the Each step of M requires 5 log | Γ | steps of M ′ . symbol a and the symbol ˆ a . In the encoding of each tape, Total time taken: 5 log | Γ | T ( n ) steps. exactly one symbol will be of the ‘ˆ type’, indicating that the corresponding head of M is positioned in that location. Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability

  3. More work tapes do not make much difference Universal Turing Machines So far, constructed Turing machines for a specific task. Proof Cont’d a primitive computer that only performs one task. To simulate one step of M , the machine makes two passes of its work tape: first it traverses the tape in the left-to-right Not very useful, since there are many things we want to do. direction and records (via additional states) the k symbols of the form ˆ a Question: does there exist a TM that does many things? Then ˆ In other words, given a ‘program’ P and an input x for P , run M uses M ’s transition function to determine the new P on x . state, symbols, and head movements and sweeps the tape Note that a program is just an algorithm for doing something, back in the right-to-left direction to update the encoding i.e., its a Turing machine. accordingly. ˆ M will never reach more than location kT ( n ) of its work tape, So...given any TM M and x , does there exist a TM UTM meaning that for each of the at most T ( n ) steps of M , ˆ that will run M on x M How to give M to UTM ? Since M is a machine. performs at most 5 kT ( n ) work (sweeping back and forth How does one give a machine to a machine? requires about 2 T ( n ) steps, and some additional steps needed How can there be a fixed machine UTM that will run any for updating head movement and book keeping). other TM ? Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability What is a Turing machine really The Algorithm for TM How can there be a fixed machine UTM that will run any other How does one give a machine to a machine? TM ? Observe that the TM s are not all that different According to Church-Turing hypothesis, any algorithm can be Can assume all have 1 input tape, 1 output tape, 1 work tape. turned into a TM . Can assume Γ = { 0 , 1 , � , ⊲ } Clever idea: Running a TM is also just an algorithm! The only thing different between different Turing machines is For example, we ran the TM for PAL ( x ) by hand. the transition table We just have to follow some rules, i.e., there is a simple But the transition table can be written up as a string of bits! algorithm for running a TM : Read a symbol of x . M α : TM represented by string of bits α Scan the transition table to find a rule which applies. ⌊ M ⌋ ∈ { 0 , 1 } ∗ : string of bits representing M Apply this rule to write new symbol and move the tape head. So UTM takes α and x , and simulates M α on x . So we just have to design a TM that can run the above algorithm. Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability

  4. Universal Turing Machine Simulating M α Storage: T 1 : input tape containing α, x . T 2 : output tape Three work tapes: T 3 contains the current state of M α T 4 is used the same way as M α ’s work-tape. T 5 contains the transition function. Transition function of UTM : Scan T 5 to find a match of the state with T 3 Scan T 5 to find a match of symbol with T 1 and T 4 . Copy new state to T 3 Copy new symbol to T 4 and move heads of T 1 and T 3 . Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability Some Quotes Uncomputable functions f is computable by a TM M if M ( x ) = f ( x ) ∀ x It would seem that any function f : { 0 , 1 } ∗ → { 0 , 1 } can be “If we were so clever that we could understand our brain, our brain computed by a Turing machine. would be so complex that we couldn’t understand it.” We don’t care how much time is taken So just spend as much time till the computation of the function finishes. Uncomputable functions exist There exists UC : { 0 , 1 } ∗ → { 0 , 1 } not computable by any TM . “It seemed unworthy of a grown man to spend his time on such trivialities, but what was I to do?” –Bertrand Russell. HALT ( P , x ): Given program P and x , does P halt on x ? Halting function HALT is not computable by any TM . Nabil Mustafa Universal Turing Machines and Undecidability Nabil Mustafa Universal Turing Machines and Undecidability

Recommend


More recommend