Presentation is loading. Please wait.

Presentation is loading. Please wait.

Turing Machines New capabilities: –infinite tape –can read OR write to tape –read/write head can move left and right 0 11001 1 10 1 00 q0q0 input tape.

Similar presentations


Presentation on theme: "Turing Machines New capabilities: –infinite tape –can read OR write to tape –read/write head can move left and right 0 11001 1 10 1 00 q0q0 input tape."— Presentation transcript:

1 Turing Machines New capabilities: –infinite tape –can read OR write to tape –read/write head can move left and right 0 11001 1 10 1 00 q0q0 input tape finite control … read/write head

2 Turing Machine Informal description: –input written on left-most squares of tape –rest of squares are blank –at each point, take a step determined by current symbol being read current state of finite control –a step consists of writing new symbol moving read/write head left or right changing state

3 Example Turing Machine language L = { w#w : w  {0,1}*} 0 1#01 q0q0 input tape finite control … read/write head

4 Turing Machine diagrams –a → R means “read a, move right” –a → L means “read a, move left” –a → b, R means “read a, write b, move right a → R b → R b → L a → b,L b → a,R start state transition label: (tape symbol read → tape symbol written, direction moved) q accept q reject states (1 accept + 1 reject) “_” means blank tape square

5 Example TM diagram q accept q0q0 q1q1 q3q3 q5q5 q7q7 q9q9 q 11 q 12 q 13 q2q2 q4q4 q6q6 q8q8 q 10 0 → _,R 1 → _,R # → R 0,1 → R 0,1,# → L 0,1 → Rx → R #→R#→R_→L_→L_→R_→R#→R#→R 0,1 → R 0,1,# → L 0,1 → Rx → R #→R#→R_→L_→L_→R_→R#→R#→R 0 → x, L 1 → x, L 0,1,x,# → L 0 → x, R 1 → x, R x → R _→R_→R_→R_→R#→R#→R

6 TM formal definition A TM is a 7-tuple (Q, Σ, , δ, q 0, q accept, q reject ) where: –Q is a finite set called the states –Σ is a finite set called the input alphabet – is a finite set called the tape alphabet –δ:Q x  → Q x  x {L, R} is a function called the transition function –q 0 is an element of Q called the start state –q accept, q reject are the accept and reject states

7 Example TM operation #01 #01 #01 #01 #01 #00 start t t #10 accept qσδ(q,σ) start0 (start, 0, R) start1 (start, 1, R) start_ (t, _, L) start# (start, #, R) t0 (accept, 1, -) t1 (t, 0, L) t# (accept, #, R) program for “binary successor”

8 TM configurations (ID) At every step in a computation, a TM is in a configuration determined by: –the contents of the tape –the state –the location of the read/write head next step completely determined by current configuration shorthand: string uqv with u,v  *, q  Q meaning: tape contents: uv followed by blanks in state q reading first symbol of v

9 TM configurations configuration C 1 yields configuration C 2 if TM can legally* move from C 1 to C 2 in 1 step –notation: C 1  C 2 –also: “yields in 1 step” notation: C 1  1 C 2 –“yields in k steps” notation: C 1  k C 2 if there exists configurations D 1,D 2,…D k-1 for which C 1  D 1  D 2  …  D k-1  C 2 –also: “yields in some # of steps” (C 1  * C 2 ) *Convention: TM halts upon entering q accept or q reject

10 TM configurations Formal definition of “yields”: uaq i bv  uq j acv if δ(q i, b) = (q j, c, L), and uaq i bv  uacq j v if δ(q i, b) = (q j, c, R) two special cases: –left end: q i bv  q j cv if δ(q i, b) = (q j, c, L) –right end: uaq i same as uaq i _ u,v  * a,b,c   q i, q j  Q (q i  q accept, q reject )

11 TM acceptance start configuration: q 0 w (w is input) accepting config.: any config.with state q accept rejecting config.: any config. with state q reject TM M accepts input w if there exist configurations C 1, C 2, …, C k –C 1 is start configuration of M on input w –C i  C i+1 for i = 1, 2, 3, …, k-1 –C k is an accepting configuration

12 Turing machine for { w#w | w in {0,1}*} Informal description of a Turing machine:

13 Turing machine for { w#w | w in {0,1}*} Informal description of a Turing machine:

14 Turing machine for { w#w | w in {0,1}*}


Download ppt "Turing Machines New capabilities: –infinite tape –can read OR write to tape –read/write head can move left and right 0 11001 1 10 1 00 q0q0 input tape."

Similar presentations


Ads by Google