Documentation

Provenance.SymEnvBuild

The environment of the symbolic evaluation, built from a cut #

The symbolic evaluation (Provenance.SymTab) reads its descriptors and the counters of its bounded recursions off an environment (Sym.SymEnv). This file builds both from a query computing the cut, as unary relations over the ambient context, and proves the environment sound wherever the cut holds the null (Sym.envOK_envOf).

The counters of a recursion of arity n are the rows of E^K, E the non-null values of the cut with the two constants 0 and ValueType.nonzero, and K = n (k + 3): there are at least as many as the rounds a restricted bag recursion over good values can run.

Unary relations of values #

def Sym.nnQ {T : Type} {c : ℕ} (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :

The non-null rows of a unary relation.

Equations
Instances For
    Dependency graph
    def Sym.constQ {T : Type} {c : ℕ} (a : T) :

    The one row holding a constant.

    Equations
    Instances For
      Dependency graph

      The alphabet of the counters #

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

      The values counters are written with: the non-null values of the cut, 0 and ValueType.nonzero, each once.

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

        The supply names a query does not mention.

        Equations
        Instances For
          Dependency graph

          Powers of a unary relation #

          def Sym.powU {T : Type} {c : ℕ} (EQ : AggQueryIn T c 1 (ColKind.allReg 1)) (K : ℕ) :

          The K-th power of a unary relation, by products.

          Equations
          Instances For
            Dependency graph

            The counters #

            def Sym.ctrW (k n : ℕ) :

            The width of the counters of a recursion of arity n, for k parameter components.

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

              The counters: the rows of E^K.

              Equations
              Instances For
                Dependency graph
                def Sym.lqQ {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) (K : ℕ) :

                The least counter.

                Equations
                Instances For
                  Dependency graph
                  def Sym.sqQ {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) (K : ℕ) :
                  AggQueryIn T c (K + K) (ColKind.allReg (K + K))

                  The successor relation of the counters.

                  Equations
                  Instances For
                    Dependency graph
                    noncomputable def Sym.valsU {T : Type} [ValueType T] (R : Multiset (Tuple T 1)) :

                    The values of a unary relation, as a finite set.

                    Equations
                    Instances For
                      Dependency graph

                      The bound above a gap #

                      The cells of the descriptors #

                      def Sym.cellSA {T : Type} {c N k : ℕ} (v : Fin 7 → SA T c N) (th : Fin k → SA T c N) :
                      Fin (7 + k) → SA T c N

                      A cell's columns as arguments: seven columns and the rank's.

                      Equations
                      Instances For
                        Dependency graph
                        def Sym.thRowQ {T : Type} [ValueType T] {c : ℕ} (k r : ℕ) :

                        The row of a constant thermometer.

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

                          The ranks from 0 to r in unary.

                          Equations
                          Instances For
                            Dependency graph

                            The five kinds of cells #

                            def Sym.concP {T : Type} [ValueType T] {c : ℕ} (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                            AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                            A concrete cell for each value of the cut.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Dependency graph
                              def Sym.thP {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (k : ℕ) :

                              The unary ranks.

                              Equations
                              Instances For
                                Dependency graph
                                def Sym.succP {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                                A cell for each gap above a non-null value of the cut with a value above it.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Dependency graph
                                  def Sym.topP {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                  AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                                  A cell for each gap above the greatest non-null value of the cut.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Dependency graph
                                    def Sym.botP {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                    AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                                    The cells of the gap below the least non-null value of the cut.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      Dependency graph
                                      def Sym.emptyQ {T : Type} [ValueType T] {c : ℕ} (s₁ s₂ : String) (cnt : SeqAggFunc T) (R : AggQueryIn T c 1 (ColKind.allReg 1)) :

                                      The empty row where the cut holds no non-null value, nothing elsewhere.

                                      Equations
                                      Instances For
                                        Dependency graph
                                        def Sym.botEP {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                        AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                                        The cells of the one gap of a cut with no non-null value.

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

                                          The cells #

                                          def Sym.cellsQ {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                          AggQueryIn T c (7 + k) (ColKind.allReg (7 + k))

                                          The cells of the descriptors, each once.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            Dependency graph
                                            def Sym.GapOK {T : Type} [ValueType T] (C : Finset T) :

                                            A gap's lower bound: none, or a non-null value of the cut.

                                            Equations
                                            Instances For
                                              Dependency graph
                                              def Sym.CellShape {T : Type} [ValueType T] (C : Finset T) (k : ℕ) (x : Tuple T (7 + k)) :

                                              The cells: a value of the cut, or a gap with a rank at most k.

                                              Equations
                                              Instances For
                                                Dependency graph

                                                Powers of a relation, block by block #

                                                theorem Sym.blk_lt {m K i j : ℕ} (hi : i < K) (hj : j < m) :
                                                m * i + j < m * K
                                                Dependency graph
                                                def Sym.blk {T : Type} (m K : ℕ) (v : Tuple T (m * K)) (i : Fin K) :
                                                Tuple T m

                                                The block i of a row of K blocks of m columns.

                                                Equations
                                                Instances For
                                                  Dependency graph
                                                  def Sym.powX {T : Type} {c m : ℕ} (R : AggQueryIn T c m (ColKind.allReg m)) (K : ℕ) :
                                                  AggQueryIn T c (m * K) (ColKind.allReg (m * K))

                                                  The K-th power of a relation, its rows laid out block after block.

                                                  Equations
                                                  Instances For
                                                    Dependency graph

                                                    The descriptors #

                                                    def Sym.descQ {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                                    AggQueryIn T c (k * (7 + k)) (ColKind.allReg (k * (7 + k)))

                                                    The descriptors: k cells.

                                                    Equations
                                                    Instances For
                                                      Dependency graph

                                                      The environment #

                                                      def Sym.envOf {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) (cnt : SeqAggFunc T) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) :
                                                      SymEnv T k c

                                                      The environment of the symbolic evaluation, built from a cut.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        Dependency graph
                                                        theorem Sym.envOK_envOf {T : Type} [ValueType T] {c : ℕ} (f : ℕ → String) {cnt : SeqAggFunc T} (hc : cnt.Counts) (k : ℕ) (CQ : AggQueryIn T c 1 (ColKind.allReg 1)) (hfr : FreshFor f CQ) (D : Database T) (γ : Fin c → T) (hnull : ∀ (a : T), ValueType.isNull a = true → a ∈ valsU (CQ.evaluatePlain D γ)) :
                                                        EnvOK (envOf f cnt k CQ) D γ

                                                        The environment built from a cut is sound wherever the cut holds the null.

                                                        Dependency graph