0% found this document useful (0 votes)
40 views44 pages

Lesson 10 Pumping Lemma

The document discusses using the pumping lemma to prove that a language is not regular. It provides an example proof that the language L={anbn: n≥0} is not regular. The proof assumes L is regular, picks a string w that satisfies the pumping lemma conditions, and considers the three possible cases for decomposing w into xyz. It shows that for each case, there exists an n value that causes xynz to not be in L, contradicting the pumping lemma. This demonstrates that the assumption that L is regular is false.

Uploaded by

Shaharbano Asif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views44 pages

Lesson 10 Pumping Lemma

The document discusses using the pumping lemma to prove that a language is not regular. It provides an example proof that the language L={anbn: n≥0} is not regular. The proof assumes L is regular, picks a string w that satisfies the pumping lemma conditions, and considers the three possible cases for decomposing w into xyz. It shows that for each case, there exists an n value that causes xynz to not be in L, contradicting the pumping lemma. This demonstrates that the assumption that L is regular is false.

Uploaded by

Shaharbano Asif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Using The Pumping Lemma

The Pumping Lemma is a statement


about regular languages whose main
utility is in creating proofs that
languages are not regular (by
contradiction).
The aim of this lecture is to analyze
what it is saying and to discover what it
takes to get a contradiction.
The Pumping Lemma for Regular Languages:
If L is a language accepted by a DFA with k
states, and w∈ L, |w| ≥ k, then ∃ x, y, z such that
1. w = x y z,
2. y ≠ ε,
3. | x y | ≤ k, and
4. x yn z is in L for all n ≥ 0.
L= { an b n : n ≥ 0 } is not a regular language.
The proof is a proof by contradiction.
We assume L is regular.
Then L is a language accepted by some DFA M
with k states for some integer k.
You must use a variable for the number of states
so that the proof works no matter how many
states some adversary is claiming for a purported
DFA.
Since L is accepted by a DFA M with k states,
the pumping lemma holds.
If L is a language accepted by a DFA with k
states, and w∈ L, |w| ≥ k, then ∃ x, y, z such that
1. w = x y z,
2. y ≠ ε,
3. | x y | ≤ k, and
4. x yn z is in L for all n ≥ 0.

The statement is true for ALL w such that |w| ≥k.


To get a contradiction it suffices to show a
counterexample with ONE w with |w| ≥ k but as noted
before, using a variable is necessary to ensure the proof
works for all k.
If L is a language accepted by a DFA with k
states, and w∈ L, |w| ≥ k, then ∃ x, y, z such
that
1. w = x y z,
2. y ≠ ε,
3. | x y | ≤ k, and
4. x yn z is in L for all n ≥ 0.

The statement says that there exists x, y, and z.


To show that this is not true, we must try all possible
choices for x, y, and z with w = xyz, y ≠ ε, and |xy| ≤ k.
If L is a language accepted by a DFA with k
states, and w∈ L, |w| ≥ k, then ∃ x, y, z such that
1. w = x y z,
Pump n times is the phrase
2. y ≠ ε, we use when getting this
contradiction by arguing
3. | x y | ≤ k, and that x yn z is not in L.
4. x yn z is in L for all n ≥ 0.

The statement is true for ALL n ≥ 0.


To get a contradiction it suffices to show a
counterexample with ONE n such that x y n z is not in L
for each choice of y.
L= { an b n : n ≥ 0 } is not a regular language.

Proof (by contradiction)

Assume L is regular.

Then L is accepted by a DFA M with k states


for some integer k.
Since L is accepted by a DFA M with k states,
the pumping lemma holds.
The pumping lemma holds for ALL w such that |w|
≥k. So we pick one string w with length at least k.

Let w = ar br where r = ⌈ k/2⌉ .

|w| = k when k is even or


k+1 if k is odd so
|w|≥k as required.

Note that |w| depends on k.


We must try all possible choices for x, y, and z with
w = xyz, y ≠ ε, and |xy| ≤ k.

Case 1: ai (aj ) ar-i-j br j≥1


Case 2: ar bi (bj ) br-i-j j≥1
Case 3: ar-i ( ai bj ) br-j i, j ≥ 1
(i=0 is case 2 and j=0 is case 1)
Note: we will show later how to better
exploit the condition that |xy| ≤k.
Case 1: ai (aj ) ar-i-j br j≥1
Case 2: ar bi (bj ) br-i-j j≥1
Case 3: ar-i ( ai bj ) br-j i, j ≥ 1
w= a a b b, 10 choices for y
Case 1: Case 2: Case 3:
(a) a b b i=0, j=1 a a (b) b i=0, j=1 a (a b ) b i=1, j=1
(aa) b b i=0, j=2 a a (b b) i=0, j=2 a (a b b) i=1, j=2
a (a) b b i=1, j=1 a a b (b) i=1, j=1 (a a b) b i=2, j=1
(a a b b) i=2, j=2
For each choice of y, we need to find
ONE n such that x y n z is not in L.
Case 1: ai (aj ) ar-i-j br j≥1
Pump zero times:
This means set n=0 in ai (aj )n ar-i-j br.
ai (aj )0 ar-i-j br = ai ar-i-j br = ar-j br
But ar-j br is not in L= { an b n : n ≥ 0 }
since r-j < r because j ≥ 1.
For each choice of y, we need to find
ONE n such that x y n z is not in L.
Case 2: ar bi (bj ) br-i-j j ≥ 1
Pump zero times:
This means set n=0 in ar bi (bj )n br-i-j
ar bi (bj )0 br-i-j = ar bi br-i-j = ar br-j
But ar br-j is not in L= { an b n : n ≥ 0 } since
r-j < r because j≥ 1.
For each choice of y, we need to find
ONE n such that x y n z is not in L.
Case 3: ar-i ( ai bj ) br-j i, j ≥ 1
Note: pumping zero times does not work
for all of these cases!
If we pump 0 times we get:
ar-i br-j and for all the cases with i=j, this
is in L= { an b n : n ≥ 0 }.
When r=5, i=2, j=2:
w= xyz= a a a ( a a b b ) b b b
Pumping 0 times gives a a a b b b which is
in L. But if we pump two times instead:
aaa(aabb)(aabb) bbb
=aaa aabb aabbbbb
which is not in L since it is not of the
form a* b *(a necessary but not sufficient
condition for being in L= { an b n : n ≥ 0 }).
For each choice of y, we need to find
ONE n such that x y n z is not in L.
Case 3: ar-i ( ai bj ) br-j i, j ≥ 1
Pump two times to get:
ar-i ( ai bj ) ( ai bj ) br-j
which is not in L= { an b n : n ≥ 0 }
because i and j ≥ 1 means it is not of the
form a* b*.
Non-regular languages R
L  {vv : v  *}

Regular languages

Courtesy Costas Busch - RPI 16


Theorem: The language

R
L  {vv : v  *}   {a, b}
is not regular

Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI 17


R
L  {vv : v  *}

Assume for contradiction


L that is a regular language

L Since is infinite
we can apply the Pumping Lemma

Courtesy Costas Busch - RPI 18


R
L  {vv : v  *}
m Let be the integer in the Pumping Lemma

w
Pick a string such that:
w L and

length | w| m

m m m m
We pick
wa b b a
Courtesy Costas Busch - RPI 19
m m m m
Write
a b b a xyz

From the Pumping Lemma

it must be that length | x y |  m, | y | 1

m m m m
xyz  a...aa...a...ab...bb...ba...a
x y z
k
Thus:
y  a , k 1 Courtesy Costas Busch - RPI 20
m m m m k
x y za b b a y  a , k 1

i
From the Pumping Lemma:
xy z  L
i  0, 1, 2, ...

2
Thus:
xy z  L
Courtesy Costas Busch - RPI 21
m m m m k
x y za b b a y  a , k 1

2
From the Pumping Lemma:
xy z  L

m+k m m m
2
xy z = a...aa...aa...a...ab...bb...ba...a ∈ L
x y y z

m k m m m
Thus:
a b b a
Courtesy Costas Busch - RPI
L 22
m k m m m
a b b a L k 1

R
BUT: L  {vv : v  *}

m k m m m
a b b a L

CONTRADICTION!!!
Courtesy Costas Busch - RPI 23
Therefore: L
Our assumption that
is a regular language is not true

Conclusion: L is not a regular language

Courtesy Costas Busch - RPI 24


Non-regular languages

n l n l
L  {a b c : n, l  0}

Regular languages

Courtesy Costas Busch - RPI 25


Theorem: The language

n l n l
L  {a b c : n, l  0}
is not regular

Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI 26


n l n l
L  {a b c : n, l  0}

Assume for contradiction


L that is a regular language

L Since is infinite
we can apply the Pumping Lemma

Courtesy Costas Busch - RPI 27


n l n l
L  {a b c : n, l  0}
m Let be the integer in the Pumping Lemma

w
Pick a string such that:
w L and

length | w| m

m m 2m
We pick
wa b c
Courtesy Costas Busch - RPI 28
m m 2m
Write
a b c xyz

From the Pumping Lemma

it must be that length | x y |  m, | y | 1

m m 2m
xyz  a...aa...aa...ab...bc...cc...c
x y z
k
Thus:
y  a , k 1 Courtesy Costas Busch - RPI 29
m m 2m k
x y za b c y  a , k 1

i
From the Pumping Lemma:
xy z  L
i  0, 1, 2, ...

0
Thus:
x y z = xz ∈ L
Courtesy Costas Busch - RPI 30
m m 2m k
x y za b c y  a , k 1

From the Pumping Lemma:


xz  L
mk m 2m
xz  a...aa...ab...bc...cc...c  L

x z

mk m 2m
Thus:
a b c
Courtesy Costas Busch - RPI
L 31
mk m 2m
a b c L k 1

n l n l
BUT: L  {a b c : n, l  0}

mk m 2m
a b c L

CONTRADICTION!!!
Courtesy Costas Busch - RPI 32
Therefore: Our assumption that
L
is a regular language is not true

Conclusion: L is not a regular language

Courtesy Costas Busch - RPI 33


n!
Non-regular languages
L  {a : n  0}

Regular languages

Courtesy Costas Busch - RPI 34


n!
Theorem: The language
L  {a : n  0}
is not regular

n!  1  2  (n  1)  n

Proof: Use the Pumping Lemma

Courtesy Costas Busch - RPI 35


n!
L  {a : n  0}

Assume for contradiction


L that is a regular language

L Since is infinite
we can apply the Pumping Lemma

Courtesy Costas Busch - RPI 36


n!
L  {a : n  0}
m Let be the integer in the Pumping Lemma

w
Pick a string such that:
w L
length | w| m

m!
We pick
wa
Courtesy Costas Busch - RPI 37
m!
Write
a xyz

From the Pumping Lemma

it must be that length | x y |  m, | y | 1


m m! m
m!
xyz  a  a...aa...aa...aa...aa...a
x y z
k
Thus:
y  a , 1 k  m
Courtesy Costas Busch - RPI 38
m! k
x y za y  a , 1 k  m

i
From the Pumping Lemma:
xy z  L
i  0, 1, 2, ...

2
Thus:
xy z  L
Courtesy Costas Busch - RPI 39
m! k
x y za y  a , 1 k  m

2
From the Pumping Lemma:
xy z  L

mk m!m
2
xy z  a...aa...aa...aa...aa...aa...a  L
x y y z

m ! k
Thus:
a L
Courtesy Costas Busch - RPI 40
m! k
a L 1 k  m

n!
Since:
L  {a : n  0}

There must exist


p
such that:

m! k  p!
Courtesy Costas Busch - RPI 41
However:
m! k  m! m for
m 1
 m! m!
 m!m  m!
 m!(m  1)
 (m  1)!

m! k  (m  1)!

m! k  p!
Courtesy Costas Busch - RPI
for any
p 42
m! k 1 k  m
a L

n!
BUT: L  {a : n  0}

m! k
a L

CONTRADICTION!!!
Courtesy Costas Busch - RPI 43
Therefore: Our assumption that
L
is a regular language is not true

Conclusion: L is not a regular language

Courtesy Costas Busch - RPI 44

You might also like