Documentation

HexBerlekampMathlib.Irreducibility

The executable Berlekamp basis size is the Mathlib natural degree after transport. This is the algorithm-facing specialization of the representation theorem natDegree_toMathlibPolynomial.

An executable unit polynomial (a nonzero constant) transports to a Mathlib unit.

Transport executable FpPoly.Irreducible to Mathlib Irreducible over ZMod p.

The positive Mathlib-degree hypothesis is essential: FpPoly.Irreducible holds vacuously for any nonzero constant (every factorization has a degree-0 factor), whereas such a constant transports to a Mathlib unit, not an irreducible. At the Berlekamp use site the emitted factors are nonconstant, so the hypothesis is available.

A passing executable gcd-unit check transports to Mathlib coprimality of the transported polynomials, via the executable Bezout identity.

@[reducible, inline]

The Mathlib polynomial X^(p^n) - X used by Rabin's divisibility leg.

Equations
Instances For

    The Rabin finite-field degree lemma in the local ZMod p form used by the contrapositive proof.

    theorem HexBerlekampMathlib.Rabin.irreducible_dvd_of_not_isCoprime {p : } [Fact (Nat.Prime p)] {g P : Polynomial (ZMod p)} (hg_irreducible : Irreducible g) (hnot_coprime : ¬IsCoprime g P) :
    g P

    For an irreducible polynomial, any nontrivial gcd/coprimality failure with P forces divisibility by P.

    The Rabin backward direction in the local ZMod p form: every irreducible polynomial of degree dividing N divides X^(p^N) - X.

    Used by the contrapositive direction of rabinTest_true_irreducible to lift divisibility of an irreducible factor g from the basis-size Frobenius polynomial down to the Frobenius polynomial at a maximal proper divisor.

    Maximal proper divisors are positive.

    Maximal proper divisors are strictly below the ambient degree.

    The executable Rabin test passing entails the exact Mathlib divisibility and coprimality checks appearing in Rabin's criterion.

    The Mathlib Rabin checks imply the executable test surface once the transport lemmas connect executable remainders and gcds to Polynomial (ZMod p).

    Executable gcd is associated to Mathlib's gcd after coefficient transport.

    toMathlibPolynomial = fpPolyEquiv is a ring iso, so executable divisibility transports both ways; feeding the executable GcdLaws through it shows the transported gcd satisfies Mathlib's gcd universal property. The two are only associated, not equal, because the executable gcd is the last nonzero xgcd remainder with no monic rescale while Mathlib's gcd is normalize-canonical.

    The executable square-free hypothesis used by Berlekamp is the corresponding Mathlib coprimality condition between the transported polynomial and its formal derivative.

    A factor with positive executable degree transports to a Mathlib polynomial of positive natDegree: its leading coefficient is nonzero and the (injective) coefficient transport preserves that, so the top coefficient survives.

    Every factor emitted by executable Berlekamp factorization on a positive-degree input is irreducible after transport to Mathlib's polynomial model, assuming the square-free input in the common-divisor form used by the executable soundness chain. The positive-degree input hypothesis is essential: emitted factors of a constant input are themselves constant, transporting to Mathlib units rather than irreducibles.

    Every factor emitted by executable Berlekamp factorization is irreducible after transport to Mathlib's polynomial model.

    If executable Berlekamp factorization cannot split a monic square-free input, then the input itself is irreducible after transport to Mathlib.

    The executable factor list is never empty; with length at most one, its head is therefore a member of the Berlekamp output, so the existing per-emitted-factor irreducibility theorem applies directly.

    Forward Rabin soundness: when the executable Rabin test accepts, the transported Mathlib polynomial is irreducible.

    Rabin's executable test is equivalent to Mathlib irreducibility for the transported polynomial.

    @[instance_reducible]

    Monicity of an executable finite-field polynomial is decidable: Monic m is the equality leadingCoeff m = 1, and ZMod64 p has decidable equality. This is the instance that lets the Bool-valued fpIsIrreducible branch on monicity and still reduce in the kernel.

    Equations

    Computable, kernel-reducible irreducibility test for finite-field polynomials, backed by Berlekamp.rabinTest on the monic normalization.

    Zero inputs are rejected; every nonzero f normalizes to a monic polynomial (normalizeMonic f).2 whose Rabin test decides irreducibility. decide +kernel reduces this test in the kernel, so via fpIsIrreducible_iff and instDecidableIrreducibleToMathlibPolynomial it certifies Irreducible (toMathlibPolynomial f) using only the kernel.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The computable Rabin-backed test agrees with Mathlib irreducibility of the transported polynomial over ZMod p.

      For nonzero f the monic normalization m = (normalizeMonic f).2 is a unit multiple of f (f = leadingCoeff f • m up to C), so irreducibility of toMathlibPolynomial m and of toMathlibPolynomial f coincide; rabin_irreducible supplies the former for the monic m (also in the constant case, where both the Rabin test and Mathlib irreducibility are false).

      @[instance_reducible]

      Mathlib irreducibility of a transported finite-field polynomial is decidable by a kernel-reducible computation: decide +kernel runs fpIsIrreducible (hence Berlekamp.rabinTest) in the kernel and reads off the verdict.

      Equations