costas busch1 more applications of the pumping lemma

55
Costas Busch 1 More Applications of The Pumping Lemma

Upload: job-robinson

Post on 15-Jan-2016

231 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 1

More Applicationsof

The Pumping Lemma

Page 2: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 2

The Pumping Lemma:

there exists an integer such that m

for any string mwLw || ,

we can write

For infinite context-free language L

uvxyzw

with lengths 1||and || vymvxy

and it must be:

0 allfor , iLzxyuv ii

Page 3: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 3

Context-free languages

}0:{ nba nn

Non-context free languages

}0:{ ncba nnn

}*},{:{ bawwwR

}},{:{ bavvv

Page 4: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 4

Theorem:The language

}*},{:{ bavvvL

is not context free

Proof: Use the Pumping Lemmafor context-free languages

Page 5: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 5

Assume for contradiction that

is context-free

Since is context-free and infinitewe can apply the pumping lemma

L

L

}*},{:{ bavvvL

Page 6: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 6

Pumping Lemma gives a magic numbersuch that:

m

Pick any string of with length at least m

we pick: Lbaba mmmm

L

}*},{:{ bavvvL

Page 7: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 7

We can write:

with lengths andmvxy || 1|| vy

uvxyzbaba mmmm

Pumping Lemma says:

Lzxyuv ii for all 0i

}*},{:{ bavvvL

Page 8: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 8

We examine all the possible locationsof string in vxy

mvxy || 1|| vyuvxyzbaba mmmm

mmmm baba

}*},{:{ bavvvL

Page 9: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 9

Case 1: vxy is within the firstma

bbaabbaa ........................v

m m m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x y

m

1kav 2kay 121 kk

}*},{:{ bavvvL

Page 10: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 10

bbaabbaa ..................................2v

21 kkm m m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x 2y

m

Case 1: vxy is within the firstma

1kav 2kay 121 kk

}*},{:{ bavvvL

Page 11: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 11

mvxy || 1|| vyuvxyzbaba mmmm

Case 1: vxy is within the firstma

121 kk

Lzxyuvbaba mmmkkm 2221

}*},{:{ bavvvL

Page 12: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 12

mvxy || 1|| vyuvxyzbaba mmmm

Case 1: vxy is within the firstma

Lzxyuv 22

Contradiction!!!

Lzxyuvbaba mmmkkm 2221

However, from Pumping Lemma:

}*},{:{ bavvvL

Page 13: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 13

is in the first

is in the firstCase 2:

bbaabbaa ........................v

m m m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x y

m

mamb

vy

1kav 2kby 121 kk

}*},{:{ bavvvL

Page 14: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 14

is in the first

is in the firstCase 2:

bbaabbaa ....................................2v

1km 2km m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x 2y

m

mamb

vy

1kav 2kby 121 kk

}*},{:{ bavvvL

Page 15: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 15

is in the first

is in the firstCase 2:

mvxy || 1|| vyuvxyzbaba mmmm mamb

vy

121 kk

Lzxyuvbaba mmkmkm 2221

}*},{:{ bavvvL

Page 16: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 16

is in the first

is in the firstCase 2:

mvxy || 1|| vyuvxyzbaba mmmm mamb

vy

Lzxyuvbaba mmkmkm 2221

Lzxyuv 22

Contradiction!!!

However, from Pumping Lemma:

}*},{:{ bavvvL

Page 17: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 17

is in the first

overlaps the firstCase 3:

bbaabbaa ........................v

m m m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x y

m

mmbamb

vy

21 kk bav 3kby 1, 21 kk

}*},{:{ bavvvL

Page 18: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 18

is in the first

overlaps the firstCase 3:

bbaabbaabbaa .................................2v

m 2k 3km

u z

mvxy || 1|| vyuvxyzbaba mmmm

x 2y

m

mmbamb

vy

21 kk bav 3kby 1, 21 kk

1k m

}*},{:{ bavvvL

Page 19: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 19

is in the first

overlaps the firstCase 3:

mvxy || 1|| vyuvxyzbaba mmmm mmba

mbvy

Lzxyuvbababa mmkmkkm 22312

1, 21 kk

}*},{:{ bavvvL

Page 20: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 20

is in the first

overlaps the firstCase 3:

mvxy || 1|| vyuvxyzbaba mmmm mmba

mbvy

Lzxyuvbababa mmkkkm 22312

Lzxyuv 22

Contradiction!!!

However, from Pumping Lemma:

}*},{:{ bavvvL

Page 21: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 21

Overlaps the first

in the firstCase 4:

bbaabbaa ........................v

m m m

u z

mvxy || 1|| vyuvxyzbaba mmmm

x y

m

mammba

vy

Analysis is similar to case 3

}*},{:{ bavvvL

Page 22: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 22

Other cases: vxy is withinmmmm baba

or

or

mmmm baba

mmmm baba

Analysis is similar to case 1:

mmmm baba

Page 23: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 23

More cases: vxy overlapsmmmm baba

or

mmmm baba

Analysis is similar to cases 2,3,4:

mmmm baba

Page 24: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 24

Since , it is impossible to overlap:

There are no other cases to consider

mvxy ||vxy mmmm baba

nor

nor

mmmm baba

mmmm baba

Page 25: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 25

In all cases we obtained a contradiction

Therefore: The original assumption that

is context-free must be wrong

Conclusion: is not context-freeL

}*},{:{ bavvvL

Page 26: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 26

Context-free languages

}0:{ nba nn

Non-context free languages

}0:{ ncba nnn

}*},{:{ bawwwR

}},{:{ bawww

}0:{ ! nan

Page 27: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 27

Theorem:The language

is not context free

Proof: Use the Pumping Lemmafor context-free languages

}0:{ ! naL n

Page 28: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 28

Assume for contradiction that

is context-free

Since is context-free and infinitewe can apply the pumping lemma

L

L

}0:{ ! naL n

Page 29: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 29

Pumping Lemma gives a magic numbersuch that:

m

Pick any string of with length at least m

we pick: Lam !

L

}0:{ ! naL n

Page 30: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 30

We can write:

with lengths andmvxy || 1|| vy

uvxyzam !

Pumping Lemma says:

Lzxyuv ii for all 0i

}0:{ ! naL n

Page 31: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 31

We examine all the possible locationsof string in vxy

mvxy || 1|| vy

!ma

uvxyzam !

There is only one case to consider

}0:{ ! naL n

Page 32: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 32

v

!m

u zx y

1kav 2kay mkk 211

aa ...............

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

Page 33: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 33

2v

21! kkm

u zx 2y

1kav 2kay

aa ...........................

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

mkk 211

Page 34: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 34

2v

km !

u zx 2y

1kav 2kay

aa ...........................

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

mk 1

21 kkk

Page 35: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 35

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

mk 1

zxyuva km 22!

Page 36: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 36

)!1(

)1(!

!!

!!

m

mm

mmm

mmkm

mk 1Since , for we have:2m

)!1(!! mkmm

Page 37: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 37

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

Lzxyuva km 22!

)!1(!! mkmm

Page 38: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 38

mvxy || 1|| vyuvxyzam !

}0:{ ! naL n

Lzxyuva km 22!

Lzxyuv 22

Contradiction!!!

However, from Pumping Lemma:

Page 39: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 39

We obtained a contradiction

Therefore: The original assumption that

is context-free must be wrong

Conclusion: is not context-freeL

}0:{ ! naL n

Page 40: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 40

Context-free languages

}0:{ nba nn

Non-context free languages

}0:{ ncba nnn

}*},{:{ bawwwR

}},{:{ bawww

}0:{ ! nan}0:{2

nba nn

Page 41: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 41

Theorem:The language

is not context free

Proof: Use the Pumping Lemmafor context-free languages

}0:{2

nbaL nn

Page 42: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 42

Assume for contradiction that

is context-free

Since is context-free and infinitewe can apply the pumping lemma

L

L

}0:{2

nbaL nn

Page 43: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 43

Pumping Lemma gives a magic numbersuch that:

m

Pick any string of with length at least m

we pick: Lba mm 2

L

}0:{2

nbaL nn

Page 44: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 44

We can write:

with lengths andmvxy || 1|| vy

uvxyzba mm 2

Pumping Lemma says:

Lzxyuv ii for all 0i

}0:{2

nbaL nn

Page 45: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 45

We examine all the possible locations

of string in vxy

mvxy || 1|| vyuvxyzba mm 2

mm ba2

}0:{2

nbaL nn

Page 46: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 46

Most complicated case:

bbaa ...........................v

2m m

u zx y

is in

is inmamb

vy

mvxy || 1|| vyuvxyzba mm 2

}0:{2

nbaL nn

Page 47: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 47

bbaa ...........................v

2m m

u zx y

1kav 2kby

mvxy || 1|| vyuvxyzba mm 2

}0:{2

nbaL nn

mkk 211

Page 48: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 48

bbaa ...........................v

2m m

u zx y

1kav 2kby

Most complicated sub-case: 01 k 02 k

mvxy || 1|| vyuvxyzba mm 2

}0:{2

nbaL nn

mkk 211

and

Page 49: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 49

0v

12 km 2km

u zx 0y

bbaa ..................

}0:{2

nbaL nn

mvxy || 1|| vyuvxyzba mm 2

1kav 2kby

Most complicated sub-case: 01 k 02 k

mkk 211

and

Page 50: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 50

}0:{2

nbaL nn

mvxy || 1|| vyuvxyzba mm 2

1kav 2kby

Most complicated sub-case: 01 k 02 k

mkk 211

and

zxyuvba kmkm 00212

Page 51: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 51

12

2

222

12

)1()(

km

mm

mkm

01 k 02 k mkk 211and

221

2 )( kmkm

Page 52: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 52

}0:{2

nbaL nn

mvxy || 1|| vyuvxyzba mm 2

221

2 )( kmkm

Lzxyuvba kmkm 00212

Page 53: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 53

}0:{2

nbaL nn

mvxy || 1|| vyuvxyzba mm 2

Lzxyuvba kmkm 00212

However, from Pumping Lemma: Lzxyuv 00

Contradiction!!!

Page 54: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 54

When we examine the rest of the caseswe also obtain a contradiction

Page 55: Costas Busch1 More Applications of The Pumping Lemma

Costas Busch 55

In all cases we obtained a contradiction

Therefore: The original assumption that

is context-free must be wrong

Conclusion: is not context-freeL

}0:{2

nbaL nn