Documentation

CategorialAlgebras.Preliminaries.Equation

Partial term operations and existence equations #

Terms are interpreted at total sorted valuations. An existence equation requires a common defined value; a quasi-existence equation asserts such an equation under a word-indexed family of premises. Specifications determine full categories of models, closed under products. Substitution commutes with evaluation when all assigned terms are defined, and homomorphisms preserve defined term values and existence equations.

Partial evaluation #

def CategorialAlgebras.Term.partialEval {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} (a : SortedSet.Map X A.carrier) {s : S} :
Term sig X s → Part (A.carrier s)

The partial term operation at a total valuation of the generators.

Equations
Instances For
    @[simp]
    theorem CategorialAlgebras.Term.partialEval_var {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} (a : SortedSet.Map X A.carrier) {s : S} (t : X s) :
    partialEval a (var t) = Part.some (a s t)

    Variables are always defined and take their assigned values.

    @[simp]
    theorem CategorialAlgebras.Term.partialEval_app {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} (a : SortedSet.Map X A.carrier) {b : List S} {s : S} (σ : sig b s) (t : Word.Family (Term sig X) b) :
    partialEval a (app σ t) = (partFamily fun (j : Fin b.length) => partialEval a (t j)).bind (A.op σ)

    Evaluation first evaluates every argument and then applies the basic partial operation.

    theorem CategorialAlgebras.Term.mem_partialEval_app {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} (a : SortedSet.Map X A.carrier) {b : List S} {s : S} (σ : sig b s) (t : Word.Family (Term sig X) b) (q : A.carrier s) :
    q ∈ partialEval a (app σ t) ↔ ∃ (r : Word.Family A.carrier b), (∀ (j : Fin b.length), r j ∈ partialEval a (t j)) ∧ q ∈ A.op σ r

    A value of an application is obtained from defined argument values and a basic value.

    theorem CategorialAlgebras.Term.partialEval_app_dom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} (a : SortedSet.Map X A.carrier) {b : List S} {s : S} (σ : sig b s) (t : Word.Family (Term sig X) b) :
    (partialEval a (app σ t)).Dom ↔ ∃ (h : ∀ (j : Fin b.length), (partialEval a (t j)).Dom), (A.op σ fun (j : Fin b.length) => (partialEval a (t j)).get ⋯).Dom

    An application is defined exactly when all arguments and the basic operation are defined.

    theorem CategorialAlgebras.Term.partialEval_hom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {B : PartialAlgebra sig} (h : A.Hom B) (a : SortedSet.Map X A.carrier) {s : S} (t : Term sig X s) {q : A.carrier s} (hq : q ∈ partialEval a t) :
    h.toMap s q ∈ partialEval (fun (s : S) (x : X s) => h.toMap s (a s x)) t

    Homomorphisms preserve defined term values at the composed total valuation.

    theorem CategorialAlgebras.Term.partialEval_hom_dom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {B : PartialAlgebra sig} (h : A.Hom B) (a : SortedSet.Map X A.carrier) {s : S} (t : Term sig X s) (ht : (partialEval a t).Dom) :
    (partialEval (fun (s : S) (x : X s) => h.toMap s (a s x)) t).Dom

    A homomorphism preserves the domain of every term operation.

    theorem CategorialAlgebras.Term.partialEval_hom_get {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {B : PartialAlgebra sig} (h : A.Hom B) (a : SortedSet.Map X A.carrier) {s : S} (t : Term sig X s) (ht : (partialEval a t).Dom) :
    (partialEval (fun (s : S) (x : X s) => h.toMap s (a s x)) t).get ⋯ = h.toMap s ((partialEval a t).get ht)

    On defined terms, evaluation commutes with the underlying mapping of a homomorphism.

    theorem CategorialAlgebras.Term.partialEval_subst_of_mem {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map Y (Term sig X)) (a : SortedSet.Map X A.carrier) (b : SortedSet.Map Y A.carrier) (hf : ∀ (s : S) (t : Y s), b s t ∈ partialEval a (f s t)) {s : S} (t : Term sig Y s) :

    Substitution commutes with evaluation at a valuation realizing every assigned term.

    def CategorialAlgebras.Term.substitutionValuation {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map Y (Term sig X)) (a : SortedSet.Map X A.carrier) (hf : ∀ (s : S) (t : Y s), (partialEval a (f s t)).Dom) :

    The total valuation obtained by evaluating an everywhere defined assignment of terms.

    Equations
    Instances For
      theorem CategorialAlgebras.Term.partialEval_subst {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map Y (Term sig X)) (a : SortedSet.Map X A.carrier) (hf : ∀ (s : S) (t : Y s), (partialEval a (f s t)).Dom) {s : S} (t : Term sig Y s) :

      Equality of partial values gives both the domain and value laws for substitution.

      theorem CategorialAlgebras.Term.partialEval_subst_dom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map Y (Term sig X)) (a : SortedSet.Map X A.carrier) (hf : ∀ (s : S) (t : Y s), (partialEval a (f s t)).Dom) {s : S} (t : Term sig Y s) :

      The domain law for substitution into a term at an everywhere defined assignment.

      Evaluation in products #

      theorem CategorialAlgebras.Term.mem_partialEval_product {S : Type u} {sig : Signature S} {X : S → Type x} {I : Type i} (A : I → PartialAlgebra sig) (a : SortedSet.Map X (PartialAlgebra.product A).carrier) {s : S} (t : Term sig X s) (q : (PartialAlgebra.product A).carrier s) :
      q ∈ partialEval a t ↔ ∀ (i : I), q i ∈ partialEval (fun (s : S) (x : X s) => a s x i) t

      Defined term values in a product are exactly the families of component term values.

      theorem CategorialAlgebras.Term.partialEval_product {S : Type u} {sig : Signature S} {X : S → Type x} {I : Type i} (A : I → PartialAlgebra sig) (a : SortedSet.Map X (PartialAlgebra.product A).carrier) {s : S} (t : Term sig X s) :
      partialEval a t = partFamily fun (i : I) => partialEval (fun (s : S) (x : X s) => a s x i) t

      The partial term operation of a product is the assembled family of term operations.

      Existence equations #

      @[reducible, inline]
      abbrev CategorialAlgebras.EEquation {S : Type u} (sig : Signature S) (X : S → Type x) (s : S) :
      Type (max (max x v) u)

      Existence equations of type $(X,s)$ are pairs of terms of sort $s$.

      Equations
      Instances For
        @[reducible, inline]
        abbrev CategorialAlgebras.EEquationSet {S : Type u} (sig : Signature S) (X : S → Type x) :
        Type (max u (max x v) u)

        A sorted set of existence equations with the common variable context $X$.

        Equations
        Instances For
          def CategorialAlgebras.EEquation.Satisfies {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (a : SortedSet.Map X A.carrier) {s : S} (e : EEquation sig X s) :

          An equation is satisfied when both sides have a common defined value.

          Equations
          Instances For
            def CategorialAlgebras.EEquation.Valid {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) {s : S} (e : EEquation sig X s) :

            Validity quantifies over all total valuations of $X$.

            Equations
            Instances For
              @[simp]
              theorem CategorialAlgebras.EEquation.satisfies_self {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (a : SortedSet.Map X A.carrier) {s : S} (t : Term sig X s) :

              An equation $P \overset{e}{=} P$ holds exactly when $P$ is defined.

              theorem CategorialAlgebras.EEquation.satisfies_iff {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (a : SortedSet.Map X A.carrier) {s : S} (e : EEquation sig X s) :
              Satisfies A a e ↔ ∃ (hp : (Term.partialEval a e.1).Dom) (hq : (Term.partialEval a e.2).Dom), (Term.partialEval a e.1).get hp = (Term.partialEval a e.2).get hq

              Satisfaction explicitly requires definedness of both sides and equality of their values.

              def CategorialAlgebras.EEquation.subst {S : Type u} {sig : Signature S} {X : S → Type x} {Y : S → Type y} (f : SortedSet.Map X (Term sig Y)) {s : S} (e : EEquation sig X s) :
              EEquation sig Y s

              Substitute on both sides of an existence equation.

              Equations
              Instances For
                theorem CategorialAlgebras.EEquation.satisfies_subst {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map X (Term sig Y)) (a : SortedSet.Map Y A.carrier) (hf : ∀ (s : S) (t : X s), (Term.partialEval a (f s t)).Dom) {s : S} (e : EEquation sig X s) :

                Substitution preserves and reflects satisfaction when its assigned terms are defined.

                theorem CategorialAlgebras.EEquation.satisfies_hom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {B : PartialAlgebra sig} (h : A.Hom B) (a : SortedSet.Map X A.carrier) {s : S} (e : EEquation sig X s) (he : Satisfies A a e) :
                Satisfies B (fun (s : S) (x : X s) => h.toMap s (a s x)) e

                Homomorphisms preserve existence equations at composed valuations.

                theorem CategorialAlgebras.EEquation.satisfies_product_iff {S : Type u} {sig : Signature S} {X : S → Type x} {I : Type i} (A : I → PartialAlgebra sig) (a : SortedSet.Map X (PartialAlgebra.product A).carrier) {s : S} (e : EEquation sig X s) :
                Satisfies (PartialAlgebra.product A) a e ↔ ∀ (i : I), Satisfies (A i) (fun (s : S) (x : X s) => a s x i) e

                An existence equation holds in a product exactly when it holds at each projection.

                def CategorialAlgebras.EEquation.IsSortwiseFinitary {S : Type u} {sig : Signature S} {X : S → Type x} {s : S} (_e : EEquation sig X s) :

                An equation is sortwise finitary when each sort has finitely many variables.

                Equations
                Instances For
                  def CategorialAlgebras.EEquation.IsFinitary {S : Type u} {sig : Signature S} {X : S → Type x} {s : S} (_e : EEquation sig X s) :

                  An equation is finitary when the disjoint union of its variable sorts is finite.

                  Equations
                  Instances For
                    def CategorialAlgebras.EEquationSet.Satisfies {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (a : SortedSet.Map X A.carrier) (E : EEquationSet sig X) :

                    A valuation satisfies a sorted set of equations component by component.

                    Equations
                    Instances For
                      def CategorialAlgebras.EEquationSet.Valid {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (E : EEquationSet sig X) :

                      Every equation of a sorted set holds at every total valuation.

                      Equations
                      Instances For
                        def CategorialAlgebras.EEquationSet.subst {S : Type u} {sig : Signature S} {X : S → Type x} {Y : S → Type y} (f : SortedSet.Map X (Term sig Y)) (E : EEquationSet sig X) :

                        The componentwise image $f^\sharp[E]$ of a sorted set of equations.

                        Equations
                        Instances For
                          theorem CategorialAlgebras.EEquationSet.satisfies_subst {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {Y : S → Type y} (f : SortedSet.Map X (Term sig Y)) (a : SortedSet.Map Y A.carrier) (hf : ∀ (s : S) (t : X s), (Term.partialEval a (f s t)).Dom) (E : EEquationSet sig X) :

                          Substitution of a set of equations obeys the evaluation law at defined assignments.

                          theorem CategorialAlgebras.EEquationSet.satisfies_hom {S : Type u} {sig : Signature S} {X : S → Type x} {A : PartialAlgebra sig} {B : PartialAlgebra sig} (h : A.Hom B) (a : SortedSet.Map X A.carrier) (E : EEquationSet sig X) (he : Satisfies A a E) :
                          Satisfies B (fun (s : S) (x : X s) => h.toMap s (a s x)) E

                          Homomorphisms preserve satisfaction of sorted sets of existence equations.

                          def CategorialAlgebras.EEquationSet.translateWord {S : Type u} {sig : Signature S} {T : Type u'} {tau : Signature T} (c : Derivor sig tau) (a : List S) (E : EEquationSet sig (Word.Variables a)) :

                          Derivor image of positional equations, including the union over source sorts mapping into each target sort. Distinct source sorts may have the same image.

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

                            Quasi-existence equations #

                            structure CategorialAlgebras.QEEquation {S : Type u} (sig : Signature S) (X : S → Type x) (a : List S) (s : S) :
                            Type (max (max u v) x)

                            A quasi-existence equation with one premise for each letter of a word.

                            Instances For
                              @[reducible, inline]
                              abbrev CategorialAlgebras.QEEquationSet {S : Type u} (sig : Signature S) (X : S → Type x) :
                              Type (max u (max x v) u)

                              The $(S^\star \times S)$-sorted set of quasi-existence equations.

                              Equations
                              Instances For
                                def CategorialAlgebras.QEEquation.Satisfies {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) (a : SortedSet.Map X A.carrier) {b : List S} {s : S} (e : QEEquation sig X b s) :

                                Satisfaction of all premises implies satisfaction of the conclusion.

                                Equations
                                Instances For
                                  def CategorialAlgebras.QEEquation.Valid {S : Type u} {sig : Signature S} {X : S → Type x} (A : PartialAlgebra sig) {b : List S} {s : S} (e : QEEquation sig X b s) :

                                  A quasi-existence equation holds at every total valuation.

                                  Equations
                                  Instances For
                                    def CategorialAlgebras.QEEquation.IsSortwiseFinitary {S : Type u} {sig : Signature S} {X : S → Type x} {b : List S} {s : S} (_e : QEEquation sig X b s) :

                                    Sortwise finitariness means finitely many variables in each sort.

                                    Equations
                                    Instances For
                                      def CategorialAlgebras.QEEquation.IsFinitary {S : Type u} {sig : Signature S} {X : S → Type x} {b : List S} {s : S} (_e : QEEquation sig X b s) :

                                      Finitariness means finitely many variables in total.

                                      Equations
                                      Instances For
                                        theorem CategorialAlgebras.QEEquation.valid_product {S : Type u} {sig : Signature S} {X : S → Type x} {I : Type i} (A : I → PartialAlgebra sig) {b : List S} {s : S} (e : QEEquation sig X b s) (h : ∀ (i : I), Valid (A i) e) :

                                        Quasi-existence validity is preserved by arbitrary products, including empty products.

                                        Specifications, models and varieties #

                                        structure CategorialAlgebras.QESpecification {S : Type u} (sig : Signature S) :
                                        Type (max (max u v) (x + 1))

                                        A quasi-existence specification over a fixed signature, with a total variable context.

                                        • vars : S → Type x

                                          The common sorted variable context.

                                        • equations : QEEquationSet sig self.vars

                                          The sorted set of quasi-existence axioms.

                                        Instances For

                                          An algebra is a model when every specified equation is valid.

                                          Equations
                                          Instances For
                                            @[reducible, inline]
                                            abbrev CategorialAlgebras.QESpecification.Models {S : Type u} {sig : Signature S} (E : QESpecification sig) :
                                            Type (max (max u v) (w + 1))

                                            Models and all partial algebra homomorphisms between them form a full subcategory.

                                            Equations
                                            Instances For

                                              The fully faithful inclusion of models into partial algebras.

                                              Equations
                                              Instances For

                                                A specification is finitary if each of its equations is finitary.

                                                Equations
                                                Instances For

                                                  A specification is sortwise finitary if every axiom has finitely many variables per sort.

                                                  Equations
                                                  Instances For
                                                    theorem CategorialAlgebras.QESpecification.isModel_product {S : Type u} {sig : Signature S} (E : QESpecification sig) {I : Type i} (A : I → PartialAlgebra sig) (h : ∀ (i : I), E.IsModel (A i)) :

                                                    Products of models are models.

                                                    A quasi-existence variety is the class of models of some specification. The universe of the variable context is fixed by the universe parameter x.

                                                    Equations
                                                    Instances For

                                                      A finitary quasi-existence variety admits a specification by finitary equations.

                                                      Equations
                                                      Instances For

                                                        Every finitary quasi-existence variety is a quasi-existence variety.

                                                        theorem CategorialAlgebras.IsQEVariety.product_mem {S : Type u} {sig : Signature S} {K : Set (PartialAlgebra sig)} (hK : IsQEVariety K) {I : Type w} (A : I → PartialAlgebra sig) (h : ∀ (i : I), A i ∈ K) :

                                                        Every quasi-existence variety is closed under products.