Lecture5 Non-regular languages

Slides:



Advertisements
Similar presentations
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Advertisements

Pumping Lemma Problem: Solution:
Lecture 9,10 Theory of AUTOMATA
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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.
CSCI 2670 Introduction to Theory of Computing September 15, 2004.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
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 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
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.
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.
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)
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)
Extra on Regular Languages and Non-Regular Languages
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
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.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
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.
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.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
 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.
CSE 105 theory of computation
Non-regular languages - The pumping lemma
Complexity and Computability Theory I
Pumping Lemma.
Foundations of Computing Science
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
Intro to Theory of Computation
Pumping Lemma for Regular Languages some languages are not regular!
COSC 3340: Introduction to Theory of Computation
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.
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
Are all Languages Regular
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
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:

Lecture5 Non-regular languages  2004 SDU

Are all languages regular? Answer: No! One argument: # of DFA’s on ? # of languages on ? the latter is larger than the former.  2004 SDU 2

Pumping Lemma First technique to show that specific given languages are not regular. The idea: Each regular language satisfies the pumping lemma, so, if a language does not, then, it is non-regular!  2004 SDU 3

Statement of Pumping Lemma If A is a regular language, then there is a number p (pumping length) where, if s is any string in A of length at least p, then s must be able to be divided into three pieces, s = xyz, satisfying the following conditions: 1. for each i  0, xyiz  A, 2. |y| > 0, and 3. |xy|  p.  2004 SDU 4

Describing the pumping lemma (contd.) Take string with There is a walk with label: w1 w2 wn ......... s1 sn-1 sn s0  2004 SDU 5

Describing the pumping lemma (contd.) , number of states. If string has length Then, a state is repeated in the walk ...... ......  2004 SDU 6

Describing the pumping lemma (contd.) Write w=xyz , here si is the first repeat state, and sl is the second apperance of si y=wi+1…wl sl-1 si+1 wl wi+1 w1 wi w2 ...... ...... wn s0 s1 wl+1 si(sl) sn z=wl+1…wn x=w1…wi  2004 SDU 7

Describing the pumping lemma (contd.) Observations : |xy| = |s0,…,si,si+1…,sl-1,si| - 1  (p+1)-1=p |y| = |si,…,sl-1,si|-1  2-1=1 y=wi+1…wl sl-1 si+1 wl wi+1 w1 wi w2 ...... s0 s1 si(sl) x=w1…wi  2004 SDU 8

Describing the pumping lemma (contd.) Observation: the string xz is accepted. w1 ...... wi w2 ...... wn s0 s1 wl+1 sn si(sl) z=wl+1…wn x=w1…wi  2004 SDU 9

Describing the pumping lemma (contd.) Observation: the string xyyz is accepted. y=wi+1…wl sl-1 si+1 wi+1 wl wn wl+1 w1 w2 ...... wi ...... s0 s1 si(sl) sn z=wl+1…wn x=w1…wi  2004 SDU 10

Proof of pumping lemma Idea: If a string w of length m is accepted by a DFA with p states, and m  p, then there is a repeat state (let i be the first one) in the accepting state sequence. s0w1 s1…wisiwi+1si+1…wlsl(=si)wl+1sl+1…wmsm z y x |xy| = |w1,…,wl| = |s0,…,si, si+1, …, si| - 1  (p+1)-1 = p |y| = |wi+1, …,wl | = |si, si+1, …, si| - 1  2-1=1 xz (= w1…wiwl+1…wm): s0, …, si, sl+1, …, sm xyyz( = w1…wiwi+1…wlwi+1…wlwl+1…wm): s0,…, si, si+1, .., sl, si+1, …, sl, sl+1, …,sm  2004 SDU 11

An exmaple 1 1,+ + + s1 s4 s2 1 1 s0 + Let p = 4. Input: 1+1+1 x = “1” y = “+1” z = “+1” Actually, we can also choose p as 3 even 2, why? Consider input 111, 11, or 1+1. Can they be pumped? What is the minimum pumping length?  2004 SDU 12

Application of Pumping Lemma Example 1: A = { 0n1n | n  0} is not regular. Proof. By contradiction. Assume, on the contrary, that A is regular. Then the pumping lemma holds for A. Let p be a pumping length. Let w = 0p1p. Then w is in A and is longer than p. Then by pumping Lemma, w can be divided into w=xyz such that For each i  0, xyiz  A |y| > 0, and 00000000 11111111 |xy|  p. Then x and y are all 0’s. So, xyyz has more 0’s than 1’s and is in A. A contradiction. So, A is not regular. y  2004 SDU 13

Application of Pumping Lemma Example 2: B={ w | w{0,1}* and has an equal number of 0’s and 1’s} is not regular. Proof. By contradiction. Assume, on the contrary, that B is regular. Then the pumping lemma holds for B. Let p be a pumping length. Let w = 0p1p. Then w is in B and is longer than p. Then by pumping Lemma, w can be divided into w=xyz such that For each i  0, xyiz  B |y| > 0, and |xy|  p. Then x and y are all 0’s. So, xyyz has more 0’s than 1’s and is in B. A contradiction. So, B is not regular. Another proof. Let B’=B0*1*. If B is regular, then B’=A is regular, a contradiction.  2004 SDU 14

Application of Pumping Lemma Example 3: C = {ww | w {0,1}*} is not regular. Proof. By contradiction. Assume, on the contrary, that C is regular. Then the pumping lemma holds for C. Let p be a pumping length. Let w = 0p10p1. Then w is in C and is longer than p. Then by pumping Lemma, w can be divided into w=xyz such that For each i  0, xyiz  C |y| > 0, and |xy|  p. Then x and y are all 0’s. Obviously xyyz cannot be represented as ww. A contradiction to that xyyz  C. So, C is not regular.  2004 SDU 15

Application of Pumping Lemma Example 4: D={1a | a = n2 for some n  0} is not regular. Proof. By contradiction. Assume, on the contrary, that D is regular. Then the pumping lemma holds for D. Let p be a pumping length. Let w = 1b, b=p2. Then w is in D and is longer than p. Then by pumping Lemma, w can be divided into w=xyz such that For each i  0, xyiz  D |y| > 0, and |xy|  p. Then xyyz=1c, where p2 < c = p2 + |y|  p2 + p, then c cannot be expressed as n2 for any n. A contradiction to that xyyz  D. So, D is not regular.  2004 SDU 16

Application of Pumping Lemam Example 5: E={0i1j | i > j} is not regular. Proof. By contradiction. Assume, on the contrary, that E is regular. Then the pumping lemma holds for E. Let p be a pumping length. Let w = 0p1p-1. Then w is in E and is longer than p. Then by pumping Lemma, w can be divided into w=xyz such that For each i  0, xyiz  E |y| > 0, and |xy|  p. Then both x and y are strings of all 0’s. Then xz = 0x1p-1, where x  p-1. A contradiction to that xz  E. So, E is not regular.  2004 SDU 17