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.
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, two-sided context equivalence.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 #
Syntactic equivalence #
Two words are syntactically equivalent for L when no two-sided context distinguishes
them as L-members.
Equations
- L.SyntacticEquiv u v = ∀ (x y : List α), x ++ u ++ y ∈ L ↔ x ++ v ++ y ∈ L
Instances For
The syntactic congruence and monoid #
The syntactic congruence of L identifies two words when no two-sided context distinguishes
them as L-members.
Equations
- L.syntacticCon = { r := fun (u v : FreeMonoid α) => L.SyntacticEquiv (FreeMonoid.toList u) (FreeMonoid.toList v), iseqv := ⋯, mul' := ⋯ }
Instances For
Two words are syntactically congruent exactly when their left quotients agree in every left context.
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
If φ recognizes L, then φ.comp ψ recognizes the inverse image of L under ψ.
The syntactic monoid divides every monoid recognizing L, since the image of φ surjects
onto the syntactic quotient through the first isomorphism theorem.
Connection to the minimal DFA #
A DFA's transition action recognizes the language it accepts.
The kernel of the minimal DFA's transition action has the same left-quotient characterization as the syntactic congruence.
The intrinsic syntactic congruence is the kernel of the minimal DFA's transition action.
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 #
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}