Nonregular Languages Section 2.4 Wed, Oct 5, 2005.

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
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
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)
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.
Courtesy Costas Busch - RPI1 Non-regular languages.
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.
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)
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
1 Non-regular languages. 2 Regular languages 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.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
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}?
Cardinality with Applications to Computability Lecture 33 Section 7.5 Wed, Apr 12, 2006.
Properties of Regular Languages
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
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
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
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.
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.
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.
1 Advanced Theory of Computation Finite Automata with output Pumping Lemma Theorem.
Cardinality with Applications to Computability
CSE 105 theory of computation
A Universal Turing Machine
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.
Properties of Regular Languages
COSC 3340: Introduction to Theory of Computation
Infiniteness Test The Pumping Lemma Nonregular Languages
Decidable Languages Costas Busch - LSU.
COSC 3340: Introduction to Theory of Computation
Deterministic PDAs - DPDAs
Elementary Questions about Regular Languages
Non-regular languages
Pumping Lemma.
Nonregular languages & the pumping lemma
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
Proposed in Turing’s 1936 paper
Formal Languages, Automata and Models of Computation
More Applications of the Pumping Lemma
COSC 3340: Introduction to Theory of Computation
Recap lecture 25 Intersection of two regular languages is regular, examples, non regular languages, example.
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Nonregular Languages Section 2.4 Wed, Oct 5, 2005

Countability of the Set of DFAs  Theorem: The set of all DFAs (over an alphabet  ) is countable.  Proof: For a given n > 0, let S n be the set of all DFAs with exactly n states. How many DFAs are in S n ? There are n choices for the initial state. For each state, there are n |  | choices for the transitions coming out of that state. Therefore, there are (n |  | ) n = n |  |n choices for .

Countability of the Set of DFAs There are 2 n choices for the final states. Therefore, the number of DFAs with exactly n states is n  n |  |n  2 n. The set of all DFAs is S 1  S 2  S 3  … This is a countable set since it is the union of a countable number of finite sets. Thus, we can enumerate the DFAs as M 0, M 1, M 2, M 3, …

The Existence of a Non-Regular Language  There exists a language that is not accepted by any DFA (provided    ).  Proof: Let L n = L(M n ). Let x be any symbol in . Let s n = x n, for all n  0. Define a new language L by the rule that s n  L if and only if s n  L n. Then L is not equal to any L n. So L is not accepted by any DFA.

The Existence of a Non-Regular Language  This is another example of a diagonalization argument.  It is a non-constructive proof. It does not provide us with an example (unless we actually figure out what each M n is!).

The Existence of a Non-Regular Language  Another non-constructive proof is based on a cardinality argument.  The set of all languages is 2  *, which is uncountable since its cardinality is equal to the cardinality of 2 N, which we know to be uncountably infinite.  The set of DFAs is countable.  Therefore, the function f(M) = L(M) cannot be onto 2  *.  So, what is an example of a nonregular language?

The Pumping Lemma  The Pumping Lemma: Let L be an infinite regular language. There exists an integer n  1 such that any string w  L, with |w|  n, can be represented as the concatenation xyz such that y is non-empty, |xy|  n, and xy i z  L for every i  0.

Proof of the Pumping Lemma  Proof: Let n be the number of states. Let w be any string in L with at least n symbols. After processing n symbols, we must have returned to a previously visited state (the Pigeonhole Principle). Let q be the first revisited state.  Let x be the string processed from s to q.  Let y be the string processed around the loop from q back to q.  Let z be the string from q to the end, a final state f.

Proof, continued Then clearly |y| > 0 and |xy|  n. It is also clear that xy i z  L for all i  0, since we may travel the loop as many times as we like, including 0 times.

The Pumping Lemma  The Pumping Lemma says that if L is regular, then certain properties hold.  The contrapositive of the Pumping Lemma says that if certain properties do not hold, then L is not regular.  Therefore, you cannot use the Pumping Lemma to conclude that a language is regular, but only that it is not regular.  That’s good, because that is exactly what we want to do.

The Standard Example of a Nonregular Language  Let L = {a i b i | i  0}.  Suppose that L is regular.  “Let n be the n of the Pumping Lemma” and consider the string w = a n b n.  Then w can be decomposed as xyz where |y| > 0 and |xy|  n.  Therefore, xy consists only of a’s.  It follows that y = a k, for some k > 0.

Standard Example of a Nonregular Language  According to the Pumping Lemma, xy 2 z is in L.  However, xy 2 z =a n + k b n, which is not in L. since n + k  n.  This is a contradiction.  Therefore, L is not regular.

A Second Example of a Nonregular Language  Let L = {w   * | w contains an equal number of a’s and b’s}.  Suppose L is regular.  Let L 1 = L(a * b * ).  Then L  L 1 = {a i b i | i  0} would also be regular, which is a contradiction.  Therefore, L is not regular.

More Examples  {w   * | w contains an unequal number of a’s and b’s}.  {w   * | w contains more a’s than b’s}.  {w   * | w = zz for some z   * }. Consider w = a n ba n b and use the Pumping Lemma.  {w   * | w  zz for some z   * }.  Notice that we use the Pumping Lemma only when necessary; other arguments are often simpler.