Professional Documents
Culture Documents
Pumping Lemma Examples-1
Pumping Lemma Examples-1
Pumping Lemma Examples-1
Pumping Lemma alternates between “for all” and “there is at least one” or “for every” or
“there exists”. Notice:
For every regular language L
There exists a constant n
For every string w in L such that |w| >= n,
There exists a way to break up w into three strings w = xyz such that |y| > 0 , |xy| <= n
and For every k>=0 , the string xykz is also in L.
courtesey: http://suraj.lums.edu.pk/~cs311w05/pumping_lemma_writeup.pdf
1. Show that L2 = {0m1m | x ∈ {0, 1}*} is not regular.
We show that the pumping lemma does not hold for L1. Consider any pumping number p;
p≥ 1. Choose w = 0p1p.
Consider any pumping decomposition w = xyz;
|y| > 0 and |xy| ≤ p. It follows that x = 0a and y = 0b and z = 0p-a-b1p, for b ≥ 1. Choose i =
2. We need to show that xy2z = 0p+b1p is not in L1.
b ≥ 1.
So p+b > p
Hence 0p+b1p is not in L.
2
3. We prove that L3 = {1n | n ≥ 0} is not regular.
We show that the pumping lemma does not hold for L3. Consider any pumping number p
≥ 1.
2
Choose w = 1p .
Consider any pumping decomposition w = xyz such that |y| > 0 and |xy| ≤ p. It follows
2
that x = 1a and y = 1b and z = 1p
−a−b, for b ≥ 1 and a + b ≤ p. Choose i = 2. We need to show that
2
xy2z = 1n +b is not in L3; that is, we need to show that p2 + b is not a square. Since b ≥ 1,
we have
p2 + b > p2. Since a + b ≤ p, we have p2 + b ≤ p2 + p < (p + 1)2 4.Prove that Language
L = {0n: n is a perfect square} is irregular.
Solution: L is infinite. Suppose L is also regular. Then according to pumping lemma there
exists an integer n such that for every string w in where |w| >= n, we can break w into
three strings w = xyz such that:
|y| > 0 , |xy| <= n and for all k>=0 , the string xykz is also in L.
Choose w to be w = 0s where s = n2 that is it is a perfect square.
Let w= 00000000000000000………00000 = xyz . (The length of w = s = n2 in this case.)
Let |xy| <= n and |y| = k. That is w = 0000 0k 000… X y z So, |xyz| = |xz| + |y| = (n2- k ) +
(k) From pumping lemma, I can pump y any number of times and the new string should
also belong to the language. Suppose I pump y twice then, the new string should belong
to the language that is it should have length that is a perfect square but, |xy2z| = |xz| +
2|y| = (n2- k ) + 2k = n2 + k where n2 + k < 1 =" (n+1)(n+1)"> n2 (As k > 0)
=> n2 <>2 + k < (n+1)2 => n2 + k is not a perfect square
=> xy2z is not in L
=> This is a contradiction to the pumping lemma
So, our initial assumption must have been wrong that is L is not regular.
http://compquiz.blogspot.com/2009/11/pumping-lemma-examples.html 2/2