Non-Regular Languages: (Pumping Lemma)
Non-Regular Languages: (Pumping Lemma)
(Pumping Lemma)
Regular languages
a *b b*c a
b c ( a b) *
etc...
Fall 2005 Costas Busch - RPI 2
How can we prove that a language L
is not regular?
3 pigeonholes
...........
m pigeonholes nm
...........
n pigeons
m pigeonholes
There is a pigeonhole
nm with at least 2 pigeons
...........
and
DFAs
b
b b
a a b
q1 q2 q3 q4
a a
Fall 2005 Costas Busch - RPI 10
Consider the walk of a “long’’ string: aaaab
(length at least 4)
b
b b
a a b
q1 q2 q3 q4
a a
Fall 2005 Costas Busch - RPI 11
The state is repeated as a result of
the pigeonhole principle
Walk of aaaab
Pigeons: q1 a q2 a q3 a q2 a q3 b q4
(walk states)
Nests: q1 q2 q3 q4
(Automaton states) Repeated
state
Fall 2005 Costas Busch - RPI 12
Consider the walk of a “long’’ string: aabb
(length at least 4)
b
b b
a a b
q1 q2 q3 q4
Fall 2005
a
Costas Busch - RPI
a 13
The state is repeated as a result of
the pigeonhole principle
Walk of aabb
Pigeons: q1 a q2 a q3 b q4 b q4
(walk states)
Nests: q1 q2 q3 q4
(Automaton states) Repeated
Automaton States
state
Fall 2005 Costas Busch - RPI 14
In General: If | w | # states of DFA ,
by the pigeonhole principle,
a state is repeated in the walk w
Walk of w 1 2 k
q1 1 2 .... i q i 1 .... j
qi
j 1
.... k
qz
i
Arbitrary DFA
q1 1 2
...... ...... k
qi qz
Repeated state
Fall 2005 Costas Busch - RPI 15
| w | # states of DFA m
Are
more
than
m
states
Walk in DFA of
w 1 2 k
1 2 ...... q ...... k
Repeated state in DFA
Fall 2005 Costas Busch - RPI 19
There could be many states repeated
Unique states
y
...
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 22
Observation: length | x y | m number
of states
of DFA
y
...
Unique States
j i 1
1
... i
q Since, in xy no
state is repeated
Fall 2005
x Costas Busch - RPI
(except q) 23
Observation: length | y | 1
Since there is at least one transition in loop
y
...
j i 1
z
... q
Fall 2005
x Costas Busch - RPI 25
Additional string: The string xz
is accepted
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 26
Additional string: The string xyyz
is accepted
Follow loop y
2 times
...
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 27
Additional string: The string xyyyz
is accepted
Follow loop y
3 times
...
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 28
i
In General: The string xy z
is accepted i 0, 1, 2, ...
Follow loop y
i times
...
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 29
Therefore: x y z L
i
i 0, 1, 2, ...
j i 1
1
... i
q j 1
... ... k
x z
Fall 2005 Costas Busch - RPI 30
In other words, we described:
• with | x y | m and | y | 1
i i 0, 1, 2, ...
• such that: xy z L
Fall 2005 Costas Busch - RPI 32
Applications
of
is not regular
Since L is infinite
we can apply the Pumping Lemma
m m
We pick wa b
Fall 2005 Costas Busch - RPI 40
m m
Write: a b xyz
i
From the Pumping Lemma: xy z L
i 0, 1, 2, ...
2
Thus: xy z L
2
From the Pumping Lemma: xy z L
mk m
2
xy z a...aa...aa...aa...ab...b L
x y y z
m k m
Thus: a b L
Fall 2005 Costas Busch - RPI 43
m k m k≥ 1
a b L
n n
BUT: L {a b : n 0}
m k m
a b L
CONTRADICTION!!!
Fall 2005 Costas Busch - RPI 44
Therefore: Our assumption that L
is a regular language is not true
Regular languages
* *
L(a b )