Are all Languages Regular

Slides:



Advertisements
Similar presentations
Lecture 9,10 Theory of AUTOMATA
Advertisements

Fall 2006Costas Busch - RPI1 Non-regular languages (Pumping Lemma)
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.
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
Automata and Formal Languages Tim Sheard 1 Lecture 8 Pumping Lemma & Distinguishability Jim Hook Tim Sheard Portland State University.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (more on Section 1.4) David Martin This work is licensed under.
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
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 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.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
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)
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.4: Nonregular Languages) David Martin With some.
1 Non-regular languages. 2 Regular languages Non-regular languages.
Extra on Regular Languages and Non-Regular Languages
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.
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.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Context Free Pumping Lemma. CFL Pumping Lemma A CFL pump consists of two non-overlapping substrings that can be pumped simultaneously while staying in.
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
CS 203: Introduction to Formal Languages and Automata
Cs466(Prasad)L11PLEG1 Examples Applying 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.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Lecture 8UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 8.
1 Advanced Theory of Computation Finite Automata with output Pumping Lemma Theorem.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
CSE 105 theory of computation
Non-regular languages - The pumping lemma
Complexity and Computability Theory I
Pumping Lemma.
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
CSE 3813 Introduction to Formal Languages and Automata
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Intro to Theory of Computation
Context Free Pumping Lemma Some languages are not context free!
Pumping Lemma for Regular Languages some languages are not regular!
Properties of Regular Languages
Lecture5 Non-regular languages
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.
Introduction to Finite Automata
Elementary Questions about Regular Languages
Non-regular languages
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Pumping Lemma September 29, 2006
Pumping Lemma.
Chapter 4 Properties of Regular Languages
Nonregular languages & the pumping lemma
CS21 Decidability and Tractability
Non-Regular Languages
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
More Applications of the Pumping Lemma
Non-regular languages
Non-regular languages
Recap lecture 25 Intersection of two regular languages is regular, examples, non regular languages, example.
The Pumping Lemma for CFL’s
The Pumping Lemma for CFL’s
CHAPTER 1 Regular Languages
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Are all Languages Regular We have seen many ways to specify Regular languages Are all languages Regular languages? The answer is No, How can we tell? A language is regular if we can describe it using any of the formalisms we have studied. If we can’t describe it, does that mean it is not regular? Maybe we’re not clever enough.

Importance of loops s p q r Consider this DFA. The input string 01011 gets accepted after an execution that goes through the state sequence s  p  q  p  q  r. This path contains a loop (corresponding to the substring 01) that starts and ends at p. There are two simple ways of modifying this path without changing its beginning and ending states: s p q r 1

s p q r delete the loop from the path; instead of going around the loop once, do it several times. As a consequence, we see that all strings of the form 0(10)i11 (where i ³ 0) are accepted. s p q r 1

Long paths must contain a loop Suppose n is the number of states of a DFA. Then every path of length n or more makes at least n+1 visits to a state and therefore must visit some state twice. Thus, every path of length n or longer must contain a loop.

Strategy Every long string in a regular language must have a loop. Regular Languages with loops exhibit certain kinds of patterns that are distinctly regular. Languages with long strings that do not adhere to the loop patterns for regular languages cannot be regular.

Pumps w aef abcdef abcdbcdef abcdbcdbcdef z x y Suppose L is a regular language, w is a string in L, and y is a non-empty substring of w. Thus, w=xyz, for some strings x, z . We say that y is a pump in w if all strings xyiz (that is, xz, xyz, xyyz, xyyyz, …) belong to L. w aef abcdef abcdbcdef abcdbcdbcdef a b c d e f z x y

Pumping Lemma Let L be a regular language. Then there exists a number n such that all w Î L such that for all |w| ³ n, there exists a prefix of w whose length is less than n which contains a pump. Formally: If w Î L and |w| ³ n then w = xyz such that y ¹ e |xy| n (xy is the prefix) xyiz Î L Definition. The number n associated to the regular language L as described in the Pumping Lemma is called the pumping constant of L.

Proof w Î L, |w| ³ n, w = xyz such that 1. y ¹ e 2. |xy| n 3. xyiz Î L Let the DFA have m states. Let |w|³m. Consider the path from the start state s to the (accepting) state d(s,w). Just following the first m arcs, we make m+1 total visits to states, so there must be a loop formed by some of these arcs. We can write w=opqr, where p corresponds to that loop, and|opq| = m (the prefix of size m). Thus let n=|op|, x=o, y = p, and z = qr. 1) Since every loop has at least one arc, we know |p| >0, thus y ¹ e 2) |xy| n because xy = op and n = |op| 3) xyiz Î L because If p is a loop, its starts at state si and d(si,p) = si, and we know that d(si,qr) = sfinal.. Thus d(sstart,x) = si, Thus for each i d(si,yi) = si, and were done.

y = q x = p start qi z = rs final r | s m steps

Proving non-regularity To prove that a given language is not regular, we use the Pumping Lemma as follows. Assuming L is regular (we are arguing by contradiction!), let n be the pumping constant of L. Making no other assumptions about n (we don't know what it is exactly), we need to produce a string wÎL of length ³ n that does not contain a pump in its n-prefix. This w depends on n; we need to give w for any value of n. There are many substrings of the n-prefix of our chosen w and we must demonstrate that none of them is a pump. Typically, we do this by writing w=xuy, a decomposition of w into three substrings about which we can only assume that u e and |xu|  n. Then we must show that for some concrete i (zero or greater) the string xuiy does not belong to L.

Skill required Notice the game-like structure of the proof. Somebody gives us n. Then we give w of length ³ n. Then our opponent gives us a non-empty substring u of the n-prefix of w (and with it the factorization w =xuy of w). Finally, we choose i such that xuiyÏ L. Our first move often requires ingenuity: We must find w so that we can successfully respond to whatever our opponent plays next.

Example 1 We show that L={0k1k | k=0,1,2, …} is not regular. Assuming the Pumping Lemma constant of L is n, we take w=0n1n. We need to show that there are no pumps in the n-prefix of w, which is 0n. If u is a pump contained in 0n then 0n = xuz, and xuuz must also be in the language. But since |u| > 0, if |xuz| = n then |xuuz| = m where m > n. So we obtain a string 0m1n with m>n, which is obviously not in L, so a contradiction is obtained, and are assumption that 0K1K is regular must be false. Note. The same choice of w and i works to show that the language: L={w Î {0,1}* | w contains equal number of 0s and 1s} is not regular either.

Example 2 We show that L = { uu | uÎ{a,b}* } is not regular. Let n be the pumping constant. Then we choose w=anbanb which clearly has length greater than n. The initial string an must contain the pump, u. So w = xuybanb, and xuyb = anb. But pumping u 0 times it must be the case that xybanb is in L too. But since u is not e, we see that xyb anb, since it must have fewer a’s. Which leads to a contradiction. Thus our original assumption that L was regular must be false. Question. If in response to the given n we play w=anan, the opponent has a chance to win. How?