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