The syntactic monoid of a language #
The syntactic monoid of a language L : Language α is the quotient of the free monoid
FreeMonoid α by the syntactic congruence: two words are identified when no two-sided context
distinguishes them as L-members, ∀ x y, x ++ u ++ y ∈ L ↔ x ++ v ++ y ∈ L.
The syntactic congruence is defined directly as this two-sided context equivalence, and identified
with the kernel of the minimal DFA's transition action (the transition monoid of L.toDFA, see
Linglib.Core.Computability.TransitionMonoid) via Language.syntacticCon_eq_ker_transitionHom.
This is the two-sided refinement of Mathlib.Computability.MyhillNerode, which builds the one-sided
right-Nerode quotient (Language.leftQuotient) and proves regularity ↔ finitely many left
quotients. It carries a monoid structure rather than just a set of states, and its Myhill–Nerode
theorem reads L.IsRegular ↔ Finite L.syntacticMonoid.
Main definitions #
Language.syntacticCon L : Con (FreeMonoid α): the syntactic congruence (two-sided context equivalence).Language.syntacticMonoid L: the quotient monoid(syntacticCon L).Quotient.Language.toSyntacticMonoid L: the projectionFreeMonoid α →* L.syntacticMonoid.Language.syntacticClass L w: the syntactic class of a wordw : List α.Language.Recognizes φ L:φrecognizesL, i.e.Lis a union ofφ-fibres.
Main results #
Language.syntacticClass_eq_iff: two words share a syntactic class iff no two-sided context distinguishes them,∀ x y, x ++ u ++ y ∈ L ↔ x ++ v ++ y ∈ L.Language.syntacticCon_eq_ker_transitionHom: the intrinsic congruence is the kernel of the transition action ofL.toDFA.Language.ker_le_syntacticCon_of_recognizes: the syntactic congruence is the coarsest congruence recognizingL, so every recognizing hom factors throughtoSyntacticMonoidviaCon.lift.Language.isRegular_iff_finite_syntacticMonoid: the Myhill–Nerode theorem in monoid form.
The syntactic congruence and monoid #
The syntactic congruence of L: two words are congruent when no two-sided context
distinguishes them as L-members.
Equations
- L.syntacticCon = { r := fun (u v : FreeMonoid α) => ∀ (x y : List α), x ++ FreeMonoid.toList u ++ y ∈ L ↔ x ++ FreeMonoid.toList v ++ y ∈ L, iseqv := ⋯, mul' := ⋯ }
Instances For
The syntactic congruence is two-sided context equivalence — by definition.
Words congruent under the syntactic congruence agree on membership of L: L is saturated by
syntacticCon L (take the empty two-sided context).
The syntactic monoid of L: the quotient of FreeMonoid α by the syntactic congruence.
Equations
- L.syntacticMonoid = L.syntacticCon.Quotient
Instances For
Equations
- One or more equations did not get rendered due to their size.
The canonical projection sending each word to its syntactic class; the underlying Con.mk'.
Equations
- L.toSyntacticMonoid = L.syntacticCon.mk'
Instances For
The syntactic projection identifies two words iff they are syntactically congruent.
The syntactic class of a word #
The syntactic class of a word w: its image in the syntactic monoid (the literature's
η(w), applied to a List α rather than a bundled FreeMonoid α).
Equations
- L.syntacticClass w = L.toSyntacticMonoid (FreeMonoid.ofList w)
Instances For
Word-level form of syntacticCon_iff: two words share a syntactic class iff no two-sided
context distinguishes them as L-members.
L is saturated by syntactic class: equal class implies equal membership.
Reverse duality: a syntactic-class equality in L.reverse is the same as the
reversed-word equality in L. The syntactic monoid of L.reverse is L's, opposite.
Universal property #
φ recognizes L when L is a union of φ-fibres, i.e. L = φ ⁻¹' S for some
S ⊆ M.
Equations
- Language.Recognizes φ L = ∃ (S : Set M), L = ⇑φ ⁻¹' S
Instances For
An L-recognizing hom's kernel lies below syntacticCon L, the coarsest such congruence.
Conversely, any hom whose kernel refines syntacticCon L recognizes L
(witness S = φ '' L).
Universal property of the syntactic monoid: a hom recognizes L exactly when its
kernel refines the syntactic congruence — syntacticCon L is the coarsest L-recognizing
congruence, so every recognizer factors through toSyntacticMonoid.
The syntactic morphism is itself an L-recognizer (the canonical one).
Connection to the minimal DFA #
Evaluating the minimal DFA L.toDFA from a quotient state s along w lands on the left
quotient of s by w.
The intrinsic syntactic congruence is the kernel of the minimal DFA's transition action — the two-sided context definition agrees with the transition-monoid quotient.
Regularity implies a finite syntactic monoid #
A regular language has a finite syntactic monoid (forward Myhill–Nerode).
A finite syntactic monoid implies regularity #
A language with finite syntactic monoid is regular (reverse Myhill–Nerode). The left-quotient map factors through the syntactic monoid, so a finite quotient forces finitely many left quotients.
Myhill–Nerode (syntactic-monoid form): L is regular iff L.syntacticMonoid is finite.
Complement- and intersection-invariance #
Generic syntactic-monoid facts about boolean combinations, used by any class defined through the
syntactic monoid (e.g. Language.IsStarFree, and Monoid.Pseudovariety.langs in general).
The syntactic congruence is complement-invariant: a two-sided context distinguishes u from
v for L exactly when it does for Lᶜ.
The syntactic monoid is complement-invariant.
The meet of the two syntactic congruences refines that of the intersection: if no L-context
and no M-context distinguishes u from v, then no (L ⊓ M)-context does either.
The kernel of the pairing of the two syntactic morphisms is exactly the meet of the two syntactic congruences (a word's class in the product is the pair of its classes).