Professional Documents
Culture Documents
3
4 pigeons
3 pigeonholes
4
A pigeonhole must
contain at least two pigeons
5
n pigeons
...........
p pigeonholes n p
...........
6
The Pigeonhole Principle
n pigeons
p pigeonholes
There is a pigeonhole
n p with at least 2 pigeons
...........
7
The Pigeonhole Principle
and
DFAs
8
DFA with 4 states
b
b b
a b b
q1 q2 q3 q4
a a
9
In walks of strings: a no state
aa is repeated
aab
b
b b
a a b
q1 q2 q3 q4
a a
10
In walks of strings: aabb a state
bbaa is repeated
abbabb
abbbabbabb...
b
b b
a a b
q1 q2 q3 q4
a a
11
If the walk of string w has length | w | 4
b
b b
a a b
q1 q2 q3 q4
a a
12
Pigeonhole principle for any DFA:
If in a walk of a string w
transitions states of DFA
then a state is repeated
b
b b
a a b
q1 q2 q3 q4
a a 13
In other words for a string w:
b
b b
a a b
q1 q2 q3 q4
a a 14
In general:
walk of w
...... q ......
15
The Pumping Lemma
16
Take an infinite regular language L
p
states
17
Basic Idea:
b a
a
q0 q1
b
a b
q2 q3
a,b
ababbaaab L(M )
a b a b b a a a b
q0 q1 q3 q2 q1 q3 q2 q0 q1 q3
Note,
a b a b b a a a b
q0 q1 q3 q2 q1 q3 q2 q0 q1 q3
.........
walk w 20
If string w has length | w | p number
of states
...... q ......
walk w 21
Write w x y z
...... q ......
x z 22
Observations: length | x y | p number
of states
length | y | 1
...... q ......
x z 23
Observation: The string x z is accepted
...... q ......
x z 24
Observation: The string xyyz
is accepted
...... q ......
x z 25
Observation: The string xyyyz
is accepted
...... q ......
x z 26
i
In General: The string xy z
is accepted i 0, 1, 2, ...
...... q ......
x z 27
In other words, we described:
28
The Pumping Lemma:
• Given a infinite regular language L
• there exists an integer p
• we can write w x y z
• with |x y| p and | y | 1
i i 0, 1, 2, ...
• such that: xy z L
29
Applications
of
30
31
32
33
n n
L {a b : n 0}
Since L is infinite
we can apply the Pumping Lemma
34
n n
Theorem: The language L {a b : n 0}
is not regular
35
How to get a contradiction
3. Write w xyz
4. Show that w xy z L
i
for some i 1
Let p
be the integer in the Pumping Lemma
Example: pick w a pb p
37
38
39
Therefore: Our assumption that L
is a regular language is not true
40
Suppose that we consider the language B ={w|w has
an equal number of 0s and 1s} and want to know
whether it is regular at not. Suppose we choose the
string 0n1n and n is the pumping length in the
lemma. Then it would seem that we could apply the
pumping lemma because if we let x and z be the
empty string, then yk = (0n1n)k is still in B. But wait,
this would then violate |xy|≤ n. If |xy|≤ n, then y
must consist only of 0s, so xyyz is not in B. Thus 0n1n
cannot be pumped.
41
n n
Non-regular languages {a b : n 0}
Regular languages
a *b b*c a
b c ( a b) *
etc...
42
Using pumping lemma to prove that the language A={yy|y
€{0,1} is not regular
Proof
Assume that A is regular
Then it must have a pumping length = p