Documentation

Provenance.SymCut

The cut a query's symbolic evaluation is taken relative to #

The symbolic evaluation of a query is correct relative to a cut holding every value the evaluation compares, groups or makes up (Sym.Good): the values of the relations it reads, its constants, the null, the context's values, and the values its aggregations compute. The last are computed by symbolic evaluations themselves: a grouping's counts, at every parameter row, are read off the symbolic evaluation of its input relative to the cut of that input, which is smaller. So the cut is defined by recursion on the query (Sym.cutQ), each aggregation adding the values its symbolic counterpart computes, and it is proved to make the evaluation good (Sym.good_cutQ).

def Sym.unionFin {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (n : ℕ) :
(Fin n → AggQueryIn T c 1 (ColKind.allReg 1)) → AggQueryIn T c 1 (ColKind.allReg 1)

The union of finitely many unary relations.

Equations
Instances For
    Dependency graph
    def Sym.u2 {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (a b : AggQueryIn T c 1 (ColKind.allReg 1)) :

    The union of two unary relations.

    Equations
    Instances For
      Dependency graph
      def Sym.valsOf {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) {n : ℕ} (q : AggQueryIn T c n (ColKind.allReg n)) :

      The values of every column of a relation.

      Equations
      Instances For
        Dependency graph
        def Sym.ambQ {T : Type} [ValueType T] (f : ℕ → String) (c : ℕ) :

        The context's values.

        Equations
        Instances For
          Dependency graph
          def Sym.nullQ {T : Type} [ValueType T] {c : ℕ} :

          The null, if the domain has one.

          Equations
          Instances For
            Dependency graph
            noncomputable def Sym.constsQ {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (S : Finset T) :

            Finitely many constants.

            Equations
            Instances For
              Dependency graph

              The aggregations of the symbolic evaluation, before their cells #

              noncomputable def Sym.gammaRaw {T : Type} [ValueType T] {k c : ℕ} (env : SymEnv T k c) (f : ℕ → String) {m n₁ n₂ : ℕ} (is : Tuple (Fin m) n₁) (ts : Tuple (TermIn T (k + c) m) n₂) (fs : Tuple (SeqAggFunc T) n₂) (q : AggQueryIn T (k + c) m (ColKind.allReg m)) (keep : Fin n₂ → Option (Selection T m)) :
              AggQueryIn T c (k * (7 + k) + n₁ * (7 + k) + n₂) (ColKind.allReg (k * (7 + k) + n₁ * (7 + k) + n₂))

              A symbolic grouping's rows: the keys' cells, then the aggregate values themselves.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                noncomputable def Sym.nestRaw {T : Type} [ValueType T] {k c : ℕ} (env : SymEnv T k c) (f : ℕ → String) {m n₁ : ℕ} {κ : Fin m → ColKind} (is : Tuple (Fin m) n₁) (p : ProjColIn T (k + c) κ) (g : Multiset T → T) (q : AggQueryIn T (k + c) m κ) :
                AggQueryIn T c (k * (7 + k) + n₁ * (7 + k) + 1) (ColKind.allReg (k * (7 + k) + n₁ * (7 + k) + 1))

                A symbolic second-level grouping's rows.

                Equations
                Instances For
                  Dependency graph
                  noncomputable def Sym.scalarRaw {T : Type} [ValueType T] {k c : ℕ} (env : SymEnv T k c) (f : ℕ → String) {m n₂ : ℕ} (ts : Tuple (TermIn T (k + c) m) n₂) (fs : Tuple (SeqAggFunc T) n₂) {κ : Fin m → ColKind} (q : AggQueryIn T (k + c) m κ) :
                  AggQueryIn T c (k * (7 + k) + n₂) (ColKind.allReg (k * (7 + k) + n₂))

                  A symbolic scalar aggregation's rows, over the padded union.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Dependency graph
                    noncomputable def Sym.winRaw {T : Type} [ValueType T] {k c : ℕ} (env : SymEnv T k c) (f : ℕ → String) {n m p : ℕ} (P : Tuple (Fin n) m) (O : Tuple (Fin n) p) (o : OrderSpec p) (w : ValueFrame T p) {hsql : ValueFrame.IsSQL o w} (t : TermIn T (k + c) n) (g : SeqAggFunc T) {κ : Fin n → ColKind} (q : AggQueryIn T (k + c) n κ) (dist : Bool) (keep : Option (Selection T n)) :
                    AggQueryIn T c ((k + n) * (7 + k) + 1) (ColKind.allReg ((k + n) * (7 + k) + 1))

                    A symbolic window's rows: the input's cells, then the window's value itself.

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

                      The cut #

                      def Sym.part (f : ℕ → String) (j : ℕ) :

                      An eighth of a supply of names.

                      Equations
                      Instances For
                        Dependency graph
                        def Sym.colsQ {T : Type} [ValueType T] {c N p : ℕ} (f : ℕ → String) (q : AggQueryIn T c N (ColKind.allReg N)) (idx : Fin p → Fin N) :

                        The values of some columns of a relation.

                        Equations
                        Instances For
                          Dependency graph
                          noncomputable def Sym.cutOf {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (S : Finset T) (core : AggQueryIn T c 1 (ColKind.allReg 1)) :

                          A cut: the null, the context's values, finitely many constants and the values a query computes.

                          Equations
                          Instances For
                            Dependency graph
                            @[irreducible]
                            noncomputable def Sym.cutCore {T : Type} [ValueType T] {k c : ℕ} (cnt : SeqAggFunc T) (f : ℕ → String) {n : ℕ} {κ : Fin n → ColKind} {l : List (String × ℕ)} :
                            AggQueryIn T (k + c) n κ l → AggQueryIn T c 1 (ColKind.allReg 1)

                            The values a query reads and computes: those of the relations it reads and those its aggregations compute, read off their symbolic counterparts relative to the cut of their input.

                            Equations
                            Instances For
                              Dependency graph
                              noncomputable def Sym.cutQ {T : Type} [ValueType T] {k c : ℕ} (cnt : SeqAggFunc T) (f : ℕ → String) {n : ℕ} {κ : Fin n → ColKind} {l : List (String × ℕ)} (q : AggQueryIn T (k + c) n κ l) :

                              The cut of a query.

                              Equations
                              Instances For
                                Dependency graph

                                What the cut names #

                                What the cut holds #

                                The cut makes the evaluation good #

                                The classes of the basis with products in place of the apply: ∅, Π, σ, ×, γ, win, μ^⊎.

                                Equations
                                Instances For
                                  Dependency graph
                                  def Sym.CutOK {T : Type} [ValueType T] {k c' n : ℕ} {κ : Fin n → ColKind} {l : List (String × ℕ)} (cnt : SeqAggFunc T) (f : ℕ → String) (q : AggQueryIn T (k + c') n κ l) (C : Finset T) (D : Database T) (γ : Fin c' → T) :

                                  What a cut is asked of a query: the null, the context's values, the query's constants and the values of its core.

                                  Equations
                                  Instances For
                                    Dependency graph

                                    The table of a query #

                                    noncomputable def Sym.tabEnv {T : Type} [ValueType T] {k c : ℕ} (cnt : SeqAggFunc T) (f : ℕ → String) {n : ℕ} {κ : Fin n → ColKind} (q : AggQueryIn T (k + c) n κ) :
                                    SymEnv T k c

                                    The environment of a query's table: built from the query's cut.

                                    Equations
                                    Instances For
                                      Dependency graph
                                      noncomputable def Sym.tabQ {T : Type} [ValueType T] {k c : ℕ} (cnt : SeqAggFunc T) (f : ℕ → String) {n : ℕ} {κ : Fin n → ColKind} (q : AggQueryIn T (k + c) n κ) :
                                      AggQueryIn T c ((k + n) * (7 + k)) (ColKind.allReg ((k + n) * (7 + k)))

                                      The table of a query: its symbolic evaluation relative to its cut, the encodings of its rows at every type of parameter row.

                                      Equations
                                      Instances For
                                        Dependency graph
                                        theorem Sym.tabQ_correct {T : Type} [ValueType T] {k c : ℕ} (Θ : Set (SeqAggFunc T)) {cnt : SeqAggFunc T} (hc : cnt.Counts) (f : ℕ → String) {n : ℕ} {κ : Fin n → ColKind} (q : AggQueryIn T (k + c) n κ) (hU : AggQueryIn.usesOnly basisProdOps q) (hsrc : SymSrc Θ q) (hf : ∀ (i : ℕ), AggQueryIn.noMention (f i) q) (D : Database T) (γ : Fin c → T) (par : Fin k → T) (hset : q.SettlesAt D (Fin.append par γ)) :
                                        SliceIs (cutAt (tabEnv cnt f q) D γ) par ((tabQ cnt f q).evaluatePlain D γ) (Multiset.map (fun (v : Tuple T n) => (v, Fin.elim0)) (q.evaluatePlain D (Fin.append par γ))) ∧ ∀ (v : Tuple T n), Multiset.Mem (q.evaluatePlain D (Fin.append par γ)) v → ∀ (i : Fin n), GoodVal par (v i)

                                        The table holds, under each parameter row's descriptor, the encodings of the rows the query computes at that row, wherever the query settles.

                                        Dependency graph