Documentation

CompPoly.Fields.Extension.Bridge

Bridging Ext P to AdjoinRoot P.poly #

The computable coefficient-vector arithmetic of CompPoly/Fields/Extension/Defs.lean is related to its specification AdjoinRoot f by

toQuot x = ∑ i, algebraMap F _ (x.coeff i) * root ^ i,

which is shown to be an injective ring homomorphism. The ring axioms on Ext P are then discharged by pushing through toQuot rather than proved on coordinates.

The load-bearing lemma is toQuot_shiftReduce: shiftReduce is "multiply by X, reduce mod f", and correspondingly toQuot (shiftReduce e) = rt * toQuot e. Everything about multiplication follows from it: monomialMod k = X^k mod f satisfies toQuot (monomialMod k) = rt ^ k by a one-line induction, and toQuot_mul is then a direct double sum with no case analysis on wrap-around.

Main definitions and statements #

Bijectivity, cardinality and the Field structure are in CompPoly/Fields/Extension/Field.lean.

The specification of the extension: the quotient ring F[X] / f.

Instances For
    noncomputable def CompPoly.Extension.Ext.rt {F : Type u_1} [Field F] (P : ExtensionParams F) :

    The image of X in the quotient, i.e. the adjoined root of f.

    Instances For

      The degree of the defining polynomial, as a WithBot.

      noncomputable def CompPoly.Extension.Ext.toQuot {F : Type u_1} [Field F] {P : ExtensionParams F} (x : Ext P) :

      The map from coefficient vectors to the quotient ring.

      Instances For

        toQuot is additive #

        @[simp]
        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_add {F : Type u_1} [Field F] {P : ExtensionParams F} (x y : Ext P) :
        (x + y).toQuot = x.toQuot + y.toQuot
        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_neg {F : Type u_1} [Field F] {P : ExtensionParams F} (x : Ext P) :
        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_sub {F : Type u_1} [Field F] {P : ExtensionParams F} (x y : Ext P) :
        (x - y).toQuot = x.toQuot - y.toQuot
        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_smul {F : Type u_1} [Field F] {P : ExtensionParams F} (c : F) (x : Ext P) :
        @[simp]

        Only the constant coefficient of 1 is nonzero, so toQuot 1 collapses to 1.

        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_natCast {F : Type u_1} [Field F] {P : ExtensionParams F} (n : ) :
        (↑n).toQuot = n
        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_intCast {F : Type u_1} [Field F] {P : ExtensionParams F} (n : ) :
        (↑n).toQuot = n

        Injectivity #

        theorem CompPoly.Extension.Ext.toQuot_eq_mk {F : Type u_1} [Field F] {P : ExtensionParams F} (x : Ext P) :
        x.toQuot = (AdjoinRoot.mk P.poly) (∑ i : Fin P.d, Polynomial.C (x.coeff i) * Polynomial.X ^ i)

        toQuot as the class of an explicit degree-< d polynomial representative.

        theorem CompPoly.Extension.Ext.toQuot_inj {F : Type u_1} [Field F] {P : ExtensionParams F} {x y : Ext P} :
        x.toQuot = y.toQuot x = y

        The defining relation and the multiply-by-X homomorphism law #

        theorem CompPoly.Extension.Ext.toQuot_rangeForm {F : Type u_1} [Field F] {P : ExtensionParams F} (x : Ext P) :
        x.toQuot = kFinset.range P.d, (algebraMap F (AdjoinRoot P.poly)) (x.coeffNat k) * rt P ^ k

        toQuot as a sum over Finset.range, using the total coeffNat. Convenient for the shift reindexing in toQuot_shiftReduce.

        theorem CompPoly.Extension.Ext.rt_relation {F : Type u_1} [Field F] {P : ExtensionParams F} :
        rt P ^ P.d + i : Fin P.d, (algebraMap F (AdjoinRoot P.poly)) (P.lowerCoeff i) * rt P ^ i = 0

        The defining relation, from AdjoinRoot.mk_self: the adjoined root rt satisfies rt ^ d + ∑ lowerᵢ · rt ^ i = 0.

        In range form: ∑_{m < d} lowerₘ · rt ^ m = -rt ^ d.

        theorem CompPoly.Extension.Ext.coeffNat_shiftReduce {F : Type u_1} [Field F] {P : ExtensionParams F} (e : Ext P) {m : } (h : m < P.d) :
        e.shiftReduce.coeffNat m = (if m = 0 then 0 else e.coeffNat (m - 1)) - e.coeffNat (P.d - 1) * P.lowerCoeffNat m

        The coefficient formula for shiftReduce, in coeffNat form.

        The multiply-by-X homomorphism law. shiftReduce is multiplication by X in the quotient, so toQuot (shiftReduce e) = rt * toQuot e. This is the one place rt_relation is consumed, and everything about multiplication reduces to it.

        Reduced monomials #

        @[simp]

        monomialMod k really is X^k reduced: its image under toQuot is rt ^ k.

        toQuot is multiplicative #

        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_mul {F : Type u_1} [Field F] {P : ExtensionParams F} (x y : Ext P) :
        (x * y).toQuot = x.toQuot * y.toQuot

        Exponentiation #

        x ^ n on Ext P is npowBinRec, i.e. repeated squaring, so it costs O(log n) multiplications. npowBinRec_succ needs only Semigroup, and associativity is already available from toQuot_mul plus injectivity — so exponentiation can be handled before the full ring structure is transported.

        theorem CompPoly.Extension.Ext.mul_assoc' {F : Type u_1} [Field F] {P : ExtensionParams F} (x y z : Ext P) :
        x * y * z = x * (y * z)

        Associativity. Kept out of the instance graph as a plain theorem to avoid a Semigroup diamond with the CommRing instance below.

        @[simp]
        theorem CompPoly.Extension.Ext.toQuot_pow {F : Type u_1} [Field F] {P : ExtensionParams F} (x : Ext P) (n : ) :
        (x ^ n).toQuot = x.toQuot ^ n

        Algebraic structure #

        The axioms are all discharged by pushing through the injective toQuot, but the instances are built field-by-field with where rather than via Function.Injective.commRing. That transport takes toQuot as data, which would make the resulting instance noncomputable and — because Monoid.toNatPow then outranks Ext.instPow — would silently break compiled x ^ n. Building by hand keeps every operation computable, matching how CPolynomial assembles its instances in CompPoly/Univariate/Basic.lean.

        @[instance_reducible]
        @[instance_reducible]

        The base field and the adjoined root #

        @[simp]

        ofBase lands on the constant coefficient, so it agrees with algebraMap into the quotient.

        @[simp]

        gen is the class of X, i.e. the adjoined root.

        The base-field embedding, as a ring homomorphism.

        Instances For
          @[instance_reducible]

          The extension is an F-algebra.

          @[simp]
          theorem CompPoly.Extension.Ext.algebraMap_eq_ofBase {F : Type u_1} [Field F] {P : ExtensionParams F} (c : F) :
          (algebraMap F (Ext P)) c = ofBase c
          theorem CompPoly.Extension.Ext.toQuot_sum {F : Type u_1} [Field F] {P : ExtensionParams F} {ι : Type u_2} (s : Finset ι) (f : ιExt P) :
          (∑ is, f i).toQuot = is, (f i).toQuot

          The defining relation at the level of Ext: gen ^ d equals the reduced monomial monomialMod d.

          gen is a root of the defining polynomial, in the form Mathlib's aeval expects.

          toQuot packaged as a ring homomorphism.

          Instances For

            Binomial compatibility #

            For a binomial modulus X^d - W, the general defining relation rt ^ d = -∑ lowerᵢ rt ^ i collapses (the only nonzero lower coefficient is lower₀ = -W) to rt ^ d = W, recovering the gen ^ d = ofBase W law the degree-4 extensions rely on.

            The collapsed defining relation for a binomial modulus: rt ^ d = W.

            The binomial defining relation at the level of Ext: gen ^ d = ofBase W.