CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

Slides:



Advertisements
Similar presentations
Lecture 9,10 Theory of AUTOMATA
Advertisements

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
CSCI 2670 Introduction to Theory of Computing September 15, 2004.
1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.
CS21 Decidability and Tractability
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
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.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
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.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
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.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Courtesy Costas Busch - RPI1 Non-regular languages.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
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 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)
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.
Introduction to CS Theory
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.
Properties of Regular Languages
Cs3102: Theory of Computation Class 5: Non-Regular Languages Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint.
CS355 - Theory of Computation Regular Expressions.
Conversions & Pumping Lemma CPSC 388 Fall 2001 Ellen Walker Hiram College.
CSCI 2670 Introduction to Theory of Computing September 13.
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.
Computability Regular expressions. Languages defined by regular expresses = Regular languages (languages recognized by FSM). Applications. Pumping lemma.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
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.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
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.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
Nonregular Languages Section 2.4 Wed, Oct 5, 2005.
CSE 105 theory of computation
CSE 105 theory of computation
Foundations of Computing Science
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
Intro to Theory of Computation
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.
Elementary Questions about Regular Languages
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Pumping Lemma September 29, 2006
CS21 Decidability and Tractability
Chapter 1 Regular Language - 02
CHAPTER 1 Regular Languages
COSC 3340: Introduction to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

Prove the Pumping Lemma, and use it to show that there are non-regular languages Introduce Regular Expression –which is one way to describe a language (or a set of strings) Objectives

Non-Regular Language? To understand the power of DFA, apart from knowing what it can do, we need to know what it cannot do Let’s look at the language B = {0 n 1 n | n  0} If we try to find a DFA to recognize B, the DFA needs to keep track of the number of 0’s we have seen so far However, number of 0’s is unlimited… there are unlimited number of possibilities So, it is NOT POSSIBLE because the DFA just has FINITE number of states!

Pumping Lemma Theorem: If A is a regular language, then there is a number p (called the pumping length) such that: if s is a string in A of length at least p, then s can be divided into three pieces, s = xyz, satisfying the following three conditions: –For each k  0, xy k z 2 A –|y|  0, and –|xy| · p

Pumping Lemma (Proof) Let us assign the pumping length p to be the number of states in the DFA that recognize A Consider the sequence of states that the DFA goes through when reading s = s 1 s 2 …s n At the beginning, it is at state r 0 = q start Then, it goes to r 1 after reading s 1, then goes to r 2, then goes to r 3 …

Pumping Lemma (Proof) When it has finished reading s p, one of the state has been visited at least two times (why?) That is, r i = r j, for some 0  i  j  p Now, let x = s 1 s 2 …s i, y = s i+1 s i+2 …s j, and z = s j+1 s j+2 …s n We can check that xy k z 2 A for all k  0 (why?) Also, |y|  0 and |xy|  p (why?)

Use of Pumping Lemma (Example 1) Lemma: The language B = {0 n 1 n | n  0} is not regular. How to prove? –Use Pumping Lemma –By contradiction Proof:Assume that B is regular. Then…

Use of Pumping Lemma (Example 1) Then, let p be the pumping length We know that 0 p 1 p is in B By pumping lemma, we know that 0 p 1 p can be divided into three parts, xyz, such that |y|  0, |xy|  p, and xy k z is in B for all k  0 In this case, y consists of all 0’s and at least 1 zero (why??) xyyz is in B, but xyyz has more 0’s than 1’s Contradiction occurs!

Use of Pumping Lemma (Example 2) Lemma: The language C = { w | w has an equal number of 0s and 1s } is not regular. How to prove?

Use of Pumping Lemma (Example 2) Proof 1: Similar to Example 1. Let s = 0 p 1 p and apply pumping lemma. Proof 2: We use the fact: the class of regular languages is closed under intersection. That is, If A and B are regular languages, then A \ B is also a regular language.

Use of Pumping Lemma (Example 2: Proof 2) Let A = { 0 m 1 n | m, n ¸ 0} Note that A is regular (why?) Now, assume that C is regular. Then, it implies that C \ A is regular However, C \ A = { 0 n 1 n | n ¸ 0}, which is not regular Thus, contradiction occurs (where?). So, C is not regular

Use of Pumping Lemma (Example 2) In Proof 1, we choose s = 0 p 1 p, we can apply pumping lemma successfully and prove that C is not regular However, if we ‘unluckily’ choose s = (01) p, using pumping lemma may not give contradiction… (E.g., |x| = , y = 01, z = (01) p-1, then every xy k z is in C) So, if you fail on first attempt, don’t give up, try another one!

Use of Pumping Lemma (Example 3) Lemma: The language F = { ww | w 2 {0,1}* } is not regular. How to prove?

Use of Pumping Lemma (Example 4) Lemma: The language {1 n 2 | n ¸ 0} is not regular. Proof: –Let p be the pumping length. –Let s = 1 p 2. –By pumping lemma, we have |xyz| = p 2. Also, 0  |y|  |xy|  p. –p 2  |xyyz|  p 2 + p  (p+1) 2 –Contradiction occurs (where??)

Use of Pumping Lemma (Example 5) Lemma: The language E = { 0 i 1 j | i  j } is not regular. Proof: Let s = 0 p+1 1 p. By pumping lemma, we can divide s into xyz such that y consists of all 0’s and |y|  0. Then, xz 2 E but xz does not have more 0s than 1s Contradiction occurs

Regular Expression In arithmetic, we can use the operations + and £ to build up expressions, such as (5+3) £ 4 –The value of this expression is 32 Similarly, we can use regular operations to build up regular expressions, such as (0 [ 1)0* –The value of this expression is a set of strings (or a language)

What does (0 [ 1)0* mean? 0 and 1 are shorthand for {0} and {1} –So, (0 [ 1) means ( {0} [ {1} ) –0* means {0}*, whose value is the language consisting of all strings with any number of 0s Just like £ in arithmetic expression, the concatenation symbol o is often omitted – So, ( 0 [ 1 ) 0* means ( 0 [ 1 ) o 0* This expression describes the set of strings that start with a 0 or a 1, which is followed by any number of 0s

What does the following regular expressions mean? 0*10*  *1  *  *001  * 1*(01 + )* (  )* (0 [  ) 1* 1* ; Note: The notation R + means RR* Binary strings containing exactly one 1 Any strings containing 1 Any strings containing 001 Any strings with even length Binary strings with 1 following each 0 01* [ 1* Empty set (no strings)