Lecture 15 Pumping Lemma

Lecture 15 Pumping Lemma
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.
s
> logc |x|
x
This tree would have at least |x| leaves. Therefore,
the depth of this tree > logc |x|
|v|+1
Let |x| > K = c .
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.
s
x
Thus, there exists a nonterminal symbol, say A
appearing twice.
Tree T is decomposed into three smaller trees I, II, III.
S
S
S
I
A
I
A
A
u
II
A
z
u
z
z
A
III
w
y
v
u
III
w
Corresponding to this tree decomposition,
x = uvwyz
which has property that for any i > 0
uv i wy i z  L(G).
v
y
A
y
v
w
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
S
I
A
u
v
III
w
is a parse tree for x with less number of node than T.
(-> <-)
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 ≠ ε,
i
(2) for any i > 0, uv wy i 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.
To get condition (3), choose A to be the lowest one
among nonterminal symbols appearing again in the
subpath from which to a leaf.
S
I
A
u
z
II
A
< |V|+1
y
v
III
w
Therefore subtree II+III has depth < |V|+1. Hence, it
Has at most K=c
|V|+1
leaves, i.e., (3) holds.
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 ≠ ε,
i
i
(2) for any i > 0, uv wy z  L,
(3) |vwy| < K.
n n n
Example 1 L={a b c | n > 0} is not CF.
CFL is not closed under intersection!
m m
n
m
n
A = {a b c | m, n > 0}
n
B = {a b c | m, n > 0}
Both A and B are CFL, but
n
n
n
A ∩ B = {a b c | n > 0} is not.
Example 2. L={ww | w (0+1)*} is not CF.
CFL is not closed under complement!
For L = {ww | w (0+1)*}, L is a CFL.
However, L = L is not.
n
L={0 | n is a prime} is not regular.
Proof. For contradiction, suppose L is CF.
Let K > 0 be the constant in Pumping
p
Lemma. Consider a prime p > K. Then, 0
= uvwxy such that vx≠ε and for any i > 0
i
i
uv wx y is in L. Thus,
|u| + |w| + |y| + i(|v|+|x|) is a prime
for any I > 0.
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. (-><-)
Theorem For a language L with one symbol,
L is CF if and only if L is regular.