# Turing machines Sipser 2.3 and 3.1 (pages 123-144)

## Presentation on theme: "Turing machines Sipser 2.3 and 3.1 (pages 123-144)"— Presentation transcript:

Turing machines Sipser 2.3 and 3.1 (pages 123-144)

CS 311 Mount Holyoke College 2 A Context-free Grammar for {a n b n c n | n ≥ 0} ? Theorem 2.34 (Pumping lemma for CFLs): If A is a CFL, then there is a number p where, if s is any string in A of length ≥ p, then s = uvxyz such that: 1.For each i ≥ 0, uv i xy i z ∈ A, 2.|vy| > 0, and 3.|vxy| ≤ p

CS 311 Mount Holyoke College 3 Proof idea Surgery on parse trees

CS 311 Mount Holyoke College 4 So… Is {a n b n c n | n ≥ 0} a CFL?

CS 311 Mount Holyoke College 5 Chomsky hierarchy Context-free languages Regular languages 0n1n0n1n anbncnanbncn

CS 311 Mount Holyoke College 6 Introducing… Turing machines a a b b a a b b Finite control Bi-directional read/write head Infinite tape

CS 311 Mount Holyoke College 7 Formally… A Turing machine is a 7-tuple (Q, Σ, Γ, δ, q 0, q accept, q reject ), where – Q is a finite set called the states – Σ is a finite set not containing the blank symbol called the input alphabet – Γ is a finite set called the tape alphabet with ∈ Γ and Σ ⊆ Γ – δ:Q ×Γ → Q ×Γ ×{L,R} – q 0 ∈ Q is the start state – q accept ∈ Q is the accept state – q accept ∈ Q is the reject state

CS 311 Mount Holyoke College 8 Recognizing {a n b n c n | n ≥ 0} b b b b c c c c Finite control Infinite tape a a a a

CS 311 Mount Holyoke College 9 Configurations A configuration is –Current state –Current tape contents –Current head location u q v means –Current state is q –Current tape contents is uv –Current head points at first symbol of v Example – âaq 1 bbcc –In state q 1 –Tape contents are âabbcc –Tape head is on first b

CS 311 Mount Holyoke College 10 Yields A configuration C 1 yields configuration C 2 if the Turing machine can legally go from C 1 to C 2 in a single step yields Written ⊢

CS 311 Mount Holyoke College 11 Turing-recognizable languages A Turing machine accepts input w if a sequence of configurations C 1,C 2,...,C k exists where 1.C 1 is the start configuration of M on input w 2.Each C i yields C i+1 3.C k is an accepting configuration Defn 3.5: A language is Turing-recognizable if it is accepted by some Turing machine.

CS 311 Mount Holyoke College 12 Recognizing.