Title: Languages and Finite Automata
1Formal Languages More Applications of the Pumping
Lemma for CFLs Hinrich Schütze IMS, Uni
Stuttgart, WS 2007/08 Slides based on RPI CSCI
2400 Thanks to Costas Busch
2The Pumping Lemma
For infinite context-free language
there exists an integer such that
for any string
we can write
with lengths
and it must be
3Non-context free languages
Context-free languages
4Theorem
The language
is not context free
Proof
Use the Pumping Lemma for context-free languages
5Assume for contradiction that
is context-free
Since is context-free and infinite we can
apply the pumping lemma
6Pumping Lemma gives a magic number such that
Pick any string of with length at least
we pick
7We can write
with lengths and
Pumping Lemma says
for all
8We examine all the possible locations of string
in
9Case 1
is within the first
10Case 1
is within the first
11Case 1
is within the first
12Case 1
is within the first
However, from Pumping Lemma
Contradiction!!!
13Case 2
is in the first
is in the first
14Case 2
is in the first
is in the first
15Case 2
is in the first
is in the first
16Case 2
is in the first
is in the first
However, from Pumping Lemma
Contradiction!!!
17Case 3
overlaps the first
is in the first
18Case 3
overlaps the first
is in the first
19Case 3
overlaps the first
is in the first
20Case 3
overlaps the first
is in the first
However, from Pumping Lemma
Contradiction!!!
21Case 4
in the first
Overlaps the first
Analysis is similar to case 3
22Other cases
is within
or
or
Analysis is similar to case 1
23More cases
overlaps
or
Analysis is similar to cases 2,3,4
24There are no other cases to consider
Since , it is impossible for
to overlap
or
or
25In all cases we obtained a contradiction
Therefore
The original assumption that
is context-free must be wrong
Conclusion
is not context-free
26Non-context free languages
Context-free languages
27Theorem
The language
is not context free
Proof
Use the Pumping Lemma for context-free languages
28Assume for contradiction that
is context-free
Since is context-free and infinite we can
apply the pumping lemma
29Pumping Lemma gives a magic number such that
Pick any string of with length at least
we pick
30We can write
with lengths and
Pumping Lemma says
for all
31We examine all the possible locations of string
in
There is only one case to consider
32(No Transcript)
33(No Transcript)
34(No Transcript)
35(No Transcript)
36Since , for we have
37(No Transcript)
38However, from Pumping Lemma
Contradiction!!!
39We obtained a contradiction
Therefore
The original assumption that
is context-free must be wrong
Conclusion
is not context-free
40Non-context free languages
Context-free languages
41Theorem
The language
is not context free
Proof
Use the Pumping Lemma for context-free languages
42Assume for contradiction that
is context-free
Since is context-free and infinite we can
apply the pumping lemma
43Pumping Lemma gives a magic number such that
Pick any string of with length at least
we pick
44We can write
with lengths and
Pumping Lemma says
for all
45We examine all the possible locations of string
in
46Most complicated case
is in
is in
47(No Transcript)
48Most complicated sub-case
and
49Most complicated sub-case
and
50Most complicated sub-case
and
51and
52(No Transcript)
53However, from Pumping Lemma
Contradiction!!!
54When we examine the rest of the cases we also
obtain a contradiction
55In all cases we obtained a contradiction
Therefore
The original assumption that
is context-free must be wrong
Conclusion
is not context-free