Title: Lecture 15 Pumping Lemma
1Lecture 15 Pumping Lemma
2Consider a CFG G (V, S, R, S). Assume for any
rule A ? w in R, w lt c for a constant c gt 0.
For x in L(G), consider a parse tree T for x.
s
gt logc x
x
This tree would have at least x leaves.
Therefore, the depth of this tree gt logc x
3v1
Let x gt K c .
Then the depth of parse tree T gt V1.
So, there is a path from root to a leaf with
length gt V1, That is, it contains at least
V1 internal nodes.
s
x
Thus, there exists a nonterminal symbol, say A
appearing twice.
4Tree T is decomposed into three smaller trees I,
II, III.
S
S
S
I
A
I
u
z
A
A
A
z
u
u
z
III
v
y
II
A
A
w
y
v
y
v
III
w
w
Corresponding to this tree decomposition,
x uvwyz which has property that for any i gt 0
uv wy z L(G).
i
i
5To make this property significant, we should have
vy ? e .
Choose T to be a parse tree for x with minimum
number of nodes. Then we would have vy ? e.
If vy e, then
S
I
A
u
v
III
w
is a parse tree for x with less number of node
than T. (-gt lt-)
6Pumping Lemma (weak) For any CFL L, there exists
a Constant K gt 0 such that any x L with x gt
K can be Decomposed as x uvwyz satisfying
(1) vy ? e, (2) for any i gt 0, uv wy z
L.
i
i
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 lt K.
7To 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
lt V1
y
v
III
w
Therefore subtree IIIII has depth lt V1.
Hence, it
Has at most Kc leaves, i.e., (3)
holds.
V1
8Pumping Lemma (strong) For any CFL L, there
exists a Constant K gt 0 such that any x L with
x gt K can be Decomposed as x uvwyz
satisfying (1) vy ? e, (2) for any i gt
0, uv wy z L, (3) vwy lt K.
i
i
9n
n
n
Example 1 La b c n gt 0 is not CF.
10CFL is not closed under intersection!
m
m
n
A a b c m, n gt 0 B a b c m, n gt
0
m
n
n
Both A and B are CFL, but A n B a b c n
gt 0 is not.
n
n
n
11Example 2. Lww w (01) is not CF.
12CFL is not closed under complement!
For L ww w (01), L is a
CFL. However, L L is not.
13L0 n is a prime is not regular.
n
- Proof. For contradiction, suppose L is CF. Let K
gt 0 be the constant in Pumping Lemma. Consider a
prime p gt K. Then, 0 uvwxy such that vx?e and
for any i gt 0 - uv wx y is in L. Thus,
- u w y i(vx) is a prime
- for any I gt 0.
p
i
i
14For i 0, uw y is a prime. For i
uwy, uwy i(vx)
(uwy)(1vx)
is a prime. (-gtlt-)
15Theorem For a language L with one symbol, L is
CF if and only if L is regular.