180 likes | 358 Views
Introduction to Computability Theory. Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli. Using the Pumping Lemma. The Pumping Lemma is our standard tool to prove a language is not regular.
E N D
Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli
Using the Pumping Lemma 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 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 ofthe form , where , and should be considered.
Example: . 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: (Cont.) 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.
Example2 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 (Cont.) 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.
Example3 What about the language L is not regular, where . Can you finda non pumpable member of L? No, This language is regular. An automaton recognizing the language is presented on the next slide.
The Language_________________ Claim: This Automaton Recognizes L
Combinatorial Observation 1 First 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.
Combinatorial Observation 2 If 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.
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 .
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.
Induction Hypothesis a. 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 .
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 Basis The reader can easily verify that computation with ( resp.) ends at ( resp.). The reader can easily verify that computation with ( resp.) ends at ( resp.).
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.
Proof (Cont.) Consider the following cases: Case1: The last bit of is 0 In 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.) Consider the following cases: Case1: The last bit of is 1 In 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 .