Documentation

HexGF2.Irreducibility

@[instance_reducible]

Decidable equality on packed GF(2) polynomials, derived from the underlying Array UInt64 representation. The wf field is a Prop, so its proofs are irrelevant for the structural comparison.

Equations
  • One or more equations did not get rendered due to their size.
@[instance_reducible]

Boolean equality on packed GF(2) polynomials, computed by decide on the decidable propositional equality.

Equations

instBEq is lawful: its boolean equality agrees with propositional equality in both directions, via of_decide_eq_true and decide_eq_true.

Square a polynomial modulo f.

Equations
Instances For

    Iterated squaring k times starting from X mod f, computing X^(2^k) mod f over the packed GF(2) representation.

    Equations
    Instances For
      @[simp]

      The zeroth Rabin Frobenius power is X reduced modulo f.

      @[simp]
      theorem Hex.GF2Poly.xpow2kMod_succ (f : GF2Poly) (k : Nat) :
      f.xpow2kMod (k + 1) = f.sqMod (f.xpow2kMod k)

      The next Rabin Frobenius power is obtained by squaring the previous remainder modulo f.

      The polynomial X^(2^k) - X reduced modulo f. Since the packed representation is over characteristic two, subtraction collapses to addition.

      Equations
      Instances For

        Positive divisors of n strictly below n, listed in ascending order.

        Equations
        Instances For

          The maximal proper divisors of n: those proper divisors not strictly below any other proper divisor of n.

          Equations
          Instances For

            true exactly when g is a nonzero constant polynomial.

            Equations
            Instances For

              The divisibility leg of Rabin's criterion: f divides X^(2^n) - X, with n = deg(f), exactly when the reduced remainder vanishes.

              Equations
              Instances For

                The gcd leg of Rabin's criterion at a single maximal proper divisor d.

                Equations
                Instances For

                  Per-divisor Rabin gcd outcomes for downstream factorization use.

                  Equations
                  Instances For
                    @[simp]

                    Checking all stored Rabin witnesses is the same as checking the Rabin coprime test over every maximal proper divisor.

                    Rabin's executable irreducibility test: f must be nonconstant, divide X^(2^n) - X, and be coprime to X^(2^d) - X for every maximal proper divisor d of n = deg(f).

                    Equations
                    Instances For

                      Bezout evidence that one Rabin gcd leg is coprime.

                      • left : GF2Poly

                        Cofactor multiplying f in the Bezout identity left * f + right * (X^(2^d) - X mod f) = 1.

                      • right : GF2Poly

                        Cofactor multiplying the Rabin gcd leg in the Bezout identity left * f + right * (X^(2^d) - X mod f) = 1.

                      Instances For

                        Self-describing certificate data for Rabin irreducibility checking.

                        The bezout array is indexed in the same order as maximalProperDivisors n. Each witness proves coprimality of f and X^(2^d) - X mod f by the executable identity left * f + right * (X^(2^d) - X mod f) = 1.

                        Instances For

                          Read the certified X^(2^k) mod f witness, if present.

                          Equations
                          Instances For
                            @[simp]

                            Certificate pow witnesses are backed directly by the pow-chain array.

                            Read the Bezout witness for the i-th maximal proper divisor, if present.

                            Equations
                            Instances For
                              @[simp]

                              Certificate Bezout witnesses are backed directly by the Bezout array.

                              The Rabin difference polynomial represented by a certificate pow-chain entry. Equivalently powWitness + (X mod f) since char 2 collapses subtraction to addition.

                              Equations
                              Instances For

                                Check that a certificate's pow chain matches the executable iteration xpow2kMod. The first entry must equal X mod f, and each subsequent entry must equal the squaring step sqMod f of the previous.

                                Equations
                                Instances For

                                  Check one Bezout witness for a Rabin maximal-proper-divisor leg.

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

                                    Check all Bezout witnesses against maximalProperDivisors cert.n.

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

                                      Executable checker for a Rabin irreducibility certificate.

                                      It validates the self-described n, recomputes every pow-chain entry, checks the divisibility leg X^(2^n) ≡ X mod f, and verifies each Bezout identity for the maximal proper divisors of n.

                                      Consumer-facing soundness target: checkIrreducibilityCertificate_imp_irreducible in HexGF2/RabinSoundness.lean lifts a true outcome to GF2Poly.Irreducible f.

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

                                        Linear-time pow-chain check: each entry must be the squaring step of the previous, with the first entry equal to X mod f.

                                        This is logically equivalent to checkPowChain but uses only O(n) squarings during kernel reduction, where checkPowChain recomputes xpow2kMod f k from scratch for each k and is O(n^2). The linear form is intended for kernel-reducible decide checks on certificates whose modulus has degree comparable to a few machine words.

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

                                          Linear-time variant of checkIrreducibilityCertificate. The only difference is that it uses checkPowChainLinear for the pow-chain leg.

                                          Consumer-facing soundness target: checkIrreducibilityCertificateLinear_imp_irreducible in HexGF2/RabinSoundness.lean lifts a true outcome to GF2Poly.Irreducible f.

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

                                            The executable Rabin divisibility test is definitionally the zero-remainder test for X^(2^deg f) - X modulo f.

                                            theorem Hex.GF2Poly.checkPowChain_spec (f : GF2Poly) (cert : IrreducibilityCertificate) :
                                            f.checkPowChain cert = true∀ (k : Nat), k cert.ncert.powChain[k]? = some (f.xpow2kMod k)

                                            A successful quadratic pow-chain check certifies every stored X^(2^k) mod f value up to the certificate degree.

                                            The executable certificate checker is sound against the parallel rabinTest Bool predicate.

                                            The irreducibility-level theorem is provided in HexGF2/RabinSoundness.lean as checkIrreducibilityCertificate_imp_irreducible.

                                            A successful linear pow-chain check certifies every stored X^(2^k) mod f value up to the certificate degree.

                                            A successful linear irreducibility certificate checker implies the executable Rabin test succeeds.