Non-Regular Languages: (Pumping Lemma)
Non-Regular Languages: (Pumping Lemma)
Non-Regular Languages: (Pumping Lemma)
(Pumping Lemma)
n n
Non-regular languages
{a b : n 0}
R
Regular languages
a *b
b*c a
b c ( a b) *
etc...
4 pigeons
3 pigeonholes
A pigeonhole must
contain at least two pigeons
pigeons
...........
pigeonholes
...........
nm
pigeons
pigeonholes
nm
There is a pigeonhole
with at least 2 pigeons
...........
q1
states
q2
q3
q4
aaaab
q1
q2
q3
q2
q3
q2
q4
a
a
q3
q4
aaaab
(walk states)
q1
q2
q3
aaaab
q2
q3
q4
Nests:
q1
(Automaton states)
q2
q3
Repeated
state
q4
q1
q2
q3
q4
q2
aabb
q4
aabb
a
a
q3
q4
Pigeons:
aabb
q4
q4
(walk states)
Nests:
(Automaton states)
q1
q2
q3
Automaton States
q4
Repeated
state
q1 1
2 .... i q i 1 ....
i
qi
j 1
....
Arbitrary DFA
q1 1
k
......
......
qz
qi
Repeated state
qz
| w | # states of DFA m
Pigeons:
Walk of
(walk states)
q1
....
qi
....
....
qi
w
qi
....
qz
Are
more
than
Nests: q1
q2
(Automaton states)
....
A state is
repeated
qm1
qm
states
Take string
w L
with
| w| m
(number of
states of DFA)
2 ......
...... k
occurrence
2 .... i q i 1 ....
Unique states
w:
Second
occurrence
.... k
j 1
We can write
w xyz
occurrence
2 .... i q i 1 ....
x 1 i
w:
Second
occurrence
y i 1 j
j 1
.... k
z j 1 k
In DFA:
w x y z
contains only
first occurrence of q
y
...
j
...
i 1
j 1
...
...
Observation:
length
| x y | m number
of states
of DFA
y
...
Unique States
j
...
i 1
Since, in xy no
state is repeated
(except q)
Observation:
length
| y | 1
y
...
j
i 1
...
z
...
and
Additional string:
The string
is accepted
xz
y
...
...
i 1
j 1
...
...
Additional string:
Follow loop
2 times
The string
is accepted
xyyz
y
...
j
...
i 1
j 1
...
...
Additional string:
The string
is accepted
Follow loop
3 times
xyyyz
...
j
...
i 1
j 1
...
...
In General:
The string
is accepted
Follow loop
times
xy z
i 0, 1, 2, ...
...
j
...
i 1
j 1
...
...
Therefore:
i 0, 1, 2, ...
x y z L
i
y
...
j
...
i 1
j 1
...
...
w L
(critical length)
with length
| w| m
w x y z
| x y | m and | y | 1
such that:
xy z L
i 0, 1, 2, ...
In the book:
Critical length
= Pumping length
Applications
of
the Pumping Lemma
Observation:
Every language of finite size has to be regular
(we can easily construct an NFA
that accepts every string in the language)
is regular
is not regular
w xyz
4. Show that
w xy z L
i
for some
w xy z L
i
i 1
Note:
Proof:
n n
L {a b : n 0}
Since L is infinite
we can apply the Pumping Lemma
n n
L {a b : n 0}
Let
Pick a string
such that:
w L
and length
We pick
m m
wa b
| w| m
| x y | m, | y | 1
m
w xyz
m m
a b
a...aa...aa...ab...b
Thus: y a , 1 k m
k
y a , 1k m
m m
x y za b
xy z L
i 0, 1, 2, ...
Thus:
xy z L
y a , 1k m
m m
x y za b
xy z L
mk
xy z a...aa...aa...aa...ab...b L
x
Thus:
m k m
b L
BUT:
m k m
b L
k 1
n n
L {a b : n 0}
m k m
b L
CONTRADICTION!!!
Therefore:
Conclusion: L
END OF PROOF
Non-regular language
n n
{a b : n 0}
Regular languages
* *
L(a b )