Documentation

HexPolyFp.Quotient.Ring

structure Hex.FpPoly.Quotient {p : Nat} [ZMod64.Bounds p] (g : FpPoly p) (hmonic : DensePoly.Monic g) (hg_pos : 0 < DensePoly.natDegree g) :

Canonical representatives for the quotient F_p[X] / (g), reduced modulo a monic positive-degree modulus.

Instances For
    theorem Hex.FpPoly.Quotient.ext {p : Nat} [ZMod64.Bounds p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} (h : a.val = b.val) :
    a = b

    Two quotient elements are equal when their underlying representatives agree; the extensionality principle for Quotient g.

    theorem Hex.FpPoly.Quotient.ext_iff {p : Nat} [ZMod64.Bounds p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} :
    a = b a.val = b.val
    @[instance_reducible]
    instance Hex.FpPoly.Quotient.instDecidableEq {p : Nat} [ZMod64.Bounds p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
    DecidableEq (g.Quotient hmonic hg_pos)
    Equations
    def Hex.FpPoly.Quotient.reduce {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f : FpPoly p) :
    g.Quotient hmonic hg_pos

    Reduce a polynomial to its canonical quotient representative.

    Equations
    Instances For
      @[simp]
      theorem Hex.FpPoly.Quotient.reduce_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f : FpPoly p) :
      (reduce f).val = g.modByMonic f hmonic

      The stored representative of reduce f is the monic remainder computed by the executable reduction path.

      theorem Hex.FpPoly.Quotient.reduce_val_eq_mod {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f : FpPoly p) :
      (reduce f).val = f % g

      The stored representative of reduce f is also the ordinary remainder f % g, exposing the algebraic view used by congruence lemmas.

      def Hex.FpPoly.Quotient.Congr {p : Nat} [ZMod64.Bounds p] {g : FpPoly p} (f h : FpPoly p) :

      Polynomial congruence modulo the defining quotient polynomial.

      Equations
      Instances For

        Congruent polynomials have the same canonical quotient representative.

        theorem Hex.FpPoly.Quotient.congr_of_reduce_eq_reduce {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {f h : FpPoly p} (heq : reduce f = reduce h) :
        Congr f h

        Equal canonical quotient representatives imply congruence modulo the defining polynomial.

        Equality of reduced representatives is equivalent to congruence modulo the quotient modulus.

        All canonical quotient representatives, enumerated via bounded-degree polynomials.

        Equations
        Instances For
          @[simp]

          elements enumerates exactly p ^ deg g canonical representatives; the order of the quotient ring FpPoly p / g.

          theorem Hex.FpPoly.Quotient.Internal.mem_elements {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :

          Every quotient element appears in elements.

          The quotient enumeration has no duplicate elements.

          The quotient has p ^ deg(g) canonical representatives in the executable list-cardinality sense.

          theorem Hex.FpPoly.Quotient.eq_iff_val_eq {p : Nat} [ZMod64.Bounds p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} :
          a = b a.val = b.val

          Equality of quotient elements is equality of canonical remainders.

          def Hex.FpPoly.Quotient.zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
          g.Quotient hmonic hg_pos

          Zero in the quotient.

          Equations
          Instances For
            @[instance_reducible]
            instance Hex.FpPoly.Quotient.instZero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
            Zero (g.Quotient hmonic hg_pos)
            Equations

            The nonzero quotient elements, as a concrete duplicate-free sublist of elements.

            Equations
            Instances For

              Membership in nonzeroElements is exactly nonzero quotient membership.

              The nonzero quotient enumeration has no duplicates.

              There are p ^ deg(g) - 1 nonzero quotient representatives.

              def Hex.FpPoly.Quotient.one {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
              g.Quotient hmonic hg_pos

              One in the quotient.

              Equations
              Instances For
                @[instance_reducible]
                instance Hex.FpPoly.Quotient.instOne {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                One (g.Quotient hmonic hg_pos)
                Equations
                def Hex.FpPoly.Quotient.X {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                g.Quotient hmonic hg_pos

                The class of the polynomial indeterminate.

                Equations
                Instances For
                  def Hex.FpPoly.Quotient.add {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                  g.Quotient hmonic hg_pos

                  Addition of canonical quotient representatives.

                  Equations
                  Instances For
                    @[instance_reducible]
                    instance Hex.FpPoly.Quotient.instAdd {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                    Add (g.Quotient hmonic hg_pos)
                    Equations
                    def Hex.FpPoly.Quotient.neg {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                    g.Quotient hmonic hg_pos

                    Negation of canonical quotient representatives.

                    Equations
                    Instances For
                      @[instance_reducible]
                      instance Hex.FpPoly.Quotient.instNeg {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                      Neg (g.Quotient hmonic hg_pos)
                      Equations
                      def Hex.FpPoly.Quotient.sub {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                      g.Quotient hmonic hg_pos

                      Subtraction of canonical quotient representatives.

                      Equations
                      Instances For
                        @[instance_reducible]
                        instance Hex.FpPoly.Quotient.instSub {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                        Sub (g.Quotient hmonic hg_pos)
                        Equations
                        def Hex.FpPoly.Quotient.mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                        g.Quotient hmonic hg_pos

                        Multiplication of canonical quotient representatives.

                        Equations
                        Instances For
                          @[instance_reducible]
                          instance Hex.FpPoly.Quotient.instMul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                          Mul (g.Quotient hmonic hg_pos)
                          Equations
                          def Hex.FpPoly.Quotient.pow {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                          Natg.Quotient hmonic hg_pos

                          Natural-number powers in the quotient.

                          Equations
                          Instances For
                            @[instance_reducible]
                            instance Hex.FpPoly.Quotient.instPowNat {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                            Pow (g.Quotient hmonic hg_pos) Nat
                            Equations
                            @[simp]
                            theorem Hex.FpPoly.Quotient.zero_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                            val 0 = g.modByMonic 0 hmonic

                            The stored representative of quotient zero is the reduction of the zero polynomial.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.one_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                            val 1 = g.modByMonic 1 hmonic

                            The stored representative of quotient one is the reduction of the constant polynomial 1.

                            @[simp]

                            The stored representative of the quotient indeterminate is the reduced polynomial variable.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.add_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            (a + b).val = g.modByMonic (a.val + b.val) hmonic

                            Addition of quotient elements reduces the sum of their canonical representatives.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.neg_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            (-a).val = g.modByMonic (-a.val) hmonic

                            Negation of a quotient element reduces the negated representative.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.sub_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            (a - b).val = g.modByMonic (a.val - b.val) hmonic

                            Subtraction of quotient elements reduces the difference of their canonical representatives.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.mul_val {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            (a * b).val = g.modByMonic (a.val * b.val) hmonic

                            Multiplication of quotient elements reduces the product of their canonical representatives.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.pow_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a ^ 0 = 1

                            Zeroth quotient power is the multiplicative identity.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.pow_succ {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) (n : Nat) :
                            a ^ (n + 1) = a ^ n * a

                            Successor quotient powers multiply one more copy on the right.

                            theorem Hex.FpPoly.Quotient.reduce_add_eq {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f h : FpPoly p) :
                            reduce (f + h) = reduce ((reduce f).val + (reduce h).val)

                            Reducing a sum agrees with summing the separately reduced representatives and reducing once more.

                            theorem Hex.FpPoly.Quotient.reduce_mul_eq {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f h : FpPoly p) :
                            reduce (f * h) = reduce ((reduce f).val * (reduce h).val)

                            Reducing a product agrees with multiplying the separately reduced representatives and reducing once more.

                            theorem Hex.FpPoly.Quotient.reduce_add {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f h : FpPoly p) :
                            reduce (f + h) = reduce f + reduce h

                            Reduction into the quotient preserves addition.

                            theorem Hex.FpPoly.Quotient.reduce_mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (f h : FpPoly p) :
                            reduce (f * h) = reduce f * reduce h

                            Reduction into the quotient preserves multiplication.

                            theorem Hex.FpPoly.Quotient.reduce_val_self {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :

                            Reducing an already-canonical quotient representative leaves it unchanged.

                            The canonical quotient representative of 1 is the polynomial 1.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.one_mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            1 * a = a

                            1 is a left identity for quotient multiplication.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.mul_one {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a * 1 = a

                            1 is a right identity for quotient multiplication.

                            theorem Hex.FpPoly.Quotient.mul_assoc {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                            a * b * c = a * (b * c)

                            Quotient multiplication is associative.

                            theorem Hex.FpPoly.Quotient.mul_comm {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            a * b = b * a

                            Quotient multiplication is commutative.

                            theorem Hex.FpPoly.Quotient.pow_add {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) (m n : Nat) :
                            a ^ (m + n) = a ^ m * a ^ n

                            Quotient powers turn addition of exponents into multiplication.

                            theorem Hex.FpPoly.Quotient.pow_mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) (m n : Nat) :
                            (a ^ m) ^ n = a ^ (m * n)

                            Quotient powers turn multiplication of exponents into iterated powering.

                            Reducing an executable polynomial power agrees with powering its quotient class.

                            The quotient class of the monomial c * X^n is the constant class c times the nth power of the quotient indeterminate.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.add_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a + 0 = a

                            0 is a right identity for addition in the quotient ring.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.zero_add {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            0 + a = a

                            0 is a left identity for addition in the quotient ring.

                            theorem Hex.FpPoly.Quotient.add_assoc {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                            a + b + c = a + (b + c)

                            Quotient addition is associative. Together with add_zero, zero_add, add_comm and add_left_neg this supplies the additive-group axioms behind the Field (Quotient g hmonic hg_pos) instance.

                            theorem Hex.FpPoly.Quotient.add_comm {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            a + b = b + a

                            Quotient addition is commutative.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.add_left_neg {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            -a + a = 0

                            Adding a quotient element to its left additive inverse gives zero.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.add_right_neg {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a + -a = 0

                            Adding the right additive inverse of a quotient element gives zero.

                            theorem Hex.FpPoly.Quotient.sub_eq_add_neg {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                            a - b = a + -b

                            Quotient subtraction is addition of the right additive inverse.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.sub_self {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a - a = 0

                            Subtracting a quotient element from itself gives zero.

                            theorem Hex.FpPoly.Quotient.sub_eq_zero_iff_eq {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} :
                            a - b = 0 a = b

                            A quotient subtraction is zero exactly when its left and right terms are equal.

                            theorem Hex.FpPoly.Quotient.sub_ne_zero_of_ne {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} (h : a b) :
                            a - b 0

                            Distinct quotient elements have nonzero difference.

                            theorem Hex.FpPoly.Quotient.ne_of_sub_ne_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} (h : a - b 0) :
                            a b

                            A nonzero quotient difference witnesses distinct quotient elements.

                            @[simp]
                            theorem Hex.FpPoly.Quotient.sub_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                            a - 0 = a

                            Subtracting zero leaves a quotient element unchanged.

                            theorem Hex.FpPoly.Quotient.left_distrib {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                            a * (b + c) = a * b + a * c

                            Quotient multiplication distributes over addition on the left.

                            theorem Hex.FpPoly.Quotient.right_distrib {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                            (a + b) * c = a * c + b * c

                            Quotient multiplication distributes over addition on the right.

                            The xgcd-based inverse candidate, normalized by the leading coefficient of the computed gcd.

                            Equations
                            Instances For

                              Narrow Euclidean obligation for quotient inversion.

                              For a nonzero canonical representative modulo a monic irreducible positive-degree polynomial, the normalized left Bezout coefficient is a multiplicative inverse modulo g.

                              def Hex.FpPoly.Quotient.inv {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                              g.Quotient hmonic hg_pos

                              Multiplicative inverse candidate in the quotient, with the conventional junk value 0⁻¹ = 0. The cancellation theorem below requires irreducibility.

                              Equations
                              Instances For
                                @[instance_reducible]
                                instance Hex.FpPoly.Quotient.instInv {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} :
                                Inv (g.Quotient hmonic hg_pos)
                                Equations

                                The inverse of 0 is 0, the conventional junk value fixed by inv. This is the inv_zero field axiom required by Field; it holds unconditionally and, unlike mul_inv_cancel, needs no irreducibility hypothesis.

                                theorem Hex.FpPoly.Quotient.mul_inv_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (hg_irr : g.Irreducible) {a : g.Quotient hmonic hg_pos} (ha : a 0) :
                                a * a⁻¹ = 1

                                Multiplicative cancellation: when g is irreducible, every nonzero quotient element a satisfies a * a⁻¹ = 1. This is the field-inverse axiom that promotes Quotient g hmonic hg_pos from a commutative ring to a Field; the Hex.FpPoly.Irreducible hypothesis is essential, since for reducible g a nonzero zero-divisor has no inverse.

                                theorem Hex.FpPoly.Quotient.inv_mul_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (hg_irr : g.Irreducible) {a : g.Quotient hmonic hg_pos} (ha : a 0) :
                                a⁻¹ * a = 1

                                The inverse candidate also cancels on the left for nonzero quotient elements modulo an irreducible polynomial.

                                @[simp]
                                theorem Hex.FpPoly.Quotient.mul_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                                a * 0 = 0

                                Multiplying any quotient element by zero gives zero.

                                @[simp]
                                theorem Hex.FpPoly.Quotient.zero_mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a : g.Quotient hmonic hg_pos) :
                                0 * a = 0

                                Zero times any quotient element is zero.

                                theorem Hex.FpPoly.Quotient.add_left_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) (h : a + b = a + c) :
                                b = c

                                Addition on the left by a fixed quotient element is cancellative.

                                theorem Hex.FpPoly.Quotient.add_right_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) (h : b + a = c + a) :
                                b = c

                                Addition on the right by a fixed quotient element is cancellative.

                                theorem Hex.FpPoly.Quotient.eq_neg_of_add_eq_zero {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} (h : a + b = 0) :
                                a = -b

                                If two quotient elements add to zero, the left element is the negative of the right element.

                                theorem Hex.FpPoly.Quotient.eq_neg_of_add_eq_zero_right {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} {a b : g.Quotient hmonic hg_pos} (h : a + b = 0) :
                                b = -a

                                If two quotient elements add to zero, the right element is the negative of the left element.

                                @[simp]
                                theorem Hex.FpPoly.Quotient.sub_add_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                                a - b + b = a

                                Adding back the right-hand subtrahend cancels quotient subtraction.

                                @[simp]
                                theorem Hex.FpPoly.Quotient.add_sub_cancel_right {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                                a + b - b = a

                                Subtracting the right-hand addend cancels quotient addition.

                                @[simp]
                                theorem Hex.FpPoly.Quotient.add_sub_cancel_left {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                                a + b - a = b

                                Subtracting the left-hand addend cancels quotient addition.

                                theorem Hex.FpPoly.Quotient.mul_neg_right {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                                a * -b = -(a * b)

                                Multiplication by a negated quotient element on the right negates the product.

                                theorem Hex.FpPoly.Quotient.neg_mul_left {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b : g.Quotient hmonic hg_pos) :
                                -a * b = -(a * b)

                                Multiplication by a negated quotient element on the left negates the product.

                                theorem Hex.FpPoly.Quotient.mul_sub {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                                a * (b - c) = a * b - a * c

                                Quotient multiplication distributes over subtraction on the left.

                                theorem Hex.FpPoly.Quotient.sub_mul {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                                (a - b) * c = a * c - b * c

                                Quotient multiplication distributes over subtraction on the right.

                                theorem Hex.FpPoly.Quotient.sub_add_sub_cancel {p : Nat} [ZMod64.Bounds p] [ZMod64.PrimeModulus p] {g : FpPoly p} {hmonic : DensePoly.Monic g} {hg_pos : 0 < DensePoly.natDegree g} (a b c : g.Quotient hmonic hg_pos) :
                                a - b + (b - c) = a - c

                                Adjacent quotient subtractions cancel their shared middle term.