Documentation

HexBerlekampZassenhausMathlib.WordCld

Coefficient cast of an executable integer polynomial into ZMod m.toNat[X].

Equations
Instances For

    Coefficient cast of an executable WordMod polynomial into ZMod m.toNat[X].

    Equations
    Instances For
      @[simp]

      Coefficient rule for the integer-polynomial cast cZ.

      @[simp]

      Coefficient rule for the WordMod-polynomial cast cW.

      theorem HexBerlekampZassenhausMathlib.cZ_mul (m : UInt64) (f g : Hex.ZPoly) :
      cZ m (f * g) = cZ m f * cZ m g

      cZ is multiplicative.

      theorem HexBerlekampZassenhausMathlib.cZ_add (m : UInt64) (f g : Hex.ZPoly) :
      cZ m (f + g) = cZ m f + cZ m g

      cZ is additive.

      theorem HexBerlekampZassenhausMathlib.cW_mul {m : UInt64} (ctx : MontCtx m) (a b : Hex.DensePoly (Hex.WordMod ctx)) :
      cW ctx (a * b) = cW ctx a * cW ctx b

      cW is multiplicative.

      theorem HexBerlekampZassenhausMathlib.cW_add {m : UInt64} (ctx : MontCtx m) (a b : Hex.DensePoly (Hex.WordMod ctx)) :
      cW ctx (a + b) = cW ctx a + cW ctx b

      cW is additive.

      theorem HexBerlekampZassenhausMathlib.eq_of_cZ_eq {m : UInt64} (x y : Hex.ZPoly) (hx : ∀ (i : ), 0 Hex.DensePoly.coeff x i Hex.DensePoly.coeff x i < m.toNat) (hy : ∀ (i : ), 0 Hex.DensePoly.coeff y i Hex.DensePoly.coeff y i < m.toNat) (h : cZ m x = cZ m y) :
      x = y

      Canonical-representative uniqueness: two integer polynomials with all coefficients in [0, m) that are congruent mod m coefficientwise are equal.

      Monic division commutes with a coefficient ring hom, in the target T[X]: the mapped executable quotient is the Mathlib monic-division quotient of the mapped inputs. Uniqueness (div_modByMonic_unique) does the work; the caller supplies the transported monic/degree facts.

      theorem HexBerlekampZassenhausMathlib.intCast_intModNat (c : ) (M : ) (hM : 0 < M) :
      (Hex.ZPoly.intModNat c M) = c

      The canonical natural representative intModNat casts back to the original residue in ZMod M.

      The word-mapped executable image toW = ofNat ∘ intModNat.

      Equations
      Instances For
        theorem HexBerlekampZassenhausMathlib.cW_toWMap_eq_cZ {m : UInt64} (ctx : MontCtx m) (x : Hex.ZPoly) :
        cW ctx (toWMap ctx x) = cZ m x

        cW of the toW-mapped image of an integer polynomial equals cZ of the original.

        theorem HexBerlekampZassenhausMathlib.cZ_reduceModPow {m : UInt64} {p a : } (hpos : 0 < m.toNat) (hm : m.toNat = p ^ a) (x : Hex.ZPoly) :
        cZ m (x.reduceModPow p a) = cZ m x

        Reduction mod p^a vanishes under the ZMod (p^a) cast.

        The ZMod cast commutes with the executable derivative.

        The ZMod cast of a word-modular polynomial commutes with the executable derivative.

        theorem HexBerlekampZassenhausMathlib.powLtWordAux_eq (p n acc r : ) :
        Hex.powLtWordAux p n acc = some rr = acc * p ^ n

        A successful powLtWordAux run computes acc * p ^ n.

        A successful powLtWordAux run stays below the word bound.

        theorem HexBerlekampZassenhausMathlib.powLtWord?_eq {p a mval : } (h : Hex.powLtWord? p a = some mval) :
        mval = p ^ a mval < UInt64.word

        A successful powLtWord? guard certifies both the power value and the word bound.

        Executable degree comparison transports to Mathlib degree comparison.

        The natural representative of an integer residue is below a positive modulus.

        theorem HexBerlekampZassenhausMathlib.cldQuotientModWord?_eq (f g : Hex.ZPoly) (p a : ) (hg : Hex.DensePoly.Monic g) (hgdeg : 0 < Hex.DensePoly.natDegree g) {mval : } (hpow : Hex.powLtWord? p a = some mval) (hodd : UInt64.ofNat mval % 2 = 1) (hm1 : 1 < mval) :

        Word-sized and arbitrary-precision logarithmic-derivative quotients agree when the modulus fits.

        The word-sized selection in cldQuotientMod agrees with the bignum reference cldQuotientModBignum for every input: the guard exactly matches the hypotheses of cldQuotientModWord?_eq, so on the fast path the word quotient is byte-identical and Option.getD returns it; off the fast path the bignum branch is taken.