Documentation

Linglib.Core.Computability.SyntacticSemigroup

The syntactic semigroup of a language #

The syntactic semigroup of a language L is the quotient of the free semigroup, whose elements are the nonempty words, by the syntactic congruence of L restricted to those words. It embeds in the syntactic monoid, which adds to it at most the class of the empty word.

The definite, reverse definite and locally trivial pseudovarieties consist of semigroups, and their languages are read off the syntactic semigroup. A monoid satisfying the defining condition of any of the three is trivial, because the condition applies to the idempotent 1.

Main definitions #

Main results #

Implementation notes #

A homomorphism η out of the free semigroup recognizes L when its extension FreeMonoid.mapWithOne η to the free monoid does, so that the kernel characterization follows from the one for monoids. Language.recognizesSemigroup_iff restates the condition on nonempty words.

References #

The syntactic congruence and semigroup #

def Language.syntacticSemigroupCon {α : Type u_1} (L : Language α) :
Con (FreeSemigroup α)

The syntactic congruence of L identifies two nonempty words when no two-sided context distinguishes them as L-members.

Equations
Instances For
    @[reducible, inline]
    abbrev Language.SyntacticSemigroup {α : Type u_1} (L : Language α) :
    Type u_1

    The syntactic semigroup of L is the quotient of FreeSemigroup α by the syntactic congruence.

    Equations
    Instances For
      def Language.toSyntacticSemigroup {α : Type u_1} (L : Language α) :
      FreeSemigroup α →ₙ* L.SyntacticSemigroup

      The syntactic morphism of L projects FreeSemigroup α onto the syntactic semigroup.

      Equations
      Instances For
        theorem Language.toSyntacticSemigroup_eq_iff {α : Type u_1} {L : Language α} {u v : FreeSemigroup α} :
        theorem Language.toSyntacticSemigroup_surjective {α : Type u_1} (L : Language α) :
        Function.Surjective ⇑L.toSyntacticSemigroup

        Relation to the syntactic monoid #

        def Language.syntacticSemigroupToMonoid {α : Type u_1} (L : Language α) :

        The embedding of the syntactic semigroup into the syntactic monoid sends the class of a nonempty word to its class in the monoid.

        Equations
        Instances For
          @[simp]
          theorem Language.syntacticSemigroupToMonoid_apply {α : Type u_1} (L : Language α) (u : FreeSemigroup α) :
          L.syntacticSemigroupToMonoid (L.toSyntacticSemigroup u) = L.toSyntacticMonoid (FreeSemigroup.toFreeMonoid u)
          theorem Language.syntacticSemigroupToMonoid_mk {α : Type u_1} (L : Language α) (a : α) (l : List α) :
          L.syntacticSemigroupToMonoid (L.toSyntacticSemigroup { head := a, tail := l }) = L.syntacticClass (a :: l)
          theorem Language.syntacticSemigroupToMonoid_injective {α : Type u_1} (L : Language α) :
          Function.Injective ⇑L.syntacticSemigroupToMonoid
          theorem Language.eq_one_or_mem_range_syntacticSemigroupToMonoid {α : Type u_1} (L : Language α) (s : L.SyntacticMonoid) :
          s = 1 ∨ s ∈ Set.range ⇑L.syntacticSemigroupToMonoid

          Every element of the syntactic monoid is the class of the empty word or the image of an element of the syntactic semigroup.

          Myhill–Nerode #

          theorem Language.IsRegular.finite_syntacticSemigroup {α : Type u_1} {L : Language α} (h : L.IsRegular) :
          theorem Language.IsRegular.of_finite_syntacticSemigroup {α : Type u_1} {L : Language α} (h : Finite L.SyntacticSemigroup) :
          L.IsRegular
          theorem Language.isRegular_iff_finite_syntacticSemigroup {α : Type u_1} {L : Language α} :
          L.IsRegular ↔ Finite L.SyntacticSemigroup

          A language is regular exactly when its syntactic semigroup is finite.

          Boolean combinations #

          Quotients #

          theorem Language.syntacticSemigroupCon_le_leftQuotient {α : Type u_1} (L : Language α) (u : List α) :
          theorem Language.syntacticSemigroupCon_congr {α : Type u_1} {L L' : Language α} (h : ∀ (w : List α), w ≠ [] → (w ∈ L ↔ w ∈ L')) :

          The syntactic congruence on nonempty words depends on L only through its nonempty words.

          theorem Language.syntacticSemigroupCon_insert_nil {α : Type u_1} {L : Language α} :

          Adjoining the empty word leaves the syntactic congruence unchanged, since the congruence quantifies only over nonempty words.

          Recognition by a semigroup #

          def Language.RecognizesSemigroup {α : Type u_1} {T : Type u_2} [Semigroup T] (η : FreeSemigroup α →ₙ* T) (L : Language α) :

          η recognizes L when its unitization FreeMonoid.mapWithOne η recognizes L. Equivalently, membership of a nonempty word in L is decided by its η-image (recognizesSemigroup_iff).

          Equations
          Instances For
            theorem Language.recognizesSemigroup_iff {α : Type u_1} {L : Language α} {T : Type u_2} [Semigroup T] {η : FreeSemigroup α →ₙ* T} :
            RecognizesSemigroup η L ↔ ∃ (P : Set T), ∀ (w : FreeSemigroup α), FreeMonoid.toList (FreeSemigroup.toFreeMonoid w) ∈ L ↔ η w ∈ P
            theorem Language.RecognizesSemigroup.comap {α : Type u_1} {L : Language α} {T : Type u_2} [Semigroup T] {η : FreeSemigroup α →ₙ* T} {β : Type u_3} (hrec : RecognizesSemigroup η L) (ψ : FreeSemigroup β →ₙ* FreeSemigroup α) :
            RecognizesSemigroup (η.comp ψ) {w : List β | ∃ (u : FreeSemigroup β), FreeMonoid.toList (FreeSemigroup.toFreeMonoid u) = w ∧ FreeMonoid.toList (FreeSemigroup.toFreeMonoid (ψ u)) ∈ L}

            If η recognizes L, then η.comp ψ recognizes the inverse image of L under ψ.

            theorem Language.ker_le_syntacticSemigroupCon_of_recognizes {α : Type u_1} {L : Language α} {T : Type u_2} [Semigroup T] {η : FreeSemigroup α →ₙ* T} (hrec : RecognizesSemigroup η L) :
            Con.ker η ≤ L.syntacticSemigroupCon
            theorem Language.recognizesSemigroup_of_ker_le {α : Type u_1} {L : Language α} {T : Type u_2} [Semigroup T] {η : FreeSemigroup α →ₙ* T} (h : Con.ker η ≤ L.syntacticSemigroupCon) :
            theorem Language.recognizesSemigroup_iff_ker_le {α : Type u_1} {L : Language α} {T : Type u_2} [Semigroup T] {η : FreeSemigroup α →ₙ* T} :
            RecognizesSemigroup η L ↔ Con.ker η ≤ L.syntacticSemigroupCon