Discrete Math. and Logic II. Using Pumping
Lemma
SFWR ENG 2FA3
Ryszard Janicki
Winter 2014
Acknowledgments:
Material
partially
based on
Automata and Computability
Ryszard Janicki
by Dexter C. Kozen (Chapter 12).
Discrete Math. and Logic II. Using Pumping Lemma
1/7
Examples
Example
Show that A = {an bn | n ≥ 0} is not regular.
Take p be the number from pumping lemma and consider
s = ap bp . Hence |s | = 2p > p.
Let x , y , z be such that s = xyz,
|y | > 0, i.e. y 6= ,
and |xy | ≤ p.
This means that y = ak where 1 ≤ k ≤ p.
Now we have xy 0 z = ap−k bp , and p − k 6= p, so xy 0 z ∈
/ A!
Hence the Pumping Lemma is not satised, i.e. A is not
regular.
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
2/7
Examples
Example
Show that C = {an! | n ≥ 0} is not regular.
Take p be the number from pumping lemma and consider
s = ap! . Hence |s | = p ! > p.
Let x , y , z be such that s = xyz,
|y | > 0, i.e. y 6= ,
and |xy | ≤ p.
This means that y = ak where 1 ≤ k ≤ p.
Now we have xy 2 z = ap!+k .
For x , k > 1 we have
x
x −1 < k ⇐⇒ x < k (x −1) ⇐⇒ x < kx −k ⇐⇒ x +k < xk
Hence p ! < p ! + k < p !k < p !(p + 1) = (p + 1)!, i.e. there is
no such natural number t that p ! + k = t !
Hence the Pumping Lemma is not satised, i.e. A is not
regular.
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
3/7
A Trick
If A and B are regular, then so is A ∩ B
If A and B are regular, then so is A ∪ B
If A and B are regular, then so is AB
If A is regular, then so is ∼A
If A is regular, then so is revA (reverse of A).
If A is regular, then so is A0 (interchanging symbols)
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
4/7
A Trick
Example
D = {x ∈ {a, b}∗ | #a(x ) = #b(x )}
#a(x ) indicates the number of a's in the string x.
Since a∗ b∗ is regular, if D is regular then D ∩ a∗ b∗ is also
regular. But D ∩ a∗ b∗ = {an bn | n ≥ 0} is not regular. Hence
D is not regular too.
A = {a n b m | n ≥ m }
b = {am b n | n ≥ m} is also regular, since
If A is regular the A
if rA is a regular expression that generates A, then the regular
expression rAa↔b , where a's and b's are interchanged (i.e. if
b
rA = ab ∪ b then rAa↔b = ba ∪ a), generates A.
m
b is regular too, but A ∩ A
b = {a b m | m|geq0} is
Hence A ∩ A
NOT regular. Therefore A is not regular too.
1
2
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
5/7
Using Pumping Lemma
Problem
Use the pumping lemma to show that the following language is not
regular.
A = {www | w ∈ {0, 1}∗ }
Proof.
Take p be the number from pumping lemma and consider
s = www , where w = 0p−1 1. Hence |s | = 3p > p.
Let x , y , z be such that s = xyz, |y | > 0, i.e. y 6= ,
and |xy | ≤ p (i.e. w = xyt for some t ∈ {0, 1}∗ ).
This means that y = 0k , or y = 0k 1 where 1 ≤ k ≤ p − 1.
Now we have either xy 0 z = xy 0 tww = 0p−k −1 1ww , or
xy 0 z = xy 0 tww = 0p−k −1 ww , but in both cases and
xy 0 z 6= www , so xy 0 z ∈
/ A!
Hence the Pumping Lemma is not satised, i.e. A is not
regular.
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
6/7
Typical Mistakes: what you can and what you cannot.
Since you want to show that the Pumping Lemma IS NOT
satised, you cannot make any assumption about the initial p.
You the fact that you show that is doe not hold for, say,
n = 100 means nothing. You just have to take `general' p.
Since the Pumping Lemma must hold for all s such that
|s | ≥ p, you may pick special s's.
Typically we show that xy 0 z = xz or xy 2 z do not belong to a
given set, but you may pick any particular value of i, for
example xy 276 z if it makes a proof better.
Ryszard Janicki
Discrete Math. and Logic II. Using Pumping Lemma
7/7
© Copyright 2026 Paperzz