Myhill-Nerode Theorem #
Let l be a language on an alphabet α. The Nerode congruence (referred to as c_l
in comments below) of a language l is a right congruence on strings where two strings are
related iff all their right extensions are either both in the language or both not in it.
The Myhill-Nerode theorem has three parts [Wik26]:
(1) l is regular iff c_l has a finite number N of equivalence classes.
(2) N is the number of states of the minimal DFA accepting l.
(3) The minimal DFA is unique up to unique isomorphism. That is, for any
minimal DFA accepting l, there exists exactly an isomorphism from it to the
canonical DFA whose states are the equivalence classses of c_l, whose
state transitions are of the form ⟦ x ⟧ → ⟦ x ++ [a] ⟧ (where a : α
and x : List α), whose initial state is ⟦ [] ⟧, and whose accepting states
are { ⟦ x ⟧ | x ∈ l }.
References #
The Nerode congruence (henceforth called c_l) of a language l is a right congruence on
strings where two strings are related iff all their right extensions are either both in the language
or both not in it.
Equations
Instances For
The quotient type of a Nerode congruence.
Equations
Instances For
The Nerode congruence of a language l gives rise to a DFA where each state corresponds to an
equivalence class of the language under the Nerode congruence. Note that this is simply the DFA
given rise to by the underlying right congruence with only the accept states specified here as
{⟦ x ⟧ | x ∈ l}.
Equations
- l.NerodeCongruenceDA = { toDA := Cslib.RightCongruence.toDA, accept := (fun (x : List α) => ⟦x⟧) '' l }
Instances For
The DFA constructed from the Nerode congruence c_l on l accepts l.
The statement (two strings are related by the Nerode congruence c_l on l iff all their right
extensions are either both in the language or both not in it) is equivalent to stating that (all
their right extensions are either both accepted or rejected by the DFA given rise to by c_l.)
If l is regular then the Nerode congruence on l has finitely many equivalence classes.
l is regular iff the Nerode congruence on l has finitely many equivalence classes.
Given a set of strings all distinguishable by l (i.e., not related to each other by the Nerode
congruence on l), the number of states in the DFA accepting l is at least the number of strings
in the set.
All DFAs accepting l must have at least as many states as the number of equivalence classes
of the Nerode congruence on l.
The minimal DFA accepting l has the same number of states as the number of equivalence classes
of the Nerode congruence on l.
Equations
- M.IsMinimalAutomaton l = (Cslib.Automata.Acceptor.language M = l ∧ Nat.card State = Nat.card l.NerodeQuotient)
Instances For
Given a DFA M, two strings are related iff they reach the same state under when run through
M. The Nerode congruence is the state congruence with respect to the minimal DFA accepting l.
Equations
Instances For
The Nerode congruence is the most coarse state congruence given a language.
The minimal DFA M accepting the language l is unique up to unique isomorphism.