20
MYHILL NERODE THEOREM By Anusha Tilkam

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

Embed Size (px)

Citation preview

Page 1: 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

MYHILL NERODE THEOREM

By Anusha Tilkam

Page 2: 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

Myhill Nerode Theorem: The following three statements are equivalent

1. The set L є ∑* is accepted by a FSA2. L is the union of some of the equivalence classes of

a right invariant equivalence relation of finite index.3. Let equivalence relation RL be defined by :

xRLy iff for all z in ∑* xz is in L exactly when yz is in L. Then RL is of finite index.

Page 3: 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

Theorem Proof:

•There are three conditions:

1. Condition (i) implies condition (ii)2. Condition (ii) implies condition (iii)3. Condition (iii) implies condition (i)

Page 4: 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

Equivalence Relation

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

Page 5: 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

Condition (i) implies condition (ii)

Proof: Let L be a regular language accepted by a DFSAM = (Q,∑,δ,q0,F).

Define RM on ∑*

x RM y if δ(q0 , x) = δ(q0 , y)

In order to show that its an equivalence relation it has to satisfy three properties.

Page 6: 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

•δ(q0 , x) = δ(q0 , x) --- Reflexive

•If δ(q0 , x) = δ(q0 , y) then

δ(q0 , y) = δ(q0 , x) --- Symmetry

•If δ(q0 , x) = δ(q0 , y)

δ(q0 , y) = δ(q0 , z) then

δ(q0 , x) = δ(q0 , z) --- Transitive

Page 7: 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

• Index of an Equivalence relation: There are N states

If This RM is an Equivalence Relation, Then the index of RM is at most the number of States of M

q0 q1 q2

qn-

1

Page 8: 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

•Right invariant

If x RM y

Then xz RM yz for any z є ∑*

Then we say RM is Right invariant

Proof: δ(q0 , x) = δ(q0 , y)

δ(q0 , xz) = δ( δ(q0 , x), z )

= δ( δ(q0 , y), z )

= δ(q0 , yz)

Therefore RM is right invariant

Page 9: 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

•L is the union of sum of the equivalence classes of that relation.

If the Equivalence Relation RM has n states.

S0 , S1 , S2, ……, Si ,…….. , Sn-1

| | | | | q0 , q1 , q2 ,….., qi ,…..…, qn-1

Page 10: 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

•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 RL.

What is Refinement?

Page 11: 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

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 RL y

Hence it is proved that every equivalence class in E is an Equivalence class in RL

Then we can say that E is a Refinement of RL

E is of finite index

Index of RL <= index of E

therefore RL is of Finite index.

Page 12: 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

•Example : DFA

L ={ w | w contains a stings having atleast one a ,no sequence of b}

∑* is partioned into three equivalence class J0,J1,J2

q0 q1q2

b

b

a

a

b

a

Page 13: 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

J0 – strings which do not contain an a

J1 – strings which contain odd number of a’s

J2 - strings which contain even number of a’s

L = J1 U J2

J0 J1 J2

є a aa

b ba aba

bb babaa babab

…… so on ……so on ……..so on

Page 14: 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

• Condition (iii) implies condition (i)

Proof:

RL is right invariant x RL y if xz є L yz є L Therefore if z = wz then xwz є L ywz є L for any w and z Then xwz RL ywz

Hence RL is Right invariant

Define an FSA M’ = (Q’, ∑,δ’,q0 ’ ,F’) as follows:For each equivalence class of RL ,we have a state in Q’.|Q’| = index of RL

Page 15: 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

• If x є ∑* denote the Equivalence class of RL to which x є to [x]

q0’ = [є] belongs to initial state / one equivalence class.

For symbol a є ∑ δ’([x],a) = [xa]This definition is consistent because RL is right invariant.

If xRL 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.

Page 16: 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

•Example :

J0 and J1 U J2 are the two equivalence

classes in RL

J0J1 , J2

ba,b

a

Page 17: 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

To show that a given language is not Regular:

• L = {anbn |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 etca, aa,aaa,aaaa,…….. Each of this cannot be in different equivalence classes.

an ~ am for m ≠ nBy Right invariance

anbn ~ am bn for m ≠ n

Hence contradiction The L cannot be regular.

Page 18: 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

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.

Page 19: 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

References•Languages and Machines

Thomas A. Sudkamp, Addison Wesley

•http://en.wikipedia.org/wiki/Myhill%E2%80%93Nerode_theorem

Page 20: 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

Thank You