The syntactic semigroup of a language #
The syntactic semigroup of L : Language α is the quotient of the free semigroup FreeSemigroup α — the nonempty words — by the syntactic congruence: the pullback of Language.syntacticCon
along FreeSemigroup.toFreeMonoid. The two quotients are related by M_A = S_A ∪ {1}
([Eil76]), a union that is disjoint exactly when no nonempty word is equivalent to the
empty one.
It is the primary invariant for varieties: D, K, LI and N are varieties of semigroups,
not of monoids. Over the free monoid they collapse, since the definite condition applied to the
idempotent 1 forces triviality; stating them on FreeSemigroup α is what avoids the collapse.
Main definitions #
Language.syntacticSemigroupCon: the syntactic congruence onFreeSemigroup αLanguage.SyntacticSemigroup: the quotient semigroupLanguage.toSyntacticSemigroup: the projection, as aMulHomLanguage.RecognizesSemigroup: recognition by the unitizationFreeMonoid.mapWithOne
Main results #
Language.syntacticSemigroupToMonoid_injective: the syntactic semigroup embeds in the syntactic monoidLanguage.isRegular_iff_finite_syntacticSemigroup: Myhill–Nerode in semigroup formLanguage.recognizesSemigroup_iff: the pointwise characterization of recognitionLanguage.recognizesSemigroup_iff_ker_le: the syntactic congruence is the coarsest one recognizingLLanguage.syntacticSemigroupCon_insert_nil: the syntactic semigroup does not see the empty word
Implementation notes #
The projection is Con.mkMulHom, mathlib's MulHom-valued quotient map for a Con over a plain
Mul (the monoid-valued Con.mk' would not apply). The word underlying a free-semigroup element
is (FreeSemigroup.toFreeMonoid u).toList; there is no semigroup-level analogue of the preimage
equation defining Language.Recognizes, since FreeSemigroup α omits the empty word, so
recognition is defined through the unitization FreeMonoid.mapWithOne and characterized
pointwise by recognizesSemigroup_iff.
References #
The syntactic congruence and semigroup #
The syntactic congruence of L identifies two nonempty words when no two-sided context
distinguishes them as L-members.
Equations
- L.syntacticSemigroupCon = Con.comap ⇑FreeSemigroup.toFreeMonoid ⋯ L.syntacticCon
Instances For
The syntactic semigroup of L is the quotient of FreeSemigroup α by the syntactic
congruence.
Equations
- L.SyntacticSemigroup = L.syntacticSemigroupCon.Quotient
Instances For
The syntactic morphism of L projects FreeSemigroup α onto the syntactic semigroup.
Equations
- L.toSyntacticSemigroup = L.syntacticSemigroupCon.mkMulHom
Instances For
Relation to the syntactic monoid #
The syntactic class of the underlying nonempty word, as a homomorphism on the free semigroup.
Equations
- L.syntacticClassMulHom = (↑L.toSyntacticMonoid).comp FreeSemigroup.toFreeMonoid
Instances For
The syntactic semigroup embeds into the syntactic monoid: a nonempty word is sent to its class in the monoid.
Equations
Instances For
The syntactic monoid is the syntactic semigroup with an identity adjoined: every element is the class of the empty word or the image of one of the semigroup.
A finite syntactic semigroup forces a finite syntactic monoid: WithOne of the semigroup
covers the monoid.
Myhill–Nerode #
L is regular iff L.SyntacticSemigroup is finite.
Boolean combinations #
Quotients #
The syntactic congruence on nonempty words depends on L only through its nonempty words.
Adjoining the empty word leaves the syntactic congruence unchanged, since the congruence quantifies only over nonempty words.
Recognition by a semigroup #
η recognizes L when its unitization FreeMonoid.mapWithOne η recognizes L.
Equivalently, membership of a nonempty word in L is decided by its η-image
(recognizesSemigroup_iff).