Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Extensions to Turing machines TMs are clumsy. Can we make them more efficient or more powerful? We will consider 6 possibilities: 1.Multiple tapes 2.Multiple.

Similar presentations


Presentation on theme: "1 Extensions to Turing machines TMs are clumsy. Can we make them more efficient or more powerful? We will consider 6 possibilities: 1.Multiple tapes 2.Multiple."— Presentation transcript:

1 1 Extensions to Turing machines TMs are clumsy. Can we make them more efficient or more powerful? We will consider 6 possibilities: 1.Multiple tapes 2.Multiple heads 3.Two dimensional tapes 4.Random access memory 5.One way tapes 6.Nondeterminism

2 2 Multiple tapes Basic idea: At each step, scan symbols of all heads. Then, control depends on set of symbols and current state; the result is to replace symbols (move R/L) on all tapes. Question: does this allow us to compute more functions? Answer: NO. Theorem: A function is TM-computable iff it is computable on a multitape TM. Proof: Assume TM M and MTTM M’. 1.Show TM M is simulated by MTTM M’ (easy) 2.Show MTTM M’ is simulated by TM M. (more interesting) < a b a a - - head1 tape1 control < a b a a - - head2 tape2 < a b a a - - head3 tape3

3 3 Multiple tapes In M, location -1 contains0not current head Alocation -1 of tape 1 Flocation -1 of tape 2 location 0 contains0not current head B’location 0 of tape 1 and posn of tape 1 head Glocation 0 of tape 2 < A B C D E - - head1 tape1 < F G H I J - - head2 tape 2 -1 0 1 2 3 M.. (0,A,F) (0,B’,G) (1,C,H) (0,D,I’) … M’ One encoding of two tapes.

4 4 Multiple tapes M -1 0 1 2 3 A B C D E 0 1 0 0 0 F G H I J 0 0 0 1 0 0 – denotes inactive location 1 - denotes active location In M’, location -1 contains0not current head Alocation -1 of tape 1 Flocation -1 of tape 2 location 0 contains0not current head B’location 0 of tape 1 and posn of tape 1 head Glocation 0 of tape 2 < A B C D E - - head1 tape1 < F G H I J - - head2 tape 2 -1 0 1 2 3 M’ Another encoding of two tapes.

5 5 Multiple tapes < A B C D E - - head1 tape1 < F G H I J - - head2 tape 2 -1 0 1 2 3 In M 1.Position head somewhere sensible – right end of data 2.Move left, memorising the symbols at all active locations. Move to right end. 3.Move left, replacing ABC by ABC 010 by 001 and HIJ by HZF 010 010 4.Return to right end. 5.If in halting state, convert contents of tape and halt. M’ Whichever encoding, consider how to simulate a transition in M. One action in M’ will be matched by several actions in M < A B C D E - - head1 tape1 < F G H Z J - - head2 tape 2 -1 0 1 2 3 M’ One transition: Move head tape 1 Replace symbol on tape 2

6 6 Multiple Heads There are n heads, but in any state, only one head can move. BUT, this doesn’t add any expressive power: this machine can be simulated by an ordinary TM (argument is similar to multiple tapes). < a b a a - - head1 tape control head2 head n

7 7 Two dimensional tapes One head on a grid that expands indefinitely to the right and down: We can simulate this machine by a TM. Number locations diagonally in M’, v v v v v > 1 2 6 7 15 > 3 5 8 14 > 4 9 13 > 10 12 > 11 then represent as follows: v 1 v 2 3 > 4 5 6 v 7 8 9 10 > 11..

8 8 Random Access Memory RAM TMs Instead of sequential data, change model to incorporate random access. program ----- program counter PC ----- registers R1 Ac Rn control tape (RAM) The tape itself (memory) is still one dimensional, and infinite, but we index into it via (a finite number of) registers. Registers and RAM cells contain natural numbers. Standard TM inputs/outputs strings over . RAM TM inputs/outputs values in N into RAM locations.

9 9 Turing machine Standard TM inputs/outputs strings over . But RAM TM inputs/outputs values in N into RAM locations. So does this mean that the RM TM is more powerful? OF COURSE NOT. Any string in  *can be represented by a numeric code (assign numbers to symbols, then concatenate). So both machines have the same domain. To show that RAM TM  M, we construct a simulation. Don’t give simulation here, but idea is K registers  k+3 tape TM tape 1 for I/O tape 2 for content of RAM tape (locn, content) tape 3 for working tape

10 10 One Way Tapes So far, our tape has been infinite in both directions. What if we restrict the tape to being one way infinite. Does this mean that the OWT TM is less powerful? OF COURSE NOT. Any two way tape machine M’ can be simulated by a one way tape machine M. Two way tape location … -2 -1 0 1 2 3 … x -2 x -1 x 0 x 1 x 2 x 3 One way tape location … 1 2 3 4 5 6 7 8 … * * x 1 x 0 x 2 x -1 x 3 x -2 Location i in M’ is at location 2i+1 in M i>=1 Location i in M’ is at location 4-2i in M i <=0 Why do we need **? To indicate end of tape (to wrap around). * at locn 1 is for the positive locations, * at locn 2 is for the negative locations

11 11 countability The argument for one way tapes is very similar to a countability argument. Defn A set is countable if we can list the elements of the set (total order), and we can refer to the ith element of the set. Examples: N : 0,1,2,3, … is countable Z : …-1, -2, 0,1, 2,… is countable NxN : is countable (m,n) < (m’,n’) iff (m+n)< (m’+n’) or if (m+n)=(m’+n’) then m<m’ (1,1) (1,2) (1,3) (1,4) … (2,1) (2,2) (2,3) (2,4) … (3,1) (3,2) (3,3) (3,4) … But R is not countable. Consider the interval [0,1). Proof: By contradiction (Cantor’s diagonisation) Assume there is an ordering 1 st 0.a 11 a 12 a 13 … 2 nd 0.a 21 a 22 a 23 … 3 rd 0.a 31 a 32 a 33 … … Now consider 0.a 11 a 22 a 33 … (all diagonal entries)

12 12 countability The argument for one way tapes is very similar to a countability argument. Defn A set is countable if we can list the elements of the set (total order), and we can refer to the ith element of the set. Examples: N : 0,1,2,3, … is countable Z : …-1, -2, 0,1, 2,… is countable NxN : is countable (m,n) < (m’,n’) iff (m+n)< (m’+n’) or if (m+n)=(m’+n’) then m<m’ (1,1) (1,2) (1,3) (1,4) … (2,1) (2,2) (2,3) (2,4) … (3,1) (3,2) (3,3) (3,4) … ………… But R is not countable. Consider the interval [0,1). Proof: By contradiction (Cantor’s diagonisation) Assume there is an ordering 1 st 0.a 11 a 12 a 13 … 2 nd 0.a 21 a 22 a 23 … 3 rd 0.a 31 a 32 a 33 … … Now consider 0.a 11 a 22 a 33 … (all diagonal entries)

13 13 countability Now change a ii to b ii as follows: b ii = a ii +1, if a ii <9 0 if a ii =9 Clearly the number 0.b 11 b 22 b 33 … is in the interval [0,1). But, it does not occur in the list because for any i, the ith digit differs from a ii (it is a ii +1!) so we cannot find a position for 0.b 11 b 22 b 33 …. Thus [0,1) is not countable. Nor is R.

14 14 Nondeterminism All machines so far have been deterministic. What if we allow nondeterminism? Nondeterminism does not affect the power of FSAs – but it does affect PDA (something not covered here). What is nondeterminism for TMs? Multiple transitions: (q,a) (p,b) (q,b) (p’,b’) (q,b) (p’’,b’’) So, we have nondeterministic computations: C 0 C 11 C 12 … C 1k C 21 C 22.. ……….. A nondeterministic machine can produce multiple outputs. But is it more powerful? (OF COURSE NOT) Defn A TM M semidecides a Lang. L iff for any w in L, at least one computation of M halts and for w not in L, no computation halts. Theorem Any nondeterministic TM M’ which semidecides a language L can be simulated by a TM M’ which semidecides L.

15 15 Nondeterminism Sketch of proof Show that if M’ semidecides L (if w is in L, at least one comp. halts) then M semidecides L (if w is in L, then M halts). How to simulate all computations of M’? We can’t simply run them one after another – what if one doesn’t halt (but a later one does)? We need to dovetail computations. Or put another way, instead of a depth first search, we need a breadth first search. Dovetailing Step 1: run first computation for 1 step. Step 2: run first computation for 2 steps and 2 nd computation for 2 steps. … Step i: run I computations for I steps. To do the dovetailing in M, use 2 tapes to store the configurations from odd and even steps. For example, assume all configurations from the 10 th step are stored on tape 2. Then, assuming no computations halt, work out next configurations (from tape 2) and write them to tape 1. Erase tape 2, then start working on configurations from 1th step, which are all no stored on tape 1. Clearly if M’ halts, then so will M. CONCLUSION: We cannot enhance a TM!


Download ppt "1 Extensions to Turing machines TMs are clumsy. Can we make them more efficient or more powerful? We will consider 6 possibilities: 1.Multiple tapes 2.Multiple."

Similar presentations


Ads by Google