3.2 Pumping Lemma for Regular Languages Given a language L, how do we know whether it is regular or not? If we can construct an FA to accept the language.

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Pumping Lemma Problem: Solution:
4.5 Inherently Ambiguous Context-free Language For some context-free languages, such as arithmetic expressions, may have many different CFG’s to generate.
Lecture 9,10 Theory of AUTOMATA
Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
Automata and Formal Languages Tim Sheard 1 Lecture 8 Pumping Lemma & Distinguishability Jim Hook Tim Sheard Portland State University.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
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.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
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)
Regular Expression (EXTRA)
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
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.
Today Chapter 1: RE = Regular Languages, nonregular languages RL pumping lemma Chapter 2: Context-Free Languages (CFLs)
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Introduction to CS Theory
Prof. Busch - LSU1 NFAs accept the Regular Languages.
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.
Overview Mathematical Induction Derivations Recursive Inference Parse Trees Equivalence of Inference, Derivations, and Parse Trees.
CS 203: Introduction to Formal Languages and Automata
Regular Languages ภาษาปกติ. Jaruloj Chongstitvatana Outline Regular expressions Regular languages Equivalence between languages accepted by.
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.
CSE 311 Foundations of Computing I Lecture 24 FSM Limits, Pattern Matching Autumn 2011 CSE 3111.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
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.
Lecture 8UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 8.
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Lecture #5 Advanced Computation Theory Finite Automata.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Non-regular languages - The pumping lemma
Foundations of Computing Science
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
More Applications of the Pumping Lemma
PROPERTIES OF REGULAR LANGUAGES
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
CS 154, Lecture 4: Limitations on DFAs (I),
Infiniteness Test The Pumping Lemma Nonregular Languages
Regular Expression We shall build expressions from the symbols using simple operations include concatenation, union and kleen closure. Several intuitive.
More on DFA minimization and DFA equivalence
Elementary Questions about Regular Languages
Non-regular languages
Chapter 4 Properties of Regular Languages
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
More Applications of the Pumping Lemma
Recap lecture 25 Intersection of two regular languages is regular, examples, non regular languages, example.
CHAPTER 1 Regular Languages
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

3.2 Pumping Lemma for Regular Languages Given a language L, how do we know whether it is regular or not? If we can construct an FA to accept the language or a regular expression denoting the language, then it is a regular. But if we can not, we still can not make sure that it is not regular. So, we have develop methods to show irregular languages. We have already mentioned one method in section 3.1 to show that a language L is not regular, if the number of equivalence classes of the relation R L is infinite. The second method we shall introduce is the pumping lemma for regular languages.

If a language L is finite, then it is easy to figure out whether or not a given string is in L. L is finite, it is sure that we can list them all. So, L is a regular language. Theorem 2: Let L be a finite language. Then L is regular. Proof: It is easy to construct an NFA as follows to accept the finite set L={  1,  2, …,  n }. q 0 q f q 1 q 2 q n p 1 p 2 p n 11  2  n n       

Lemma 4(The pumping lemma): Let L be an infinite regular language over an alphabet . Then there is a constant n such that for each string  in L with |  |  n,  can be written as  = xyz, where |xy|  n and |y|  1, and for all k  0, xy k z  L. Proof : Since L is regular, by the Myhill-Nerode theorem there is a minimal DFA M = (Q, , , q 0, F) accepting L. Let n be |Q|. If   L and |  |  n. Let  =a 1 a 2 …a m, where m  n. Let q i =  ( q 0, a 1 a 2 …a i ), i = 1, 2, …, m. Since there are only n states in Q and m  n, by the pigeon hole theorem there are two states of q 0, q 1, q 2, …, and q n are same, say 0  i  j  n and q i = q j.

q i =  ( q 0, a 1 a 2 …a i ) =  ( q 0, a 1 a 2 …a j ) = q j. We have that q i =  ( q 0, a 1 a 2 …a i ) =  ( q i, a (i+1) …a j ). Let x = a 1 a 2 …a i, y = a (i+1) …a j, and z = a (i+1) …a m. Hence, q i =  ( q i, a (i+1) …a j ) =  ( q i, (a (i+1) …a j ) k ), for all k  0. We have that  ( q 0, xy k z) =  ( q i, y k z) =  ( q i, z) =  ( q 0, xyz)  F, for all k  0. Therefore,  = xy k z, where |xy|  n and |y|  1, and xy k z  L, for all k  0.

The pumping lemma says that (  L)( L is regular and |L| is infinite  (  n ) ( (   in L, |  |  n) (  x, y and z, |xy|  n and |y|  1,  = xyz)(  i  0) (xy i z  L))) Therefore, L is regular and |L| is infinite, we have that “  n, ” such that “   in L, |  |  n,  x, y and z,  = xyz, where |xy|  n and |y|  1, and xy i z  L, for all i  0.” To show that a set L is not regular by contradiction, we first assume that L were regular and  n in the pumping lemma. And show that “   in L, |  |  n,  x, y and z,  = xyz, where |xy|  n and |y|  1,  i  0 such that xy i z  L.” For a true statement ”  x P(x)   n Q(n) ”, where P( ) and Q( ) are two predicates, suppose that we want to show that for some y P(y) is not true. We can first assume that P(y) were true. And show there is an n such that Q(n) is false. That the predicate Q(n) is false leads to a contradiction. Hence, P(y) is not true.

Example 6: Let L={0 i 1 i | i>0}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose  = 0 n 1 n. We have that   L and |  | > n. Let  = xyz, where |xy|  n and |y|  1. Since |xy|  n and |y|  1, we have that x = 0 |x| and y = 0 |y|. It is obvious that xy i z  L for i  1, since the number of 0s is not equal to that of 1s in the string xy i z. Contradict to the assumption that L is regular.

Example 7: Let L be the regular expressions over an alphabet  ={0, 1}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose  = ( n 0*)*…)*). We have that   L and |  | > n. Let  = xyz, where |xy|  n and |y|  1. Since |xy|  n and |y|  1, we have that x = ( |x| and y = ( |y|. It is obvious that xy i z  L for i  1, since the number of the left parentheses is not equal to that of right parentheses in the string xy i z. Contradict to the assumption that L is regular.

Example 8: Let L = {  in {0, 1}* | i = the number of 0’s in , and j = the number of 1’s in , i, j  1 and gcd(i, j)=1}. Show that L is not regular. Solution : Assume that L were regular. Let n be the constant in the pumping lemma. Choose  = 0 t 1 s, where s =2*3*5*…*p n, p n is the nth prime number and t = p n+1. We have that   L and |  | > n. Let  = xyz, where |xy|  n and |y|  1. Hence, x = 0 |x| and y = 0 |y|. Consider the case that i = 0, xy i z = xz = 0 t - |y| 1 s. Since t - |y| 1. Then xz  L. Contradiction.