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 Con.syntactic of L: two words are identified when
no two-sided context distinguishes them as L-members, ∀ x y, x ++ u ++ y ∈ L ↔ x ++ v ++ y ∈ L.
It is the coarsest congruence saturating L, so the syntactic morphism factors through every
recognizing homomorphism, and the quotient is finite exactly when L is regular. This is the
two-sided refinement of the one-sided right-Nerode quotient Language.leftQuotient, carrying a
monoid structure rather than a bare set of states.
Main definitions #
Language.syntacticCon: the syntactic congruence ofLas a subset of the free monoid.Language.SyntacticMonoid: the quotient monoid(syntacticCon L).Quotient.Language.toSyntacticMonoid: the projectionFreeMonoid α →* L.SyntacticMonoid.Language.syntacticClass: the syntactic class of a word.Language.Recognizes:φrecognizesLwhenLis a union ofφ-fibres.Language.rightQuotient: the right-quotient dual ofLanguage.leftQuotient.
Main results #
Language.recognizes_iff_ker_le: a homomorphism recognizesLexactly when its kernel refines the syntactic congruence.Language.syntacticMonoidEquivTransitionMonoid: the syntactic monoid is the transition monoid of the minimal DFAL.toDFA.Language.isRegular_iff_finite_syntacticMonoid: a language is regular exactly when its syntactic monoid is finite.
References #
The syntactic congruence and monoid #
The syntactic congruence of L is the syntactic congruence of its words in the free
monoid.
Equations
- L.syntacticCon = Con.syntactic (⇑FreeMonoid.toList ⁻¹' L)
Instances For
The syntactic monoid of L is the quotient of FreeMonoid α by the syntactic congruence.
Equations
- L.SyntacticMonoid = L.syntacticCon.Quotient
Instances For
The syntactic morphism of L projects FreeMonoid α onto the syntactic monoid.
Equations
- L.toSyntacticMonoid = L.syntacticCon.mk'
Instances For
The syntactic class of a word #
The syntactic class of a word w is its image in the syntactic monoid.
Equations
- L.syntacticClass w = L.toSyntacticMonoid (FreeMonoid.ofList w)
Instances For
Universal property #
φ recognizes L when L is the FreeMonoid.ofList-pullback of a union of
φ-fibres.
Equations
- Language.Recognizes φ L = ∃ (S : Set M), L = ⇑FreeMonoid.ofList ⁻¹' ⇑φ ⁻¹' S
Instances For
Connection to the minimal DFA #
The syntactic monoid of L is the transition monoid of its minimal DFA.
Equations
- L.syntacticMonoidEquivTransitionMonoid = (Con.congr (MulEquiv.refl (FreeMonoid α)) ⋯).trans (Con.quotientKerEquivRange L.toDFA.transitionHom)
Instances For
Myhill–Nerode #
L is regular iff L.SyntacticMonoid is finite.
Boolean combinations #
The syntactic monoid of L is trivial exactly when L is empty or full.
Quotients #
The right quotient of L by u is the set of prefixes w such that w ++ u is in L.
Equations
- L.rightQuotient u = {w : List α | w ++ u ∈ L}