HepLean Documentation

Mathlib.Algebra.Polynomial.Degree.Definitions

Degree of univariate polynomials #

Main definitions #

Main results #

degree p is the degree of the polynomial p, i.e. the largest X-exponent in p. degree p = some n when p ≠ 0 and n is the highest power of X that appears in p, otherwise degree 0 = ⊥.

Equations
  • p.degree = p.support.max
Instances For

    natDegree p forces degree p to ℕ, by defining natDegree 0 = 0.

    Equations
    Instances For
      def Polynomial.leadingCoeff {R : Type u} [Semiring R] (p : Polynomial R) :
      R

      leadingCoeff p gives the coefficient of the highest power of X in p

      Equations
      • p.leadingCoeff = p.coeff p.natDegree
      Instances For
        def Polynomial.Monic {R : Type u} [Semiring R] (p : Polynomial R) :

        a polynomial is Monic if its leading coefficient is 1

        Equations
        • p.Monic = (p.leadingCoeff = 1)
        Instances For
          theorem Polynomial.Monic.def {R : Type u} [Semiring R] {p : Polynomial R} :
          p.Monic p.leadingCoeff = 1
          instance Polynomial.Monic.decidable {R : Type u} [Semiring R] {p : Polynomial R} [DecidableEq R] :
          Decidable p.Monic
          Equations
          • Polynomial.Monic.decidable = id inferInstance
          @[simp]
          theorem Polynomial.Monic.leadingCoeff {R : Type u} [Semiring R] {p : Polynomial R} (hp : p.Monic) :
          p.leadingCoeff = 1
          theorem Polynomial.Monic.coeff_natDegree {R : Type u} [Semiring R] {p : Polynomial R} (hp : p.Monic) :
          p.coeff p.natDegree = 1
          @[simp]
          theorem Polynomial.coeff_natDegree {R : Type u} [Semiring R] {p : Polynomial R} :
          p.coeff p.natDegree = p.leadingCoeff
          @[simp]
          theorem Polynomial.degree_eq_bot {R : Type u} [Semiring R] {p : Polynomial R} :
          p.degree = p = 0
          theorem Polynomial.degree_ne_bot {R : Type u} [Semiring R] {p : Polynomial R} :
          p.degree p 0
          theorem Polynomial.degree_eq_natDegree {R : Type u} [Semiring R] {p : Polynomial R} (hp : p 0) :
          p.degree = p.natDegree
          theorem Polynomial.degree_eq_iff_natDegree_eq {R : Type u} [Semiring R] {p : Polynomial R} {n : } (hp : p 0) :
          p.degree = n p.natDegree = n
          theorem Polynomial.degree_eq_iff_natDegree_eq_of_pos {R : Type u} [Semiring R] {p : Polynomial R} {n : } (hn : 0 < n) :
          p.degree = n p.natDegree = n
          theorem Polynomial.natDegree_eq_of_degree_eq_some {R : Type u} [Semiring R] {p : Polynomial R} {n : } (h : p.degree = n) :
          p.natDegree = n
          theorem Polynomial.degree_ne_of_natDegree_ne {R : Type u} [Semiring R] {p : Polynomial R} {n : } :
          p.natDegree np.degree n
          @[simp]
          theorem Polynomial.degree_le_natDegree {R : Type u} [Semiring R] {p : Polynomial R} :
          p.degree p.natDegree
          theorem Polynomial.natDegree_eq_of_degree_eq {R : Type u} {S : Type v} [Semiring R] {p : Polynomial R} [Semiring S] {q : Polynomial S} (h : p.degree = q.degree) :
          p.natDegree = q.natDegree
          theorem Polynomial.le_degree_of_ne_zero {R : Type u} {n : } [Semiring R] {p : Polynomial R} (h : p.coeff n 0) :
          n p.degree
          theorem Polynomial.degree_mono {R : Type u} {S : Type v} [Semiring R] [Semiring S] {f : Polynomial R} {g : Polynomial S} (h : f.support g.support) :
          f.degree g.degree
          theorem Polynomial.degree_le_degree {R : Type u} [Semiring R] {p q : Polynomial R} (h : q.coeff p.natDegree 0) :
          p.degree q.degree
          theorem Polynomial.natDegree_le_iff_degree_le {R : Type u} [Semiring R] {p : Polynomial R} {n : } :
          p.natDegree n p.degree n
          theorem Polynomial.natDegree_lt_iff_degree_lt {R : Type u} {n : } [Semiring R] {p : Polynomial R} (hp : p 0) :
          p.natDegree < n p.degree < n
          theorem Polynomial.natDegree_le_of_degree_le {R : Type u} [Semiring R] {p : Polynomial R} {n : } :
          p.degree np.natDegree n

          Alias of the reverse direction of Polynomial.natDegree_le_iff_degree_le.

          theorem Polynomial.degree_le_of_natDegree_le {R : Type u} [Semiring R] {p : Polynomial R} {n : } :
          p.natDegree np.degree n

          Alias of the forward direction of Polynomial.natDegree_le_iff_degree_le.

          theorem Polynomial.natDegree_le_natDegree {R : Type u} {S : Type v} [Semiring R] {p : Polynomial R} [Semiring S] {q : Polynomial S} (hpq : p.degree q.degree) :
          p.natDegree q.natDegree
          @[simp]
          theorem Polynomial.degree_C {R : Type u} {a : R} [Semiring R] (ha : a 0) :
          (Polynomial.C a).degree = 0
          theorem Polynomial.degree_C_le {R : Type u} {a : R} [Semiring R] :
          (Polynomial.C a).degree 0
          theorem Polynomial.degree_C_lt {R : Type u} {a : R} [Semiring R] :
          (Polynomial.C a).degree < 1
          @[simp]
          theorem Polynomial.natDegree_C {R : Type u} [Semiring R] (a : R) :
          (Polynomial.C a).natDegree = 0
          @[simp]
          theorem Polynomial.natDegree_natCast {R : Type u} [Semiring R] (n : ) :
          (↑n).natDegree = 0
          @[deprecated Polynomial.natDegree_natCast]
          theorem Polynomial.natDegree_nat_cast {R : Type u} [Semiring R] (n : ) :
          (↑n).natDegree = 0

          Alias of Polynomial.natDegree_natCast.

          @[simp]
          theorem Polynomial.natDegree_ofNat {R : Type u} [Semiring R] (n : ) [n.AtLeastTwo] :
          (OfNat.ofNat n).natDegree = 0
          theorem Polynomial.degree_natCast_le {R : Type u} [Semiring R] (n : ) :
          (↑n).degree 0
          @[deprecated Polynomial.degree_natCast_le]
          theorem Polynomial.degree_nat_cast_le {R : Type u} [Semiring R] (n : ) :
          (↑n).degree 0

          Alias of Polynomial.degree_natCast_le.

          @[simp]
          theorem Polynomial.degree_monomial {R : Type u} {a : R} [Semiring R] (n : ) (ha : a 0) :
          ((Polynomial.monomial n) a).degree = n
          @[simp]
          theorem Polynomial.degree_C_mul_X_pow {R : Type u} {a : R} [Semiring R] (n : ) (ha : a 0) :
          (Polynomial.C a * Polynomial.X ^ n).degree = n
          theorem Polynomial.degree_C_mul_X {R : Type u} {a : R} [Semiring R] (ha : a 0) :
          (Polynomial.C a * Polynomial.X).degree = 1
          theorem Polynomial.degree_monomial_le {R : Type u} [Semiring R] (n : ) (a : R) :
          ((Polynomial.monomial n) a).degree n
          theorem Polynomial.degree_C_mul_X_pow_le {R : Type u} [Semiring R] (n : ) (a : R) :
          (Polynomial.C a * Polynomial.X ^ n).degree n
          theorem Polynomial.degree_C_mul_X_le {R : Type u} [Semiring R] (a : R) :
          (Polynomial.C a * Polynomial.X).degree 1
          @[simp]
          theorem Polynomial.natDegree_C_mul_X_pow {R : Type u} [Semiring R] (n : ) (a : R) (ha : a 0) :
          (Polynomial.C a * Polynomial.X ^ n).natDegree = n
          @[simp]
          theorem Polynomial.natDegree_C_mul_X {R : Type u} [Semiring R] (a : R) (ha : a 0) :
          (Polynomial.C a * Polynomial.X).natDegree = 1
          @[simp]
          theorem Polynomial.natDegree_monomial {R : Type u} [Semiring R] [DecidableEq R] (i : ) (r : R) :
          ((Polynomial.monomial i) r).natDegree = if r = 0 then 0 else i
          theorem Polynomial.natDegree_monomial_le {R : Type u} [Semiring R] (a : R) {m : } :
          ((Polynomial.monomial m) a).natDegree m
          theorem Polynomial.natDegree_monomial_eq {R : Type u} [Semiring R] (i : ) {r : R} (r0 : r 0) :
          ((Polynomial.monomial i) r).natDegree = i
          theorem Polynomial.coeff_ne_zero_of_eq_degree {R : Type u} {n : } [Semiring R] {p : Polynomial R} (hn : p.degree = n) :
          p.coeff n 0
          theorem Polynomial.degree_X_pow_le {R : Type u} [Semiring R] (n : ) :
          (Polynomial.X ^ n).degree n
          theorem Polynomial.degree_X_le {R : Type u} [Semiring R] :
          Polynomial.X.degree 1
          theorem Polynomial.natDegree_X_le {R : Type u} [Semiring R] :
          Polynomial.X.natDegree 1
          @[simp]
          theorem Polynomial.degree_X {R : Type u} [Semiring R] [Nontrivial R] :
          Polynomial.X.degree = 1
          @[simp]
          theorem Polynomial.natDegree_X {R : Type u} [Semiring R] [Nontrivial R] :
          Polynomial.X.natDegree = 1
          @[simp]
          theorem Polynomial.degree_neg {R : Type u} [Ring R] (p : Polynomial R) :
          (-p).degree = p.degree
          theorem Polynomial.degree_neg_le_of_le {R : Type u} [Ring R] {a : WithBot } {p : Polynomial R} (hp : p.degree a) :
          (-p).degree a
          @[simp]
          theorem Polynomial.natDegree_neg {R : Type u} [Ring R] (p : Polynomial R) :
          (-p).natDegree = p.natDegree
          theorem Polynomial.natDegree_neg_le_of_le {R : Type u} {m : } [Ring R] {p : Polynomial R} (hp : p.natDegree m) :
          (-p).natDegree m
          @[simp]
          theorem Polynomial.natDegree_intCast {R : Type u} [Ring R] (n : ) :
          (↑n).natDegree = 0
          @[deprecated Polynomial.natDegree_intCast]
          theorem Polynomial.natDegree_int_cast {R : Type u} [Ring R] (n : ) :
          (↑n).natDegree = 0

          Alias of Polynomial.natDegree_intCast.

          theorem Polynomial.degree_intCast_le {R : Type u} [Ring R] (n : ) :
          (↑n).degree 0
          @[deprecated Polynomial.degree_intCast_le]
          theorem Polynomial.degree_int_cast_le {R : Type u} [Ring R] (n : ) :
          (↑n).degree 0

          Alias of Polynomial.degree_intCast_le.

          @[simp]
          theorem Polynomial.leadingCoeff_neg {R : Type u} [Ring R] (p : Polynomial R) :
          (-p).leadingCoeff = -p.leadingCoeff
          def Polynomial.nextCoeff {R : Type u} [Semiring R] (p : Polynomial R) :
          R

          The second-highest coefficient, or 0 for constants

          Equations
          • p.nextCoeff = if p.natDegree = 0 then 0 else p.coeff (p.natDegree - 1)
          Instances For
            theorem Polynomial.nextCoeff_eq_zero {R : Type u} [Semiring R] {p : Polynomial R} :
            p.nextCoeff = 0 p.natDegree = 0 0 < p.natDegree p.coeff (p.natDegree - 1) = 0
            theorem Polynomial.nextCoeff_ne_zero {R : Type u} [Semiring R] {p : Polynomial R} :
            p.nextCoeff 0 p.natDegree 0 p.coeff (p.natDegree - 1) 0
            @[simp]
            theorem Polynomial.nextCoeff_C_eq_zero {R : Type u} [Semiring R] (c : R) :
            (Polynomial.C c).nextCoeff = 0
            theorem Polynomial.nextCoeff_of_natDegree_pos {R : Type u} [Semiring R] {p : Polynomial R} (hp : 0 < p.natDegree) :
            p.nextCoeff = p.coeff (p.natDegree - 1)
            theorem Polynomial.degree_add_le {R : Type u} [Semiring R] (p q : Polynomial R) :
            (p + q).degree p.degree q.degree
            theorem Polynomial.degree_add_le_of_degree_le {R : Type u} [Semiring R] {p q : Polynomial R} {n : } (hp : p.degree n) (hq : q.degree n) :
            (p + q).degree n
            theorem Polynomial.degree_add_le_of_le {R : Type u} [Semiring R] {p q : Polynomial R} {a b : WithBot } (hp : p.degree a) (hq : q.degree b) :
            (p + q).degree a b
            theorem Polynomial.natDegree_add_le {R : Type u} [Semiring R] (p q : Polynomial R) :
            (p + q).natDegree p.natDegree q.natDegree
            theorem Polynomial.natDegree_add_le_of_degree_le {R : Type u} [Semiring R] {p q : Polynomial R} {n : } (hp : p.natDegree n) (hq : q.natDegree n) :
            (p + q).natDegree n
            theorem Polynomial.natDegree_add_le_of_le {R : Type u} {n m : } [Semiring R] {p q : Polynomial R} (hp : p.natDegree m) (hq : q.natDegree n) :
            (p + q).natDegree m n
            @[simp]
            theorem Polynomial.leadingCoeff_eq_zero {R : Type u} [Semiring R] {p : Polynomial R} :
            p.leadingCoeff = 0 p = 0
            theorem Polynomial.leadingCoeff_ne_zero {R : Type u} [Semiring R] {p : Polynomial R} :
            p.leadingCoeff 0 p 0
            theorem Polynomial.leadingCoeff_eq_zero_iff_deg_eq_bot {R : Type u} [Semiring R] {p : Polynomial R} :
            p.leadingCoeff = 0 p.degree =
            theorem Polynomial.natDegree_C_mul_X_pow_le {R : Type u} [Semiring R] (a : R) (n : ) :
            (Polynomial.C a * Polynomial.X ^ n).natDegree n
            theorem Polynomial.degree_erase_le {R : Type u} [Semiring R] (p : Polynomial R) (n : ) :
            (Polynomial.erase n p).degree p.degree
            theorem Polynomial.degree_erase_lt {R : Type u} [Semiring R] {p : Polynomial R} (hp : p 0) :
            (Polynomial.erase p.natDegree p).degree < p.degree
            theorem Polynomial.degree_update_le {R : Type u} [Semiring R] (p : Polynomial R) (n : ) (a : R) :
            (p.update n a).degree p.degree n
            theorem Polynomial.degree_sum_le {R : Type u} [Semiring R] {ι : Type u_1} (s : Finset ι) (f : ιPolynomial R) :
            (∑ is, f i).degree s.sup fun (b : ι) => (f b).degree
            theorem Polynomial.degree_mul_le {R : Type u} [Semiring R] (p q : Polynomial R) :
            (p * q).degree p.degree + q.degree
            theorem Polynomial.degree_mul_le_of_le {R : Type u} [Semiring R] {p q : Polynomial R} {a b : WithBot } (hp : p.degree a) (hq : q.degree b) :
            (p * q).degree a + b
            theorem Polynomial.degree_pow_le {R : Type u} [Semiring R] (p : Polynomial R) (n : ) :
            (p ^ n).degree n p.degree
            theorem Polynomial.degree_pow_le_of_le {R : Type u} [Semiring R] {p : Polynomial R} {a : WithBot } (b : ) (hp : p.degree a) :
            (p ^ b).degree b * a
            @[simp]
            theorem Polynomial.leadingCoeff_monomial {R : Type u} [Semiring R] (a : R) (n : ) :
            ((Polynomial.monomial n) a).leadingCoeff = a
            theorem Polynomial.leadingCoeff_C_mul_X_pow {R : Type u} [Semiring R] (a : R) (n : ) :
            (Polynomial.C a * Polynomial.X ^ n).leadingCoeff = a
            theorem Polynomial.leadingCoeff_C_mul_X {R : Type u} [Semiring R] (a : R) :
            (Polynomial.C a * Polynomial.X).leadingCoeff = a
            @[simp]
            theorem Polynomial.leadingCoeff_C {R : Type u} [Semiring R] (a : R) :
            (Polynomial.C a).leadingCoeff = a
            theorem Polynomial.leadingCoeff_X_pow {R : Type u} [Semiring R] (n : ) :
            (Polynomial.X ^ n).leadingCoeff = 1
            theorem Polynomial.leadingCoeff_X {R : Type u} [Semiring R] :
            Polynomial.X.leadingCoeff = 1
            @[simp]
            theorem Polynomial.monic_X_pow {R : Type u} [Semiring R] (n : ) :
            (Polynomial.X ^ n).Monic
            @[simp]
            theorem Polynomial.monic_X {R : Type u} [Semiring R] :
            Polynomial.X.Monic
            theorem Polynomial.Monic.ne_zero {R : Type u_2} [Semiring R] [Nontrivial R] {p : Polynomial R} (hp : p.Monic) :
            p 0
            theorem Polynomial.Monic.ne_zero_of_ne {R : Type u} [Semiring R] (h : 0 1) {p : Polynomial R} (hp : p.Monic) :
            p 0
            theorem Polynomial.Monic.ne_zero_of_polynomial_ne {R : Type u} [Semiring R] {p q r : Polynomial R} (hp : p.Monic) (hne : q r) :
            p 0
            theorem Polynomial.natDegree_mul_le {R : Type u} [Semiring R] {p q : Polynomial R} :
            (p * q).natDegree p.natDegree + q.natDegree
            theorem Polynomial.natDegree_mul_le_of_le {R : Type u} {n m : } [Semiring R] {p q : Polynomial R} (hp : p.natDegree m) (hg : q.natDegree n) :
            (p * q).natDegree m + n
            theorem Polynomial.natDegree_pow_le {R : Type u} [Semiring R] {p : Polynomial R} {n : } :
            (p ^ n).natDegree n * p.natDegree
            theorem Polynomial.natDegree_pow_le_of_le {R : Type u} {m : } [Semiring R] {p : Polynomial R} (n : ) (hp : p.natDegree m) :
            (p ^ n).natDegree n * m
            theorem Polynomial.natDegree_eq_zero_iff_degree_le_zero {R : Type u} [Semiring R] {p : Polynomial R} :
            p.natDegree = 0 p.degree 0
            theorem Polynomial.degree_le_iff_coeff_zero {R : Type u} [Semiring R] (f : Polynomial R) (n : WithBot ) :
            f.degree n ∀ (m : ), n < mf.coeff m = 0
            theorem Polynomial.degree_lt_iff_coeff_zero {R : Type u} [Semiring R] (f : Polynomial R) (n : ) :
            f.degree < n ∀ (m : ), n mf.coeff m = 0
            theorem Polynomial.natDegree_pos_iff_degree_pos {R : Type u} [Semiring R] {p : Polynomial R} :
            0 < p.natDegree 0 < p.degree
            @[simp]
            theorem Polynomial.degree_X_pow {R : Type u} [Semiring R] [Nontrivial R] (n : ) :
            (Polynomial.X ^ n).degree = n
            @[simp]
            theorem Polynomial.natDegree_X_pow {R : Type u} [Semiring R] [Nontrivial R] (n : ) :
            (Polynomial.X ^ n).natDegree = n
            theorem Polynomial.degree_sub_le {R : Type u} [Ring R] (p q : Polynomial R) :
            (p - q).degree p.degree q.degree
            theorem Polynomial.degree_sub_le_of_le {R : Type u} [Ring R] {p q : Polynomial R} {a b : WithBot } (hp : p.degree a) (hq : q.degree b) :
            (p - q).degree a b
            theorem Polynomial.natDegree_sub_le {R : Type u} [Ring R] (p q : Polynomial R) :
            (p - q).natDegree p.natDegree q.natDegree
            theorem Polynomial.natDegree_sub_le_of_le {R : Type u} {n m : } [Ring R] {p q : Polynomial R} (hp : p.natDegree m) (hq : q.natDegree n) :
            (p - q).natDegree m n
            theorem Polynomial.degree_sub_lt {R : Type u} [Ring R] {p q : Polynomial R} (hd : p.degree = q.degree) (hp0 : p 0) (hlc : p.leadingCoeff = q.leadingCoeff) :
            (p - q).degree < p.degree
            theorem Polynomial.degree_X_sub_C_le {R : Type u} [Ring R] (r : R) :
            (Polynomial.X - Polynomial.C r).degree 1
            theorem Polynomial.natDegree_X_sub_C_le {R : Type u} [Ring R] (r : R) :
            (Polynomial.X - Polynomial.C r).natDegree 1