Title: Nonregular languages
1Non-regular languages
2Non-regular languages
Regular languages
3How can we prove that a language is not regular?
Problem this is not easy to prove
Solution the Pumping Lemma !!!
4The Pigeonhole Principle
5pigeons
pigeonholes
6A pigeonhole must contain at least two pigeons
7pigeons
...........
pigeonholes
...........
8The Pigeonhole Principle
pigeons
pigeonholes
There is a pigeonhole with at least 2 pigeons
...........
9The Pigeonhole Principleand DFAs
10DFA with states
11In walks of strings
no state is repeated
12In walks of strings
a state is repeated
13If string has length
Then the transitions of string are more than the
states of the DFA
Thus, a state must be repeated
14In general, for any DFA String has
length number of states
A state must be repeated in the walk of
walk of
......
......
Repeated state
15In other words for a string
transitions are pigeons
states are pigeonholes
walk of
......
......
Repeated state
16The Pumping Lemma
17Take an infinite regular language
There exists a DFA that accepts
states
18Take string with
There is a walk with label
.........
walk
19If string has length
(number of states of DFA)
then, from the pigeonhole principle
a state is repeated in the walk
......
......
walk
20Let be the first state repeated in the walk
of
......
......
walk
21Write
......
......
22Observations
length
number of states of DFA
length
......
......
23The string is accepted
Observation
......
......
24The string is accepted
Observation
......
......
25The string is accepted
Observation
......
......
26The string is accepted
In General
......
......
27In General
Language accepted by the DFA
......
......
28In other words, we described
The Pumping Lemma !!!
29The Pumping Lemma
- Given a infinite regular language
- for any string with length
30Applications ofthe Pumping Lemma
31Theorem
The language
is not regular
Proof
Use the Pumping Lemma
32Assume for contradiction that is a regular
language
Since is infinite we can apply the Pumping
Lemma
33Let be the integer in the Pumping Lemma
Pick a string such that
length
We pick
34Write
From the Pumping Lemma
it must be that length
Thus
35From the Pumping Lemma
Thus
36From the Pumping Lemma
Thus
37BUT
CONTRADICTION!!!
38Our assumption that is a regular language is not
true
Therefore
Conclusion
is not a regular language
39Non-regular languages
Regular languages
40Non-regular languages
Regular languages
41Theorem
The language
is not regular
Proof
Use the Pumping Lemma
42Assume for contradiction that is a regular
language
Since is infinite we can apply the Pumping
Lemma
43Let be the integer in the Pumping Lemma
Pick a string such that
and
length
We pick
44Write
From the Pumping Lemma
it must be that length
Thus
45From the Pumping Lemma
Thus
46From the Pumping Lemma
Thus
47BUT
CONTRADICTION!!!
48Our assumption that is a regular language is not
true
Therefore
Conclusion
is not a regular language
49Non-regular languages
Regular languages
50Theorem
The language
is not regular
Proof
Use the Pumping Lemma
51Assume for contradiction that is a regular
language
Since is infinite we can apply the Pumping
Lemma
52Let be the integer in the Pumping Lemma
Pick a string such that
and
length
We pick
53Write
From the Pumping Lemma
it must be that length
Thus
54From the Pumping Lemma
Thus
55From the Pumping Lemma
Thus
56BUT
CONTRADICTION!!!
57Our assumption that is a regular language is not
true
Therefore
Conclusion
is not a regular language
58Non-regular languages
Regular languages
59Theorem
The language
is not regular
Proof
Use the Pumping Lemma
60Assume for contradiction that is a regular
language
Since is infinite we can apply the Pumping
Lemma
61Let be the integer in the Pumping Lemma
Pick a string such that
length
We pick
62Write
From the Pumping Lemma
it must be that length
Thus
63From the Pumping Lemma
Thus
64From the Pumping Lemma
Thus
65Since
There must exist such that
66However
for
for any
67BUT
CONTRADICTION!!!
68Our assumption that is a regular language is not
true
Therefore
Conclusion
is not a regular language
69Summary
- Showing regular
- construct DFA, NFA
- construct regular expression
- show L is the union, concatenation, intersection
(regular operations) of regular languages. - Showing non-regular
- pumping lemma
- assume regular, apply closure properties of
regular languages and obtain a known non-regular
language.