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.

Slides:



Advertisements
Similar presentations
Chapter Eleven: Non-Regular Languages
Advertisements

Pumping Lemma Problem: Solution:
CSCI 3130: Formal languages and automata theory Tutorial 5
1 Pumping Lemma –A technique for proving a language L is NOT regular –What does the Pumping Lemma mean? –Proof of Pumping Lemma.
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.
CS21 Decidability and Tractability
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.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin This work is licensed under.
1 Module 33 Non-context free languages –Intuition and Examples CFL Pumping Lemma –Comparison to regular language pumping lemma –What it means –Proof overview.
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
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 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
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.
Lecture 8 Sept 29, 2011 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
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 Module 24 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
Costas Busch1 More Applications of The Pumping Lemma.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
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.
Introduction to CS Theory
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
CS 3240 – Chapter 4.  Closure Properties  Algorithms for Elementary Questions:  Is a given word, w, in L?  Is L empty, finite or infinite?  Are L.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Properties of Regular Languages
CS355 - Theory of Computation Regular Expressions.
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
CS 203: Introduction to Formal Languages and Automata
Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
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.
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.
 2004 SDU Lecture8 NON-Context-free languages.  2004 SDU 2 Are all languages context free? Ans: No. # of PDAs on  < # of languages on  Pumping lemma:
Lecture 8UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 8.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
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
Chapter 4 Properties of Regular Languages
Non-Regular Languages
More Applications of the Pumping Lemma
COSC 3340: Introduction to Theory of Computation
Presentation transcript:

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 proof –Incorrect pumping lemma proofs –Some rules of thumb

2 Pumping Lemma Applying it to prove a specific language L is not regular

3 How we use the Pumping Lemma We choose a specific language L –For example, {a j b j | j > 0} We show that L does not satisfy the pumping condition We conclude that L is not regular

4 Showing L “does not pump” 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 A language L does not satisfy the pumping condition if: –for all integers n of sufficient size –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L

5 Example Proof A language L does not satisfy the pumping condition if: –for all integers n of sufficient size –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L Proof that L = {a i b i | i>0} does not satisfy the pumping condition Let n be the integer from the pumping lemma Choose x = a n b n Consider all strings u, v, w s.t. x = uvw and |uv| ≤ n and |v| ≥ 1 Argue that uv k w is not in L for some k ≥ 0 –Argument must apply to all possible u,v,w –Continued on next slide

6 Example Proof Continued Proof that L = {a i b i | i>0} does not satisfy the pumping condition Let n be the integer from the pumping lemma Choose x = a n b n Consider all strings u, v, w s.t. x = uvw and |uv| ≤ n and |v| ≥ 1 Argue that uv k w is not in L for some k ≥ 0 –Argument must apply to all possible u,v,w –Continued on right uv 0 w = uw is not in L –uv contains only a’s why? –uw = a n-|v| b n Follows from previous line and uvw = x = a n b n –uw contains fewer a’s than b’s why? –Therefore, uw is not in L Therefore L does not satisfy the pumping condition

7 Alternate choice of k Proof that L = {a i b i | i>0} does not satisfy the pumping condition Let n be the integer from the pumping lemma Choose x = a n b n Consider all strings u, v, w s.t. x = uvw and |uv| ≤ n and |v| ≥ 1 Argue that uv k w is not in L for some k ≥ 0 –Argument must apply to all possible u,v,w –Continued on right uv 2 w = uvvw is not in L –uv contains only a’s why? –uvvw = a n+|v| b n follows from previous line and uvw = x = a n b n –uvvw contains more a’s than b’s why? –Therefore, uvvw is not in L Therefore L does not satisfy the pumping condition

8 Pumping Lemma Some bad applications of the pumping lemma

9 Bad Pumping Lemma Applications We now look at some examples of bad applications of the pumping lemma We work with the language EQUAL consisting of the set of strings over {a,b} such that the number of a’s equals the number of b’s We focus first on bad choices of string x We then consider another flawed technique

10 First bad choice of x A language L does not satisfy the pumping condition if: –Let n be the integer from the pumping lemma –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L Let n be the integer from the pumping lemma Choose x = a 10 b 10 –What is wrong with this choice of x?

11 Second bad choice of x A language L does not satisfy the pumping condition if: –Let n be the integer from the pumping lemma –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L Let n be the integer from the pumping lemma Choose x = a n b 2n –What is wrong with this choice of x?

12 Third bad choice of x A language L does not satisfy the pumping condition if: –Let n be the integer from the pumping lemma –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L Let n be the integer from the pumping lemma Choose x = (ab) n –What is wrong with this choice of x? There is a choice of u, v, w satisfying the three conditions such that for all k ≥ 0, uv k w is in L Give such a u, v, w. For v=ab there is no contradiction

13 Find the flaw in this proof A language L does not satisfy the pumping condition if: –Let n be the integer from the pumping lemma –there exists a string x in L of length at least n such that –for all strings u, v, w such that x = uvw and |uv| ≤ n and |v| ≥ 1 –There exists a k ≥ 0 such that uv k w is not in L Let n be the integer from the pumping lemma Choose x = a n b n Let u = a 2, v =a, w = a n-3 b n –|uv| = 3 ≤ n –|v| = 1 Choose k = 2 Argue uv 2 w is not in EQUAL –uv 2 w = uvvw = a 2 aaa n-3 b n = a n+1 b n –There is one more a than b in uv 2 w –Thus uv 2 w is not in L –Choose all possible v's

14 Pumping Lemma Two rules of thumb

15 Two Rules of Thumb * Try to make the first n characters of x identical –For EQUAL, choose x = a n b n rather than (ab) n Simplifies case analysis as v only contains a’s Try k=0 or k=2 –k=0 This reduces number of occurrences of that first character –k=2 This increases number of occurrences of that first character

16 Summary We use the Pumping Lemma to prove a language is not regular –Note, does not work for all nonregular languages, though Choosing a good string x is first key step Choosing a good integer k is second key step Must apply argument to all legal u, v, w