Documentation

Complexity.Computability.PolyTime.JetArray

Dense truncated bivariate jet arrays in polynomial time #

Appendix B.2 of OpenAI, The Exponential Time Hypothesis is False represents elements of the truncated bivariate polynomial ring ℤ[V]/(V^ℓ)[z]/(z^J) as dense J × ℓ tables of integer coefficients, stored in their unique representative modulo (z^J, V^ℓ).

Building on the rectangular integer table primitives (Cslib.IsTableShape, Cslib.rowEntry, Cslib.tabulateTable) in Complexity/Computability/PolyTime/Int/Table.lean, this module provides executable truncated jet operations on List (List ℤ) (Cslib.JetRows), proves exact coefficient formulas and commutative-ring laws on (J, ℓ)-shaped arrays, establishes ℓ₁ coefficient-norm and binary bit-length bounds for truncated 2D convolution, and certifies that every operation is computable in polynomial time on multi-tape Turing machines (Turing.MultiTapeTM.ComputableInPolyTime) with dimensions (J, ℓ) in unary and coefficient tables in encList (encList encIntBin).

Main definitions #

Main results #

References #

@[reducible, inline]

Dense list-of-rows representation of truncated bivariate jets in ℤ[V]/(V^ℓ)[z]/(z^J).

Instances For

    Executable jet operations #

    def Cslib.zeroJet (J ℓ : ℕ) :

    The J × ℓ zero jet array.

    Instances For
      def Cslib.constJet (J ℓ : ℕ) (c : ℤ) :

      The constant jet c placed at (0, 0) and 0 elsewhere, truncated to J × ℓ.

      Instances For
        def Cslib.zJet (J ℓ : ℕ) :

        The generator z in ℤ[V]/(V^ℓ)[z]/(z^J) (1 at (1, 0) when in range).

        Instances For
          def Cslib.vJet (J ℓ : ℕ) :

          The generator V in ℤ[V]/(V^ℓ)[z]/(z^J) (1 at (0, 1) when in range).

          Instances For
            def Cslib.addJet (J ℓ : ℕ) (A B : List (List ℤ)) :

            Entrywise addition of two jet arrays, normalized to shape J × ℓ.

            Instances For
              def Cslib.negJet (J ℓ : ℕ) (A : List (List ℤ)) :

              Entrywise negation of a jet array, normalized to shape J × ℓ.

              Instances For
                def Cslib.subJet (J ℓ : ℕ) (A B : List (List ℤ)) :

                Entrywise subtraction of two jet arrays, normalized to shape J × ℓ.

                Instances For
                  def Cslib.smulJet (J ℓ : ℕ) (c : ℤ) (A : List (List ℤ)) :

                  Entrywise integer scalar multiplication of a jet array, normalized to shape J × ℓ.

                  Instances For
                    def Cslib.shiftZJet (J ℓ : ℕ) (A : List (List ℤ)) :

                    Multiplication by z modulo z^J, shifting row index up by 1 and dropping row J - 1.

                    Instances For
                      def Cslib.shiftVJet (J ℓ : ℕ) (A : List (List ℤ)) :

                      Multiplication by V modulo V^ℓ, shifting column index up by 1 and dropping ℓ - 1.

                      Instances For
                        def Cslib.convEntry (A B : List (List ℤ)) (j u : ℕ) :

                        Coefficient (j, u) of the 2D Cauchy product of A and B, computed over List.range.

                        Instances For
                          def Cslib.convJet (J ℓ : ℕ) (A B : List (List ℤ)) :

                          Truncated 2D convolution in ℤ[V]/(V^ℓ)[z]/(z^J) using O(J^2 ℓ^2) integer operations.

                          Instances For

                            Output shape and exact coefficient semantics #

                            theorem Cslib.isTableShape_zeroJet (J ℓ : ℕ) :
                            IsTableShape J ℓ (zeroJet J ℓ)
                            theorem Cslib.isTableShape_constJet (J ℓ : ℕ) (c : ℤ) :
                            IsTableShape J ℓ (constJet J ℓ c)
                            theorem Cslib.isTableShape_zJet (J ℓ : ℕ) :
                            IsTableShape J ℓ (zJet J ℓ)
                            theorem Cslib.isTableShape_vJet (J ℓ : ℕ) :
                            IsTableShape J ℓ (vJet J ℓ)
                            theorem Cslib.isTableShape_addJet (J ℓ : ℕ) (A B : List (List ℤ)) :
                            IsTableShape J ℓ (addJet J ℓ A B)
                            theorem Cslib.isTableShape_negJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            IsTableShape J ℓ (negJet J ℓ A)
                            theorem Cslib.isTableShape_subJet (J ℓ : ℕ) (A B : List (List ℤ)) :
                            IsTableShape J ℓ (subJet J ℓ A B)
                            theorem Cslib.isTableShape_smulJet (J ℓ : ℕ) (c : ℤ) (A : List (List ℤ)) :
                            IsTableShape J ℓ (smulJet J ℓ c A)
                            theorem Cslib.isTableShape_shiftZJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            IsTableShape J ℓ (shiftZJet J ℓ A)
                            theorem Cslib.isTableShape_shiftVJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            IsTableShape J ℓ (shiftVJet J ℓ A)
                            theorem Cslib.isTableShape_convJet (J ℓ : ℕ) (A B : List (List ℤ)) :
                            IsTableShape J ℓ (convJet J ℓ A B)
                            theorem Cslib.convEntry_eq_sum (A B : List (List ℤ)) (j u : ℕ) :
                            convEntry A B j u = ∑ j₁ ∈ Finset.range (j + 1), ∑ u₁ ∈ Finset.range (u + 1), rowEntry A j₁ u₁ * rowEntry B (j - j₁) (u - u₁)
                            @[simp]
                            theorem Cslib.rowEntry_zeroJet (J ℓ j u : ℕ) :
                            rowEntry (zeroJet J ℓ) j u = 0
                            theorem Cslib.rowEntry_constJet {J ℓ : ℕ} (c : ℤ) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (constJet J ℓ c) j u = if j = 0 ∧ u = 0 then c else 0
                            theorem Cslib.rowEntry_zJet {J ℓ j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (zJet J ℓ) j u = if j = 1 ∧ u = 0 then 1 else 0
                            theorem Cslib.rowEntry_vJet {J ℓ j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (vJet J ℓ) j u = if j = 0 ∧ u = 1 then 1 else 0
                            theorem Cslib.rowEntry_addJet {J ℓ : ℕ} (A B : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (addJet J ℓ A B) j u = rowEntry A j u + rowEntry B j u
                            theorem Cslib.rowEntry_negJet {J ℓ : ℕ} (A : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (negJet J ℓ A) j u = -rowEntry A j u
                            theorem Cslib.rowEntry_subJet {J ℓ : ℕ} (A B : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (subJet J ℓ A B) j u = rowEntry A j u - rowEntry B j u
                            theorem Cslib.rowEntry_smulJet {J ℓ : ℕ} (c : ℤ) (A : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (smulJet J ℓ c A) j u = c * rowEntry A j u
                            theorem Cslib.rowEntry_shiftZJet {J ℓ : ℕ} (A : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (shiftZJet J ℓ A) j u = if j = 0 then 0 else rowEntry A (j - 1) u
                            theorem Cslib.rowEntry_shiftVJet {J ℓ : ℕ} (A : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (shiftVJet J ℓ A) j u = if u = 0 then 0 else rowEntry A j (u - 1)
                            theorem Cslib.rowEntry_convJet {J ℓ : ℕ} (A B : List (List ℤ)) {j u : ℕ} (hj : j < J) (hu : u < ℓ) :
                            rowEntry (convJet J ℓ A B) j u = ∑ j₁ ∈ Finset.range (j + 1), ∑ u₁ ∈ Finset.range (u + 1), rowEntry A j₁ u₁ * rowEntry B (j - j₁) (u - u₁)

                            Algebraic identities on (J, ℓ)-shaped jet arrays #

                            theorem Cslib.addJet_comm (J ℓ : ℕ) (A B : List (List ℤ)) :
                            addJet J ℓ A B = addJet J ℓ B A
                            theorem Cslib.addJet_assoc (J ℓ : ℕ) (A B C : List (List ℤ)) :
                            addJet J ℓ (addJet J ℓ A B) C = addJet J ℓ A (addJet J ℓ B C)
                            theorem Cslib.zeroJet_addJet {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                            addJet J ℓ (zeroJet J ℓ) A = A
                            theorem Cslib.addJet_zeroJet {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                            addJet J ℓ A (zeroJet J ℓ) = A
                            theorem Cslib.negJet_addJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            addJet J ℓ (negJet J ℓ A) A = zeroJet J ℓ
                            theorem Cslib.addJet_negJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            addJet J ℓ A (negJet J ℓ A) = zeroJet J ℓ
                            theorem Cslib.subJet_eq_addJet_negJet (J ℓ : ℕ) (A B : List (List ℤ)) :
                            subJet J ℓ A B = addJet J ℓ A (negJet J ℓ B)
                            theorem Cslib.smulJet_addJet (J ℓ : ℕ) (c : ℤ) (A B : List (List ℤ)) :
                            smulJet J ℓ c (addJet J ℓ A B) = addJet J ℓ (smulJet J ℓ c A) (smulJet J ℓ c B)
                            theorem Cslib.one_smulJet {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                            smulJet J ℓ 1 A = A
                            theorem Cslib.convJet_comm (J ℓ : ℕ) (A B : List (List ℤ)) :
                            convJet J ℓ A B = convJet J ℓ B A

                            Commutativity of truncated 2D convolution.

                            theorem Cslib.convJet_assoc (J ℓ : ℕ) (A B C : List (List ℤ)) :
                            convJet J ℓ (convJet J ℓ A B) C = convJet J ℓ A (convJet J ℓ B C)

                            Associativity of truncated 2D convolution.

                            theorem Cslib.convJet_addJet (J ℓ : ℕ) (A B C : List (List ℤ)) :
                            convJet J ℓ A (addJet J ℓ B C) = addJet J ℓ (convJet J ℓ A B) (convJet J ℓ A C)

                            Left distributivity of truncated 2D convolution over addition.

                            theorem Cslib.addJet_convJet (J ℓ : ℕ) (A B C : List (List ℤ)) :
                            convJet J ℓ (addJet J ℓ A B) C = addJet J ℓ (convJet J ℓ A C) (convJet J ℓ B C)

                            Right distributivity of truncated 2D convolution over addition.

                            theorem Cslib.zeroJet_convJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            convJet J ℓ (zeroJet J ℓ) A = zeroJet J ℓ
                            theorem Cslib.convJet_zeroJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            convJet J ℓ A (zeroJet J ℓ) = zeroJet J ℓ
                            theorem Cslib.constJet_convJet (J ℓ : ℕ) (c : ℤ) (A : List (List ℤ)) :
                            convJet J ℓ (constJet J ℓ c) A = smulJet J ℓ c A
                            theorem Cslib.convJet_constJet (J ℓ : ℕ) (A : List (List ℤ)) (c : ℤ) :
                            convJet J ℓ A (constJet J ℓ c) = smulJet J ℓ c A
                            theorem Cslib.constJet_one_convJet {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                            convJet J ℓ (constJet J ℓ 1) A = A
                            theorem Cslib.convJet_constJet_one {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                            convJet J ℓ A (constJet J ℓ 1) = A
                            theorem Cslib.smulJet_convJet (J ℓ : ℕ) (c : ℤ) (A B : List (List ℤ)) :
                            convJet J ℓ (smulJet J ℓ c A) B = smulJet J ℓ c (convJet J ℓ A B)
                            theorem Cslib.convJet_smulJet (J ℓ : ℕ) (c : ℤ) (A B : List (List ℤ)) :
                            convJet J ℓ A (smulJet J ℓ c B) = smulJet J ℓ c (convJet J ℓ A B)
                            theorem Cslib.shiftZJet_eq_convJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            shiftZJet J ℓ A = convJet J ℓ (zJet J ℓ) A

                            shiftZJet agrees with multiplying by the generator zJet under convJet.

                            theorem Cslib.shiftVJet_eq_convJet (J ℓ : ℕ) (A : List (List ℤ)) :
                            shiftVJet J ℓ A = convJet J ℓ (vJet J ℓ) A

                            shiftVJet agrees with multiplying by the generator vJet under convJet.

                            ℓ₁ coefficient norm and binary bit-length bounds #

                            The ℓ₁ coefficient norm ∑ |c| of a list of integer rows.

                            Instances For
                              theorem Cslib.jetL1Norm_tabulateTable (J ℓ : ℕ) (g : ℕ → ℕ → ℤ) :
                              jetL1Norm (tabulateTable J ℓ g) = ∑ j ∈ Finset.range J, ∑ u ∈ Finset.range ℓ, (g j u).natAbs
                              theorem Cslib.sum_rowEntry_natAbs_le_jetL1Norm (J ℓ : ℕ) (A : List (List ℤ)) :
                              ∑ j ∈ Finset.range J, ∑ u ∈ Finset.range ℓ, (rowEntry A j u).natAbs ≤ jetL1Norm A

                              Truncating any list of rows to (J, ℓ) cannot increase its ℓ₁ coefficient norm.

                              theorem Cslib.jetL1Norm_eq_sum_rowEntry {J ℓ : ℕ} {A : List (List ℤ)} (hA : IsTableShape J ℓ A) :
                              jetL1Norm A = ∑ j ∈ Finset.range J, ∑ u ∈ Finset.range ℓ, (rowEntry A j u).natAbs

                              On a (J, ℓ)-shaped jet array, jetL1Norm equals the sum of in-bounds |rowEntry A j u|.

                              @[simp]
                              theorem Cslib.jetL1Norm_zeroJet (J ℓ : ℕ) :
                              jetL1Norm (zeroJet J ℓ) = 0
                              theorem Cslib.jetL1Norm_addJet_le (J ℓ : ℕ) (A B : List (List ℤ)) :

                              Triangle inequality for the ℓ₁ coefficient norm under addJet.

                              theorem Cslib.jetL1Norm_subJet_le (J ℓ : ℕ) (A B : List (List ℤ)) :
                              theorem Cslib.jetL1Norm_smulJet_le (J ℓ : ℕ) (c : ℤ) (A : List (List ℤ)) :
                              theorem Cslib.jetL1Norm_convJet_le (J ℓ : ℕ) (A B : List (List ℤ)) :

                              Submultiplicativity of the ℓ₁ coefficient norm under truncated 2D convolution (OpenAI, The Exponential Time Hypothesis is False, Appendix B.2): ‖A * B mod (z^J, V^ℓ)‖₁ ≤ ‖A‖₁ · ‖B‖₁.

                              theorem Cslib.natAbs_le_jetL1Norm_of_mem {A : List (List ℤ)} {row : List ℤ} (hrow : row ∈ A) {z : ℤ} (hz : z ∈ row) :

                              Every stored entry of A has magnitude bounded by jetL1Norm A.

                              Every coefficient rowEntry A j u has magnitude bounded by jetL1Norm A.

                              theorem Cslib.natAbs_rowEntry_convJet_le_norm (J ℓ : ℕ) (A B : List (List ℤ)) (j u : ℕ) :

                              Magnitude bound on every entry of convJet in terms of input ℓ₁ norms.

                              theorem Cslib.length_encIntBin_mem_convJet_le_norm {J ℓ : ℕ} {A B : List (List ℤ)} {row : List ℤ} (hrow : row ∈ convJet J ℓ A B) {z : ℤ} (hz : z ∈ row) :

                              Encoded bit-length bound on every stored entry of convJet via input ℓ₁ norms.

                              theorem Cslib.natAbs_rowEntry_convJet_le {J ℓ MA MB : ℕ} {A B : List (List ℤ)} (hA : ∀ row ∈ A, ∀ z ∈ row, z.natAbs ≤ MA) (hB : ∀ row ∈ B, ∀ z ∈ row, z.natAbs ≤ MB) (j u : ℕ) :
                              (rowEntry (convJet J ℓ A B) j u).natAbs ≤ J * ℓ * (MA * MB)

                              Entrywise max-magnitude bound for convJet: if entries of A and B have magnitudes at most MA and MB, then every coefficient of convJet J ℓ A B has magnitude at most J * ℓ * (MA * MB).

                              theorem Cslib.size_natAbs_rowEntry_convJet_le {J ℓ bA bB : ℕ} {A B : List (List ℤ)} (hA : ∀ row ∈ A, ∀ z ∈ row, z.natAbs.size ≤ bA) (hB : ∀ row ∈ B, ∀ z ∈ row, z.natAbs.size ≤ bB) (j u : ℕ) :
                              (rowEntry (convJet J ℓ A B) j u).natAbs.size ≤ bA + bB + (J * ℓ).size

                              Binary magnitude-size bound for convJet: if stored entries of A and B have binary magnitude size at most bA and bB, then every coefficient of convJet J ℓ A B has binary magnitude size at most bA + bB + (J * ℓ).size.

                              theorem Cslib.length_encIntBin_mem_convJet_le {J ℓ bA bB : ℕ} {A B : List (List ℤ)} (hA : ∀ row ∈ A, ∀ z ∈ row, (Turing.MultiTapeTM.encIntBin z).length ≤ bA + 1) (hB : ∀ row ∈ B, ∀ z ∈ row, (Turing.MultiTapeTM.encIntBin z).length ≤ bB + 1) {row : List ℤ} (hrow : row ∈ convJet J ℓ A B) {z : ℤ} (hz : z ∈ row) :

                              Encoded bit-length bound for every stored entry of convJet: if stored entries of A and B have encIntBin length at most bA + 1 and bB + 1, then every stored entry of convJet J ℓ A B has encIntBin length at most bA + bB + (J * ℓ).size + 1.

                              Plain polynomial-time certificates #