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.
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 #
The free algebra on the sorted set $X$.
Equations
- CategorialAlgebras.Term.algebra sig X = { carrier := CategorialAlgebras.Term sig X, op := fun {a : List S} {s : S} => CategorialAlgebras.Term.app }
Instances For
Evaluation with a specified valuation of the generators.
Equations
- CategorialAlgebras.Term.eval f (CategorialAlgebras.Term.var x_3) = f x✝ x_3
- CategorialAlgebras.Term.eval f (CategorialAlgebras.Term.app σ t) = A.op σ fun (j : Fin a.length) => CategorialAlgebras.Term.eval f (t j)
Instances For
Evaluation interprets an operation on the evaluated family of arguments.
The extension $f^\sharp$ of a valuation to a homomorphism.
Equations
- CategorialAlgebras.Term.lift f = { toMap := fun (x : S) => CategorialAlgebras.Term.eval f, map_op := ⋯ }
Instances For
The universal property: every valuation extends to exactly one homomorphism.
Extending the insertion of generators gives the identity.
Extension commutes with postcomposition by a homomorphism.
Renaming the generators of a term.
Equations
- CategorialAlgebras.Term.map f = CategorialAlgebras.Term.lift fun (s : S) (x : X s) => CategorialAlgebras.Term.var (f s x)
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
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.