Myhill-Nerode Theorem

Similar documents
Minimal DFA. minimal DFA for L starting from any other

State Minimization for DFAs

Finite-State Automata: Recap

Formal Languages and Automata

Deterministic Finite-State Automata

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Regular expressions, Finite Automata, transition graphs are all the same!!

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Lecture 09: Myhill-Nerode Theorem

Fundamentals of Computer Science

Convert the NFA into DFA

Theory of Computation Regular Languages

DFA minimisation using the Myhill-Nerode theorem

First Midterm Examination

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

Finite Automata-cont d

Non-deterministic Finite Automata

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CMSC 330: Organization of Programming Languages

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

First Midterm Examination

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

CHAPTER 1 Regular Languages. Contents

Lecture 08: Feb. 08, 2019

Worked out examples Finite Automata

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Regular Languages and Applications

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Coalgebra, Lecture 15: Equations for Deterministic Automata

Chapter 2 Finite Automata

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Harvard University Computer Science 121 Midterm October 23, 2012

Let's start with an example:

Non-deterministic Finite Automata

More on automata. Michael George. March 24 April 7, 2014

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Designing finite automata II

GNFA GNFA GNFA GNFA GNFA

Deterministic Finite Automata

Java II Finite Automata I

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Homework 3 Solutions

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

1 Nondeterministic Finite Automata

Closure Properties of Regular Languages

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Languages & Automata

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing

Introduction to ω-autamata

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Model Reduction of Finite State Machines by Contraction

Automata and Languages

p-adic Egyptian Fractions

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Some Theory of Computation Exercises Week 1

Revision Sheet. (a) Give a regular expression for each of the following languages:

Formal languages, automata, and theory of computation

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Tutorial Automata and formal Languages

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Math 4310 Solutions to homework 1 Due 9/1/16

Lecture 9: LTL and Büchi Automata

Formal Language and Automata Theory (CS21004)

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Streamed Validation of XML Documents

1 From NFA to regular expression

CISC 4090 Theory of Computation

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

3. Finite automata and regular languages: theory

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

NFAs continued, Closure Properties of Regular Languages

3 Regular expressions

Closure Properties of Regular Languages

DFA Minimization and Applications

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CSC 311 Theory of Computation

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Today s Topics Automata and Languages

Transcription:

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 23 August 2012

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Outline 1 Overview 2 Myhill-Nerode Theorem 3 Correspondence etween DA s nd MN reltions 4 Cnonicl DA for L 5 Computing cnonicl DFA

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem: Overview Every lnguge L hs cnonicl deterministic utomton ccepting it. Every other DA for L is refinement of this cnonicl DA. There is unique DA for L with the miniml numer of sttes. Holds for ny L (not just regulr L). L is regulr iff this cnonicl DA hs finite numer of sttes. There is n lgorithm to compute this cnonicl DA from ny given finite-stte DA for L.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Illustrting refinement of DA: Exmple 1 Every DA for L is refinement of this cnonicl DA: u p q, r, t s,,,,,

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Illustrting refinement of DA: Exmple 2 Every DA for L is refinement of this cnonicl DA:

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Cnonicl equivlence reltion L on A induced y L A : x L y iff z A, xz L iff yz L. x L y iff y x L L Theorem (Myhill-Nerode) L is regulr iff L is of finite index (tht is hs finite numer of equivlence clsses).

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 1 Descrie the equivlence clsses for L = Odd numer of s.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 2 Descrie precisely the equivlence clsses of L for the lnguge L {, } comprising strings in which 2nd lst letter is.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 2 Descrie precisely the equivlence clsses of L for the lnguge L {, } comprising strings in which 2nd lst letter is. ɛ,,.,...

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 3 Descrie the equivlence clsses of L for the lnguge L = { n n n 0}.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 3 Descrie the equivlence clsses of L for the lnguge L = { n n n 0}. ɛ 2 2 3 3 3 2 4 2 4 3 5 3,...,

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exercise 3 Descrie the equivlence clsses of L for the lnguge L = { n n n 0}. ɛ 2 2 3 3 3 2 4 2 4 3 5 3,... Note: The nturl deterministic PDA for L gives this DA.,

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode (MN) reltions for lnguge An MN reltion for lnguge L on n lphet A is n equivlence reltion R on A stisfying 1 R is right-invrint (i.e. xry = xry for ech A.) 2 R refines (or respects ) L (i.e. xry = x, y L or x, y L). A

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Deterministic Automt for L nd MN reltions for L DA for L nd MN reltions for L re in 1-1 correspondence (they represent echother). A R A A R R DA for L MN reltions for L Mps A R A nd A R R re inverses of echother.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple DA nd its induced MN reltion L is Odd numer of s : ɛ A R A ɛ R A R

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Deterministic Automt for L nd MN reltions for L DA (with no unrechle sttes) for L nd MN reltions for L re in 1-1 correspondence. A R A A R R DA for L MN reltions for L Mps A R A nd A R R re inverses of echother.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA The reltion L refines ll MN-reltions for L Lemm Let L e ny lnguge over n lphet A. Let R e ny MN-reltion for L. Then R refines L.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA The reltion L refines ll MN-reltions for L Lemm Let L e ny lnguge over n lphet A. Let R e ny MN-reltion for L. Then R refines L. Proof: To prove tht xry implies x L y. Suppose x L y. Then there exists z such tht (WLOG) xz L nd yz L. Suppose xry. Since its n MN reltion for L, it must e right invrint; nd hence xzryz. But this contrdicts the ssumption tht R respects L.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA The reltion L refines ll MN-reltions for L Lemm Let L e ny lnguge over n lphet A. Let R e ny MN-reltion for L. Then R refines L. Proof: To prove tht xry implies x L y. Suppose x L y. Then there exists z such tht (WLOG) xz L nd yz L. Suppose xry. Since its n MN reltion for L, it must e right invrint; nd hence xzryz. But this contrdicts the ssumption tht R respects L. As corollry we hve: Theorem (Myhill-Nerode) L is regulr iff L is of finite index (tht is hs finite numer of equivlence clsses).

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Cnonicl DA for L We cll A L the cnonicl DA for L. In wht sense is A L cnonicl? Every other DA for L is refinement of A L. A is refinement of B if there is stle prtitioning of A such tht quotient of A under (written A/ ) is isomorphic to B. Stle prtitioning of A = (Q, s, δ, F ) is n equivlence reltion on Q such tht: p q implies δ(p, ) δ(q, ). If p q nd p F, then q F lso. Note tht if is stle prtitioning of A, then A/ ccepts the sme lnguge s A.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple: 1 A stle prtitioning shown y pink nd light pink clsses, nd elow, the quotiented utomton: u p q, r, t s,,,,,

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple: 2

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Proving cnonicity of A L Let A e DA for L with no unrechle sttes. Then A L represents stle prtitioning of A. (Use the refinement of L y the MN reltion R A.) ɛ A R A A L L ɛ

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Stle prtitioning Let A = (Q, s, δ, F ) e DA for L with no unrech. sttes. The cnonicl MN reltion for L (i.e. L ) induces corsest stle prtitioning L of A given y p L q iff x, y A such tht δ(s, x) = p nd δ(s, y) = q, with x L y. Define stle prtitioning of A y p q iff z A : δ(p, z) F iff δ(q, z) F. z p z q

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple of prtitioning reltion u p q, r, t s,

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Stle prtitioning is corsest Clim: coincides with L. L =. Proof: p q iff x, y, z : δ(s, x) = p, δ(s, y) = q, nd δ(p, z) F ut δ(q, z) F. iff p L q.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Algorithm to compute for given DFA Input: DFA A = (Q, s, δ, F ). Output: for A. 1 Initilize entry for ech pir in tle to unmrked. 2 Mrk (p, q) if p F nd q F or vice-vers. 3 Scn tle entries nd repet till no more mrks cn e dded: 1 If there exists unmrked (p, q) with A such tht δ(p, ) nd δ(q, ) re mrked, then mrk (p, q). 4 Return s: p q iff (p, q) is left unmrked in tle.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple Run minimiztion lgorithm on DFA elow: u p q, r, t s, u p t q s r u p t q s r

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple Run minimiztion lgorithm on DFA elow: u p q, r, t s, u p t q s r u p t q s r

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple Run minimiztion lgorithm on DFA elow: u p q, r, t s, u p t q s r u p t q s r

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Exmple Run minimiztion lgorithm on DFA elow: u p q, r, t s, u p t q s r u p t q s r

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Correctness of minimiztion lgorithm Clim: Algo lwys termintes. n(n 1)/2 tle entries in ech scn, nd t most n(n 1)/2 scns. In fct, numer of scns in lgo is n, where n = Q. 1 Consider modified step 3.1 in which mrk check is done wrt the tle t the end of previous scn. 2 Argue tht t end of i-th scn lgo computes i, where p i q iff w A with w i : δ(p, w) F iff δ(q, w) F. 3 Oserve tht i+1 strictly refines i, unless the lgo termintes fter scn i + 1. So modified lgo does t most n scns. 4 Both versions mrk the sme set of pirs. Also if modified lgo mrks pir, originl lgo hs lredy mrked it.

Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Correctness of minimiztion lgorithm Clim: Algo mrks (p, q) iff p q. ( ) ( ) z p z q