Languages and Finite Automata

Download Report

Transcript Languages and Finite Automata

More Applications
of
the Pumping Lemma
Prof. Busch - LSU
1
The Pumping Lemma:
• Given a infinite regular language
• there exists an integer
• for any string
• we can write
• with
L
m (critical length)
w L with length | w |  m
w x y z
| x y |  m and | y |  1
• such that:
xy z  L
i
Prof. Busch - LSU
i  0, 1, 2, ...
2
Non-regular languages
L  {vv : v  *}
R
Regular languages
Prof. Busch - LSU
3
Theorem: The language
L  {vv : v  *}
R
  {a, b}
is not regular
Proof:
Use the Pumping Lemma
Prof. Busch - LSU
4
L  {vv : v  *}
R
Assume for contradiction
that L is a regular language
Since L is infinite
we can apply the Pumping Lemma
Prof. Busch - LSU
5
L  {vv : v  *}
R
Let
m be the critical length for L
Pick a string
w such that: w  L
and length
We pick
| w| m
wa b b a
m m m m
Prof. Busch - LSU
6
From the Pumping Lemma:
we can write: w  a b b a
m
with lengths:
m
m
m
x y z
| x y |  m, | y | 1
m
m m m
w  xyz  a...aa...a...ab...bb...ba...a
x
Thus:
y
z
y a , 1k m
k
Prof. Busch - LSU
7
x y za b b a
m m m m
y a , 1k m
k
From the Pumping Lemma:
xy z  L
i
i  0, 1, 2, ...
Thus:
xy z  L
2
Prof. Busch - LSU
8
x y za b b a
m m m m
y a , 1k m
k
From the Pumping Lemma:
xy z  L
2
m m m
m+k
2
xy z = a...aa...aa...a...ab...bb...ba...a ∈L
x
Thus:
y
a
y
z
m k m m m
b b a
Prof. Busch - LSU
L
9
a
BUT:
m k m m m
b b a
L
k 1
L  {vv : v  *}
R
a
m k m m m
b b a
L
CONTRADICTION!!!
Prof. Busch - LSU
10
Therefore:
Our assumption that L
is a regular language is not true
Conclusion: L is not a regular language
END OF PROOF
Prof. Busch - LSU
11
Non-regular languages
n l n l
L  {a b c
: n, l  0}
Regular languages
Prof. Busch - LSU
12
Theorem: The language
n l n l
L  {a b c
: n, l  0}
is not regular
Proof:
Use the Pumping Lemma
Prof. Busch - LSU
13
n l n l
L  {a b c
: n, l  0}
Assume for contradiction
that L is a regular language
Since L is infinite
we can apply the Pumping Lemma
Prof. Busch - LSU
14
n l n l
L  {a b c
Let
: n, l  0}
m be the critical length of L
Pick a string
w such that: w  L
length
We pick
and
| w| m
wa b c
m m 2m
Prof. Busch - LSU
15
From the Pumping Lemma:
We can write
w a b c
With lengths
| x y |  m, | y | 1
m
m 2m
m
x y z
m
2m
w  xyz  a...aa...aa...ab...bc...cc...c
x
Thus:
y
z
y a , 1k m
k
Prof. Busch - LSU
16
x y za b c
m m 2m
y a , 1k m
k
From the Pumping Lemma:
xy z  L
i
i  0, 1, 2, ...
Thus:
0
x y z = xz ∈ L
Prof. Busch - LSU
17
x y za b c
m m 2m
y a , 1k m
k
xz  L
From the Pumping Lemma:
mk
m
2m
xz  a...aa...ab...bc...cc...c  L
x
Thus:
z
a
mk m 2m
b c
Prof. Busch - LSU
L
18
a
BUT:
mk m 2m
n l n l
L  {a b c
a
L
b c
k 1
: n, l  0}
mk m 2m
b c
L
CONTRADICTION!!!
Prof. Busch - LSU
19
Therefore:
Our assumption that L
is a regular language is not true
Conclusion: L is not a regular language
END OF PROOF
Prof. Busch - LSU
20
Non-regular languages
L  {a : n  0}
n!
Regular languages
Prof. Busch - LSU
21
Theorem: The language
L  {a : n  0}
n!
is not regular
n!  1 2  (n  1)  n
Proof:
Use the Pumping Lemma
Prof. Busch - LSU
22
L  {a : n  0}
n!
Assume for contradiction
that L is a regular language
Since L is infinite
we can apply the Pumping Lemma
Prof. Busch - LSU
23
L  {a : n  0}
n!
Let
m be the critical length of
Pick a string
L
w such that: w  L
length
We pick
wa
Prof. Busch - LSU
| w| m
m!
24
From the Pumping Lemma:
We can write
w a
With lengths
| x y |  m, | y | 1
m!
x y z
m
w  xyz  a
m!
m!m
 a...aa...aa...aa...aa...a
x
Thus:
y
z
y  a , 1 k  m
k
Prof. Busch - LSU
25
x y za
y  a , 1 k  m
m!
k
From the Pumping Lemma:
xy z  L
i
i  0, 1, 2, ...
Thus:
xy z  L
2
Prof. Busch - LSU
26
x y za
y  a , 1 k  m
m!
k
From the Pumping Lemma:
mk
xy z  L
2
m!m
xy z  a...aa...aa...aa...aa...aa...a  L
2
x
Thus:
y
y
a
m! k
Prof. Busch - LSU
z
L
27
a
Since:
m! k
L
1 k  m
L  {a : n  0}
n!
There must exist
p such that:
m! k  p!
Prof. Busch - LSU
28
However:
m! k  m! m
 m! m!
for
m 1
 m!m  m!
 m!(m  1)
 (m  1)!
m! k  (m  1)!
m! k  p!
Prof. Busch - LSU
for any
p
29
a
BUT:
m! k
L
1 k  m
L  {a : n  0}
n!
a
m! k
L
CONTRADICTION!!!
Prof. Busch - LSU
30
Therefore:
Our assumption that L
is a regular language is not true
Conclusion: L is not a regular language
END OF PROOF
Prof. Busch - LSU
31