Documentation

Provenance.SymOrder

The successor relation of a finite relation, without a recursion #

A relation of non-null rows, listed once each, is sorted by the lexicographic ascending order (ascLt). Its successor relation – the pairs of consecutive rows – its least row and its greatest row are written with products, selections, projections and the NOT IN difference: a pair of rows in increasing order with no row between them, a row with no row below it, a row with no row above it (Sym.evaluatePlain_succQ, Sym.evaluatePlain_leastQ, Sym.evaluatePlain_greatestQ). These are what a bounded recursion's counters and the gaps of a cut are read off.

Consecutive elements of a sorted list #

The sorted listing of a relation #

noncomputable def Sym.sortedRows {T : Type} [ValueType T] {p : ℕ} (R : Multiset (Tuple T p)) :
List (Tuple T p)

The listing of a relation's rows in increasing order.

Equations
Instances For
    Dependency graph

    The comparison as a predicate #

    def Sym.ltOn {T : Type} [ValueType T] {c N p : ℕ} (x y : Fin p → Fin N) :

    One block of a row below another, in the ascending lexicographic order.

    Equations
    Instances For
      Dependency graph

      The two blocks of a row #

      def Sym.blockL' {T : Type} (a b : ℕ) (x : Tuple T (a + b)) :
      Tuple T a

      The first block of a row.

      Equations
      Instances For
        Dependency graph
        def Sym.blockR' {T : Type} (a b : ℕ) (x : Tuple T (a + b)) :
        Tuple T b

        The second block of a row.

        Equations
        Instances For
          Dependency graph

          Products and projections #

          def Sym.projQ {T : Type} {c N M : ℕ} {l : List (String × ℕ)} (F : Fin M → SA T c N) (q : AggQueryIn T c N (ColKind.allReg N) l) :

          A projection onto arguments: columns, constants and context values.

          Equations
          Instances For
            Dependency graph

            The order queries #

            def Sym.ltQ {T : Type} [ValueType T] {c p : ℕ} (R : AggQueryIn T c p (ColKind.allReg p)) :
            AggQueryIn T c (p + p) (ColKind.allReg (p + p))

            The pairs of rows in increasing order.

            Equations
            Instances For
              Dependency graph
              def Sym.midQ {T : Type} [ValueType T] {c p : ℕ} (R : AggQueryIn T c p (ColKind.allReg p)) :
              AggQueryIn T c (p + p) (ColKind.allReg (p + p))

              The pairs of rows with a row between them.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                def Sym.aboveQ {T : Type} [ValueType T] {c p : ℕ} (R : AggQueryIn T c p (ColKind.allReg p)) :

                The rows with a row below them.

                Equations
                Instances For
                  Dependency graph
                  def Sym.belowQ {T : Type} [ValueType T] {c p : ℕ} (R : AggQueryIn T c p (ColKind.allReg p)) :

                  The rows with a row above them.

                  Equations
                  Instances For
                    Dependency graph
                    def Sym.succQ {T : Type} [ValueType T] {c p : ℕ} (s₁ s₂ : String) (cnt : SeqAggFunc T) (R : AggQueryIn T c p (ColKind.allReg p)) :
                    AggQueryIn T c (p + p) (ColKind.allReg (p + p))

                    The successor relation.

                    Equations
                    Instances For
                      Dependency graph
                      def Sym.leastQ {T : Type} [ValueType T] {c p : ℕ} (s₁ s₂ : String) (cnt : SeqAggFunc T) (R : AggQueryIn T c p (ColKind.allReg p)) :

                      The least row.

                      Equations
                      Instances For
                        Dependency graph
                        def Sym.greatestQ {T : Type} [ValueType T] {c p : ℕ} (s₁ s₂ : String) (cnt : SeqAggFunc T) (R : AggQueryIn T c p (ColKind.allReg p)) :

                        The greatest row.

                        Equations
                        Instances For
                          Dependency graph
                          def Sym.NonNullRows {T : Type} [ValueType T] {c p : ℕ} (R : AggQueryIn T c p (ColKind.allReg p)) (D : Database T) (γ : Fin c → T) :

                          What the relation's rows are asked: no null value.

                          Equations
                          Instances For
                            Dependency graph
                            theorem Sym.evaluatePlain_succQ {T : Type} [ValueType T] {c p : ℕ} {R : AggQueryIn T c p (ColKind.allReg p)} {D : Database T} {γ : Fin c → T} (s₁ s₂ : String) {cnt : SeqAggFunc T} (hc : cnt.Counts) (h₁ : AggQueryIn.noMention s₁ R) (h₂ : AggQueryIn.noMention s₂ R) (hR : NonNullRows R D γ) (hnd : Multiset.Nodup (R.evaluatePlain D γ)) :
                            (succQ s₁ s₂ cnt R).evaluatePlain D γ = succRel (sortedRows (R.evaluatePlain D γ))

                            The successor relation, as a query.

                            Dependency graph
                            theorem Sym.evaluatePlain_leastQ {T : Type} [ValueType T] {c p : ℕ} {R : AggQueryIn T c p (ColKind.allReg p)} {D : Database T} {γ : Fin c → T} (s₁ s₂ : String) {cnt : SeqAggFunc T} (hc : cnt.Counts) (h₁ : AggQueryIn.noMention s₁ R) (h₂ : AggQueryIn.noMention s₂ R) (hR : NonNullRows R D γ) (hnd : Multiset.Nodup (R.evaluatePlain D γ)) (h0 : 0 < (sortedRows (R.evaluatePlain D γ)).length) :
                            (leastQ s₁ s₂ cnt R).evaluatePlain D γ = {(sortedRows (R.evaluatePlain D γ))[0]}

                            The least row is the first of the sorted listing.

                            Dependency graph