Documentation

HexBerlekamp.RabinSoundness.RabinShape

Every prime-field residue is a root of xPowSubX 1: this is Fermat's little theorem packaged through the executable FpPoly evaluation.

Each prime-field linear factor X - C c divides xPowSubX 1.

The canonical prime-field product has size p + 1.

The canonical prime-field product is nonzero.

xPowSubX 1 has size p + 1.

The variable prime-field product identity: the canonical product over field constants equals xPowSubX 1.

Substituting w into xPowSubX 1 = X^p - X yields linearPow w p - w. This transport takes the variable identity primeFieldProduct_X_eq_xPowSubX to its witness-substituted form.

theorem Hex.Berlekamp.primeFieldProduct_witness_eq {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] (w : FpPoly p) :
List.foldl (fun (acc : FpPoly p) (c : ZMod64 p) => acc * (w - FpPoly.C c)) 1 (ZMod64.values p) = w.linearPow p - w

Substituting an arbitrary witness into the prime-field product identity.

Divisibility by w^p - w transports to the canonical witness product.

A polynomial of positive degree is not the unit polynomial.

If gcd(f, q) is a unit polynomial and g divides both f and q, then g is itself a unit polynomial.

Soundness of the executable Rabin test against the project-side FpPoly.Irreducible predicate.

The proof orchestrates the foundational lemmas above. The combinatorial shape (decomposing rabinTest, picking a monic irreducible factor of size strictly between 0 and n, handling through a maximal proper divisor, and contradicting the gcd leg) lives here. The heavy mathematical content (Rabin's degree theorem in both directions, finite-field factor existence, the absolute–modular Frobenius identity, and the xPowSubX divisibility chain) is delegated to the foundational lemmas above and in RabinCore.

Accepted executable irreducibility certificates imply project-side FpPoly.Irreducible, composing checkIrreducibilityCertificate_rabinTest with the Rabin soundness theorem above.

The kernel-reducible certificate checker also implies project-side FpPoly.Irreducible, composing the linear checker soundness theorem with Rabin soundness.

The incremental kernel-reducible certificate checker also implies project-side FpPoly.Irreducible.