Documentation

HexResultant.ExactDiv

@[irreducible]
def Hex.powNat {R : Type u} [One R] [Mul R] (x : R) (n : Nat) :
R

Natural powers by binary exponentiation, using only the executable One and Mul operations. The association order is part of this law-free computational definition; correctness consumers assume associative ring multiplication.

Equations
Instances For
    theorem Hex.mul_pow {S : Type u} [Lean.Grind.CommRing S] (a b : S) (n : Nat) :
    (a * b) ^ n = a ^ n * b ^ n

    Powers distribute over multiplication in a lightweight commutative ring.

    theorem Hex.pow_mul {S : Type u} [Lean.Grind.Semiring S] (x : S) (m n : Nat) :
    x ^ (m * n) = (x ^ m) ^ n

    Raising a power to another power multiplies the two exponents.

    theorem Hex.pow_ne_zero {S : Type u} [Lean.Grind.CommRing S] [Div S] [ExactDivLaws S] (h1 : 1 0) {a : S} (ha : a 0) (n : Nat) :
    a ^ n 0

    Natural powers of a nonzero element stay nonzero in every nontrivial exact-division ring.

    theorem Hex.powNat_eq_pow {S : Type u} [Lean.Grind.Semiring S] (x : S) (n : Nat) :
    powNat x n = x ^ n

    The executable binary power agrees with the lightweight semiring power.

    theorem Hex.powNat_ne_zero {S : Type u} [Lean.Grind.CommRing S] [Div S] [ExactDivLaws S] (h1 : 1 0) {a : S} (ha : a 0) (n : Nat) :
    powNat a n 0

    The executable natural power of a nonzero element stays nonzero.

    def Hex.divExp {R : Type u} [Zero R] [DecidableEq R] [One R] [Mul R] [Div R] (x y : R) (n : Nat) :
    R

    Brown's scalar update x^n / y^(n-1), with the same total zero behavior as exactDiv.

    Equations
    Instances For
      theorem Hex.DensePoly.size_scale {R : Type u} [Lean.Grind.CommRing R] [DecidableEq R] [Div R] [ExactDivLaws R] {a : R} (ha : a 0) (p : DensePoly R) :
      (scale a p).size = p.size

      A nonzero scalar does not change the normalized dense size.

      theorem Hex.DensePoly.scale_ne_zero {R : Type u} [Lean.Grind.CommRing R] [DecidableEq R] [Div R] [ExactDivLaws R] {a : R} (ha : a 0) {p : DensePoly R} (hp : p 0) :
      scale a p 0

      Scaling a nonzero polynomial by a nonzero coefficient remains nonzero.

      The leading coefficient scales with a nonzero coefficient scalar.

      noncomputable def Hex.DensePoly.divScalar {R : Type u} [Zero R] [DecidableEq R] [Div R] (p : DensePoly R) (b : R) :

      Divide every coefficient by the same scalar.

      Kernel-facing specification: one map over the coefficient list. Compiled code runs the Array.map pass divScalarImpl via divScalar_eq_impl.

      Equations
      Instances For
        def Hex.DensePoly.divScalarImpl {R : Type u} [Zero R] [DecidableEq R] [Div R] (p : DensePoly R) (b : R) :

        Runtime array implementation of coefficientwise exact scalar division.

        Equations
        Instances For

          The list specification and array implementation of scalar division agree.

          theorem Hex.DensePoly.size_divScalarImpl_le {R : Type u} [Zero R] [DecidableEq R] [Div R] (p : DensePoly R) (b : R) :

          Coefficientwise scalar division cannot increase the stored polynomial size.

          @[csimp]

          Register the array pass as the compiled scalar-division implementation.

          theorem Hex.DensePoly.coeff_divScalar {R : Type u} [Lean.Grind.CommRing R] [DecidableEq R] [Div R] [ExactDivLaws R] (p : DensePoly R) {b : R} (hb : b 0) (n : Nat) :
          (p.divScalar b).coeff n = p.coeff n / b

          Coefficient law for exact scalar division by a nonzero factor.

          @[simp]
          theorem Hex.DensePoly.divScalar_scale {R : Type u} [Lean.Grind.CommRing R] [DecidableEq R] [Div R] [ExactDivLaws R] (p : DensePoly R) {b : R} (hb : b 0) :
          (scale b p).divScalar b = p

          Exact scalar division undoes scalar multiplication by a nonzero factor.

          theorem Hex.DensePoly.scale_cancel {R : Type u} [Lean.Grind.CommRing R] [DecidableEq R] [Div R] [ExactDivLaws R] {b : R} (hb : b 0) {p q : DensePoly R} (h : scale b p = scale b q) :
          p = q

          Scaling by a nonzero coefficient is cancellable.

          Exact coefficient division lifts recursively to exact dense-polynomial division, including nonunit constants and nonmonic polynomial factors.