Documentation

CategorialAlgebras.Heterogeneous.Evaluation

Evaluation in the heterogeneous signature #

Unary and binary applications reduce to their arguments and basic partial operations. These formulas make the domain specification and the contextual equations independent of positional casts, and apply to carriers which need not be inhabited.

Basic evaluation formulas #

@[simp]
theorem CategorialAlgebras.Heterogeneous.partFamily_some {J : Type x} {A : J → Type w} (x : (j : J) → A j) :
(partFamily fun (j : J) => Part.some (x j)) = Part.some x

A family of defined values assembles to its defined function.

def CategorialAlgebras.Heterogeneous.single {S : Type u} {A : S → Type w} {s : S} (x : A s) :

A one-entry sorted family.

Equations
Instances For
    def CategorialAlgebras.Heterogeneous.pair {S : Type u} {A : S → Type w} {s : S} (x y : A s) :

    A two-entry sorted family.

    Equations
    Instances For
      @[simp]
      theorem CategorialAlgebras.Heterogeneous.single_eta {S : Type u} {A : S → Type w} {s : S} (x : Word.Family A [s]) :
      single (x 0) = x

      A one-entry family is determined by its only value.

      @[simp]
      theorem CategorialAlgebras.Heterogeneous.pair_eta {S : Type u} {A : S → Type w} {s : S} (x : Word.Family A [s, s]) :
      pair (x 0) (x 1) = x

      A two-entry family is determined by its two values.

      theorem CategorialAlgebras.Heterogeneous.partialEval_unary {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} {A : PartialAlgebra (Symbol I sig)} (v : SortedSet.Map X A.carrier) {s t : I × S} (σ : Symbol I sig [s] t) (t✝ : Term (Symbol I sig) X s) :
      Term.partialEval v (unary σ t✝) = (Term.partialEval v t✝).bind fun (x : A.carrier s) => A.op σ (single x)

      Evaluate a unary application by first evaluating its only argument.

      theorem CategorialAlgebras.Heterogeneous.partialEval_binary {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} {A : PartialAlgebra (Symbol I sig)} (v : SortedSet.Map X A.carrier) {s : S} {j k : I} (h : j < k) (t r : Term (Symbol I sig) X (k, s)) :
      Term.partialEval v (binary h t r) = (Term.partialEval v t).bind fun (x : A.carrier (k, s)) => (Term.partialEval v r).bind fun (y : A.carrier (k, s)) => A.op (Symbol.comp h s) (pair x y)

      Evaluate a binary application by first evaluating both arguments.

      @[simp]
      theorem CategorialAlgebras.Heterogeneous.partialEval_variables {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {A : PartialAlgebra (Symbol I sig)} {a : List (I × S)} {s : I × S} (σ : Symbol I sig a s) (v : SortedSet.Map (Word.Variables a) A.carrier) :
      Term.partialEval v (Term.app σ fun (j : Fin a.length) => Term.var (Word.position a j)) = A.op σ fun (j : Fin a.length) => v (a.get j) (Word.position a j)

      Evaluate an application to variables as the corresponding basic operation.

      @[simp]
      theorem CategorialAlgebras.Heterogeneous.satisfies_defined {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} (A : PartialAlgebra (Symbol I sig)) (v : SortedSet.Map X A.carrier) {s : I × S} (t : Term (Symbol I sig) X s) :

      An existence assertion is equivalent to definedness of the term.

      def CategorialAlgebras.Heterogeneous.uniformValuation {S : Type u} {A : S → Type w} {s : S} {m : ℕ} (x : Fin m → A s) :

      Interpret a uniform context at an arbitrary tuple of elements of its sole sort.

      Equations
      Instances For
        @[simp]
        theorem CategorialAlgebras.Heterogeneous.eval_uniform_variable {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} (A : PartialAlgebra (Symbol I sig)) {s : I × S} {m : ℕ} (x : Fin m → A.carrier s) (j : Fin m) :

        Uniform variables evaluate to the entries of their tuple.

        @[simp]
        theorem CategorialAlgebras.Heterogeneous.satisfies_transport {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} (A : PartialAlgebra (Symbol I sig)) (v : SortedSet.Map X A.carrier) {s t : I × S} (h : s = t) (e : EEquation (Symbol I sig) X s) :

        Transport of the output sort does not change satisfaction of an equation.

        Dimensional families and contexts #

        theorem CategorialAlgebras.Heterogeneous.partialEval_base {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} {A : PartialAlgebra (Symbol I sig)} (v : SortedSet.Map X A.carrier) (k : I) {a : List S} {s : S} (σ : sig a s) (t : Word.Family (fun (s : S) => Term (Symbol I sig) X (k, s)) a) :
        Term.partialEval v (base k σ t) = (partFamily fun (j : Fin a.length) => Term.partialEval v (t j)).bind fun (z : (j : Fin a.length) → A.carrier (k, a.get j)) => A.op (Symbol.base k σ) ((dimensionFamily k a).symm z)

        Evaluation of an original symbol can use its original input positions.

        theorem CategorialAlgebras.Heterogeneous.eval_dimension_family {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {X : I × S → Type x} {A : PartialAlgebra (Symbol I sig)} (v : SortedSet.Map X A.carrier) (k : I) (a : List S) (t : Word.Family (Term (Symbol I sig) X) (dimensionWord k a)) (r : Word.Family A.carrier (dimensionWord k a)) (hr : ∀ (p : Fin (dimensionWord k a).length), Term.partialEval v (t p) = Part.some (r p)) (p : Fin a.length) :

        Evaluation commutes with reindexing a family of everywhere defined terms.

        theorem CategorialAlgebras.Heterogeneous.dimensionFamily_all {I : Type i} {S : Type u} {A : I × S → Type w} (P : (s : I × S) → A s → Prop) (k : I) (a : List S) (r : Word.Family A (dimensionWord k a)) :
        (∀ (p : Fin (dimensionWord k a).length), P ((dimensionWord k a).get p) (r p)) ↔ ∀ (p : Fin a.length), P (k, a.get p) ((dimensionFamily k a) r p)

        A quantified predicate on dimensional families may use the original positions.

        theorem CategorialAlgebras.Heterogeneous.uniform_valid_iff {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} (A : PartialAlgebra (Symbol I sig)) {s : I × S} {m : ℕ} {p : List (I × S)} {t : I × S} (prem : Word.Family (EEquation (Symbol I sig) (UniformVariables s m)) p) (concl : EEquation (Symbol I sig) (UniformVariables s m) t) :
        QEEquation.Valid A (uniformEquation s m prem concl).equation ↔ ∀ (x : Fin m → A.carrier s), (∀ (j : Fin p.length), EEquation.Satisfies A (uniformValuation x) (prem j)) → EEquation.Satisfies A (uniformValuation x) concl

        Uniform contexts may be checked at arbitrary tuples of their single sort.

        Total operations from equations #

        theorem CategorialAlgebras.Heterogeneous.boundary_total {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {A : PartialAlgebra (Symbol I sig)} (hA : SatisfiesEquations A) {j k : I} (h : j < k) (s : S) (b : Bool) (x : A.carrier (k, s)) :
        (A.op (Symbol.boundary h s b) (single x)).Dom

        Source and target are total in every algebra satisfying the equations.

        theorem CategorialAlgebras.Heterogeneous.identity_total {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {A : PartialAlgebra (Symbol I sig)} (hA : SatisfiesEquations A) {j k : I} (h : j < k) (s : S) (x : A.carrier (j, s)) :

        Identities are total in every algebra satisfying the equations.

        theorem CategorialAlgebras.Heterogeneous.base_total {I : Type i} [Preorder I] {S : Type u} {sig : Signature S} {A : PartialAlgebra (Symbol I sig)} (hA : SatisfiesEquations A) (k : I) {a : List S} {s : S} (σ : sig a s) (x : Word.Family A.carrier (dimensionWord k a)) :
        (A.op (Symbol.base k σ) x).Dom

        Every dimensional copy of an original symbol is total.