MYHILL-NERODE-THEOREM

Download Report

Transcript MYHILL-NERODE-THEOREM

MYHILL NERODE THEOREM

By Anusha Tilkam

Myhill Nerode Theorem:

The following three statements are equivalent 1.

2.

3.

The set L є ∑* is accepted by a FSA L is the union of some of the equivalence classes of a right invariant equivalence relation of finite index.

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.

Theorem Proof:

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

Equivalence Relation

A binary relation over a set X is an equivalence relation if it satisfies • Reflexivity • • Symmetry Transitivity

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.

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

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

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

• 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

• 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?

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 Equivalence class in R L Hence it is proved that every equivalence class in E is an L y 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.

• Example : DFA q 0 b a q 1 b a q 2 b a 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

є

J 0

b bb …… so on a

J 1

ba babaa ……so on

J 2

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

• Condition (iii) implies condition (i) Proof: x R L xwz є L R L is right invariant y if xz є L yz є L Therefore if z = wz then 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 |Q’| = index of R L L ,we have a state in Q’.

• If x є ∑* denote the Equivalence class of R L [x] to which x є to 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.

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

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.

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.

References

Languages and Machines

Thomas A. Sudkamp, Addison Wesley • http://en.wikipedia.org/wiki/Myhill%E2%80%9 3Nerode_theorem

Thank You