1 Pumping Lemma –A technique for proving a language L is NOT regular –What does the Pumping Lemma mean? –Proof of Pumping Lemma.

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

Proof of the Pumping Theorem for Regular Languages Richard Beigel CIS Temple University.
Chapter Three: Closure Properties for Regular Languages
Lecture 9,10 Theory of AUTOMATA
Lecture 10 Pumping Lemma A property of regular sets.
Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Mount Holyoke College 2 Nonregular languages? We now know: –Regular languages may be specified either.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
1 Lecture 14 Language class LFSA –Study limits of what can be done with FSA’s –Closure Properties –Comparing to other language classes.
1 Module 33 Non-context free languages –Intuition and Examples CFL Pumping Lemma –Comparison to regular language pumping lemma –What it means –Proof overview.
1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
1 Lecture 31 EQUAL language –Designing a CFG –Proving the CFG is correct.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Limitations.
1 Module 36 Non context-free languages –Examples and Intuition Pumping lemma for CFL’s –Pumping condition –No proof of pumping lemma –Applying pumping.
1 More Applications of the Pumping Lemma. 2 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we.
Courtesy Costas Busch - RPI1 Non-regular languages.
Homework 4 Solutions.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Fall 2006Costas Busch - RPI1 More Applications of the Pumping Lemma.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
Lecture 7UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 7.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
1 Non-regular languages. 2 Regular languages Non-regular languages.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
Tutorial CSC3130 : Formal Languages and Automata Theory Haifeng Wan ( )
The Pumping Lemma for Context Free Grammars. Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Closure.
Solution Exercise 1.43 a A r r s q q > b b e b s’ q r q’ b r’ a A’
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
A Universal Turing Machine
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
1 Recap lecture 27 Pumping lemma version II, proof, examples, Myhill Nerode theorem, examples.
Properties of Regular Languages
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
CS 203: Introduction to Formal Languages and Automata
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
1 Applications of pumping lemma(Dr. Torng) Applications of Pumping Lemma –General proof template What is the same in every proof What changes in every.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
1 Find as many examples as you can of w, x, y, z so that w is accepted by this DFA, w = x y z, y ≠ ε, | x y | ≤ 7, and x y n z is in L for all n ≥ 0.
1 Module 12 Computation and Configurations –Formal Definition –Examples.
Cs466(Prasad)L11PLEG1 Examples Applying Pumping Lemma.
Nonregular Languages How do you prove a language to be regular? How do you prove a language to be nonregular? A Pumping Lemma.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Infiniteness Test The Pumping Lemma Nonregular Languages
Hopcroft, Motawi, Ullman, Chap 4, sections 4.1 and 4.2
Elementary Questions about Regular Languages
Non-regular languages
Pumping Lemma September 29, 2006
Chapter 4 Properties of Regular Languages
Nonregular languages & the pumping lemma
Non-Regular Languages
More Applications of the Pumping Lemma
Presentation transcript:

1 Pumping Lemma –A technique for proving a language L is NOT regular –What does the Pumping Lemma mean? –Proof of Pumping Lemma

2 Pumping Lemma How do we use it?

3 Pumping Condition A language L satisfies the pumping condition if: –there exists an integer n > 0 such that –for all strings x in L of length at least n –there exist strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 and For all k ≥ 0, uv k w is in L

4 Pumping Lemma All regular languages satisfy the pumping condition All languages over {a,b} Regular languages “Pumping Languages”

5 Implications We can use the pumping lemma to prove a language L is not regular –How? We cannot use the pumping lemma to prove a language is regular –How might we try to use the pumping lemma to prove that a language L is regular and why does it fail? Regular Pumping

6 Pumping Lemma What does it mean?

7 Pumping Condition A language L satisfies the pumping condition if: –there exists an integer n > 0 such that –for all strings x in L of length at least n –there exist strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 and For all k ≥ 0, uv k w is in L

8 v can be pumped Let x = abcdefg be in L Then there exists a substring v in x such that v can be repeated (pumped) in place any number of times and the resulting string is still in L –uv k w is in L for all k ≥ 0 For example –v = cde uv 0 w = uw = abfg is in L uv 1 w = uvw = abcdefg is in L uv 2 w = uvvw = abcdecdefg is in L uv 3 w = uvvvw = abcdecdecdefg is in L … 1) x in L 2) x = uvw 3) For all k ≥ 0, uv k w is in L

9 What the other parts mean A language L satisfies the pumping condition if: –there exists an integer n > 0 such that defer what n is till later –for all strings x in L of length at least n x must be in L and have sufficient length –there exist strings u, v, w such that x = uvw and |uv| ≤ n and –v occurs in the first n characters of x |v| ≥ 1 and –v is not For all k ≥ 0, uv k w is in L

10 Example 1 Let L be the set of even length strings over {a,b} Let x = abaa Let n = 2 What are the possibilities for v? –abaa, abaa –abaa Which one satisfies the pumping lemma?

11 Examples 2 * Let L be the set of strings over {a,b} where the number of a’s mod 3 is 1 Let x = abbaaa Let n = 3 What are the possibilities for v? –abbaaa, abbaaa, abbaaa –abbaaa, abbaaa –abbaaa Which ones satisfy the pumping lemma?

12 Pumping Lemma Proof

13 High Level Outline Let L be an arbitrary regular language Let M be an FSA such that L(M) = L –M exists by definition of LFSA and the fact that regular languages and LFSA are identical Show that L satisfies the pumping condition –Use M in this part

14 First step: n+1 prefixes of x Let n be the number of states in M Let x be an arbitrary string in L of length at least n –Let x i denote the ith character of string x There are at least n+1 distinct prefixes of x –length 0: –length 1: x 1 –length 2: x 1 x 2 –... –length i: x 1 x 2 … x i –... –length n: x 1 x 2 … x i … x n

15 Example Let n = 8 Let x = abcdefgh There are 9 distinct prefixes of x –length 0: –length 1: a –length 2: ab –... –length 8: abcdefgh

16 Second step: Pigeon-hole Principle As M processes string x, it processes each prefix of x –In particular, each prefix of x must end up in some state of M Situation –There are n+1 distinct prefixes of x –There are only n states in M Conclusion –At least two prefixes of x must end up in the same state of M Pigeon-hole principle –Name these two prefixes p 1 and p 2

17 Third step: Forming u, v, w Setting: –Prefix p 1 has length i –Prefix p 2 has length j > i prefix p 1 of length i: x 1 x 2 … x i prefix p 2 of length j: x 1 x 2 … x i x i+1 … x j Forming u, v, w –Set u = p 1 = x 1 x 2 … x i –Set v = x i+1 … x j –Set w = x j+1 … x |x| –x 1 x 2 … x i x i+1 … x j x j+1 … x |x| u v w

18 Example 1 Let M be a 5-state FSA that accepts all strings over {a,b,c,…,z} whose length mod 5 = 3 Consider x = abcdefghijklmnopqr, a string in L What are the two prefixes p 1 and p 2 ? What are u, v, w?

19 Example 2 Let M be a 3-state FSA that accepts all strings over {0,1} whose binary value mod 3 = 1 Consider x = 10011, a string in L What are the two prefixes p 1 and p 2 ? What are u, v, w?

20 Fourth step: Showing u, v, w satisfy all the conditions |uv| ≤ n –uv = p 2 –p 2 is one of the first n+1 prefixes of string x |v| ≥ 1 –v consists of the characters in p 2 after p 1 –Since p 2 and p 1 are distinct prefixes of x, v is not For all k ≥ 0, uv k w in L –u=p 1 and uv=p 2 end up in the same state q of M This is how we defined p 1 and p 2 –Thus for all k ≥ 0, uv k ends up in state q –The string w causes M to go from state q to an accepting state

21 Example 1 again Let M be a 5-state FSA that accepts all strings over {a,b,c,…,z} whose length mod 5 = 3 Consider x = abcdefghijklmnopqr, a string in L What are u, v, w? –u = –v = abcde –w = fghijklmnopqr |uv| = 5 ≤ 5 |v| = 5 ≥ 1 For all t ≥ 0, (abcde) t fghijklmnopqr is in L

22 Example 2 again Let M be a 3-state FSA that accepts all strings over {0,1} whose binary interpretation mod 3 = 1 Consider x = 10011, a string in L What are u, v, w? –u = 1 –v = 00 –w = 11 |uv| = 3 ≤ 3 |v| = 2 ≥ 1 For all k ≥ 0, 1(00) k 11 is in L

23 Pumping Lemma A language L satisfies the pumping condition if: –there exists an integer n > 0 such that –for all strings x in L of length at least n –there exist strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 and For all k ≥ 0, uv k w is in L Pumping Lemma: All regular languages satisfy the pumping condition