Documentation

HexHenselMathlib.HenselLemmas

Coefficientwise executable congruence modulo m transfers to equality after mapping the corresponding Mathlib polynomials to ZMod m.

theorem HexHenselMathlib.hensel_correct (f g h : Hex.ZPoly) (p k : ) [Hex.ZMod64.Bounds p] [Hex.ZMod64.PrimeModulus p] (s t : Hex.FpPoly p) (hk : 1 k) (hp : 1 < p) (hprod : (g * h).congr f p) (hbez : (s * Hex.ZPoly.modP p g + t * Hex.ZPoly.modP p h).liftToZ.congr 1 p) (hmonic : Hex.DensePoly.Monic g) (hgdeg : 0 < Hex.DensePoly.natDegree g) :

The iterative executable lift gives a factorization of f over Mathlib polynomials modulo p^k.

The iterative executable lift extends the input factorization modulo p.

theorem HexHenselMathlib.hensel_degree (f g h : Hex.ZPoly) (p k : ) [Hex.ZMod64.Bounds p] [Hex.ZMod64.PrimeModulus p] (s t : Hex.FpPoly p) (hk : 1 k) (hp : 1 < p) (hprod : (g * h).congr f p) (hbez : (s * Hex.ZPoly.modP p g + t * Hex.ZPoly.modP p h).liftToZ.congr 1 p) (hmonic : Hex.DensePoly.Monic g) (hgdeg : 0 < Hex.DensePoly.natDegree g) :

The iterative executable lift preserves the Mathlib degree of the monic lifted factor.

Equality of Mathlib polynomial reductions modulo m gives the executable coefficientwise congruence used by Hex.ZPoly.

The executable monic predicate transfers to Mathlib's polynomial monic predicate.

theorem HexHenselMathlib.quadraticHenselStep_factor_correct (m : ) (f g h s t : Hex.ZPoly) (hm : 0 < m) (hprod : (g * h).congr f m) (hbez : (s * g + t * h).congr 1 m) (hmonic : Hex.DensePoly.Monic g) :

The quadratic executable step gives a Mathlib factorization modulo m*m. This is the Mathlib-facing form of Hex.ZPoly.quadraticHenselStep_factor_spec.

The quadratic executable step updates Bezout witnesses modulo m*m. This is the Mathlib-facing form of Hex.ZPoly.quadraticHenselStep_bezout_spec.

The quadratic step preserves monicity on the lifted g factor in Mathlib form.

The executable substrate (Hex.ZPoly.quadraticHenselStep_monic) requires 1 < m: at m = 1 every *ModSquare operation reduces modulo 1, collapsing the lifted factor to the zero polynomial, which is not monic. So the hypothesis is 1 < m.

theorem HexHenselMathlib.hensel_unique (f g h g' h' : Polynomial ) (p k : ) [Fact (Nat.Prime p)] (_hk : 0 < k) (hg : g.Monic) (hg' : g'.Monic) (hdeg : g.natDegree = g'.natDegree) (hprod : have φ := Int.castRingHom (ZMod (p ^ k)); Polynomial.map φ g * Polynomial.map φ h = Polynomial.map φ f) (hprod' : have φ := Int.castRingHom (ZMod (p ^ k)); Polynomial.map φ g' * Polynomial.map φ h' = Polynomial.map φ f) (hg1 : have φ := Int.castRingHom (ZMod p); Polynomial.map φ g = Polynomial.map φ g') (_hh1 : have φ := Int.castRingHom (ZMod p); Polynomial.map φ h = Polynomial.map φ h') (hcop : have φ := Int.castRingHom (ZMod p); IsCoprime (Polynomial.map φ g) (Polynomial.map φ h)) :

Coprime monic factorizations with the same reduction modulo p are unique modulo p^k.

The 0 < k hypothesis is part of the calling convention; the proof works for k = 0 too because ZMod 1 is the zero ring. The hh1 hypothesis is similarly redundant: the cancellation step uses hg1 to substitute g' for g mod p, which suffices in conjunction with hcop and the monic degree bound.

Quadratic lifting is compatible with the Mathlib uniqueness theorem at the doubled prime-power precision.

@[irreducible]

Guarded-tree split coprimality over ZPoly, stated directly on the integer polynomials (via their modP images) rather than on the FpPoly factors. This is the ZPoly-level analogue of QuadraticMultifactorCoprimeSplits used to transport arbitrary monic factor lists (as arise in the linear/quadratic agreement) into the balanced quadratic invariant.

Equations
Instances For
    theorem HexHenselMathlib.inv_of_ZCoprimeSplits (p k : ) [Hex.ZMod64.Bounds p] [Hex.ZMod64.PrimeModulus p] (f : Hex.ZPoly) (factors : List Hex.ZPoly) (hp : 1 < p) (hk : 1 k) (hfactors_monic : gfactors, Hex.DensePoly.Monic g) (hproduct : factors.toArray.polyProduct.congr f p) (hcop : ZCoprimeSplits p factors) (hne : factors []) :

    Build the guarded quadratic multifactor lift invariant from ZPoly-level boundary facts: monic factors, split coprimality (ZCoprimeSplits), and the lifted product congruence modulo p. No monic-target hypothesis is required; the balanced invariant constrains only the leading factor of each split, which is a product of the (monic) input factors.

    The linear multifactor invariant can initialise the quadratic multifactor invariant when every raw input head is monic.

    The linear and quadratic multifactor lifters agree modulo p ^ k after canonical reduction, when both are applied to the same input under the recursive MultifactorLiftInvariant precondition consumed by both Hex.ZPoly.multifactorLift_spec and Hex.ZPoly.multifactorLiftQuadratic_spec.

    The result is stated over the public array/product multifactor surface rather than the private split-tree helpers, and is expressed in Mathlib form via Polynomial.map (Int.castRingHom (ZMod (p ^ k))). Through zpoly_congr_toPolynomial_map_eq / zpoly_congr_of_toPolynomial_map_eq, this is equivalent to per-factor canonicalisation by Hex.ZPoly.reduceModPow _ p k.

    The raw-head monicity hypothesis hmonic is required: it pins each split head's Mathlib degree so hensel_unique can identify the linear and quadratic lifts. See multifactorLiftList_map_eq_quadratic for the congruent-target induction behind the proof.

    This proves the lift-uniqueness correspondence between the executable hex-hensel algorithms and their Mathlib polynomial interpretations.