Vous êtes sur la page 1sur 40

The Pumping Lemma

Computation Theory
M Ayzed Mirza
13-NTU-4005
2
The Pumping Lemma
3
Take an infinite regular language
L
There exists a DFA that accepts L
m
states
(contains an infinite number of strings)
4
m w > | |
(number of
states of DFA)
then, at least one state is repeated
in the walk of
w
q
...... ......
1
o
2
o
k
o
Take string with L we
k
w o o o
2 1
=
Walk in DFA of
Repeated state in DFA
5
Take to be the first state repeated q
q ....
w
There could be many states repeated
q
.... ....
Second
occurrence
First
occurrence
Unique states
One dimensional projection of walk :
1
o
2
o k
o
i
o
j
o
1 + i
o
1 + j
o
6
q .... q
.... ....
Second
occurrence
First
occurrence
1
o
2
o
k
o
i
o
j
o
1 + i
o
1 + j
o
w One dimensional projection of walk :
i
x o o
1
=
j i
y o o
1 +
=
k j
z o o
1 +
=
xyz w=
We can write
7
z y x w=
q
... ...
x
y
z
In DFA:
...
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
contains only
first occurrence of
q
8
Observation:
m y x s | |
length number
of states
of DFA
Since, in no
state is repeated
(except q)
xy
Unique States
q
...
x
y
...
1
o
i
o
1 + i
o
j
o
9
Observation:
1 | | > y
length
Since there is at least one transition in loop
q
y
...
1 + i
o
j
o
10
We do not care about the form of string
z
q
...
x
y
z
...
z may actually overlap with the paths of and x y
11
The string
is accepted
z x
Additional string:
q
... ...
x
z
...
Do not follow loop
y
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
12
The string
is accepted
z y y x
q
... ... ...
x
z
Follow loop
2 times
Additional string:
y
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
13
The string
is accepted
z y y y x
q
... ... ...
x
z
Follow loop
3 times
Additional string:
y
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
14
The string
is accepted
z y x
i
In General:
... , 2 , 1 , 0 = i
q
... ... ...
x
z
Follow loop
times
i
y
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
15
L z y x
i
e
Therefore:
... , 2 , 1 , 0 = i
Language accepted by the DFA
q
... ... ...
x
z
y
...
1
o
k
o
i
o
1 + i
o
j
o
1 + j
o
16
The Pumping Lemma:
Given a infinite regular language L
there exists an integer m
for any string with length L we
m w > | |
we can write z y x w=
with and
m y x s | | 1 | | > y
such that:
L z y x
i
e
... , 2 , 1 , 0 = i
(critical length)
17
Applications

of

the Pumping Lemma
18
Observation:
Every language of finite size has to be regular
Therefore, every non-regular language
has 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 that
An 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
L we
3. Write
xyz w=
4. Show that L z xy w
i
e =
'
for some
1 = i
5. This gives a contradiction, since from
pumping lemma
L z xy w
i
e =
'
m w > | |
1. Let be the critical length for m
L
21
Note:
It suffices to show that
only one string
gives a contradiction
L we
You dont need to obtain
contradiction for every
L we
22
Theorem:
The language } 0 : { > = n b a L
n n
is not regular
Proof: Use the Pumping Lemma
Example of Pumping Lemma application
23
Assume for contradiction
that is a regular language
L
Since is infinite
we can apply the Pumping Lemma
L
} 0 : { > = n b a L
n n
24
Let be the critical length for
Pick a string such that: w
L w e
m w > | |
and length
m m
b a w=
We pick
m
} 0 : { > = n b a L
n n
L
25
with lengths
From the Pumping Lemma:
1 | | , | | > s y m y x
b ab aa aa a b a xyz
m m
... ... ... ... = =
m k a y
k
s s = 1 ,
x y z
m m
we can write z y x b a w
m m
= =
Thus:
= w
26
From the Pumping Lemma:
L z y x
i
e
... , 2 , 1 , 0 = i
Thus:
m m
b a z y x =
L z y x e
2
m k a y
k
s s = 1 ,
27
From the Pumping Lemma:
L b ab aa aa aa a z xy e = ... ... ... ... ...
2
x y z
k m+
m
Thus:
L z y x e
2
m m
b a z y x =
y
L b a
m k m
e
+
m k a y
k
s s = 1 ,
28
L b a
m k m
e
+
} 0 : { > = n b a L
n n
BUT:
L b a
m k m
e
+
CONTRADICTION!!!
1 k
29
Our assumption that
is 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 L we
m w > | |
we can write z y x w=
with and
m y x s | | 1 | | > y
such that:
L z y x
i
e
... , 2 , 1 , 0 = i
32
Regular languages
Non-regular languages
*} : { E e = v vv L
R
33
Theorem: The language
is not regular
Proof: Use the Pumping Lemma
*} : { E e = v vv L
R
} , { b a = E
34
Assume for contradiction
that is a regular language
L
Since is infinite
we can apply the Pumping Lemma
L
*} : { E e = v vv L
R
35
m m m m
a b b a w=
We pick
Let be the critical length for
Pick a string such that: w
L w e
m w > | |
length
m
and
*} : { E e = v vv L
R
L
36
we can write:
z y x a b b a w
m m m m
= =
with lengths:
From the Pumping Lemma:
a ba bb ab a aa a xyz ... ... ... ... ... ... =
x
y
z
m
m m m
1 | | , | | > s y m y x
m k a y
k
s s = 1 ,
Thus:
= w
37
From the Pumping Lemma:
L z y x
i
e
... , 2 , 1 , 0 = i
Thus:
L z y x e
2
m m m m
a b b a z y x =
m k a y
k
s s = 1 ,
38
From the Pumping Lemma:
L a ba bb ab a aa aa a z xy ... ... ... ... ... ... ... =
2
x
y
z
k m+
m m m
y
L z y x e
2
Thus:
m m m m
a b b a z y x =
L a b b a
m m m k m
e
+
m k a y
k
s s = 1 ,
39
L a b b a
m m m k m
e
+
L a b b a
m m m k m
e
+
BUT:
CONTRADICTION!!!
1 > k
*} : { E e = v vv L
R
40
Our assumption that
is a regular language is not true
L
Conclusion: L is not a regular language
Therefore:
END OF PROOF

Vous aimerez peut-être aussi