Documentation

Mathlib.Computability.MyhillNerode

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 #

def Language.leftQuotient {α : Type u} (L : Language α) (x : List α) :

The left quotient of x is the set of suffixes y such that x ++ y is in L.

Equations
Instances For
    @[simp]
    theorem Language.leftQuotient_nil {α : Type u} (L : Language α) :
    theorem Language.leftQuotient_append {α : Type u} (L : Language α) (x y : List α) :
    @[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 α) :
    def Language.toDFA {α : Type u} (L : Language α) :

    The left quotients of a language are the states of an automaton that accepts the language.

    Equations
    Instances For
      @[simp]
      theorem Language.mem_accept_toDFA {α : Type u} {L : Language α} (s : (Set.range L.leftQuotient)) :
      @[simp]
      theorem Language.step_toDFA {α : Type u} {L : Language α} (s : (Set.range L.leftQuotient)) (a : α) :
      (L.toDFA.step s a) = (↑s).leftQuotient [a]
      @[simp]
      theorem Language.start_toDFA {α : Type u} (L : Language α) :
      L.toDFA.start = L
      @[simp]
      theorem Language.accepts_toDFA {α : Type u} (L : Language α) :

      Myhill–Nerode theorem. A language is regular if and only if the set of left quotients is finite.