Review
• Languages and Grammars
– Alphabets, strings, languages
CS 301 - Lecture 7
More Pumping Lemma
Fall 2008
• Regular Languages
– Deterministic Finite Automata
– Nondeterministic Finite Automata
– Equivalence of NFA and DFA
– Minimizing a DFA
– Regular Expressions
– Regular Grammars
– Properties of Regular Languages
– Pumping lemma for Regular Languages
• Today:
– More pumping lemma for regular languages
The Pumping Lemma:
• Given a infinite regular language
• there exists an integer
• for any string
• we can write
• with
L
is not regular
m
w∈ L with length | w | ≥ m
w= x y z
| x y | ≤ m and | y | ≥ 1
• such that:
Theorem: The language L = {a nb n : n ≥ 0}
x yi z ∈ L
Proof:
Use the Pumping Lemma
i = 0, 1, 2, ...
1
L = {a nb n : n ≥ 0}
L = {a nb n : n ≥ 0}
Let
Assume for contradiction
that L is a regular language
m be the integer in the Pumping Lemma
Pick a string
w such that: w ∈ L
length
Since L is infinite
we can apply the Pumping Lemma
Write:
a mb m = x y z
We pick
w = a mb m
x y z = a mb m
y = ak , k ≥ 1
From the Pumping Lemma:
x yi z ∈ L
From the Pumping Lemma
it must be that length
| x y | ≤ m, | y |≥ 1
m
m m
xyz = a b
m
i = 0, 1, 2, ...
= a...aa...aa...ab...b
x
Thus:
| w|≥ m
y
z
Thus:
x y2 z ∈ L
y = ak , k ≥ 1
2
y = ak , k ≥ 1
x y z = a mb m
From the Pumping Lemma:
x y2 z ∈ L
m
m+k
xy 2 z = a...aa...aa...aa...ab...b ∈ L
x
Thus:
Therefore:
y
a m+ k b m ∈ L
y
z
a m+ k b m ∈ L
Our assumption that L
is a regular language is not true
BUT:
L = {a nb n : n ≥ 0}
a m+ k b m ∉ L
CONTRADICTION!!!
Non-regular languages
{a nb n : n ≥ 0}
Regular languages
Conclusion: L
is not a regular language
3
More Applications
of
Non-regular languages
L = {vv R : v ∈ Σ*}
Regular languages
the Pumping Lemma
L = {vv R : v ∈ Σ*}
Theorem: The language
L = {vv R : v ∈ Σ*}
is not regular
Proof:
Use the Pumping Lemma
Σ = {a, b}
Assume for contradiction
that L is a regular language
Since L is infinite
we can apply the Pumping Lemma
4
Write
L = {vv R : v ∈ Σ*}
Let
m be the integer in the Pumping Lemma
a mb mb m a m = x y z
From the Pumping Lemma
it must be that length
Pick a string
w such that: w ∈ L
length
We pick
and
m
| w|≥ m
y = ak , k ≥ 1
x y z = a mb mb m a m
x
Thus:
y
x y z = a mb mb m a m
x yi z ∈ L
i = 0, 1, 2, ...
m+k
x y2 z ∈ L
y = ak , k ≥ 1
x y2 z ∈ L
m m m
xy 2 z = a...aa...aa...a...ab...bb...ba...a ?¸ L
x
Thus:
z
y = ak , k ≥ 1
From the Pumping Lemma:
From the Pumping Lemma:
m m m
xyz = a...aa...a...ab...bb...ba...a
m m m m
w=a b b a
| x y | ≤ m, | y |≥ 1
Thus:
y
y
z
a m + k b mb m a m ∈ L
5
a m + k b mb m a m ∈ L
BUT:
k ≥1
Therefore:
Our assumption that L
is a regular language is not true
L = {vv R : v ∈ Σ*}
a m + k b mb m a m ∉ L
Conclusion: L
is not a regular language
CONTRADICTION!!!
Non-regular languages
L = {a nbl c n+l : n, l ≥ 0}
Theorem: The language
L = {a nbl c n+l : n, l ≥ 0}
is not regular
Regular languages
Proof:
Use the Pumping Lemma
6
L = {a nbl c n+l : n, l ≥ 0}
L = {a nbl c n+l : n, l ≥ 0}
Let
Assume for contradiction
that L is a regular language
m be the integer in the Pumping Lemma
Pick a string
w such that: w ∈ L
length
Since L is infinite
we can apply the Pumping Lemma
Write
a mb m c 2 m = x y z
From the Pumping Lemma
it must be that length | x
m
We pick
y | ≤ m, | y |≥ 1
2m
From the Pumping Lemma:
Thus:
y
z
y = ak , k ≥ 1
x yi z ∈ L
i = 0, 1, 2, ...
xyz = a...aa...aa...ab...bc...cc...c
x
| w|≥ m
w = a mb m c 2 m
x y z = a mb m c 2 m
m
and
Thus:
k
y = a , k ≥1
7
y = ak , k ≥ 1
x y z = a mb m c 2 m
xz ∈ L
From the Pumping Lemma:
m−k
a m−k b mc 2m ∈ L
m
2m
BUT:
k ≥1
L = {a nbl c n+l : n, l ≥ 0}
xz = a...aa...ab...bc...cc...c ∈ L
x
Thus:
Therefore:
z
a m−k b mc 2m ∈ L
Our assumption that L
is a regular language is not true
a m−k b mc 2m ∉ L
CONTRADICTION!!!
Non-regular languages
L = {a n! : n ≥ 0}
Regular languages
Conclusion: L
is not a regular language
8
Theorem: The language
L = {a n! : n ≥ 0}
n!
L = {a : n ≥ 0}
is not regular
n! = 1 ⋅ 2 (n − 1) ⋅ n
Proof:
Since L is infinite
we can apply the Pumping Lemma
Use the Pumping Lemma
L = {a n! : n ≥ 0}
Let
Write
m be the integer in the Pumping Lemma
Pick a string
Assume for contradiction
that L is a regular language
a m! = x y z
From the Pumping Lemma
it must be that length | x
w such that: w ∈ L
length
m
| w|≥ m
w=a
m!− m
xyz = a m! = a...aa...aa...aa...aa...a
x
We pick
y | ≤ m, | y |≥ 1
m!
Thus:
y
z
y = ak , 1 ≤ k ≤ m
9
y = ak , 1 ≤ k ≤ m
x y z = a m!
y = ak , 1 ≤ k ≤ m
x y z = a m!
From the Pumping Lemma:
x yi z ∈ L
From the Pumping Lemma:
i = 0, 1, 2, ...
m+k
y
y
2
z
xy z ∈ L
Thus:
a m!+ k ∈ L
Since:
m!− m
xy 2 z = a...aa...aa...aa...aa...aa...a ∈ L
x
Thus:
x y2 z ∈ L
1≤ k ≤ m
L = {a n! : n ≥ 0}
There must exist
p such that:
However:
a m!+ k ∈ L
m!+ k ≤ m!+ m
≤ m!+ m!
for
m >1
< m!m + m!
= m!(m + 1)
= (m + 1)!
m!+ k < (m + 1)!
m!+ k = p!
m!+ k ≠ p!
for any
p
10
a m!+ k ∈ L
BUT:
1≤ k ≤ m
Therefore:
Our assumption that L
is a regular language is not true
L = {a n! : n ≥ 0}
a m!+ k ∉ L
Conclusion: L
is not a regular language
CONTRADICTION!!!
What’s Next
• Read
– Linz Chapter 1, 2.1, 2.2, 2.3, (skip 2.4) 3, 4, 5.1-5.3
– JFLAP Startup, Chapter 1, 2.1, 3, 4, 6.1
• Next Lecture Topics from Chapter 5.1-5.3
– Context Free Grammars
• Quiz 1 in Recitation on Wednesday 9/17
– Covers Linz 1.1, 1.2, 2.1, 2.2, 2.3 and JFLAP 1, 2.1
– Closed book, but you may bring one sheet of 8.5 x 11 inch paper with any
notes you like.
– Quiz will take the full hour
• Homework
– Homework Due Thursday
11
© Copyright 2026 Paperzz