Documentation

CategorialAlgebras.Preliminaries.Term

Terms and free algebras #

Terms are inductive trees with sorted variables and operation nodes. Recursion evaluates a term in any algebra. The resulting extension is the unique homomorphism on the generators. For the free-forgetful adjunction the carrier universe contains the sort and symbol universes; this ensures that the free algebra remains in the chosen category of algebras.

inductive CategorialAlgebras.Term {S : Type u} (sig : Signature S) (X : S → Type w) :
S → Type (max u v w)

Terms over $\Sigma$ with variables in $X$, indexed by their output sort.

  • var {S : Type u} {sig : Signature S} {X : S → Type w} {s : S} : X s → Term sig X s

    A generator of the specified sort.

  • app {S : Type u} {sig : Signature S} {X : S → Type w} {a : List S} {s : S} : sig a s → Word.Family (Term sig X) a → Term sig X s

    Application of a symbol to a family of terms of its input sorts.

Instances For

    Evaluation and the universal property #

    @[reducible, inline]
    abbrev CategorialAlgebras.Term.algebra {S : Type u} (sig : Signature S) (X : S → Type w) :

    The free algebra on the sorted set $X$.

    Equations
    Instances For
      def CategorialAlgebras.Term.eval {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} (f : SortedSet.Map X A.carrier) {s : S} :
      Term sig X s → A.carrier s

      Evaluation with a specified valuation of the generators.

      Equations
      Instances For
        @[simp]
        theorem CategorialAlgebras.Term.eval_var {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} (f : SortedSet.Map X A.carrier) {s : S} (x : X s) :
        eval f (var x) = f s x

        Evaluation sends a variable to its assigned value.

        @[simp]
        theorem CategorialAlgebras.Term.eval_app {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} (f : SortedSet.Map X A.carrier) {a : List S} {s : S} (σ : sig a s) (t : Word.Family (Term sig X) a) :
        eval f (app σ t) = A.op σ fun (j : Fin a.length) => eval f (t j)

        Evaluation interprets an operation on the evaluated family of arguments.

        def CategorialAlgebras.Term.lift {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} (f : SortedSet.Map X A.carrier) :
        (algebra sig X).Hom A

        The extension $f^\sharp$ of a valuation to a homomorphism.

        Equations
        Instances For
          theorem CategorialAlgebras.Term.hom_ext {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} {f g : (algebra sig X).Hom A} (h : ∀ (s : S) (x : X s), f.toMap s (var x) = g.toMap s (var x)) :
          f = g

          Homomorphisms out of a free algebra are determined by their values on variables.

          theorem CategorialAlgebras.Term.exists_unique_lift {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} (f : SortedSet.Map X A.carrier) :
          ∃! h : (algebra sig X).Hom A, ∀ (s : S) (x : X s), h.toMap s (var x) = f s x

          The universal property: every valuation extends to exactly one homomorphism.

          @[simp]
          theorem CategorialAlgebras.Term.lift_var {S : Type u} {sig : Signature S} {X : S → Type w} :
          (lift fun (s : S) (x : X s) => var x) = Algebra.Hom.id (algebra sig X)

          Extending the insertion of generators gives the identity.

          theorem CategorialAlgebras.Term.lift_comp {S : Type u} {sig : Signature S} {X : S → Type w} {A : Algebra sig} {B : Algebra sig} (f : SortedSet.Map X A.carrier) (g : A.Hom B) :
          (lift fun (s : S) (x : X s) => g.toMap s (f s x)) = (lift f).comp g

          Extension commutes with postcomposition by a homomorphism.

          def CategorialAlgebras.Term.map {S : Type u} {sig : Signature S} {X : S → Type w} {Y : S → Type z} (f : SortedSet.Map X Y) :
          (algebra sig X).Hom (algebra sig Y)

          Renaming the generators of a term.

          Equations
          Instances For

            The free-forgetful adjunction #

            The free algebra functor in a universe containing the sorts and operation symbols.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def CategorialAlgebras.Term.homEquiv {S : Type u} {sig : Signature S} (X : SortedSet S) (A : Algebra sig) :
              (algebra sig X ⟶ A) ≃ (X ⟶ A.carrier)

              The natural equivalence between homomorphisms from a free algebra and valuations.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                The free algebra functor is left adjoint to the forgetful functor.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For