Introduction to CS Theory

Slides:



Advertisements
Similar presentations
Properties of Regular Sets
Advertisements

Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Summary Showing regular Showing non-regular construct DFA, NFA
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
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Mount Holyoke College 2 Nonregular languages? We now know: –Regular languages may be specified either.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
Automata and Formal Languages Tim Sheard 1 Lecture 8 Pumping Lemma & Distinguishability Jim Hook Tim Sheard Portland State University.
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
Transparency No Formal Language and Automata Theory Chapter 10 The Myhill-Nerode Theorem (lecture 15,16 and B)
CS 310 – Fall 2006 Pacific University CS310 Pumping Lemma Sections:1.4 page 77 September 27, 2006.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
Regular Expression (EXTRA)
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
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.
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.
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.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY For next time: Read 2.1 & 2.2.
Today Chapter 1: RE = Regular Languages, nonregular languages RL pumping lemma Chapter 2: Context-Free Languages (CFLs)
1 Module 24 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Transparency No. 8-1 Formal Language and Automata Theory Chapter 8 DFA state minimization (lecture 13, 14)
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.
CS 461 – Sept. 12 Simplifying FA’s. –Let’s explore the meaning of “state”. After all if we need to simplify, this means we have too many states. –Myhill-Nerode.
Tutorial CSC3130 : Formal Languages and Automata Theory Haifeng Wan ( )
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Solution Exercise 1.43 a A r r s q q > b b e b s’ q r q’ b r’ a A’
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
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}?
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
Cs466(Prasad)L11PLEG1 Examples Applying Pumping Lemma.
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.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
1 Recap lecture 28 Examples of Myhill Nerode theorem, Quotient of a language, examples, Pseudo theorem: Quotient of a language is regular, prefixes of.
Regular Expression (EXTRA)
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Intro to Theory of Computation
CS 154, Lecture 4: Limitations on DFAs (I),
CSE322 Minimization of finite Automaton & REGULAR LANGUAGES
Non-regular languages
CS21 Decidability and Tractability
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
Chapter 1 Regular Language - 02
Instructor: Aaron Roth
Regular Language Equivalence and DFA Minimization
CHAPTER 1 Regular Languages
THEORY OF COMPUTATION 06 NUMBER OF STATES.
Presentation transcript:

Introduction to CS Theory Lecture 8 – Pumping Lemma, Myhill-Nerode Theorem Piotr Faliszewski pf@cs.rit.edu

The Pumping Lemma Theorem (The Pumping Lemma) Let L be a regular language. There is an integer n such that for any x  L with |x|  n there are strings u, v, w such that x = uvw |uv| ≤ n |v| > 0 For each m  0, uvmw  L Applications of the pumping lemma Showing that some language is not regular Prove that for this language the pumping lemma does not hold Just because the pumping lemma holds does not mean that the language is regular!

Proving a Language Nonregular Set L = {aibi | i  N }. Goal: Show that L is not regular. Proof. (by contradiction) Suppose that L is regular. Thus, pumping lemma holds for L and there exists an n such that for each string x in L, |x| > n, there are strings u, v, w such that x = uvm, |uv| ≤ n |v| > 0 For each m  0, uvmw  L Pick x = anbn. The pumping lemma implies however that for some j  1 it holds that an+jbn is in L! But this is false. A contradiction..

Steps of a “Pumping Lemma” Proof Nonmechanical elements of a “pumping lemma”-based nonregularity proof Choose x of length at least n. Choose m (often 0 or 2, never 1) Derive the contradiction Some examples: L1 = {ai | i is a square} L2 = {ai | i is prime} L3 = {ww | w  Σ*} L4 = {w | w has an equal number of a’s and b’s} What about: {aibjcj | i,j  N}  {bjck | j,k  N} {x | no prefix of x has more 0s than 1s}

Regular and Nonregular Languages How do we know a language is regular? Give a regular expression Find an NFA … ? How do we know a language is not regular? Pumping lemma What if we cannot come up with an NFA or a regular expressin, but we also have trouble showing the language is not regular via the pumping lemma?

Distinguishing Strings Def. Let L be a language over Σ, and x be a string in Σ*. The set L/x is defined as follows: L/x = {z  Σ* | xz  L} Distinguishing two strings Two strings x, y are distinguishable if L/x ≠ L/y If L is regular and x and y are two distinguishable strings, can there be an FA that ends in the same state after processing x and after processing y? Theorem. Let L be a language over Σ. Suppose there are n > 0 strings that are pairwise distinguishable with respect to L. Then there can be no FA recognizing L with fewer than n states

Myhill-Nerode Theorem Def. Let L be a language over Σ. The indistinguishability relation IL on Σ* is defined as follows: For all x, y  Σ*, x IL y iff L/x = L/y. Applications of Myhill-Nerode Theorem Show that a language is regular Show that a language is not regular Derive an FA for a regular language with a minimum number of states. Properties of IL IL is an equivalence relation We will later see that L is regular if and only if the set of equivalence classes of IL is finite (Myhill-Nerode Theorem)

Myhill-Nerode Theorem: Examples Σ = {0,1} Show that the language of palindromes is not regular: L = {wΣ* | w = wR } Show that the following language is regular: L’ = {wΣ* | w ends with 10 }

Constructing an FA from IL Theorem. Let L be a language over Σ and let QL be the set of equivalence classes of IL. If QL is finite, then ML = (QL, Σ, q0, AL δ) is a finite automaton accepting L, where: q0 = [ε] AL = { qQL|QL  L≠} δ([x], a) = [xa] ML has the fewest states of any FA accepting L.

Minimizing an FA Why is that correct? We can use Myhill-Nerode to construct a minimal automaton for a regular language specified via an automaton. Minimizing an automaton Remove all states unreachable from the start state. For p, q  Q, p ≡ q if and only if for all strings z, (δ*(p,z)  A  δ*(q,z)  A) Determine all pairs of equivalent states. Then identify all equivalent states. Why is that correct? Claim. For any two strings, x, y, x IL y iff δ*(q0, x) ≡ δ*(q0, y). 0, 1 2 3 1 0, 1 1 6 1 1 4 5 0, 1

Algorithm for Determining Equivalent States Algorithm List all unordered pairs of states (p,q) where p ≠ q Mark each pair on the list that has exactly one element in A Make a pass through the list of states and mark those pairs (p,q) such that (δ(p,a), δ(q,a)) is marked Repeat 3. until you make a pass where no new pairs are marked. Marked pairs are exactly those that contain states that are not equivalent. 4 1 2 1 5 1 1 1 1 6 3 1 7 1