Documentation

HexPoly.Euclid.Content

noncomputable def Hex.DensePoly.contentNat (p : DensePoly Int) :

The nonnegative gcd of the coefficients of an integer polynomial.

Kernel-facing specification: one fold over the reference coefficient list. Compiled code runs the Array.foldl loop contentNatImpl via the @[csimp] proof contentNat_eq_impl.

Equations
Instances For

    Runtime implementation of contentNat: a direct Array.foldl with no intermediate list (value-equal to contentNat by contentNat_eq_impl, registered @[csimp]).

    Equations
    Instances For
      @[csimp]

      Register the Array.foldl loop as the compiled implementation of contentNat.

      The integer content of a polynomial. This is always nonnegative.

      Equations
      Instances For

        The primitive part obtained by dividing every coefficient by the content.

        Kernel-facing specification: one map over the reference coefficient list. Compiled code runs the Array.map pass primitivePartImpl via the @[csimp] proof primitivePart_eq_impl.

        Equations
        Instances For

          Runtime implementation of primitivePart: one Array.map pass over the stored coefficients (value-equal to primitivePart by primitivePart_eq_impl, registered @[csimp]).

          Equations
          Instances For
            @[csimp]

            Register the Array.map pass as the compiled implementation of primitivePart.

            The content of an integer polynomial divides every coefficient.

            theorem Hex.DensePoly.dvd_content_of_nat_dvd_coeff (p : DensePoly Int) (d : Nat) (h : ∀ (n : Nat), d p.coeff n) :
            d p.content

            If a natural number divides every integer coefficient, its integer cast divides the polynomial content.

            theorem Hex.DensePoly.natCast_dvd_content_of_dvd_coeff (p : DensePoly Int) (d : Nat) (h : ∀ (n : Nat), d p.coeff n) :
            d p.content

            If a natural number divides every coefficient, then it divides the content.

            theorem Hex.DensePoly.nat_eq_one_of_content_eq_one_of_nat_dvd_coeff (p : DensePoly Int) (d : Nat) (hp : p.content = 1) (h : ∀ (n : Nat), d p.coeff n) :
            d = 1

            A natural number that divides every coefficient of a primitive integer polynomial must be 1.

            theorem Hex.DensePoly.nat_dvd_of_scalar_mul_primitive_coeff_dvd (p : DensePoly Int) (d : Nat) (a : Int) (hp : p.content = 1) (h : ∀ (n : Nat), d a * p.coeff n) :
            d a

            Scalar annihilator for primitive integer polynomials: if d divides every coefficient of a * p and p is primitive (content one), then d already divides a.

            @[simp]

            Scaling the primitive part by the content reconstructs the original integer polynomial.

            @[simp]

            Multiplying an integer polynomial by -1 preserves its content.

            @[simp]

            Content scales by the absolute value of the scaling integer.

            Scaling the zero integer polynomial by -1 is still zero.

            @[simp]

            The zero integer polynomial has content zero.

            @[simp]

            The content of a constant integer polynomial is the absolute value of the constant.

            @[simp]

            If an integer polynomial has zero content, its primitive part is zero.

            @[simp]

            A polynomial whose content is 1 equals its primitive part.

            The primitive part of a polynomial with nonzero content has content 1.