Examples
Applying Pumping Lemma
cs466(Prasad)
L11PLEG
1
Lp {a p | p is a prime number }
is not regular.
Proof by contradiction:
• Let L p be accepted by a k-state DFA.
• Choose s a n , where n is a prime k
• For all prefixes of length j k ,
j i
n j
(
a
)
a
Lp
• show there exists i j , such that
• i.e., ( j i n j ) is a composite number.
j
j
cs466(Prasad)
L11PLEG
2
• Choose
ij n 1
(For this specific problem i j happens to be
independent of j, but that need not always be the
case.)
j*( n 1) n j n*j n
n * ( j 1)
composite number!
a n1a n1 Lp , (a 2 )n1 a n2 Lp ,...
• L p is non-regular because it violates the
necessary condition.
cs466(Prasad)
L11PLEG
3
Lp {a b | n m}
n m
Proof : (For this example, choice of initial string is crucial.)
s a n where n number of states of DFA
• For this choice of s, the pumping lemma cannot
generate a contradiction!
• However, let s a n 1b n instead.
Original String :
Pumped String :
cs466(Prasad)
s a j a n 1 j bn
i* j
a a
L11PLEG
n 1 j n
b
4
• For
i 0 n j 1
n 1 j n
• Thus, by pumping the substring containing
a’s 0 times (effectively deleting it), the
number of a’s can be made smaller than the
number of b’s.
• So, by pumping lemma, L is non-regular.
cs466(Prasad)
L11PLEG
5
Lc {a c | c is a composite number }
is not regular.
• Proof by contradiction:
a
Lc , the
– If Lc is regular, then so is
complement of Lc .
a
Lc Lp which is known to be non– But
regular.
– So, Lc cannot be regular.
• Proving Lc to be non-regular using pumping
lemma may be difficult/impossible.
cs466(Prasad)
L11PLEG
6
Source of the problem?
Regular (ultimately periodic)
…}
{
Prime (sparse)
…}
{
Composite(dense)
…}
{
cs466(Prasad)
L11PLEG
7
Summary of Proof Techniques Employed
• Counter Examples
• Constructions/Simulations
• Induction Proofs
• Impossibility Proofs
• Proofs by Contradiction
• Reduction Proofs : Closure Properties
cs466(Prasad)
L11PLEG
8
© Copyright 2026 Paperzz