Documentation

Complexity.Computability.Circuit.Rational.Runtime.Lift.Defs

List programs and evaluation equivalences for the integer lift tables #

At every grid point the executable generator materializes the integer lift matrices Rational.Generator.integralLift, built from the integer Taylor test matrices Rational.IntegralTest.padded and the signed-monomial formula Rational.IntegralLift.entry. Those definitions are indexed by Fin and ZMod with a type-level modulus, and use Nat.choose. This file restates them as ordinary programs on natural numbers, integers and lists of rows, and proves that they compute the landed matrix definitions:

Magnitude bounds, bit-length budgets, and polynomial-time Turing machine certificates for these list programs are proved in Complexity/Computability/Circuit/Rational/Runtime/Lift.lean.

Main definitions #

Main results #

References #

Index bridges #

The residue of the row-major block coordinate is the quotient by the degree.

The position inside the block of the row-major block coordinate is the remainder.

Lists of rows #

theorem Cslib.Circuits.Rational.tabulateTable_eq_rowsOf {d : ℕ} (g : ℕ → ℕ → ℤ) (A : Matrix (Fin d) (Fin d) ℤ) (h : ∀ (i j : Fin d), g ↑i ↑j = A i j) :

A tabulated square list of rows is the list of rows of a matrix it agrees with.

theorem Cslib.Circuits.Rational.natAbs_le_of_mem_rows {rows : List (List ℤ)} {C : ℕ} (h : ∀ (i j : ℕ), (rowEntry rows i j).natAbs ≤ C) {row : List ℤ} (hrow : row ∈ rows) {z : ℤ} (hz : z ∈ row) :

Every stored entry is bounded once every indexed entry is.

Coefficient rows #

Multiply a polynomial by X + c. The polynomial is given by its list of coefficients, constant coefficient first; coefficient i of the product is l[i - 1] + c * l[i].

Instances For

    The coefficients of (X + c) ^ k, constant coefficient first, computed by k shift-and-add steps from [1].

    Instances For

      The coefficient rows coeffRow c k for k < M.

      Instances For
        @[simp]

        shiftAddRow c l has length l.length + 1.

        theorem Cslib.Circuits.Rational.getD_shiftAddRow (c : ℤ) (l : List ℤ) (i : ℕ) :
        (shiftAddRow c l).getD i 0 = (0 :: l).getD i 0 + c * l.getD i 0

        The i-th entry of shiftAddRow c l is (0 :: l).getD i 0 + c * l.getD i 0.

        @[simp]

        The zeroth coefficient row is [1].

        The (k + 1)-th coefficient row is shiftAddRow c applied to the k-th row.

        @[simp]

        coeffRow c k has length k + 1.

        coeffRow computes the coefficients of (X + C c) ^ k.

        theorem Cslib.Circuits.Rational.getD_coeffRow_eq (c : ℤ) (k i : ℕ) :
        (coeffRow c k).getD i 0 = c ^ (k - i) * ↑(k.choose i)

        The closed form of the coefficient rows, as in IntegralTest.full.

        theorem Cslib.Circuits.Rational.rowEntry_coeffRows (c : ℤ) (M k i : ℕ) :
        rowEntry (coeffRows c M) k i = if k < M then (coeffRow c k).getD i 0 else 0

        Reading row k and column i of coeffRows c M gives (coeffRow c k).getD i 0 for k < M.

        The integer Taylor test matrix #

        def Cslib.Circuits.Rational.testTerm (M : ℕ) (minus plus : List (List ℤ)) (t : ℤ) (u v q : ℕ) :

        The summand q of entry (u, v) of the integer Taylor test matrix: coefficient u of (X - a) ^ (M - 1 - q) times coefficient q of (X + a) ^ v times t ^ q, read from the coefficient rows minus and plus.

        Instances For
          def Cslib.Circuits.Rational.testTerms (M : ℕ) (minus plus : List (List ℤ)) (t : ℤ) (u v : ℕ) :

          The summands of entry (u, v) of the integer Taylor test matrix.

          Instances For
            def Cslib.Circuits.Rational.testEntry (M N : ℕ) (minus plus : List (List ℤ)) (t : ℤ) (u v : ℕ) :

            Entry (u, v) of the integer Taylor test matrix; the columns from N on are zero.

            Instances For

              The integer Taylor test matrix IntegralTest.padded M N a t as a list of rows.

              Instances For
                theorem Cslib.Circuits.Rational.testEntry_eq (M N : ℕ) (a t : ℤ) (u v : Fin M) :
                testEntry M N (coeffRows (-a) M) (coeffRows a M) t ↑u ↑v = IntegralTest.padded M N a t u v

                testEntry on coeffRows (-a) M and coeffRows a M equals IntegralTest.padded.

                The list program computes the integer Taylor test matrix.

                @[simp]
                theorem Cslib.Circuits.Rational.length_testRows (M N : ℕ) (a t : ℤ) :
                (testRows M N a t).length = M

                testRows M N a t has M rows.

                The integer lift #

                The signed coefficient of the cyclotomic regular representation on natural numbers: CyclotomicRing.signedEntry with the residue replaced by its value.

                Instances For
                  def Cslib.Circuits.Rational.liftTerm (M Dg : ℕ) (T : List (List ℤ)) (p r : ℤ) (u v i j α κ : ℕ) :

                  The term (α, κ) of entry ((u, i), (v, j)) of the integer lift with test matrix T, with M residues and cyclotomic degree Dg. The residue β of IntegralLift.entry is forced to be u - v, which is (u + M - v) % M; κ - β and α * (u - κ) are computed likewise.

                  Instances For
                    def Cslib.Circuits.Rational.liftTerms (M Dg : ℕ) (T : List (List ℤ)) (p r : ℤ) (u v i j α : ℕ) :

                    The terms κ < M of the inner sum, for the residue α.

                    Instances For
                      def Cslib.Circuits.Rational.liftSums (M Dg : ℕ) (T : List (List ℤ)) (p r : ℤ) (u v i j : ℕ) :

                      The inner sums α < M of an integer lift entry.

                      Instances For
                        def Cslib.Circuits.Rational.liftEntry (M Dg : ℕ) (T : List (List ℤ)) (p r : ℤ) (u v i j : ℕ) :

                        Entry ((u, i), (v, j)) of the integer lift: a double sum of M ^ 2 terms.

                        Instances For

                          The integer lift matrix with test matrix T, in the row-major block order: index i is the pair (i / Dg, i % Dg).

                          Instances For

                            The n + 1 integer lift matrices at the grid point (t, p, r), with truncation N, M residues and cyclotomic degree Dg.

                            Instances For

                              The double sum computes the integer lift formula, for any list of rows that agrees with the test matrix at residues.

                              theorem Cslib.Circuits.Rational.liftTable_eq (n N e : ℕ) (x : Fin 3 → ℕ) (a : Fin (n + 1)) :

                              The list program computes Generator.integralLift.

                              theorem Cslib.Circuits.Rational.rowEntry_liftTable (n N e : ℕ) (x : Fin 3 → ℕ) (a : Fin (n + 1)) (i j : Fin (Generator.matrixDimension e)) :
                              rowEntry (liftTable (CyclotomicRing.dimension e) (CyclotomicRing.degree e) (testRows (CyclotomicRing.dimension e) N ↑↑a ↑(x 0)) ↑(x 1) ↑(x 2)) ↑i ↑j = Generator.integralLift n N e x a i j

                              Reading entry (i, j) of liftTable gives Generator.integralLift.

                              theorem Cslib.Circuits.Rational.liftRows_eq (n N e : ℕ) (x : Fin 3 → ℕ) :
                              liftRows n N (CyclotomicRing.dimension e) (CyclotomicRing.degree e) (x 0) (x 1) (x 2) = List.map (fun (a : Fin (n + 1)) => rowsOf (Generator.integralLift n N e x a)) (List.finRange (n + 1))

                              The list program computes all integer lift matrices at a grid point.

                              The list program computes the executable generator's dense input tables.

                              @[simp]
                              theorem Cslib.Circuits.Rational.length_liftTable (M Dg : ℕ) (T : List (List ℤ)) (p r : ℤ) :
                              (liftTable M Dg T p r).length = M * Dg

                              liftTable M Dg T p r has M * Dg rows.

                              @[simp]
                              theorem Cslib.Circuits.Rational.length_liftRows (n N M Dg t p r : ℕ) :
                              (liftRows n N M Dg t p r).length = n + 1

                              liftRows n N M Dg t p r has n + 1 tables.