1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

18
1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli

Transcript of 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Page 1: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

1

Introduction to Computability Theory

Discussion3: Uses of the Pumping Lemma

Prof. Amos Israeli

Page 2: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

The Pumping Lemma is our standard tool to prove a language is not regular.

Remember: For any regular language L there exists a constant p such that every word , satisfying can be pumped.

Meaning: Finding a single word and that cannot be pumped is sufficient to show that L is not regular.

Using the Pumping Lemma

2

Lw

Lw

pw ||

pw ||

Page 3: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Since we do not know the value of p we use it as a parameter and look at words defined in terms of p , e.g. .

Once w is selected we can try to pump it.On the down side: In order to show that w is not

pumpable, every possible division of the form , where , and should be considered.

Using the Pumping Lemma

3

Lw

xyzw

ppw 10

pxy || 0|| y

Page 4: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Lemma: The language is not regular.Proof: Assume towards a contradiction that L is

regular and let p be the pumping length of L. Let . By the Pumping Lemma there

exists a division of w, , such that , and w can be pumped.

This means that , where .Since we conclude

Example: .

4

ppbaw xyzw

nnbaL

pxy ||kaxy pk

nnbaL

0|| ylay

Page 5: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

This however implies that in , the number of 0-s is smaller then the number of 1-s.

It also means that for every , the number of 0-s in is larger then the number of 1-s. Both cases constitute a contradiction.

Note: Each one of these cases is separately sufficient for the proof.

Example: (Cont.)

5

nnbaL

1izxy i

zxy0

Page 6: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Lemma: The language L is not regular, where .

Proof: Assume towards a contradiction that L is regular and let p be the pumping length of L.

At this point students are encouraged to look for a non pumpable member of L.

The trick is to remember that a single non pumpable word is sufficient.

Example2

6

s-#0 in s-1 # | wwL

Page 7: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Note: If the first p symbols of w include both 0-s and 1-s w can be pumped.

Solution: Use the same word as in the previous example.

Example2 (Cont.)

7

Page 8: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

What about the language L is not regular, where .

Can you find a non pumpable member of L?No, This language is regular. An automaton

recognizing the language is presented on the next slide.

Example3

8

s-#10 in s-01 # | wwL

Page 9: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

The Language_________________ s-#10 in s-01 # | wwL

sq

01q

10q

0q

1q

0

1

0

0

0

0

1

11

1

Claim: This Automaton Recognizes L 9

Page 10: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Combinatorial Observation 1First note that for any , the difference

between the number of 01 substrings and the number 10 substrings is at least -1 and at most 1.

The reason: if the string starts with 0 and the difference is 1, the string must end with 1. Any addition of 1 will not increase this difference and an addition of 0 will decrease it to 0.The analogous reasoning holds for strings starting with 0.

10

*1,0w

Page 11: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Combinatorial Observation 2If the first bit of is 0 (1 respectively) then

its last bit is also 0 (1 respectively).If the first bit of is 0 (1 respectively) then

its last bit is 1 (0 respectively).The proof uses the first observation and it is

carried out by induction on the length of w. Combinatorial observation 2 is used in the correctness proof of the DFA.

11

Lw

Lw

Page 12: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Proof

Denote the automaton presented before by D. We would like to prove that D recognizes L. We will prove that computation of D on any word of L is ended either on , or , or .

This however is not enough. We also have to prove that computation of D on any word not in L is completed either on or on .

12

0q 1q

01q 10q

startq

Page 13: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Proof

First note that the only word on which D, completes its computation at is .Since , and , this is OK.

The rest of the proof is by induction on the length of w.

13

startq Dstart Fq L

Page 14: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Induction Hypothesisa. Computation of any word , whose last

bit is 0 ends at .b. Computation of any word , whose last

bit is 1 ends at . c. Computation of any word , whose last

bit is 1 ends at . d. Computation of any word , whose last

bit is 0 ends at .

14

0qLw

01q

10q

Lw1q

Lw

Lw

Page 15: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

10w

Proof (Cont.)Note that the word is accepted.Also note that computation on any word starting

with 0 (1 resp.) goes to the upper (lower resp. branch of D .

Induction BasisThe reader can easily verify that computation

with ( resp.) ends at ( resp.).The reader can easily verify that computation

with ( resp.) ends at ( resp.). 15

L

01q 10q

0q0w 1w 1q

01w

Page 16: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Proof (Cont.)Assume the induction hypothesis (Abrev. IH)

holds for word such that .Note: It is not enough to assume correctness

only for words in the language L.Consider a word such that .Assume that the first bit in w is 0 (The proof for

words starting with 1 is analogous).Let denote the first n bits of w.

16

*1,0w

nw

nw ||

*1,0w 1|| nw

Page 17: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Consider the following cases:Case1: The last bit of is 0In this case, by observation 2 we get . By

IH(a) computation of D on ends at .If the last bit of w is 0 then and indeed the

computation of D ends at .If the last bit of w is 1 then by observation 2,

and indeed computation of D ends at .

Proof (Cont.)

17

Lw

Lw n

0q

nw

Lw 01q

nw

0q

Page 18: 1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.

Consider the following cases:Case1: The last bit of is 1In this case, by observation 2 we get . By

IH(b) computation of D on ends at .If the last bit of w is 0 then and indeed the

computation of D ends at .If the last bit of w is 1 then by observation 2,

and indeed computation of D ends at .

Proof (Cont.)

18

Lw

Lw n

nw

Lw 01q

nw

0q

01q