the pumping lemma
DESCRIPTION
The Pumping LemmaTRANSCRIPT
The Pumping LemmaComputation Theory
M Ayzed Mirza13-NTU-4005
2
The Pumping Lemma
3
Take an infinite regular languageL
There exists a DFA that accepts L
mstates
(contains an infinite number of strings)
4
mw ||(number of states of DFA)
then, at least one state is repeated in the walk of w
q...... ......1 2 k
Take string with Lw
kw 21Walk in DFA of
Repeated state in DFA
5
Take to be the first state repeatedq
q....
w
There could be many states repeated
q.... ....
Second
occurrence First
occurrence
Unique states
One dimensional projection of walk :
1 2 ki j1i 1j
6
q.... q.... ....
Second
occurrence First
occurrence
1 2 ki j1i 1j
wOne dimensional projection of walk :
ix 1 jiy 1 kjz 1
xyzwWe can write
7
zyxw
q... ...
x
y
z
In DFA:
...
...
1 ki1ij
1j
contains only first occurrence of q
8
Observation: myx ||length numberof statesof DFA
Since, in no state is repeated (except q)
xy
Unique States
q...
x
y
...
1 i1ij
9
Observation: 1|| ylength
Since there is at least one transition in loop
q
y
...
1ij
10
We do not care about the form of string z
q...
x
y
z
...
zmay actually overlap with the paths of and x y
11
The string is accepted
zxAdditional string:
q... ...
x z
...
Do not follow loopy
...
1 ki1ij
1j
12
The string is accepted
zyyx
q... ... ...
x z
Follow loop2 times
Additional string:
y
...
1 ki1ij
1j
13
The string is accepted
zyyyx
q... ... ...
x z
Follow loop3 times
Additional string:
y
...
1 ki1ij
1j
14
The string is accepted
zyx iIn General:
...,2,1,0i
q... ... ...
x z
Follow loop timesi
y
...
1 ki1ij
1j
15
Lzyx i Therefore: ...,2,1,0i
Language accepted by the DFA
q... ... ...
x z
y
...
1 ki1ij
1j
16
The Pumping Lemma:• Given a infinite regular language L
• there exists an integer m
• for any string with length Lw mw ||
• we can write zyxw
• with andmyx || 1|| y
• such that: Lzyx i ...,2,1,0i
(critical length)
17
Applications
of
the Pumping Lemma
18
Observation:Every language of finite size has to be regular
Therefore, every non-regular languagehas to be of infinite size (contains an infinite number of strings)
(we can easily construct an NFA that accepts every string in the language)
19
Suppose you want to prove thatAn infinite language is not regular
1. Assume the opposite: is regular
2. The pumping lemma should hold for
3. Use the pumping lemma to obtain a contradiction
L
L
L
4. Therefore, is not regular L
20
Explanation of Step 3: How to get a contradiction
2. Choose a particular string which satisfies the length condition
Lw
3. Write xyzw
4. Show that Lzxyw i for some 1i
5. This gives a contradiction, since from pumping lemma Lzxyw i
mw ||
1. Let be the critical length for m L
21
Note: It suffices to show that only one stringgives a contradiction
Lw
You don’t need to obtaincontradiction for every Lw
22
Theorem: The language }0:{ nbaL nn
is not regular
Proof: Use the Pumping Lemma
Example of Pumping Lemma application
23
Assume for contradictionthat is a regular languageL
Since is infinitewe can apply the Pumping Lemma
L
}0:{ nbaL nn
24
Let be the critical length for
Pick a string such that: w Lw
mw ||and length
mmbawWe pick
m
}0:{ nbaL nn
L
25
with lengths
From the Pumping Lemma:
1||,|| ymyx
babaaaaabaxyz mm ............
mkay k 1,
x y z
m m
we can write zyxbaw mm
Thus:
w
26
From the Pumping Lemma: Lzyx i
...,2,1,0i
Thus:
mmbazyx
Lzyx 2
mkay k 1,
27
From the Pumping Lemma:
Lbabaaaaaaazxy ...............2
x y z
km m
Thus:
Lzyx 2
mmbazyx
y
Lba mkm
mkay k 1,
28
Lba mkm
}0:{ nbaL nnBUT:
Lba mkm
CONTRADICTION!!!
1≥k
29
Our assumption thatis a regular language is not true
L
Conclusion: L is not a regular language
Therefore:
END OF PROOF
30
More Applications
of
the Pumping Lemma
31
The Pumping Lemma:• Given a infinite regular language L
• there exists an integer (critical length)m
• for any string with length Lw mw ||
• we can write zyxw
• with andmyx || 1|| y
• such that: Lzyx i ...,2,1,0i
32
Regular languages
Non-regular languages *}:{ vvvL R
33
Theorem:The language
is not regular
Proof: Use the Pumping Lemma
*}:{ vvvL R },{ ba
34
Assume for contradictionthat is a regular languageL
Since is infinitewe can apply the Pumping Lemma
L
*}:{ vvvL R
35
mmmm abbaw We pick
Let be the critical length for
Pick a string such that: w Lw
mw ||length
m
and
*}:{ vvvL R
L
36
we can write: zyxabbaw mmmm
with lengths:
From the Pumping Lemma:
ababbabaaaaxyz ..................
x y z
m m m m
1||,|| ymyx
mkay k 1,Thus:
w
37
From the Pumping Lemma: Lzyx i
...,2,1,0i
Thus: Lzyx 2
mmmm abbazyx mkay k 1,
38
From the Pumping Lemma:
Lababbabaaaaaazxy ∈.....................=2
x y z
km + m m m
y
Lzyx 2
Thus:
mmmm abbazyx
Labba mmmkm
mkay k 1,
39
Labba mmmkm
Labba mmmkm
BUT:
CONTRADICTION!!!
1k
*}:{ vvvL R
40
Our assumption thatis a regular language is not true
L
Conclusion: L is not a regular language
Therefore:
END OF PROOF