120 likes | 221 Views
Turing machines. Sipser 2.3 and 3.1 (pages 123-144). 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:
E N D
Turing machines Sipser 2.3 and 3.1 (pages 123-144)
A Context-free Grammar for {anbncn| 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 = uvxyzsuch that: • For each i ≥ 0, uvixyiz ∈ A, • |vy| > 0, and • |vxy| ≤ p
Proof idea • Surgery on parse trees
So… • Is {anbncn| n ≥ 0} a CFL?
Chomsky hierarchy anbncn Context-free languages Regular languages 0n1n
Introducing… Turing machines Infinite tape a b a b ⨆ ⨆ ⨆ Bi-directional read/write head Finite control
Formally… • A Turing machine is a 7-tuple (Q, Σ, Γ, δ, q0, qaccept, qreject), 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} • q0∈Q is the start state • qaccept∈Q is the accept state • qaccept∈Qis the reject state
Recognizing {anbncn| n ≥ 0} Infinite tape a a b b c c ⨆ ⨆ ⨆ Finite control
Configurations • A configurationis • Current state • Current tape contents • Current head location • uqvmeans • Current state is q • Current tape contents isuv • Current head points at first symbol of v • Example • âaq1bbcc • In state q1 • Tape contents are âabbcc • Tape head is on first b
Yields • A configuration C1 yields configuration C2 if the Turing machine can legally go from C1 to C2 in a single step • yields • Written ⊢
Turing-recognizable languages • A Turing machine accepts input w if a sequence of configurations C1,C2,...,Ck exists where • C1 is the start configuration of M on input w • Each Ci yields Ci+1 • Ck is an accepting configuration • Defn 3.5: A language is Turing-recognizable if it is accepted by some Turing machine.