2. Consider a CFG G = (V, Σ, R, S).
Assume for any rule A → w in R, |w| < c for a constant c > 0.
For x in L(G), consider a parse tree T for x.
x
This tree would have at least |x| leaves. Therefore,
the depth of this tree > logc |x|
> logc |x|
s
2
3. Let |x| > K = c .
|v|+1
Then the depth of parse tree T > |V|+1.
So, there is a path from root to a leaf with length > |V|+1,
That is, it contains at least |V|+1 internal nodes.
x
Thus, there exists a nonterminal symbol, say A
appearing twice.
s
3
4. A
A
u
v
w
y
z
S
Tree T is decomposed into three smaller trees I, II, III.
I
II
III
Corresponding to this tree decomposition,
x = uvwyz
which has property that for any i > 0
uv wy z L(G).i i
∈
I
III
A
u
w
z
S
w
u
v
v y
y
z
A
A
A
S
4
5. To make this property significant, we should have
vy ≠ ε .
Choose T to be a parse tree for x with minimum number
of nodes. Then we would have vy ≠ ε.
If vy = ε, then
I
III
A
S
u v
w
is a parse tree for x with less number of node than T.
(-> <-)
5
6. Pumping Lemma (weak): For any CFL L, there exists a
Constant K > 0 such that any x L with |x| > K can be
Decomposed as x = uvwyz satisfying
(1) vy ≠ ε,
(2) for any i > 0, uv wy z L.
∈
∈
∈
It is similar to the situation od pumping lemma fo
regular languages that this lemma may not easy
to use.
Therefore, we would like to add some condition which
can restrict the location of v and y. The following is such
A condition.
(3) |vwy| < K.
i i
6
7. A
A
u
v
w
y
z
S
To get condition (3), choose A to be the lowest one
among nonterminal symbols appearing again in the
subpath from which to a leaf.
I
II
III
Therefore subtree II+III has depth < |V|+1. Hence, it
Has at most K=c leaves, i.e., (3) holds.
|V|+1
< |V|+1
7
8. Pumping Lemma (strong): For any CFL L, there exists a
Constant K > 0 such that any x L with |x| > K can be
Decomposed as x = uvwyz satisfying
(1) vy ≠ ε,
(2) for any i > 0, uv wy z L,
(3) |vwy| < K.
i i
∈
∈
8
10. CFL is not closed under intersection!
A = {a b c | m, n > 0}
B = {a b c | m, n > 0}
m m n
m nn
Both A and B are CFL, but
A ∩ B = {a b c | n > 0} is not.
n nn
10
12. CFL is not closed under complement!
For L = {ww | w (0+1)*}, L is a CFL.
However, L = L is not.
∈
12
13. Proof. For contradiction, suppose L is CF. Let K > 0
be the constant in Pumping Lemma. Consider a
prime p > K. Then, 0 = uvwxy such that vx≠ε and
for any i > 0
uv wx y is in L. Thus,
|u| + |w| + |y| + i(|v|+|x|) is a prime
for any I > 0.
13
n
p
i i
14. For i =0, |u|+|w| + |y| is a prime.
For i =|u|+|w|+|y|, |u|+|w|+|y|+ i(|v|+|x|)
= (|u|+|w|+|y|)(1+|v|+|x|)
is a prime. (-><-)
14
15. Theorem For a language L with one symbol,
L is CF if and only if L is regular.
15