Presentation is loading. Please wait.

Presentation is loading. Please wait.

MYHILL NERODE THEOREM By Anusha Tilkam. Myhill Nerode Theorem: The following three statements are equivalent 1.The set L є ∑* is accepted by a FSA 2.L.

Similar presentations


Presentation on theme: "MYHILL NERODE THEOREM By Anusha Tilkam. Myhill Nerode Theorem: The following three statements are equivalent 1.The set L є ∑* is accepted by a FSA 2.L."— Presentation transcript:

1 MYHILL NERODE THEOREM By Anusha Tilkam

2 Myhill Nerode Theorem: The following three statements are equivalent 1.The set L є ∑* is accepted by a FSA 2.L is the union of some of the equivalence classes of a right invariant equivalence relation of finite index. 3.Let equivalence relation R L be defined by : xR L y iff for all z in ∑* xz is in L exactly when yz is in L. Then R L is of finite index.

3 Theorem Proof: There are three conditions: 1.Condition (i) implies condition (ii) 2.Condition (ii) implies condition (iii) 3.Condition (iii) implies condition (i)

4 Equivalence Relation A binary relation ̴ over a set X is an equivalence relation if it satisfies Reflexivity Symmetry Transitivity

5 Condition (i) implies condition (ii) Proof: Let L be a regular language accepted by a DFSA M = (Q,∑,δ,q 0,F). Define R M on ∑* x R M y if δ(q 0, x) = δ(q 0, y) In order to show that its an equivalence relation it has to satisfy three properties.

6 δ(q 0, x) = δ(q 0, x) --- Reflexive If δ(q 0, x) = δ(q 0, y) then δ(q 0, y) = δ(q 0, x) --- Symmetry If δ(q 0, x) = δ(q 0, y) δ(q 0, y) = δ(q 0, z) then δ(q 0, x) = δ(q 0, z) --- Transitive

7 Index of an Equivalence relation: There are N states If This R M is an Equivalence Relation, Then the index of R M is at most the number of States of M q0q0 q1q1 q2q2 q n-1

8 Right invariant If x R M y Then xz R M yz for any z є ∑* Then we say R M is Right invariant Proof: δ(q 0, x) = δ(q 0, y) δ(q 0, xz) = δ( δ(q 0, x), z ) = δ( δ(q 0, y), z ) = δ(q 0, yz) Therefore R M is right invariant

9 L is the union of sum of the equivalence classes of that relation. If the Equivalence Relation R M has n states. S 0, S 1, S 2, ……, S i, …….., S n-1 | | | | | q 0, q 1, q 2,….., q i,…..…, q n-1

10 Condition (ii) implies condition (iii) : Proof: Let E be an equivalence relation as defined in (ii). We have to prove that E is a Refinement of R L. What is Refinement?

11 x E y | x,y є to same equivalence class of E xz E yz | xz is related to yz for any z є ∑* L is the union of sum of the equivalence classes of E. If L contains this equivalence class then xz and yz are in L or it may not be in L. Then we can say that x R L y Hence it is proved that every equivalence class in E is an Equivalence class in R L Then we can say that E is a Refinement of R L E is of finite index Index of R L <= index of E therefore R L is of Finite index.

12 Example : DFA L ={ w | w contains a stings having atleast one a,no sequence of b} ∑* is partioned into three equivalence class J 0,J 1,J 2 q0q0 q1q1 q2q2 b b a a b a

13 J 0 – strings which do not contain an a J 1 – strings which contain odd number of a’s J 2 - strings which contain even number of a’s L = J 1 U J 2 J 0 J 1 J 2 є a aa b ba aba bb babaa babab …… so on ……..so on

14 Condition (iii) implies condition (i) Proof: R L is right invariant x R L y if xz є L yz є L Therefore if z = wz then xwz є L ywz є L for any w and z Then xwz R L ywz Hence R L is Right invariant Define an FSA M’ = (Q’, ∑,δ’,q 0 ’,F’) as follows: For each equivalence class of R L,we have a state in Q’. |Q’| = index of R L

15 If x є ∑* denote the Equivalence class of R L to which x є to [x] q 0 ’ = [є] belongs to initial state / one equivalence class. For symbol a є ∑ δ’([x],a) = [xa] This definition is consistent because R L is right invariant. If xR L y then δ([x],a) = [ya] Because x,y belong to same class and Right invariant. Therefore we can say that L is accepted by a FSA.

16 Example : J 0 and J 1 U J 2 are the two equivalence classes in R L J0J0 J 1, J 2 b a,b a

17 To show that a given language is not Regular: L = {a n b n |n>=1} Assume that L is Regular Then by Myhill Nerode theorem we can say that L is the union of sum of the Equivalence classes and etc a, aa,aaa,aaaa,…….. Each of this cannot be in different equivalence classes. a n ~ a m for m ≠ n By Right invariance a n b n ~ a m b n for m ≠ n Hence contradiction The L cannot be regular.

18 Conclusion Shown how the Myhill Nerode theorem helps in minimizing the number of states in a DFA. How it shows that the language is not regular.

19 References Languages and Machines Thomas A. Sudkamp, Addison Wesley http://en.wikipedia.org/wiki/Myhill%E2%80%9 3Nerode_theoremhttp://en.wikipedia.org/wiki/Myhill%E2%80%9 3Nerode_theorem

20 Thank You


Download ppt "MYHILL NERODE THEOREM By Anusha Tilkam. Myhill Nerode Theorem: The following three statements are equivalent 1.The set L є ∑* is accepted by a FSA 2.L."

Similar presentations


Ads by Google