c4 1 pumping lemma
play

C4.1 Pumping Lemma Regular NFAs Languages Automata & Regular - PowerPoint PPT Presentation

Theory of Computer Science March 30, 2020 C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Theory of Computer Science C4. Regular Languages: Pumping Lemma, Closure Properties C4.1 Pumping Lemma and Decidability


  1. Theory of Computer Science March 30, 2020 — C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Theory of Computer Science C4. Regular Languages: Pumping Lemma, Closure Properties C4.1 Pumping Lemma and Decidability C4.2 Closure Properties Gabriele R¨ oger University of Basel C4.3 Decidability March 30, 2020 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 1 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 2 / 35 C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Overview Regular Languages Grammars & Grammars DFAs C4.1 Pumping Lemma Regular NFAs Languages Automata & Regular Formal Languages Expressions Context-free Pumping Languages Lemma Properties Context-sensitive & Type-0 Languages Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 3 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 4 / 35

  2. C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Pumping Lemma: Motivation Pumping Lemma You can show that a language is regular by specifying Theorem (Pumping Lemma) an appropriate grammar, finite automaton, or regular expression. Let L be a regular language. Then there is an n ∈ N How can you you show that a language (a pumping number for L) such that all words x ∈ L with | x | ≥ n is not regular? can be split into x = uvw with the following properties: 1 | v | ≥ 1 , 2 | uv | ≤ n, and ◮ Direct proof that no regular grammar exists 3 uv i w ∈ L for all i = 0 , 1 , 2 , . . . . that generates the language � difficult in general Question: what if L is finite? ◮ Pumping lemma: use a necessary property that holds for all regular languages. Picture courtesy of imagerymajestic / FreeDigitalPhotos.net Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 5 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 6 / 35 C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Pumping Lemma: Proof Pumping Lemma: Proof Theorem (Pumping Lemma) Theorem (Pumping Lemma) Let L be a regular language. Then there is an n ∈ N Let L be a regular language. Then there is an n ∈ N (a pumping number for L) such that all words x ∈ L with | x | ≥ n (a pumping number for L) such that all words x ∈ L with | x | ≥ n can be split into x = uvw with the following properties: can be split into x = uvw with the following properties: 1 | v | ≥ 1 , 1 | v | ≥ 1 , 2 | uv | ≤ n, and 2 | uv | ≤ n, and 3 uv i w ∈ L for all i = 0 , 1 , 2 , . . . . 3 uv i w ∈ L for all i = 0 , 1 , 2 , . . . . Proof. Proof (continued). For regular L there exists a DFA M = � Q , Σ , δ, q 0 , E � with Choose a split x = uvw so M is in the same state after reading u L ( M ) = L . We show that n = | Q | has the desired properties. and after reading uv . Obviously, we can choose the split in a way that | v | ≥ 1 and | uv | ≤ | Q | are satisfied. . . . Consider an arbitrary x ∈ L ( M ) with length | x | ≥ | Q | . Including the start state, M visits | x | + 1 states while reading x . Because of | x | ≥ | Q | at least one state has to be visited twice. . . . Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 7 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 8 / 35

  3. C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Pumping Lemma: Proof Pumping Lemma: Application Theorem (Pumping Lemma) Let L be a regular language. Then there is an n ∈ N (a pumping number for L) such that all words x ∈ L with | x | ≥ n Using the pumping lemma (PL): can be split into x = uvw with the following properties: 1 | v | ≥ 1 , Proof of Nonregularity 2 | uv | ≤ n, and ◮ If L is regular, then the pumping lemma holds for L . 3 uv i w ∈ L for all i = 0 , 1 , 2 , . . . . ◮ By contraposition: if the PL does not hold for L , then L cannot be regular. Proof (continued). ◮ That is: if there is no n ∈ N with the properties of the PL, The word v corresponds to a loop in the DFA after reading u and then L cannot be regular. can thus be repeated arbitrarily often. Every subsequent continuation with w ends in the same end state as reading x . Therefore uv i w ∈ L ( M ) = L is satisfied for all i = 0 , 1 , 2 , . . . . Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 9 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 10 / 35 C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Pumping Lemma: Caveat Pumping Lemma: Example Example The language L = { a n b n | n ∈ N } is not regular. Caveat: The pumping lemma is a necessary condition for a language Proof. to be regular, but not a sufficient one. Assume L is regular. Then let p be a pumping number for L . � there are languages that satisfy the pumping lemma The word x = a p b p is in L and has length ≥ p . conditions but are not regular Let x = uvw be a split with the properties of the PL. � for such languages, other methods are needed to show Then the word x ′ = uv 2 w is also in L . Since | uv | ≤ p , uv consists that they are not regular (e.g., the Myhill-Nerode theorem) only of symbols a and x ′ = a | u | a 2 | v | a p −| uv | b p = a p + | v | b p . Since | v | ≥ 1 it follows that p + | v | � = p and thus x ′ / ∈ L . This is a contradiction to the PL. � L is not regular. Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 11 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 12 / 35

  4. C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Pumping Lemma Decidability Pumping Lemma Pumping Lemma: Another Example I Pumping Lemma: Another Example II Example The language L = { ab n ac n +2 | n ∈ N } is not regular. Example The language L = { ab n ac n +2 | n ∈ N } is not regular. Proof (continued). If | u | = 0, then word v starts with an a . Proof. Hence, uv 0 w = b p −| v | +1 ac p +2 does not start with symbol a Assume L is regular. Then let p be a pumping number for L . The word x = ab p ac p +2 is in L and has length ≥ p . and is therefore not in L . This is a contradiction to the PL. Let x = uvw be a split with the properties of the PL. If | u | > 0, then word v consists only of b s. Consider uv 0 w = ab p −| v | ac p +2 . As | v | ≥ 1, this word does not From | uv | ≤ p and | v | ≥ 1 we know that uv consists of one a contain two more c s than b s and is therefore not in language L . followed by at most p − 1 b s. This is a contradiction to the PL. We distinguish two cases, | u | = 0 and | u | > 0. . . . We have in all cases a contradiction to the PL. � L is not regular. Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 13 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 14 / 35 C4. Regular Languages: Pumping Lemma, Closure Properties and C4. Regular Languages: Pumping Lemma, Closure Properties and Decidability Closure Properties Decidability Closure Properties Closure Properties How can you combine regular languages in a way to get another regular language C4.2 Closure Properties as a result? Picture courtesy of stockimages / FreeDigitalPhotos.net Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 15 / 35 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 30, 2020 16 / 35

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend