turing machines
DESCRIPTION
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: - PowerPoint PPT PresentationTRANSCRIPT
Turing machines
Sipser 2.3 and 3.1 (pages 123-144)
CS 311Mount Holyoke College
2
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 = uvxyz such that: 1. For each i ≥ 0, uvixyiz A∈ , 2. |vy| > 0, and 3. |vxy| ≤ p
CS 311Mount Holyoke College
3
Proof idea
• Surgery on parse trees
CS 311Mount Holyoke College
4
So…
• Is {anbncn| n ≥ 0} a CFL?
CS 311Mount Holyoke College
5
Chomsky hierarchy
Context-free languages
Regular languages
0n1n
anbncn
CS 311Mount Holyoke College
6
Introducing… Turing machines
a b a b ⨆ ⨆ ⨆
Finite control
Bi-directional read/write head
Infinite tape
CS 311Mount Holyoke College
7
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 Q ∈ is the reject state
CS 311Mount Holyoke College
8
Recognizing {anbncn| n ≥ 0}
b b c c ⨆ ⨆ ⨆
Finite control
Infinite tape
a a
CS 311Mount 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– âaq1bbcc
– In state q1
– Tape contents are âabbcc– Tape head is on first b
CS 311Mount Holyoke College
10
Yields
• A configuration C1 yields configuration C2 if the Turing machine can legally go from C1 to C2 in a single step
• yields • Written ⊢
CS 311Mount Holyoke College
11
Turing-recognizable languages
• A Turing machine accepts input w if a sequence of configurations C1,C2,...,Ck exists where 1. C1 is the start configuration of M on input w
2. Each Ci yields Ci+1
3. Ck is an accepting configuration
• Defn 3.5: A language is Turing-recognizable if it is accepted by some Turing machine.
CS 311Mount Holyoke College
12
Recognizing .