Documentation

Provenance.JointHom

The joint reading of a family, and homomorphisms #

A selection comparing several aggregate values of one family reads them in one world of the family (classWorlds). Under a homomorphism the family's listing is reordered among tied occurrences – the evaluator lists a group by its rows and then by the annotations, and the annotations are not the same on the two sides – and a joint reading is blind to that only if every value of the family is reordered together.

This holds when every value of the family is built from one listing of the family's occurrences by a function of the occurrence's row: a LeafSpec says how a value reads an occurrence (what each of its leaves reads, whether it is in the leaf's group, whether the leaf's clause keeps it), and LeafSpec.build is the value it builds from a listing. Then a world of the family is read off the sequence of rows it selects (classWorlds_presented), the bag of those is blind to a tie-block permutation of the listing (subWorlds_tiePerm), and the joint worlds of the two sides correspond (classWorlds_hom).

structure LeafSpec (ρ T : Type) :

How an aggregate value reads an occurrence of its family, as a function of the occurrence's row ρ: the value each leaf reads, whether the occurrence is in each leaf's group, whether each leaf's clause keeps it – and the leaves' aggregates, conventions and combining function.

Instances For
    Dependency graph
    def LeafSpec.build {ρ T β K : Type} (sp : LeafSpec ρ T) (L : List β) (ann : β → K) (str : β → ρ) (φ : FamId T) :

    The value built from a listing L of the family, an occurrence being read through its row str and annotated by ann.

    Equations
    Instances For
      Dependency graph
      def LeafSpec.okL {ρ T : Type} (sp : LeafSpec ρ T) (s : List ρ) :

      Whether a selected sequence of rows is a world of the value.

      Equations
      Instances For
        Dependency graph
        def LeafSpec.valL {ρ T : Type} (sp : LeafSpec ρ T) (s : List ρ) :
        T

        The value on a selected sequence of rows.

        Equations
        Instances For
          Dependency graph
          def AggExpr.PresBy {ρ β T K : Type} (e : AggExpr T K) (L : List β) (ann : β → K) (str : β → ρ) (ok : List ρ → Prop) (val : List ρ → T) :

          An aggregate expression presented by a listing: its occurrences are the listing's, position for position, with the listing's annotations, and its world condition and its value are read off the rows a world selects, through ok and val. This is all a joint reading asks of a value of a family.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Dependency graph
            theorem classWorlds_presented {T K : Type} [CommSemiringWithMonus K] [ValueType T] [DecidableEq K] {ρ β : Type} {n : ℕ} (u : Tuple (GenValue T K) n) (M : List (Fin n)) (L : List β) (ann : β → K) (str : β → ρ) (ok : Fin n → List ρ → Prop) (val : Fin n → List ρ → T) (hM : ∀ k ∈ M, ∃ (y : AggTok T K), u k = Sum.inr y ∧ y.flatExpr.PresBy L ann str (ok k) (val k)) (x₀ : AggTok T K) (hx₀ : x₀.isNested = false) (ok₀ : List ρ → Prop) (val₀ : List ρ → T) (hx₀b : x₀.flatExpr.PresBy L ann str ok₀ val₀) :
            classWorlds u M x₀ = Multiset.map (fun (w : K × K × List ρ) => (w.1, w.2.1, fun (k : Fin n) => if k ∈ M then some (val k w.2.2) else none)) (Multiset.filter (fun (w : K × K × List ρ) => ∀ k ∈ M, ok k w.2.2) (Multiset.map (fun (w : K × K × List β) => (w.1, w.2.1, List.map str w.2.2)) (subWorlds ann L)))

            A family built from one listing reads its worlds off the listing. If every column of M holds a value presented by the listing L (each read through its own ok and val), and so does the value x₀ the family is listed by, then the family's worlds are the subfamilies of L, each read through the rows it selects.

            Dependency graph
            theorem classWorlds_hom {T K : Type} [CommSemiringWithMonus K] [ValueType T] [DecidableEq K] {K' : Type} [CommSemiringWithMonus K'] [DecidableEq K'] (f : K →+* K') {ρ β β' : Type} {n : ℕ} (u : Tuple (GenValue T K) n) (u' : Tuple (GenValue T K') n) (M : List (Fin n)) (L : List β) (ann : β → K) (str : β → ρ) (L' : List β') (ann' : β' → K') (str' : β' → ρ) (e : β → β') {eqv : β' → β' → Prop} (heqv : ∀ {a b : β'}, eqv a b → str' a = str' b) (hperm : TiePerm eqv L' (List.map e L)) (hstr : ∀ (b : β), str' (e b) = str b) (hann : ∀ (b : β), ann' (e b) = f (ann b)) (ok : Fin n → List ρ → Prop) (val : Fin n → List ρ → T) (hM : ∀ k ∈ M, ∃ (y : AggTok T K), u k = Sum.inr y ∧ y.flatExpr.PresBy L ann str (ok k) (val k)) (hM' : ∀ k ∈ M, ∃ (y : AggTok T K'), u' k = Sum.inr y ∧ y.flatExpr.PresBy L' ann' str' (ok k) (val k)) (x₀ : AggTok T K) (hx₀ : x₀.isNested = false) (ok₀ : List ρ → Prop) (val₀ : List ρ → T) (hx₀b : x₀.flatExpr.PresBy L ann str ok₀ val₀) (x₀' : AggTok T K') (hx₀' : x₀'.isNested = false) (hx₀b' : x₀'.flatExpr.PresBy L' ann' str' ok₀ val₀) :
            classWorlds u' M x₀' = Multiset.map (fun (w : K × K × (Fin n → Option T)) => (f w.1, f w.2.1, w.2.2)) (classWorlds u M x₀)

            The joint worlds of a family under a homomorphism. On the two sides the family's values are presented, through the same readings, by two listings, the second a tie-block permutation of the first pushed through f – occurrences swapped only where their rows read alike. Then the family's worlds correspond, annotations pushed through f and every value unchanged: the values of the family are reordered together.

            Dependency graph
            theorem jointWorlds_hom {T K : Type} [CommSemiringWithMonus K] [ValueType T] [DecidableEq K] {K' : Type} [CommSemiringWithMonus K'] [DecidableEq K'] (f : K →+* K') {n : ℕ} (u : Tuple (GenValue T K) n) (u' : Tuple (GenValue T K') n) (cols : List (Fin n)) (hagg : ∀ k ∈ cols, (∃ (x : AggTok T K), u k = Sum.inr x) ↔ ∃ (x' : AggTok T K'), u' k = Sum.inr x') (hkey : ∀ k ∈ cols, ∀ l ∈ cols, ∀ (x y : AggTok T K) (x' y' : AggTok T K'), u k = Sum.inr x → u l = Sum.inr y → u' k = Sum.inr x' → u' l = Sum.inr y' → (x'.classKey = y'.classKey ↔ x.classKey = y.classKey)) (hclass : ∀ k ∈ cols, ∀ (x : AggTok T K) (x' : AggTok T K'), u k = Sum.inr x → u' k = Sum.inr x' → classWorlds u' (List.map Prod.fst (List.filter (fun (p : Fin n × AggTok T K) => decide (p.2.classKey = x.classKey)) (tokCols u cols))) x' = Multiset.map (fun (w : K × K × (Fin n → Option T)) => (f w.1, f w.2.1, w.2.2)) (classWorlds u (List.map Prod.fst (List.filter (fun (p : Fin n × AggTok T K) => decide (p.2.classKey = x.classKey)) (tokCols u cols))) x)) :
            jointWorlds u' cols = Multiset.map (fun (w : K × K × (Fin n → Option T)) => (f w.1, f w.2.1, w.2.2)) (jointWorlds u cols)

            The joint worlds of a row under a homomorphism. If the two rows hold aggregate values at the same compared columns, group them into families alike, and each family's worlds correspond, so do the joint worlds.

            Dependency graph

            Families presented on both sides #

            What the joint reading of a row needs under a homomorphism, collected over a set S of pairs of corresponding values (the target's and the source's): that the two sides group them into families alike, and that each family is presented – its flat values built from one listing on each side, the two listings tie-block permuted (ListingRel), or its nested values having corresponding worlds (NestedValue.WCorr).

            structure ListingRel {K K' : Type} [CommSemiringWithMonus K] [CommSemiringWithMonus K'] (f : K →+* K') (T : Type) :

            Two listings of a family's occurrences, related by a homomorphism: the target's is a tie-block permutation of the source's pushed through f, occurrences swapped only where their rows read alike.

            Instances For
              Dependency graph
              def ListingRel.Member {T K K' : Type} [CommSemiringWithMonus K] [CommSemiringWithMonus K'] {f : K →+* K'} (D : ListingRel f T) (y' : AggTok T K') (y : AggTok T K) :

              A pair of flat values presented by a related pair of listings, through the same readings.

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

                The worlds of two nested values correspond under a homomorphism: both enumerations are images of one bag of indices, and at each index the two worlds keep and leave out annotations related by f, read the same inner values, and ask the same of what they keep. This is all a reading of a nested value asks of its worlds – its admissibility, its value and its weight – and it reads only the storey and the occurrences of the two values, so a term over a nested column keeps it.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Dependency graph
                  def NestMember {T K K' : Type} (y' : AggTok T K') (y : AggTok T K) :

                  A pair of nested values with the same outer aggregate and convention.

                  Equations
                  Instances For
                    Dependency graph
                    def FamPres {T K K' : Type} [CommSemiringWithMonus K] [CommSemiringWithMonus K'] [DecidableEq T] [DecidableEq K] [DecidableEq K'] (f : K →+* K') (S : AggTok T K' × AggTok T K → Prop) :

                    A set of corresponding values whose families are presented on both sides.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Dependency graph
                      theorem classWorlds_of_wcorr {T K K' : Type} [CommSemiringWithMonus K] [CommSemiringWithMonus K'] [ValueType T] [DecidableEq K] [DecidableEq K'] (f : K →+* K') {n : ℕ} (u : Tuple (GenValue T K) n) (u' : Tuple (GenValue T K') n) (M : List (Fin n)) (a : NestedValue T K) (a' : NestedValue T K') (hw : NestedValue.WCorr f a' a) (hM : ∀ k ∈ M, ∃ (b : NestedValue T K) (b' : NestedValue T K'), u k = Sum.inr (AggTok.nest b) ∧ u' k = Sum.inr (AggTok.nest b') ∧ b'.agg = b.agg ∧ b'.scalar = b.scalar) :
                      classWorlds u' M (AggTok.nest a') = Multiset.map (fun (w : K × K × (Fin n → Option T)) => (f w.1, f w.2.1, w.2.2)) (classWorlds u M (AggTok.nest a))

                      A nested family's worlds under a homomorphism. If the representatives' worlds correspond and every column of the family holds a nested value with the same outer aggregate and convention on both sides, the family's worlds correspond, the pair pushed through f.

                      Dependency graph
                      theorem jointWorlds_of_famPres {T K K' : Type} [CommSemiringWithMonus K] [CommSemiringWithMonus K'] [ValueType T] [DecidableEq K] [DecidableEq K'] (f : K →+* K') {n : ℕ} (u : Tuple (GenValue T K) n) (u' : Tuple (GenValue T K') n) (cols : List (Fin n)) (hagg : ∀ k ∈ cols, (∃ (x : AggTok T K), u k = Sum.inr x) ↔ ∃ (x' : AggTok T K'), u' k = Sum.inr x') (hF : FamPres f fun (p : AggTok T K' × AggTok T K) => ∃ k ∈ cols, u' k = Sum.inr p.1 ∧ u k = Sum.inr p.2) :
                      jointWorlds u' cols = Multiset.map (fun (w : K × K × (Fin n → Option T)) => (f w.1, f w.2.1, w.2.2)) (jointWorlds u cols)

                      The joint worlds of a row whose families are presented on both sides correspond.

                      Dependency graph

                      Closure under terms #

                      A term over an aggregate column (AggTok.postcompTerm) composes the value's outer function and keeps its family: the same occurrences, the same group key, a family identifier recording the term. So it stays in its class, and a presented family stays presented.

                      inductive PCl {T K K' : Type} [ValueType T] (S : AggTok T K' × AggTok T K → Prop) :
                      AggTok T K' × AggTok T K → Prop

                      The closure of a set of corresponding values under terms, taken on both sides alike.

                      Instances For
                        Dependency graph

                        The operator a family records #

                        def FamId.lab {T : Type} :
                        FamId T → ℕ

                        The label of the operator a family identifier records.

                        Equations
                        Instances For
                          Dependency graph
                          def AggTok.lab {T K : Type} (x : AggTok T K) :

                          The label of the operator that built an aggregate value.

                          Equations
                          Instances For
                            Dependency graph

                            The operators' labels #

                            The hom commutation reads several values of one family in one world, so what it asks of a query is that two operators building values never share a label (AggQueryIn.labelsDistinct): values of different operators are then in different families, and an identifier determines its value across every evaluation the query performs (AggQueryIn.builds_coherent).

                            def labCons {α : Type} (w : ℕ) (lab : α) (L : List α) :
                            List α

                            An operator's label, where it builds a column: an aggregation with no aggregate builds no value, so its label is not one of a value.

                            Equations
                            Instances For
                              Dependency graph
                              def AggQueryIn.labels {T : Type} {c n : ℕ} {κ : Fin n → ColKind} {l : List (String × ℕ)} :
                              AggQueryIn T c n κ l → List ℕ

                              The labels of the operators that build aggregate values, an aggregation with no aggregate building none (labCons).

                              Equations
                              Instances For
                                Dependency graph
                                def AggQueryIn.labelsDistinct {T : Type} {c n : ℕ} {κ : Fin n → ColKind} {l : List (String × ℕ)} (q : AggQueryIn T c n κ l) :

                                No two operators building aggregate values share a label.

                                Equations
                                Instances For
                                  Dependency graph

                                  An expression's world statistics under a homomorphism #