You are on page 1of 11

MYHILL-NERODE Theorem

Given a language L, any two strings x and y are in the


same class iI Ior all possible strings z either both xz and yz
are in L or both not. these classes are equivalent classes.
1. L divides the set oI all possible strings into separate
(mutually exclusive) classes.
2. II L is regular, the number oI classes L creates is Iinite.
3. II the number oI classes L creates is Iinite, L is regular.
MYHILL-NERODE Theorem: Example
We may use MYHILL-NERODE theorem to prove a
language is regular or is not regular.
Example: 0*10*
three equivalent classes c
1
0*, c
2
0*10*, and c
3

0*10*1(01)*
Example: a
n
b
n
it creates inIinite number oI classes: c, a, aa, aaa, ..,
Minimum State automaton
The minimum state automaton accepting a language L is
unique. The number oI states oI the minimum state
automaton is the number equivalent classes created by L.
Example: 0*10*
the minimum FA Ior this language has three states each
Ior an equivalent class.
c
1
c
2 c
3
0
1
0
1
0, 1
Minimization Algorithm
For a given DFA, two states p and q are equivalent iI and
only iI Ior each input string x, o(p, x) is an accepting state
iI and only iI o(q, x) is an accepting state.
Remove all states that are not accessible Irom the initial
state. The result is the minimum state Iinite automaton.
Find all equivalent states.
Equivalent states are combined into one state.
Find Equivalent States
For p in F and q in Q-F do mark (p, q)
Ior each pair oI distinct states (p, q) in F F or (Q-F) (Q-F) do
iI Ior some input symbol a, (o(p, a), o(q, a)) is marked then
mark (p, q);
recursively mark all unmarked pairs on the list Ior (p, q) and on
the lists oI other pairs that are marked at this step.
else
Ior all input symbols do
iI (o(p, a) = o(q, a)
put (p, q) on the list Ior (o(p, a), o(q, a))
All unmarked pairs oI states are equivalent states.
Equivalent States
The Iind equivalent state algorithm Iinds all equivalent
states.
The equivalent states Iound by the algorithm are
equivalent.
Equivalence oI states is transitive. Namely, iI p is
equivalent to q and q is equivalent to r, then p is equivalent
to r.
Equivalence oI states partitions all states into disjoint sets.
Decidability
A problem is decidable iI there exists an algorithm to
determine the answer oI the problem within a given
number oI steps.
A problem is undecidable iI there is no such an algorithm.
Decidable Problems for Regular Languages
II a regular language is empty
II a regular language is Iinite
II a regular language is inIinite
Equivalence oI two regular languages
Emptiness, Finiteness, and Infiniteness
The language accepted by an DFA M with n states is
nonempty iI and only iI the DFA accepts a string oI
length less than n.
inIinite iI and only iI the DFA accepts some string oI
length l, where n s l 2n.
There is an algorithm to check iI all strings w with ,w, n
belong to a regular language.
There is an algorithm to check iI all strings w with n
,w, 2n belong to a regular language.
Equivalence
There is an algorithm to determine iI two regular languages
are equivalent.
Assume that two languages are represented as regular
expressions.
L
1
and L
2
are equivalent iI and only iI
is empty. is a regular language and
there is an algorithm to determine its emptiness.
)
2 1
( )
2 1
(
)
2 1
( )
2 1
(
Equivalence
Assume that two languages are represented as the
minimum DFAs, M1 and M2.
Imagine a new DFA M which includes all states and
transitions oI M1 and M2.
Apply the Iind equivalent state algorithm to determine iI
the two start states oI M1 and M2 are equivalent or not.
II they are equivalent, then the two languages are
equivalent. Otherwise, they are not equivalent.

You might also like