Documentation

HexPolyZ.Mignotte

The floor of the square root of n.

Equations
Instances For

    The least natural number whose square is at least n.

    Equations
    Instances For

      The squared Euclidean norm of the coefficient vector of f.

      Equations
      Instances For

        A conservative natural-number upper bound on the Euclidean norm of the coefficient vector of f.

        Equations
        Instances For

          The executable Mignotte bound for the j-th coefficient of a degree-k factor of f, using the conservative Hex.ZPoly.coeffL2NormBound.

          Equations
          Instances For

            Uniform executable coefficient bound used by the default integer factorization entry point.

            It takes the maximum of the executable Mignotte coefficient bounds over every candidate factor degree up to f.natDegree and every coefficient index up to that degree.

            The compiled runtime uses the value-equal closed form below, registered through @[csimp], which computes the loop-invariant Hex.ZPoly.coeffL2NormBound once instead of recomputing the whole bignum coefficient norm inside every one of the O(deg^2) mignotteCoeffBound terms.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[simp]

              Base case of floorSqrt: the n = 0 guard fires before the Newton iteration, so floorSqrt 0 normalizes to 0.

              The square of floorSqrt n is at most n: it is a lower square root.

              @[simp]

              Base case of ceilSqrt: since floorSqrt 0 = 0 is a perfect square, ceilSqrt returns its floor branch, normalizing ceilSqrt 0 to 0.

              The square of Hex.ZPoly.ceilSqrt applied to n is at least n. This is the executable upper-square bound used by the Mignotte coefficient norm chain: in the perfect-square branch of the ceiling square root, equality holds; in the non-perfect-square branch, the bound follows from the Newton iterator invariant.

              Restates coeffNormSq f as the explicit foldl summing (f.coeff i).natAbs ^ 2 over the stored coefficient indices i < f.size.

              coeffL2NormBound f equals the ceiling square root of the squared coefficient norm coeffNormSq f.

              The executable Euclidean-norm bound has square at most twice the exact squared coefficient norm.

              mignotteCoeffBound f k j equals the product binom k j * coeffL2NormBound f of the binomial coefficient and the conservative coefficient-norm bound.

              theorem Hex.ZPoly.defaultFactorCoeffBound_eq (f : ZPoly) :
              f.defaultFactorCoeffBound = have degreeBound := DensePoly.natDegree f; List.foldl (fun (acc k : Nat) => List.foldl (fun (acc j : Nat) => max acc (f.mignotteCoeffBound k j)) acc (List.range (k + 1))) 0 (List.range (degreeBound + 1))

              Restates defaultFactorCoeffBound f as the nested foldl taking the maximum of mignotteCoeffBound f k j over factor degrees k up to f.natDegree and coefficient indices j up to k.

              @[simp]

              The zero polynomial has no stored coefficients, so the empty foldl defining coeffNormSq normalizes coeffNormSq 0 to 0.

              @[simp]

              Base case of the coefficient-norm bound: coeffNormSq 0 = 0 and ceilSqrt 0 = 0, so coeffL2NormBound 0 normalizes to 0.

              @[simp]

              Base case of the Mignotte coefficient bound: the conservative norm factor coeffL2NormBound 0 = 0 annihilates the product, so mignotteCoeffBound 0 k j normalizes to 0 for every degree k and index j.

              @[simp]

              Base case of the default factor coefficient bound: every entry of the nested maximum is mignotteCoeffBound 0 k j = 0, so defaultFactorCoeffBound 0 normalizes to 0.

              The executable Mignotte coefficient bound mignotteCoeffBound f k j vanishes when the coefficient index j exceeds the factor degree k.

              Every executable Mignotte coefficient bound within the ambient degree range is bounded by the default uniform factorization bound.

              The conservative coefficient-norm bound coeffL2NormBound f is at most the default uniform factor coefficient bound defaultFactorCoeffBound f.

              theorem Hex.ZPoly.defaultFactorCoeffBound_le (f : ZPoly) {B : Nat} (h : ∀ (k : Nat), k DensePoly.natDegree f∀ (j : Nat), j kf.mignotteCoeffBound k j B) :

              Upper-bound companion of mignotteCoeffBound_le_defaultFactorCoeffBound: if every executable Mignotte coefficient bound within the ambient degree range is at most B, then so is the default uniform factor coefficient bound.

              A nonzero integer polynomial has positive squared Euclidean coefficient norm: the last stored coefficient is nonzero and contributes a positive summand to the fold.

              A nonzero integer polynomial has positive conservative Euclidean coefficient-norm upper bound.

              A nonzero integer polynomial has positive uniform default factor coefficient bound.

              Consequently, f ≠ 0 gives B ≠ 0; together with p ≥ 2, it also gives the precision-modulus lower bound required by coefficient reconstruction.

              theorem Hex.ZPoly.binom_le_central {n k j : Nat} (hjk : j k) (hkn : k n) :
              Nat.binom k j Nat.binom n (n / 2)

              The binomial coefficient over the factor rectangle j ≤ k ≤ n is dominated by the central binomial of the top row: binom k j ≤ binom n (n / 2). This is the monotonicity that collapses the defaultFactorCoeffBound double max.

              Runtime implementation of defaultFactorCoeffBound: the closed-form central binomial times the single loop-invariant norm.

              Equations
              Instances For
                @[csimp]

                Register the value-equal closed form defaultFactorCoeffBoundImpl as the compiled implementation of defaultFactorCoeffBound. The @[csimp] swap is backed by the proof, so the runtime one-norm/one-binomial evaluation is verified equal to the O(deg^2) specification.