These are the human proofs of Zassenhaus algorithm, at full length.
The Zassenhaus algorithm returns the irreducible factorization full
This proof shows: correctness.
Let f∈Z[x] be primitive and square-free, of degree n≥1, with lc(f)>0. For a=∑aixi write ∥a∥1=∑∣ai∣, ∥a∥∞=max∣ai∣ and ∥a∥2=(∑ai2)1/2. For a=0 with complex roots α1,…,αm, the Mahler measure is M(a)=∣lc(a)∣∏imax(1,∣αi∣). A bar denotes reduction modulo p, and "a mods m" is the representative with coefficients in (−m/2,m/2].
Step 1: a good prime exists (line L1)
Since f is square-free over Q, gcd(f,f′)=1 in Q[x], so there are s,t∈Q[x] with sf+tf′=1. Multiply by a common denominator: s1f+t1f′=R with s1,t1∈Z[x] and an integer R=0. For a prime p∤Rlc(f), reduction gives sˉ1fˉ+tˉ1fˉ′=Rˉ=0, so gcd(fˉ,fˉ′)=1 and fˉ is square-free, of degree n. Only finitely many primes divide Rlc(f), so the search in line L1 stops.
Fix this p. Line L2 gives distinct monic irreducible u1,…,ur∈Fp[x] with fˉ=lc(f)u1⋯ur; they are pairwise coprime because fˉ is square-free.
Step 2: Hensel lifting (line L4)
Lemma 1 (one lifting step). Let F,g,h∈Z[x] with g monic, gcd(gˉ,hˉ)=1, and F≡gh(modpj) for some j≥1. Then there are a,b with dega<degg such that g∗=g+pja and h∗=h+pjb satisfy F≡g∗h∗(modpj+1).
Proof. Let e=(F−gh)/pj∈Z[x]. Let t∈Fp[x] with thˉ≡1(modgˉ), which exists as gcd(gˉ,hˉ)=1. Put aˉ=(eˉt)modgˉ, so aˉhˉ≡eˉ(modgˉ), and bˉ=(eˉ−aˉhˉ)/gˉ, an exact division. Lift aˉ,bˉ to a,b∈Z[x] with coefficients in [0,p). Then ah+bg≡e(modp) and
g∗h∗=gh+pj(ah+bg)+p2jab≡gh+pje=F(modpj+1),
because 2j≥j+1. □
g∗ is monic and g∗≡g, h∗≡h(modp), so the step can be repeated. The implementation applies it k−1 times to lc(f)u1⋯ur split as u1⋅(lc(f)u2⋯ur), then splits the second factor in the same way, and so on. Comparing leading coefficients, the last cofactor has leading coefficient ≡lc(f)(modpk), and dividing it by lc(f) modulo pk makes it monic. So line L4 returns monic v1,…,vr with vˉi=ui and
f≡lc(f)v1⋯vr(modpk).(1)
Lemma 2 (uniqueness). Let G,G∗ be monic and H,H∗∈Z[x] with Gˉ=Gˉ∗, Hˉ=Hˉ∗, gcd(Gˉ,Hˉ)=1 and GH≡G∗H∗(modpk). Then G≡G∗(modpk).
Proof. Suppose not, and let j<k be the largest integer such that pj divides both G∗−G and H∗−H; j≥1. Write G∗=G+pja, H∗=H+pjb; then dega<degG, as both are monic of the same degree. From G∗H∗−GH=pj(aH+bG)+p2jab≡0(modpj+1) we get aˉHˉ+bˉGˉ=0. So Gˉ divides aˉHˉ and hence aˉ, which has smaller degree; so aˉ=0. Then bˉGˉ=0 and Gˉ=0 is monic, so bˉ=0. Thus pj+1 divides both differences, against the choice of j. □
Step 3: the size bound
Lemma 3. (a) For nonzero a∈Z[x] of degree m, ∥a∥1≤2mM(a). (b) M(ab)=M(a)M(b), and M(a)≥∣lc(a)∣≥1 for nonzero a∈Z[x]. (c) M(a)≤∥a∥2.
Proof. (a) By Vieta's formulas, the coefficient of xm−i is ±lc(a)ei(α1,…,αm), and ∣ei∣≤(im)∏lmax(1,∣αl∣), since each of the (im) products of i roots has absolute value at most ∏lmax(1,∣αl∣). Summing over i gives 2mM(a). (b) The roots of ab are those of a and of b, and lc(ab)=lc(a)lc(b); the second claim holds as every factor max(1,∣α∣) is at least 1 and lc(a) is a nonzero integer. (c) This is Landau's inequality; see von zur Gathen and Gerhard, Section 6.6. □
Let B be an integer with B≥2nlc(f)∥f∥2; line L3 takes B=2nlc(f)(⌊∥f∥2⌋+1). Let k be such that pk>2B.
Corollary 4. Let F∈Z[x] divide f, and let F=hh′ in Z[x]. Then
Proof. By (a), the left side is at most ∣lc(h)lc(h′)∣lc(F)22degh+degh′M(h)M(h′)=∣lc(F)∣2degFM(F) by (b). Since F∣f, (b) gives M(F)≤M(f) and ∣lc(F)∣≤lc(f), and (c) gives M(f)≤∥f∥2; also degF≤n. For the second claim, ∥lc(F)F∥∞≤∣lc(F)∣∥F∥1≤∣lc(F)∣2degFM(F)≤B. □
Step 4: the recombination loop (lines L5 to L10)
For S⊆T write gS∗=lc(F)∏v∈Sv mods pk and hS∗=lc(F)∏v∈T∖Sv mods pk. Every factor h∈Z[x] of F has p∤lc(h), since lc(h)∣lc(f); so by unique factorization in Fp[x] there is a unique S(h)⊆T with hˉ=lc(h)∏v∈S(h)vˉ, and S(hh2)=S(h)⊔S(h2).
We show that the following hold each time line L6 is reached.
(I1) F is primitive, lc(F)>0, f=F∏g∈Gg, and F≡lc(F)∏v∈Tv(modpk); T is not empty.
(I2) Every g∈G is irreducible, primitive, with lc(g)>0.
(I3) Every irreducible factor h of F has ∣S(h)∣≥s.
At line L5 these hold by (1), with T={v1,…,vr}, G empty and s=1.
Completeness of the test. Let h be a primitive factor of F with lc(h)>0, h′=F/h, and S=S(h). Then gS∗=lc(h)lc(F)h. Indeed, F≡(∏Sv)⋅(lc(F)∏T∖Sv) by (I1), and also F=(lc(h)−1h)⋅(lc(h)h′) modulo pk, where lc(h)−1 is the inverse modulo pk. Both first factors are monic and reduce to ∏Svˉ, and the second factors reduce to the same polynomial and are coprime to it modulo p. Lemma 2 gives ∏Sv≡lc(h)−1h, so lc(F)∏Sv≡lc(h)lc(F)h(modpk). The right side has integer coefficients of absolute value at most B<pk/2 by Corollary 4, so it is the symmetric representative gS∗. In the same way hS∗=lc(h′)lc(F)h′. By Corollary 4, ∥gS∗∥1∥hS∗∥1≤B: the test of line L7 accepts S.
Soundness of the test. Let S pass the test, ∥gS∗∥1∥hS∗∥1≤B. By (I1), gS∗hS∗≡lc(F)F(modpk). Both sides have coefficients of absolute value at most B<pk/2: the left side because ∥ab∥∞≤∥a∥1∥b∥1, the right side by Corollary 4. So gS∗hS∗=lc(F)F. The leading coefficient of gS∗ is lc(F), because 0<lc(F)≤B<pk/2; the same holds for hS∗. By Gauss's lemma, pp(gS∗)pp(hS∗)=pp(lc(F)F)=F, with positive leading coefficients. Here deggS∗=∑v∈Sdegv≥1 and S(pp(gS∗))=S.
Line L8. If some S of size s passes, let g=pp(gS∗) and Fnew=pp(hS∗). Then F=gFnew, so f=Fnew⋅g⋅∏Gg′, the product over the old list G. Write hS∗=cFnew with c>0; c divides lc(F), so p∤c, and Fnew≡c−1lc(F)∏T∖Sv=lc(Fnew)∏T∖Sv(modpk). As ∣S∣=s≤∣T∣/2<∣T∣, the new T is not empty. So (I1) holds. For (I2), suppose g=h1h2 with h1,h2 not units; since g is primitive, both have degree at least 1, so S(h1) and S(h2) are nonempty and S(h1)⊔S(h2)=S. An irreducible factor of h1 is an irreducible factor of F with fewer than s elements in its subset, which contradicts (I3). So g is irreducible. (I3) still holds, because every factor of Fnew is a factor of F with the same subset.
Line L9. If no S of size s passes, then by completeness no irreducible factor h of F has ∣S(h)∣=s; with (I3), all have ∣S(h)∣≥s+1. So (I3) holds for s+1.
Termination. Each pass through the loop removes elements from T or increases s, and the loop runs only while 2s≤∣T∣≤r. So it stops.
The output (line L10). At the end 2s>∣T∣. Suppose F were reducible; then F=h1h2 with nonconstant primitive h1,h2, and S(h1)⊔S(h2)=T, so one of them, say S(h1), has at most ∣T∣/2<s elements. An irreducible factor of h1 then violates (I3). So F is irreducible; it is nonconstant because T is not empty and degF=∑v∈Tdegv. With (I1) and (I2), the output G followed by F is a list of irreducible primitive polynomials with positive leading coefficients and product f. By unique factorization in Z[x], it is the factorization of f. ■