1 properties of context-free languages is a certain language context-free? is the family of cfls...
TRANSCRIPT
1
Properties of Context-Free Languages
• Is a certain language context-free?
• Is the family of CFLs closed under a certain operation?
2
Pumping Lemma
Let L be an infinite CFL. Then there exists m 0 such that any w L with |w| m can be decomposed as w = uvxyz where:
• |vy| 1
• |vxy| m
• uvixyiz L for all i 0
4
Moves in the Game
1. The opponent picks m 0.
2. We choose w L with |w| m.
3. The opponent chooses the decomposition w = uvxyz such that |vy| 1 and |vxy| m.
4. We pick i such that uvixyiz L.
8
Moves in the Game
1. The opponent picks m 0.
2. We choose w = ambmambm.
3. The opponent chooses the decomposition w = uvxyz such that |vy| 1 and |vxy| m.
m m m m
a . . . a b . . . b a . . . a b . . . b
u v x y z
9
Moves in the Game
1. The opponent picks m 0.
2. We choose w = ambmambm.
3. The opponent chooses the decomposition w = uvxyz such that |vy| 1 and |vxy| m.
m m m m
a . . . a b . . . b a . . . a b . . . b
u v x y z
4. We pick i such that uvixyiz L.
11
Linear Context-Free Languages
A CFL L is said to be linear iff there exists a linear CFG G such that L = L(G).
(A grammar is linear iff at most 1 variable can occur on the right side of any production)
12
Pumping Lemma for Linear CFLs
Let L be an infinite linear CFL. Then there exists m 0 such that any w L with |w| m can be decomposed as w = uvxyz where:
• |vy| 1
• |uvyz| m
• uvixyiz L for all i 0
13
Moves in the Game
1. The opponent picks m 0.
2. We choose w L with |w| m.
3. The opponent chooses the decomposition w = uvxyz such that |vy| 1 and |uvyz| m.
4. We pick i such that uvixyiz L.
15
Closure Properties of Context-Free Languages
L1 and L2 are context-free.
How about L1L2, L1L2 , L1L2 , L1, L1* ?
16
Theorem
If L1 and L2 are context-free, then so are L1L2 , L1L2 ,
L1*.
(The family of context-free languages is closed under union, concatenation, and star-closure.)
17
Proof
• G1 = (V1, T1, S1, P1) G2 = (V2, T2, S2, P2)
G3 = (V1V2{S3}, T1T2, S3, P1P2{S3 S1 | S2})
L(G3) = L(G1)L(G2)
18
Proof
• G1 = (V1, T1, S1, P1) G2 = (V2, T2, S2, P2)
G4 = (V1V2{S4}, T1T2, S4, P1P2{S4 S1S2})
L(G4) = L(G1).L(G2)
23
Homework
• Exercises: 2, 7, 8, 9, 14, 15, 16 of Section 8.1.
• Exercises: 2, 4, 10, 15 of Section 8.2.
• Presentations:
Section 12.1: Computability and Decidability + Halting Problem
Section 13.1: Recursive Functions
Post Systems + Church's Thesis
Section 13.2: Measures of Complexity + Complexity Classes