Motivation
Factoring a polynomial with rational coefficients into irreducible factors is one of the basic tasks of computer algebra. Before 1982 the standard method (Berlekamp's algorithm modulo a small prime, Hensel lifting, then recombination of the p-adic factors, as in Zassenhaus's approach) could take exponential time, because the number of ways to recombine modular factors grows exponentially with the number of factors. A. K. Lenstra, H. W. Lenstra, Jr. and L. Lovász gave the first deterministic polynomial-time algorithm for factoring primitive polynomials in Z[X] (Math. Ann. 261, 1982). Its key idea is to replace recombination by a search for a short vector in a lattice, and the lattice basis reduction algorithm introduced for that purpose (the LLL algorithm) has since become a standard tool in number theory, cryptanalysis and integer programming.
Section 2 of the paper, Factors and Lattices, is the bridge between the two halves: it shows that an irreducible factor of f can be read off from a reduced basis of a lattice built from a p-adic factor of f. This mission formalizes that section.
Timeline. Mignotte (1974) bounded the coefficients of a factor of an integer polynomial in terms of the polynomial itself. A. K. Lenstra (Mathematisch Centrum report IW 190/81, 1981, Theorem 2) proved the weaker statement that, under the same conditions, a short lattice vector has a nontrivial gcd with f. LLL (1982) proved the sharper Propositions (2.7), (2.13) and (2.16) used here, which pin down the irreducible factor h0 itself.
Setting
For g=∑iaiXi with real coefficients, the length of g is ∣g∣=(∑iai2)1/2. For a positive integer q, (gmodq) is the polynomial over Z/qZ obtained by reducing every coefficient modulo q.
Throughout, p is a prime number, k a positive integer, and f∈Z[X] a polynomial of degree n>0. A polynomial h∈Z[X] is fixed with
- (2.1) h has leading coefficient 1;
- (2.2) (hmodpk) divides (fmodpk) in (Z/pkZ)[X];
- (2.3) (hmodp) is irreducible in Fp[X];
- (2.4) (hmodp)2 does not divide (fmodp) in Fp[X].
Write l=degh, so 0<l≤n. Proposition (2.5) shows that f has an irreducible factor h0∈Z[X] with (hmodp)∣(h0modp), unique up to sign; this is the factor the section recovers.
Fix an integer m≥l. The lattice L is the set of polynomials g∈Z[X] of degree at most m such that (hmodpk) divides (gmodpk). Identifying ∑i=0maiXi with (a0,…,am)∈Rm+1, L is a lattice of rank m+1 with basis {pkXi:0≤i<l}∪{hXj:0≤j≤m−l} and determinant pkl.
A basis b1,…,bm+1 of L is reduced if its Gram–Schmidt data bi∗, μij=(bi,bj∗)/(bj∗,bj∗) satisfy ∣μij∣≤21 for j<i and ∣bi∗+μii−1bi−1∗∣2≥43∣bi−1∗∣2 for 1<i≤m+1.
Formalization targets
Goal: Proposition (2.16)
Assume
(2.14)pkl>2mn/2(m2m)n/2∣f∣m+n,
that b1,…,bm+1 is a reduced basis of L, and that some j satisfies
(2.17)∣bj∣<(pkl/∣f∣m)1/n.
If t is the largest such j, then
degh0=m+1−t,h0=gcd(b1,…,bt),
and (2.17) holds for all 1≤j≤t.
Milestones
- (2.5): existence and uniqueness of h0, and for g∣f the equivalence of (hmodp)∣(gmodp), (hmodpk)∣(gmodpk) and h0∣g.
- (2.11): inside the proof of (2.7), the elements of M={λf+μb} of degree below e+l lie in pkZ[X].
- (2.7): if b∈L and pkl>∣f∣m∣b∣n then h0∣b.
- Mignotte's bound: a divisor g of f with degg≤m has ∣g∣≤(m2m)1/2∣f∣.
- (2.13): under (2.14), degh0≤m if and only if ∣b1∣<(pkl/∣f∣m)1/n.
- (2.18): #J≤m+1−degh1 for linearly independent bj divisible by h1.
- (2.19): if degh0≤m, then {1,…,m+1−degh0}⊂J.
Companion items: the basis of L and d(L)=pkl (2.6), and the remark that for t=1 the vector b1 is itself an irreducible factor of f.
Significance
Proposition (2.16) is what makes the factoring algorithm of Sect. 3 correct: running the reduction for increasing m, the first m for which (2.15) holds produces h0 by one gcd computation, and repeating on f/h0 factors f completely. Together with the polynomial running time of basis reduction (missions I and II of this series), it yields the polynomial-time factoring theorem (3.6). Proposition (2.7) on its own is a general principle, often reused: a polynomial that is divisible by h modulo pk and has small norm relative to pkl must share the factor h0 with f.
All results here are proved in the paper and standard in textbooks (e.g. von zur Gathen and Gerhard, Modern Computer Algebra). To our knowledge there is no machine-checked proof of (2.7), (2.13) or (2.16) in Lean or Mathlib. Mathlib has Hensel-type lemmas and the Mahler measure, including a coefficient-wise Mignotte bound and Landau's inequality, but not the ℓ2 form of Mignotte's bound used here, nor any of the lattice statements. A Lean development of this section would be the algebraic core of a verified LLL factoring theorem.
Difficulty
The obvious argument for (2.7) is to bound the resultant of f and b: it is divisible by pkl when they share a factor modulo pk, and bounded by ∣f∣m∣b∣n by Hadamard. That argument gives only gcd(f,b)=1, the weaker version of [8], not that h0 divides b. The paper's sharper statement needs a lattice M of combinations λf+μb, the projection to its top coefficients, and the congruence argument (2.11) that forces the low-degree elements of M into pkZ[X]; formalizing it requires determinant and Hadamard bounds for a lattice of rank n+m′−2e inside a space of polynomials.
Mignotte's ℓ2 bound needs the Mahler measure and the inequality ∣g∣≤(d2d)1/2M(g), which is not the coefficient-wise form available in Mathlib. The step (2.19) needs Proposition (1.12) on reduced bases, which is the goal of mission I. The final part of (2.16) needs the primitivity of the basis vectors, which depends on L being exactly the set of multiples of h modulo pk of degree at most m.
Formalization scope
Polynomials are Polynomial ℤ; (gmodq) is g.map (Int.castRingHom (ZMod q)); ∣g∣ is the square root of the sum of the squares of the coefficients over the support. Degrees are natDegree, except in (2.11), where degree with values in WithBot ℕ keeps deg0=−∞ as on the page. A polynomial of degree at most m is identified with its coefficient vector in EuclideanSpace ℝ (Fin (m + 1)). Linear independence of b1,…,bm+1 is over R on coefficient vectors; "basis for L" means in L, independent, and spanning L over Z. Gram–Schmidt vectors are Mathlib's unnormalised InnerProductSpace.gramSchmidt.
Indices are 0-based: the paper's b1 is b 0. The index t of (2.16) is kept as the paper's 1-based value, 1≤t≤m+1, so degh0=m+1−t appears unchanged. The powers 2mn/2, (m2m)n/2, (m2m)1/2 and (⋅)1/n are real powers with real exponents.
The standing assumptions are hypotheses of every item that involves p, k or h: p prime, k≥1, degf>0, (2.1)–(2.4), m≥l. Mignotte's bound (which assumes only f=0) and (2.18) (pure linear algebra on polynomials of degree at most m) do not need them. The factor h0 is any irreducible h0∈Z[X] with h0∣f and (hmodp)∣(h0modp). A gcd is stated by its universal property (divides each, and every common divisor divides it), which determines it up to sign. Two milestones are stated slightly more generally than the page: Mignotte's bound for every divisor of degree at most m, and (2.18) for every nonzero common divisor h1.
The goal does not assume (2.7), (2.13), Mignotte's bound, (2.18) or (2.19); these are milestones. A trivial formalization in which h0 is an arbitrary divisor of f, or in which "reduced basis" is asserted of a family that need not be a basis of L, is ruled out by the definitions.
Needed infrastructure: Hensel-type arguments over Z/pkZ, Gauss's lemma, the Mahler measure, Hadamard's inequality, and Proposition (1.12) on reduced bases. The lattice determinant results and the ℓ2 Mignotte bound are reusable beyond this mission. Proofs of any milestone are welcome, as are proofs of the missing Mathlib infrastructure.
Selected references
- A. K. Lenstra, H. W. Lenstra, Jr., L. Lovász, Factoring polynomials with rational coefficients, Math. Ann. 261 (1982), 515–534. https://doi.org/10.1007/BF01457454
- M. Mignotte, An inequality about factors of polynomials, Math. Comp. 28 (1974), 1153–1157 (reference [10] of the paper).
- D. E. Knuth, The Art of Computer Programming, Vol. 2, Seminumerical Algorithms, Addison-Wesley, 1981, Exercise 4.6.2.20 (reference [7] of the paper).
- A. K. Lenstra, Lattices and factorization of polynomials, Report IW 190/81, Mathematisch Centrum, Amsterdam, 1981 (reference [8] of the paper; its Theorem 2 is the weaker form of (2.7)).
- J. von zur Gathen, J. Gerhard, Modern Computer Algebra, 3rd ed., Cambridge University Press, 2013, Ch. 16 (textbook treatment).