Myhill–Nerode theorem #
This file proves the Myhill–Nerode theorem using left quotients.
Given a language L and a word x, the left quotient of L by x is the set of suffixes y
such that x ++ y is in L. The Myhill–Nerode theorem shows that each left quotient, in fact,
corresponds to the state of an automaton that matches L, and that L is regular if and only if
there are finitely many such states.
References #
The left quotient of x is the set of suffixes y such that x ++ y is in L.
Instances For
@[simp]
theorem
Language.leftQuotient_append
{α : Type u}
(L : Language α)
(x y : List α)
:
L.leftQuotient (x ++ y) = (L.leftQuotient x).leftQuotient y
@[simp]
theorem
Language.mem_leftQuotient
{α : Type u}
{L : Language α}
(x y : List α)
:
y ∈ L.leftQuotient x ↔ x ++ y ∈ L
theorem
Language.leftQuotient_accepts_apply
{α : Type u}
{σ : Type v}
(M : DFA α σ)
(x : List α)
:
M.accepts.leftQuotient x = M.acceptsFrom (M.eval x)
theorem
Language.leftQuotient_accepts
{α : Type u}
{σ : Type v}
(M : DFA α σ)
:
M.accepts.leftQuotient = M.acceptsFrom ∘ M.eval
theorem
Language.IsRegular.finite_range_leftQuotient
{α : Type u}
{L : Language α}
(h : L.IsRegular)
:
The left quotients of a language are the states of an automaton that accepts the language.
Instances For
@[simp]
@[simp]
theorem
Language.step_toDFA
{α : Type u}
{L : Language α}
(s : ↑(Set.range L.leftQuotient))
(a : α)
:
↑(L.toDFA.step s a) = (↑s).leftQuotient [a]
@[simp]
@[simp]
theorem
Language.IsRegular.of_finite_range_leftQuotient
{α : Type u}
{L : Language α}
(h : (Set.range L.leftQuotient).Finite)
:
theorem
Language.isRegular_iff_finite_range_leftQuotient
{α : Type u}
{L : Language α}
:
L.IsRegular ↔ (Set.range L.leftQuotient).Finite
Myhill–Nerode theorem. A language is regular if and only if the set of left quotients is finite.