Rabin's irreducibility test #
A polynomial f of degree d over a finite field F with q = |F| elements is irreducible
exactly when
f ∣ X^(q^d) - X, andfis coprime toX^(q^(d/ℓ)) - Xfor every primeℓ ∣ d.
The first condition says every irreducible factor of f has degree dividing d; the second
rules out all proper divisors of d as factor degrees, forcing f itself to be irreducible.
Both rest on the fundamental correspondence
Polynomial.irreducible_dvd_X_pow_sub_X_iff_natDegree_dvd from
CompPoly/Data/Polynomial/Frobenius.lean.
This generalizes irreducible_of_rabin_128_passed_over_GF2
(CompPoly/Fields/Binary/BF128Ghash/Basic.lean), which is the d = 128, F = GF(2)
specialization, to arbitrary degree over any finite field.
Main statements #
Polynomial.irreducible_of_rabin: the two conditions imply irreducibility.Polynomial.rabin_of_irreducible: the converse, so the test is exact.Polynomial.irreducible_iff_rabin: the resulting characterization.
All three take the field size as a numeral q with hcard : Fintype.card F = q; see "The shape
of these statements" below for why, and pass rfl if you have no numeral.
References #
- [Rabin80] Michael O. Rabin, Probabilistic Algorithms in Finite Fields, SIAM Journal on Computing 9(2), 1980.
If m is a proper divisor of a nonzero d, then m divides d / ℓ for some prime factor ℓ
of d.
This is the arithmetic core of Rabin's test: it is why checking the prime-index quotients
d / ℓ suffices to rule out every proper divisor of d.
The shape of these statements #
Each test below takes the field size as a numeral q together with hcard : Fintype.card F = q,
rather than reading it off as Fintype.card F, and substitutes it away internally. Both kinds of
caller are served: a concrete field supplies hcard as ZMod.card _ (or its own cardinality
lemma) and states its conditions at the numeral its certificates were generated for; a caller with
no numeral in hand passes rfl and gets the Fintype.card F statement back verbatim.
The alternative — stating the conditions at Fintype.card F and having concrete callers cast each
one with rw [hcard] — is what this shape exists to rule out. Such a cast leaves an Eq.mpr
transport around a certificate argument whose type carries a huge exponent (X ^ (q ^ d)), and a
kernel replay from an empty environment need not follow the same normalization path the elaborator
took: one such transport has been observed to send the kernel into
Polynomial.pow → npowRec → Nat.rec, unfolding the power one exponent step at a time until the
deep-recursion guard fired. Since there is only one form of each statement, that cast has no
occasion to appear. docs/wiki/field-extensions.md records the history, and
CompPoly/Data/Polynomial/RabinCertificate.lean packages these tests at concrete degrees.
Rabin's irreducibility test (soundness).
If a degree-d polynomial f over a finite field with q elements divides X^(q^d) - X and is
coprime to X^(q^(d/ℓ)) - X for every prime ℓ ∣ d, then f is irreducible.
Rabin's irreducibility test (completeness).
An irreducible polynomial of degree d satisfies both Rabin conditions.
Rabin's irreducibility test. For a polynomial of positive degree d over a finite field
with q elements, irreducibility is equivalent to the two Rabin conditions.