Algorithm Search⌘K

Proofs: Zassenhaus algorithm

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]f \in \mathbb{Z}[x] be primitive and square-free, of degree n≥1n \ge 1, with lc⁡(f)>0\operatorname{lc}(f) > 0. For a=∑aixia = \sum a_i x^i write ∥a∥1=∑∣ai∣\|a\|_1 = \sum |a_i|, ∥a∥∞=max⁡∣ai∣\|a\|_\infty = \max |a_i| and ∥a∥2=(∑ai2)1/2\|a\|_2 = (\sum a_i^2)^{1/2}. For a≠0a \ne 0 with complex roots α1,…,αm\alpha_1, \ldots, \alpha_m, the Mahler measure is M(a)=∣lc⁡(a)∣∏imax⁡(1,∣αi∣)\mathrm{M}(a) = |\operatorname{lc}(a)| \prod_i \max(1, |\alpha_i|). A bar denotes reduction modulo pp, and "aa mods mm" is the representative with coefficients in (−m/2,m/2](-m/2, m/2].

Step 1: a good prime exists (line L1)

Since ff is square-free over Q\mathbb{Q}, gcd⁡(f,f′)=1\gcd(f, f') = 1 in Q[x]\mathbb{Q}[x], so there are s,t∈Q[x]s, t \in \mathbb{Q}[x] with sf+tf′=1s f + t f' = 1. Multiply by a common denominator: s1f+t1f′=Rs_1 f + t_1 f' = R with s1,t1∈Z[x]s_1, t_1 \in \mathbb{Z}[x] and an integer R≠0R \ne 0. For a prime p∤Rlc⁡(f)p \nmid R \operatorname{lc}(f), reduction gives sˉ1fˉ+tˉ1fˉ′=Rˉ≠0\bar s_1 \bar f + \bar t_1 \bar f' = \bar R \ne 0, so gcd⁡(fˉ,fˉ′)=1\gcd(\bar f, \bar f') = 1 and fˉ\bar f is square-free, of degree nn. Only finitely many primes divide Rlc⁡(f)R \operatorname{lc}(f), so the search in line L1 stops.

Fix this pp. Line L2 gives distinct monic irreducible u1,…,ur∈Fp[x]u_1, \ldots, u_r \in \mathbb{F}_p[x] with fˉ=lc⁡(f)‾ u1⋯ur\bar f = \overline{\operatorname{lc}(f)}\, u_1 \cdots u_r; they are pairwise coprime because fˉ\bar f is square-free.

Step 2: Hensel lifting (line L4)

Lemma 1 (one lifting step). Let F,g,h∈Z[x]F, g, h \in \mathbb{Z}[x] with gg monic, gcd⁡(gˉ,hˉ)=1\gcd(\bar g, \bar h) = 1, and F≡gh(modpj)F \equiv g h \pmod{p^j} for some j≥1j \ge 1. Then there are a,ba, b with deg⁡a<deg⁡g\deg a < \deg g such that g∗=g+pjag^* = g + p^j a and h∗=h+pjbh^* = h + p^j b satisfy F≡g∗h∗(modpj+1)F \equiv g^* h^* \pmod{p^{j+1}}.

Proof. Let e=(F−gh)/pj∈Z[x]e = (F - gh)/p^j \in \mathbb{Z}[x]. Let t∈Fp[x]t \in \mathbb{F}_p[x] with thˉ≡1(modgˉ)t \bar h \equiv 1 \pmod{\bar g}, which exists as gcd⁡(gˉ,hˉ)=1\gcd(\bar g, \bar h) = 1. Put aˉ=(eˉt) mod gˉ\bar a = (\bar e t) \bmod \bar g, so aˉhˉ≡eˉ(modgˉ)\bar a \bar h \equiv \bar e \pmod {\bar g}, and bˉ=(eˉ−aˉhˉ)/gˉ\bar b = (\bar e - \bar a \bar h) / \bar g, an exact division. Lift aˉ,bˉ\bar a, \bar b to a,b∈Z[x]a, b \in \mathbb{Z}[x] with coefficients in [0,p)[0, p). Then ah+bg≡e(modp)a h + b g \equiv e \pmod p and

g∗h∗=gh+pj(ah+bg)+p2jab≡gh+pje=F(modpj+1),g^* h^* = g h + p^j (a h + b g) + p^{2j} a b \equiv g h + p^j e = F \pmod{p^{j+1}},

because 2j≥j+12j \ge j + 1. □\square

g∗g^* is monic and g∗≡gg^* \equiv g, h∗≡h(modp)h^* \equiv h \pmod p, so the step can be repeated. The implementation applies it k−1k - 1 times to lc⁡(f)u1⋯ur\operatorname{lc}(f) u_1 \cdots u_r split as u1⋅(lc⁡(f)u2⋯ur)u_1 \cdot (\operatorname{lc}(f) u_2 \cdots u_r), then splits the second factor in the same way, and so on. Comparing leading coefficients, the last cofactor has leading coefficient ≡lc⁡(f)(modpk)\equiv \operatorname{lc}(f) \pmod {p^k}, and dividing it by lc⁡(f)\operatorname{lc}(f) modulo pkp^k makes it monic. So line L4 returns monic v1,…,vrv_1, \ldots, v_r with vˉi=ui\bar v_i = u_i and

f≡lc⁡(f) v1⋯vr(modpk).(1)f \equiv \operatorname{lc}(f)\, v_1 \cdots v_r \pmod {p^k}. \tag{1}

Lemma 2 (uniqueness). Let G,G∗G, G^* be monic and H,H∗∈Z[x]H, H^* \in \mathbb{Z}[x] with Gˉ=Gˉ∗\bar G = \bar G^*, Hˉ=Hˉ∗\bar H = \bar H^*, gcd⁡(Gˉ,Hˉ)=1\gcd(\bar G, \bar H) = 1 and GH≡G∗H∗(modpk)G H \equiv G^* H^* \pmod{p^k}. Then G≡G∗(modpk)G \equiv G^* \pmod{p^k}.

Proof. Suppose not, and let j<kj < k be the largest integer such that pjp^j divides both G∗−GG^* - G and H∗−HH^* - H; j≥1j \ge 1. Write G∗=G+pjaG^* = G + p^j a, H∗=H+pjbH^* = H + p^j b; then deg⁡a<deg⁡G\deg a < \deg G, as both are monic of the same degree. From G∗H∗−GH=pj(aH+bG)+p2jab≡0(modpj+1)G^* H^* - G H = p^j(a H + b G) + p^{2j} a b \equiv 0 \pmod {p^{j+1}} we get aˉHˉ+bˉGˉ=0\bar a \bar H + \bar b \bar G = 0. So Gˉ\bar G divides aˉHˉ\bar a \bar H and hence aˉ\bar a, which has smaller degree; so aˉ=0\bar a = 0. Then bˉGˉ=0\bar b \bar G = 0 and Gˉ≠0\bar G \ne 0 is monic, so bˉ=0\bar b = 0. Thus pj+1p^{j+1} divides both differences, against the choice of jj. □\square

Step 3: the size bound

Lemma 3. (a) For nonzero a∈Z[x]a \in \mathbb{Z}[x] of degree mm, ∥a∥1≤2mM(a)\|a\|_1 \le 2^m \mathrm{M}(a). (b) M(ab)=M(a)M(b)\mathrm{M}(ab) = \mathrm{M}(a)\mathrm{M}(b), and M(a)≥∣lc⁡(a)∣≥1\mathrm{M}(a) \ge |\operatorname{lc}(a)| \ge 1 for nonzero a∈Z[x]a \in \mathbb{Z}[x]. (c) M(a)≤∥a∥2\mathrm{M}(a) \le \|a\|_2.

Proof. (a) By Vieta's formulas, the coefficient of xm−ix^{m-i} is ±lc⁡(a) ei(α1,…,αm)\pm \operatorname{lc}(a)\, e_i(\alpha_1, \ldots, \alpha_m), and ∣ei∣≤(mi)∏lmax⁡(1,∣αl∣)|e_i| \le \binom{m}{i} \prod_l \max(1, |\alpha_l|), since each of the (mi)\binom{m}{i} products of ii roots has absolute value at most ∏lmax⁡(1,∣αl∣)\prod_l \max(1, |\alpha_l|). Summing over ii gives 2mM(a)2^m \mathrm{M}(a). (b) The roots of abab are those of aa and of bb, and lc⁡(ab)=lc⁡(a)lc⁡(b)\operatorname{lc}(ab) = \operatorname{lc}(a)\operatorname{lc}(b); the second claim holds as every factor max⁡(1,∣α∣)\max(1, |\alpha|) is at least 11 and lc⁡(a)\operatorname{lc}(a) is a nonzero integer. (c) This is Landau's inequality; see von zur Gathen and Gerhard, Section 6.6. □\square

Let BB be an integer with B≥2nlc⁡(f)∥f∥2B \ge 2^n \operatorname{lc}(f) \|f\|_2; line L3 takes B=2nlc⁡(f)(⌊∥f∥2⌋+1)B = 2^n \operatorname{lc}(f) (\lfloor \|f\|_2 \rfloor + 1). Let kk be such that pk>2Bp^k > 2B.

Corollary 4. Let F∈Z[x]F \in \mathbb{Z}[x] divide ff, and let F=hh′F = h h' in Z[x]\mathbb{Z}[x]. Then

∥lc⁡(F)lc⁡(h)h∥1⋅∥lc⁡(F)lc⁡(h′)h′∥1≤2deg⁡F∣lc⁡(F)∣ M(F)≤B,∥lc⁡(F)F∥∞≤B.\Big\| \tfrac{\operatorname{lc}(F)}{\operatorname{lc}(h)} h \Big\|_1 \cdot \Big\| \tfrac{\operatorname{lc}(F)}{\operatorname{lc}(h')} h' \Big\|_1 \le 2^{\deg F} |\operatorname{lc}(F)|\, \mathrm{M}(F) \le B, \qquad \|\operatorname{lc}(F) F\|_\infty \le B.

Proof. By (a), the left side is at most lc⁡(F)2∣lc⁡(h)lc⁡(h′)∣2deg⁡h+deg⁡h′M(h)M(h′)=∣lc⁡(F)∣ 2deg⁡FM(F)\frac{\operatorname{lc}(F)^2}{|\operatorname{lc}(h) \operatorname{lc}(h')|} 2^{\deg h + \deg h'} \mathrm{M}(h)\mathrm{M}(h') = |\operatorname{lc}(F)|\, 2^{\deg F} \mathrm{M}(F) by (b). Since F∣fF \mid f, (b) gives M(F)≤M(f)\mathrm{M}(F) \le \mathrm{M}(f) and ∣lc⁡(F)∣≤lc⁡(f)|\operatorname{lc}(F)| \le \operatorname{lc}(f), and (c) gives M(f)≤∥f∥2\mathrm{M}(f) \le \|f\|_2; also deg⁡F≤n\deg F \le n. For the second claim, ∥lc⁡(F)F∥∞≤∣lc⁡(F)∣∥F∥1≤∣lc⁡(F)∣2deg⁡FM(F)≤B\|\operatorname{lc}(F) F\|_\infty \le |\operatorname{lc}(F)| \|F\|_1 \le |\operatorname{lc}(F)| 2^{\deg F} \mathrm{M}(F) \le B. □\square

Step 4: the recombination loop (lines L5 to L10)

For S⊆TS \subseteq T write gS∗=lc⁡(F)∏v∈Svg^*_S = \operatorname{lc}(F) \prod_{v \in S} v mods pkp^k and hS∗=lc⁡(F)∏v∈T∖Svh^*_S = \operatorname{lc}(F) \prod_{v \in T \setminus S} v mods pkp^k. Every factor h∈Z[x]h \in \mathbb{Z}[x] of FF has p∤lc⁡(h)p \nmid \operatorname{lc}(h), since lc⁡(h)∣lc⁡(f)\operatorname{lc}(h) \mid \operatorname{lc}(f); so by unique factorization in Fp[x]\mathbb{F}_p[x] there is a unique S(h)⊆TS(h) \subseteq T with hˉ=lc⁡(h)‾∏v∈S(h)vˉ\bar h = \overline{\operatorname{lc}(h)} \prod_{v \in S(h)} \bar v, and S(hh2)=S(h)⊔S(h2)S(h h_2) = S(h) \sqcup S(h_2).

We show that the following hold each time line L6 is reached.

  • (I1) FF is primitive, lc⁡(F)>0\operatorname{lc}(F) > 0, f=F∏g∈Ggf = F \prod_{g \in G} g, and F≡lc⁡(F)∏v∈Tv(modpk)F \equiv \operatorname{lc}(F) \prod_{v \in T} v \pmod {p^k}; TT is not empty.
  • (I2) Every g∈Gg \in G is irreducible, primitive, with lc⁡(g)>0\operatorname{lc}(g) > 0.
  • (I3) Every irreducible factor hh of FF has ∣S(h)∣≥s|S(h)| \ge s.

At line L5 these hold by (1), with T={v1,…,vr}T = \{v_1, \ldots, v_r\}, GG empty and s=1s = 1.

Completeness of the test. Let hh be a primitive factor of FF with lc⁡(h)>0\operatorname{lc}(h) > 0, h′=F/hh' = F/h, and S=S(h)S = S(h). Then gS∗=lc⁡(F)lc⁡(h)hg^*_S = \frac{\operatorname{lc}(F)}{\operatorname{lc}(h)} h. Indeed, F≡(∏Sv)⋅(lc⁡(F)∏T∖Sv)F \equiv \big(\prod_S v\big) \cdot \big(\operatorname{lc}(F) \prod_{T \setminus S} v\big) by (I1), and also F=(lc⁡(h)−1h)⋅(lc⁡(h)h′)F = \big(\operatorname{lc}(h)^{-1} h\big) \cdot \big(\operatorname{lc}(h) h'\big) modulo pkp^k, where lc⁡(h)−1\operatorname{lc}(h)^{-1} is the inverse modulo pkp^k. Both first factors are monic and reduce to ∏Svˉ\prod_S \bar v, and the second factors reduce to the same polynomial and are coprime to it modulo pp. Lemma 2 gives ∏Sv≡lc⁡(h)−1h\prod_S v \equiv \operatorname{lc}(h)^{-1} h, so lc⁡(F)∏Sv≡lc⁡(F)lc⁡(h)h(modpk)\operatorname{lc}(F) \prod_S v \equiv \frac{\operatorname{lc}(F)}{\operatorname{lc}(h)} h \pmod{p^k}. The right side has integer coefficients of absolute value at most B<pk/2B < p^k/2 by Corollary 4, so it is the symmetric representative gS∗g^*_S. In the same way hS∗=lc⁡(F)lc⁡(h′)h′h^*_S = \frac{\operatorname{lc}(F)}{\operatorname{lc}(h')} h'. By Corollary 4, ∥gS∗∥1∥hS∗∥1≤B\|g^*_S\|_1 \|h^*_S\|_1 \le B: the test of line L7 accepts SS.

Soundness of the test. Let SS pass the test, ∥gS∗∥1∥hS∗∥1≤B\|g^*_S\|_1 \|h^*_S\|_1 \le B. By (I1), gS∗hS∗≡lc⁡(F)F(modpk)g^*_S h^*_S \equiv \operatorname{lc}(F) F \pmod {p^k}. Both sides have coefficients of absolute value at most B<pk/2B < p^k / 2: the left side because ∥ab∥∞≤∥a∥1∥b∥1\|a b\|_\infty \le \|a\|_1 \|b\|_1, the right side by Corollary 4. So gS∗hS∗=lc⁡(F)Fg^*_S h^*_S = \operatorname{lc}(F) F. The leading coefficient of gS∗g^*_S is lc⁡(F)\operatorname{lc}(F), because 0<lc⁡(F)≤B<pk/20 < \operatorname{lc}(F) \le B < p^k/2; the same holds for hS∗h^*_S. By Gauss's lemma, pp⁡(gS∗)pp⁡(hS∗)=pp⁡(lc⁡(F)F)=F\operatorname{pp}(g^*_S)\operatorname{pp}(h^*_S) = \operatorname{pp}(\operatorname{lc}(F) F) = F, with positive leading coefficients. Here deg⁡gS∗=∑v∈Sdeg⁡v≥1\deg g^*_S = \sum_{v \in S} \deg v \ge 1 and S(pp⁡(gS∗))=SS(\operatorname{pp}(g^*_S)) = S.

Line L8. If some SS of size ss passes, let g=pp⁡(gS∗)g = \operatorname{pp}(g^*_S) and Fnew=pp⁡(hS∗)F_{\text{new}} = \operatorname{pp}(h^*_S). Then F=gFnewF = g F_{\text{new}}, so f=Fnew⋅g⋅∏Gg′f = F_{\text{new}} \cdot g \cdot \prod_{G} g', the product over the old list GG. Write hS∗=cFnewh^*_S = c F_{\text{new}} with c>0c > 0; cc divides lc⁡(F)\operatorname{lc}(F), so p∤cp \nmid c, and Fnew≡c−1lc⁡(F)∏T∖Sv=lc⁡(Fnew)∏T∖Sv(modpk)F_{\text{new}} \equiv c^{-1} \operatorname{lc}(F) \prod_{T \setminus S} v = \operatorname{lc}(F_{\text{new}}) \prod_{T \setminus S} v \pmod{p^k}. As ∣S∣=s≤∣T∣/2<∣T∣|S| = s \le |T|/2 < |T|, the new TT is not empty. So (I1) holds. For (I2), suppose g=h1h2g = h_1 h_2 with h1,h2h_1, h_2 not units; since gg is primitive, both have degree at least 11, so S(h1)S(h_1) and S(h2)S(h_2) are nonempty and S(h1)⊔S(h2)=SS(h_1) \sqcup S(h_2) = S. An irreducible factor of h1h_1 is an irreducible factor of FF with fewer than ss elements in its subset, which contradicts (I3). So gg is irreducible. (I3) still holds, because every factor of FnewF_{\text{new}} is a factor of FF with the same subset.

Line L9. If no SS of size ss passes, then by completeness no irreducible factor hh of FF has ∣S(h)∣=s|S(h)| = s; with (I3), all have ∣S(h)∣≥s+1|S(h)| \ge s + 1. So (I3) holds for s+1s + 1.

Termination. Each pass through the loop removes elements from TT or increases ss, and the loop runs only while 2s≤∣T∣≤r2s \le |T| \le r. So it stops.

The output (line L10). At the end 2s>∣T∣2s > |T|. Suppose FF were reducible; then F=h1h2F = h_1 h_2 with nonconstant primitive h1,h2h_1, h_2, and S(h1)⊔S(h2)=TS(h_1) \sqcup S(h_2) = T, so one of them, say S(h1)S(h_1), has at most ∣T∣/2<s|T|/2 < s elements. An irreducible factor of h1h_1 then violates (I3). So FF is irreducible; it is nonconstant because TT is not empty and deg⁡F=∑v∈Tdeg⁡v\deg F = \sum_{v \in T} \deg v. With (I1) and (I2), the output GG followed by FF is a list of irreducible primitive polynomials with positive leading coefficients and product ff. By unique factorization in Z[x]\mathbb{Z}[x], it is the factorization of ff. ■\blacksquare

Back to Zassenhaus algorithm