The floor of the square root of n.
Equations
- Hex.ZPoly.floorSqrt n = if n = 0 then 0 else Hex.ZPoly.sqrtAux✝ n (2 * n.log2 + 1) n
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
- f.coeffNormSq = List.foldl (fun (acc i : Nat) => acc + (Hex.DensePoly.coeff f i).natAbs ^ 2) 0 (List.range (Hex.DensePoly.size f))
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
- f.mignotteCoeffBound k j = Hex.Nat.binom k j * f.coeffL2NormBound
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
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.
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.
The zero polynomial has no stored coefficients, so the empty foldl
defining coeffNormSq normalizes coeffNormSq 0 to 0.
Base case of the coefficient-norm bound: coeffNormSq 0 = 0 and
ceilSqrt 0 = 0, so coeffL2NormBound 0 normalizes to 0.
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.
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.
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.
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
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.