Documentation

Complexity.Computability.PolyTime.ParityFactorEval

Beigel–Tarui parity-amplifier coefficients and staged factor jet evaluation #

Lemma 5.1 and Appendix B.1–B.2 of OpenAI, The Exponential Time Hypothesis is False expand $p_\ell(Y) = (1 - Y)^\ell \sum_{j < \ell} \binom{\ell + j - 1}{j} Y^j$ in powers of $h(Y) = Y (Y - 1)$ with linear remainders $a_{\ell, s} + b_{\ell, s} Y$, and evaluate a single parity-amplifier factor on a fixed-denominator $z$-jet cleared by $\Gamma = \Delta^{2 \ell - 1}$.

Coefficient $\ell_1$-norms and list/polynomial helpers #

The $\ell_1$-norm $\sum_i |c_i|$ of an integer coefficient list.

Instances For

    polyNorm1 of the empty coefficient list is 0.

    theorem Cslib.polyNorm1_cons (c : ℤ) (p : List ℤ) :

    polyNorm1 of c :: p adds c.natAbs to polyNorm1 p.

    polyNorm1 is additive across list concatenation.

    Reversing a coefficient list preserves polyNorm1.

    Taking a prefix does not increase polyNorm1.

    theorem Cslib.natAbs_mem_le_polyNorm1 {p : List ℤ} {z : ℤ} (hz : z ∈ p) :

    Every coefficient z ∈ p has z.natAbs ≤ polyNorm1 p.

    theorem Cslib.polyNorm1_le_length_mul {p : List ℤ} {B : ℕ} (h : ∀ z ∈ p, z.natAbs ≤ B) :

    Uniform entrywise magnitude bound B implies polyNorm1 p ≤ p.length * B.

    Bounding z.natAbs ≤ 2 ^ e bounds (encIntBin z).length ≤ e + 2.

    Univariate polynomial and 1D $z$-jet primitives #

    Addition of univariate integer polynomials represented by low-first coefficient lists.

    Instances For
      def Cslib.cauchyCoeff (p q : List ℤ) (k : ℕ) :

      The $k$-th Cauchy-product coefficient $\sum_{i \le k} p_i q_{k - i}$.

      Instances For
        def Cslib.mulZJet (J : ℕ) (u v : List ℤ) :

        1D truncated $z$-jet Cauchy product $(u \cdot v) \bmod z^J$ of length $J$.

        Instances For

          Multiplication of univariate integer polynomials represented by low-first coefficient lists.

          Instances For

            Single Horner-division step for monic division by $Y^2 - Y$.

            Instances For

              Monic division of p by $h(Y) = Y^2 - Y$ with linear remainder (a, b).

              Instances For
                theorem Cslib.getD_polyAdd (p q : List ℤ) (i : ℕ) :
                (polyAdd p q).getD i 0 = p.getD i 0 + q.getD i 0

                Entrywise getD specification of polyAdd.

                Triangle inequality for polyNorm1 of polyAdd.

                @[simp]
                theorem Cslib.length_mulZJet (J : ℕ) (u v : List ℤ) :
                (mulZJet J u v).length = J

                mulZJet J u v has length J.

                Below J, ofCoeffList (mulZJet J u v) has the same coefficients as ofCoeffList u * ofCoeffList v.

                theorem Cslib.getD_mulZJet_of_lt {J j : ℕ} (hj : j < J) (u v : List ℤ) :

                Coefficient specification of mulZJet on degree-$< J$ prefixes.

                Submultiplicativity of polyNorm1 under truncated $z$-jet multiplication mulZJet.

                Submultiplicativity of polyNorm1 under polyMul.

                @[simp]

                Quotient length invariant of divModByH.

                Linear remainder magnitude bound for divModByH ([OAI26c], Lemma B.1).

                Quotient $\ell_1$-norm bound for divModByH ([OAI26c], Lemma B.1).

                Beigel–Tarui parity-amplifier coefficients (parityLinearCoeffs) #

                Prefix-sum step mapping $v$ to $(\sum_{i \le j} v_i)_{j < |v|}$.

                Instances For

                  Degree-$< \ell$ Taylor inverse of $(1 - Y)^\ell$ modulo $Y^\ell$.

                  Instances For

                    Coefficient list of $(1 - Y)^\ell$.

                    Instances For

                      Coefficient list of $p_\ell(Y) = (1 - Y)^\ell \sum_{j < \ell} \binom{\ell + j - 1}{j} Y^j$.

                      Instances For

                        Single outer division step appending the linear remainder of divModByH.

                        Instances For

                          Executable Beigel–Tarui linear remainder table [(a_0, b_0), ..., (a_{ℓ-1}, b_{ℓ-1})] expanding $p_\ell(Y) = \sum_{s < \ell} (a_s + b_s Y) (Y (Y - 1))^s$.

                          Instances For

                            Integer evaluation of the Beigel–Tarui $(a_s, b_s)$ expansion in powers of $y (y - 1)$.

                            Instances For
                              theorem Cslib.ofCoeffList_parityPolyCoeffs {ℓ : ℕ} (hℓ : 1 ≤ ℓ) :

                              Polynomial specification of parityPolyCoeffs for $1 \le \ell$.

                              @[simp]

                              parityLinearCoeffs ℓ has length ℓ.

                              Exact $\mathbb{Z}[X]$ identity expanding $p_\ell(X)$ in powers of $X^2 - X$.

                              evalParityAmplifier ℓ y agrees with (Polynomial.parityAmplifier ℓ).eval y.

                              theorem Cslib.evalParityAmplifier_eq {ℓ : ℕ} (hℓ : 1 ≤ ℓ) (y : ℤ) :
                              evalParityAmplifier ℓ y = (1 - y) ^ ℓ * ∑ j ∈ Finset.range ℓ, ↑((ℓ + j - 1).choose j) * y ^ j

                              For $1 \le \ell$ and every integer $y$, the $(a_{\ell, s}, b_{\ell, s})$ expansion evaluates to $p_\ell(y) = (1 - y)^\ell \sum_{j < \ell} \binom{\ell + j - 1}{j} y^j$.

                              theorem Cslib.evalParityAmplifier_modEq {ℓ : ℕ} (hℓ : 1 ≤ ℓ) (y : ℤ) :

                              Beigel–Tarui parity amplification ([OAI26c], Lemma 5.1): for $1 \le \ell$ and every $y \in \mathbb{Z}$, $p_\ell(y) \equiv [2 \mid y] \pmod{2^\ell}$.

                              Magnitude and bit-length bounds for parityLinearCoeffs (Lemma B.1) #

                              theorem Cslib.natAbs_mem_parityLinearCoeffs_le {ℓ : ℕ} {ab : ℤ × ℤ} (hab : ab ∈ parityLinearCoeffs ℓ) :
                              ab.1.natAbs ≤ 2 ^ (7 * ℓ ^ 2) ∧ ab.2.natAbs ≤ 2 ^ (7 * ℓ ^ 2)

                              Coefficient magnitude bound ([OAI26c], Lemma B.1): every pair $(a_s, b_s)$ in parityLinearCoeffs ℓ has $|a_s|, |b_s| \le 2^{7 \ell^2}$.

                              Coefficient bit-length bound ([OAI26c], Lemma B.1): every coefficient in parityLinearCoeffs ℓ uses at most $7 \ell^2 + 2$ bits under encIntBin.

                              Staged fixed-denominator factor jet evaluation (evalParityFactorJet) #

                              def Cslib.truncZJet (J : ℕ) (u : List ℤ) :

                              Truncate or zero-pad a 1D integer $z$-jet to length $J$.

                              Instances For
                                def Cslib.powZJet (J : ℕ) (u : List ℤ) (s : ℕ) :

                                1D truncated $z$-jet power $u^s \bmod z^J$ of length $J$.

                                Instances For
                                  def Cslib.ParityFactorEval.colJet (J ℓ : ℕ) (Δ : ℤ) (yJet : List ℤ) (coeffs : List (ℤ × ℤ)) (hJet : List ℤ) (s : ℕ) :

                                  Column-$s$ cleared $z$-jet $\Delta^{2 (\ell - 1 - s)} (\Delta a_s + b_s Y) (Y (Y - \Delta))^s$ of length $J$.

                                  Instances For
                                    def Cslib.ParityFactorEval.cols (J ℓ : ℕ) (Δ : ℤ) (yJet : List ℤ) :

                                    Column list (colJet ... s)_{s < ℓ} for evalParityFactorJet.

                                    Instances For
                                      def Cslib.evalParityFactorJet (J ℓ : ℕ) (Δ : ℤ) (yJet : List ℤ) :

                                      Staged fixed-denominator parity-factor jet evaluation ([OAI26c], Appendix B.2): returns a $J \times \ell$ integer table (J rows of length ℓ) whose entry (j, s) (j < J, s < ℓ) is unconditionally (including when $\Delta = 0$) the $z^j$ coefficient of the homogenized integer polynomial $\Delta^{2 (\ell - 1 - s)} (\Delta a_s + b_s \widetilde{Y}(z)) (\widetilde{Y}(z) (\widetilde{Y}(z) - \Delta))^s \bmod z^J$ for $\widetilde{Y}(z) = \sum_{r < J} \text{yJet}[r] z^r$. When $\Delta \ne 0$, this equals the $z^j$ coefficient of $\Gamma \cdot (a_s + b_s Y(z)) (Y(z) (Y(z) - 1))^s \bmod z^J$ for $Y(z) = \Delta^{-1} \widetilde{Y}(z)$ and $\Gamma = \Delta^{2 \ell - 1}$ (see evalParityFactorJet_entry_cast_rat; for $\Delta = 0$, e.g. evalParityFactorJet 1 1 0 [1] = [[-1]], whereas the rational expression has $\Gamma = 0$).

                                      Instances For
                                        @[simp]
                                        theorem Cslib.length_truncZJet (J : ℕ) (u : List ℤ) :

                                        truncZJet J u has length J.

                                        @[simp]
                                        theorem Cslib.length_powZJet (J : ℕ) (u : List ℤ) (s : ℕ) :
                                        (powZJet J u s).length = J

                                        powZJet J u s has length J.

                                        theorem Cslib.isTableShape_evalParityFactorJet (J ℓ : ℕ) (Δ : ℤ) (yJet : List ℤ) :
                                        IsTableShape J ℓ (evalParityFactorJet J ℓ Δ yJet)

                                        evalParityFactorJet J ℓ Δ yJet has rectangular shape J × ℓ.

                                        theorem Cslib.coeff_eq_below_mul {P₁ P₂ Q₁ Q₂ : Polynomial ℤ} {J : ℕ} (h1 : ∀ i < J, P₁.coeff i = Q₁.coeff i) (h2 : ∀ i < J, P₂.coeff i = Q₂.coeff i) (j : ℕ) :
                                        j < J → (P₁ * P₂).coeff j = (Q₁ * Q₂).coeff j

                                        Polynomial multiplication preserves coefficient equality below degree J.

                                        theorem Cslib.getD_powZJet_of_lt {J j : ℕ} (hj : j < J) (u : List ℤ) (s : ℕ) :

                                        Coefficient specification of powZJet on degree-$< J$ prefixes.

                                        theorem Cslib.evalParityFactorJet_entry_eq_coeff {J ℓ j s : ℕ} (hj : j < J) (hs : s < ℓ) (Δ : ℤ) (yJet : List ℤ) :
                                        rowEntry (evalParityFactorJet J ℓ Δ yJet) j s = have ab := (parityLinearCoeffs ℓ).getD s (0, 0); have Y := Polynomial.ofCoeffList (List.take J yJet); (Polynomial.C (Δ ^ (2 * (ℓ - 1 - s))) * ((Polynomial.C (Δ * ab.1) + Polynomial.C ab.2 * Y) * (Y * (Y - Polynomial.C Δ)) ^ s)).coeff j

                                        Polynomial-in-$z$ specification of evalParityFactorJet modulo $z^J$.

                                        Stage-2 to Stage-3 bridge ([OAI26c], §5.4 and Appendix B.2): for every $j < J$ and all $\ell, s \in \mathbb{N}$, entry $(j, s)$ of evalParityFactorJet J ℓ Δ yJet equals the $z^j$ coefficient of the $V^s$ coefficient of Cslib.BitString.parityFactorCleared.

                                        theorem Cslib.evalParityFactorJet_entry_cast_rat {J ℓ j s : ℕ} (hℓ : 1 ≤ ℓ) (hj : j < J) (hs : s < ℓ) {Δ : ℤ} (hΔ : Δ ≠ 0) (yJet : List ℤ) :
                                        have ab := (parityLinearCoeffs ℓ).getD s (0, 0); have YQ := Polynomial.C (↑Δ)⁻¹ * Polynomial.map (Int.castRingHom ℚ) (Polynomial.ofCoeffList (List.take J yJet)); ↑(rowEntry (evalParityFactorJet J ℓ Δ yJet) j s) = (Polynomial.C (↑Δ ^ (2 * ℓ - 1)) * ((Polynomial.C ↑ab.1 + Polynomial.C ↑ab.2 * YQ) * (YQ * (YQ - 1)) ^ s)).coeff j

                                        Rational $z$-jet homogenization identity ([OAI26c], Appendix B.2) for $\Delta \ne 0$ and $Y_{\mathbb{Q}}(z) = \Delta^{-1} \widetilde{Y}(z) \in \mathbb{Q}[X]$.

                                        theorem Cslib.evalParityFactorJet_row_sum_cast_rat {J ℓ j : ℕ} (hℓ : 1 ≤ ℓ) (hj : j < J) {Δ : ℤ} (hΔ : Δ ≠ 0) (yJet : List ℤ) :

                                        Summing row $j < J$ of evalParityFactorJet ($V = 1$) gives the $z^j$ coefficient of $\Delta^{2 \ell - 1} p_\ell(Y_{\mathbb{Q}}(z))$ over $\mathbb{Q}[X]$.

                                        theorem Cslib.evalParityFactorJet_row_zero_entry {J ℓ s : ℕ} (hJ : 1 ≤ J) (hs : s < ℓ) (Δ y : ℤ) {yJet : List ℤ} (hy0 : yJet.getD 0 0 = Δ * y) :
                                        have ab := (parityLinearCoeffs ℓ).getD s (0, 0); rowEntry (evalParityFactorJet J ℓ Δ yJet) 0 s = Δ ^ (2 * ℓ - 1) * ((ab.1 + ab.2 * y) * (y * (y - 1)) ^ s)

                                        Constant-in-$z$ ($j = 0$) integer specialization when $\text{yJet}[0] = \Delta y$.

                                        theorem Cslib.evalParityFactorJet_row_zero_sum {J ℓ : ℕ} (hJ : 1 ≤ J) (Δ y : ℤ) {yJet : List ℤ} (hy0 : yJet.getD 0 0 = Δ * y) :
                                        ((evalParityFactorJet J ℓ Δ yJet).getD 0 []).sum = Δ ^ (2 * ℓ - 1) * evalParityAmplifier ℓ y

                                        Summing row $0$ when $\text{yJet}[0] = \Delta y$ gives $\Delta^{2 \ell - 1} p_\ell(y)$.

                                        Prefix $\ell_1$-norm and bit-length bounds for evalParityFactorJet (Appendix B.2) #

                                        truncZJet preserves the prefix $\ell_1$-norm.

                                        theorem Cslib.polyNorm1_powZJet_le (J : ℕ) (u : List ℤ) (s : ℕ) :

                                        Powering bound for powZJet under polyNorm1.

                                        theorem Cslib.jetL1Norm_evalParityFactorJet_le (J ℓ : ℕ) (Δ : ℤ) (yJet : List ℤ) :
                                        jetL1Norm (evalParityFactorJet J ℓ Δ yJet) ≤ ℓ * 2 ^ (7 * ℓ ^ 2) * (polyNorm1 (List.take J yJet) + Δ.natAbs + 2) ^ (2 * ℓ - 1)

                                        Total factor-table $\ell_1$-norm bound ([OAI26c], Appendix B.2, bound $B_1$).

                                        theorem Cslib.natAbs_row_take_sum_evalParityFactorJet_le {J ℓ : ℕ} {Δ : ℤ} {yJet r : List ℤ} (hr : r ∈ evalParityFactorJet J ℓ Δ yJet) (m : ℕ) :
                                        (List.take m r).sum.natAbs ≤ ℓ * 2 ^ (7 * ℓ ^ 2) * (polyNorm1 (List.take J yJet) + Δ.natAbs + 2) ^ (2 * ℓ - 1)

                                        Prefix-sum magnitude bound for every row of evalParityFactorJet ([OAI26c], Appendix B.2).

                                        theorem Cslib.length_encIntBin_evalParityFactorJet_le {J ℓ : ℕ} {Δ : ℤ} {yJet r : List ℤ} (hr : r ∈ evalParityFactorJet J ℓ Δ yJet) (m : ℕ) :
                                        (Turing.MultiTapeTM.encIntBin (List.take m r).sum).length ≤ 8 * ℓ ^ 2 + 2 * ℓ * (polyNorm1 (List.take J yJet) + Δ.natAbs + 2).size + 2 ∧ ∀ z ∈ r, (Turing.MultiTapeTM.encIntBin z).length ≤ 8 * ℓ ^ 2 + 2 * ℓ * (polyNorm1 (List.take J yJet) + Δ.natAbs + 2).size + 2

                                        Entry and row-prefix bit-length bound ([OAI26c], Appendix B.2): every entry and row prefix sum uses $O(\ell^2 + \ell \log(\|\widetilde{y}\|_1 + |\Delta| + 2))$ bits under encIntBin.

                                        Plain polynomial-time certificates (ComputableInPolyTime) #

                                        polyNorm1 l is bounded exponentially in (encList encIntBin l).length.

                                        Wrapping a binary integer into a singleton list is polynomial-time.