Documentation

CslibFrontier.Foundations.Data.ZMod.PolynomialRoots

Root counts of polynomials over ZMod n #

Over a field, a nonzero polynomial has at most natDegree roots (Polynomial.card_roots'). Over ZMod n with composite n it can have many more: (n / p) * X vanishes on every multiple of a prime p ∣ n. This file proves the general bound: a nonzero f : (ZMod n)[X] has at most f.natDegree * (n / n.minFac) roots. The proof writes an integer lift of f as p ^ j * G for a prime p ∣ n such that G is nonzero modulo p, and counts the residues of ZMod n above the at most f.natDegree roots of G in ZMod p.

Main results #

theorem ZMod.card_filter_castHom_eq {n d : ℕ} [NeZero n] (hd : d ∣ n) (r : ZMod d) :
{x : ZMod n | (castHom hd (ZMod d)) x = r}.card = n / d

Reducing ZMod n modulo a divisor d has fibres of size exactly n / d. The fibre over 0 is ZMod.card_filter_dvd_val; the others are its translates.

theorem ZMod.card_filter_eval_eq_zero_le {n : ℕ} [NeZero n] {f : Polynomial (ZMod n)} (hf : f ≠ 0) :
{x : ZMod n | Polynomial.eval x f = 0}.card ≤ f.natDegree * (n / n.minFac)

Root bound over ZMod n. A nonzero polynomial f over ZMod n has at most f.natDegree * (n / n.minFac) roots. For prime n this is the usual bound f.natDegree.

theorem Nat.minFac_mul_pow {p q ζ : ℕ} (hp : Prime p) (hq : Prime q) (hpq : p < q) (hζ : ζ ≠ 0) :
((p * q) ^ ζ).minFac = p

For primes p < q and ζ ≠ 0, the smallest prime factor of (p * q) ^ ζ is p.