Output of one quadratic Hensel doubling step. The four fields package the
updated leading factor g (monic, the input g corrected modulo m^2), the
updated complementary factor h, and the updated Bezout witnesses s, t
satisfying s * g + t * h ≡ 1 (mod m^2).
- g : ZPoly
The updated monic factor.
- h : ZPoly
The updated complementary factor.
- s : ZPoly
The updated Bezout coefficient multiplying
g. - t : ZPoly
The updated Bezout coefficient multiplying
h.
Instances For
Canonical coefficient reduction modulo m^2.
Equations
Instances For
Residue f - g * h corrected by the factor update of the quadratic Hensel
step: starting from g * h ≡ f (mod m), this quantity is divisible by m and
its lift drives the first-order correction that achieves g' * h' ≡ f (mod m^2).
Equations
- Hex.QuadraticLiftResult.factorError f g h = f - g * h
Instances For
Runtime implementation of factorError: the same residual with the
product taken by Kronecker substitution (Hex.ZPoly.mulKronecker, value-equal
to the schoolbook product by Hex.ZPoly.mulKronecker_eq). The bignum Hensel
step is the only caller, and its g * h is the widest product in the lift.
Equations
- Hex.QuadraticLiftResult.factorErrorImpl f g h = f - g.mulKronecker h
Instances For
Register the Kronecker product as the compiled implementation of
factorError.
The working modulus m * m = m² of one quadratic Hensel doubling step.
Equations
- Hex.ZPoly.quadraticModulus m = m * m
Instances For
Reduce a single coefficient to its canonical residue modulo m².
Equations
Instances For
Polynomial sum f + g with every coefficient reduced modulo m².
Equations
- f.addModSquare g m = Hex.QuadraticLiftResult.reduceModSquare (f + g) m
Instances For
Polynomial difference f - g with every coefficient reduced modulo m².
Equations
- f.subModSquare g m = Hex.QuadraticLiftResult.reduceModSquare (f - g) m
Instances For
Polynomial product f * g with every coefficient reduced modulo m².
Public, unlike its sibling reductions, because its compiled implementation is
swapped by a @[csimp] theorem, and csimp lemmas must be public.
Equations
- f.mulModSquare g m = Hex.QuadraticLiftResult.reduceModSquare (f * g) m
Instances For
Runtime implementation of mulModSquare: the same reduced product
with the multiplication taken by Kronecker substitution. Eight of the nine
polynomial products in the bignum quadratic step go through this definition.
Equations
- f.mulModSquareImpl g m = Hex.QuadraticLiftResult.reduceModSquare (f.mulKronecker g) m
Instances For
Register the Kronecker product as the compiled implementation of
mulModSquare.
Modular multiplication by a single monomial. Kept as a separate specification so compiled division can avoid sending the monomial's leading zero coefficients through the generic schoolbook multiplier.
Equations
- Hex.ZPoly.mulMonomialModSquare k coeff q m = Hex.ZPoly.mulModSquare (Hex.DensePoly.monomial k coeff) q m
Instances For
Linear-time implementation of modular monomial multiplication.
Equations
- Hex.ZPoly.mulMonomialModSquareImpl k coeff q m = Hex.QuadraticLiftResult.reduceModSquare (Hex.DensePoly.shift k (Hex.DensePoly.scale coeff q)) m
Instances For
The shift-and-scale monomial kernel is exactly the generic modular product.
Proof-backed compiled implementation of modular monomial multiplication.
Fuel-driven long-division kernel returning the quotient/remainder of the
running rem by the monic divisor q, with all arithmetic reduced modulo m².
The Hensel theorem surface supplies monic divisors, so this exploits that
invariant to avoid coefficient division in the modular hot path.
Equations
- One or more equations did not get rendered due to their size.
- Hex.ZPoly.divModMonicModSquareAux m q 0 x✝¹ x✝ = (x✝¹, x✝)
Instances For
Quotient and remainder of p divided by the monic divisor q, working
modulo m², with the dividend size supplying the recursion fuel.
Public, unlike its Aux worker, because its compiled implementation is swapped
by a @[csimp] theorem, and csimp lemmas must be public.
Equations
Instances For
Windowed implementation of the modular monic division.
The windowed loop needs a monic divisor at a positive modulus -- the only shape the Hensel step ever divides by; every other input falls back to the specification loop, so the two agree on every input.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Proof-backed compiled implementation of the modular monic division.