Degree of univariate polynomials #
Main definitions #
Polynomial.degree
: the degree of a polynomial, where0
has degree⊥
Polynomial.natDegree
: the degree of a polynomial, where0
has degree0
Polynomial.leadingCoeff
: the leading coefficient of a polynomialPolynomial.Monic
: a polynomial is monic if its leading coefficient is 0Polynomial.nextCoeff
: the next coefficient after the leading coefficient
Main results #
Polynomial.degree_eq_natDegree
: the degree and natDegree coincide for nonzero polynomials
natDegree p
forces degree p
to ℕ, by defining natDegree 0 = 0
.
Equations
- p.natDegree = WithBot.unbot' 0 p.degree
Instances For
leadingCoeff p
gives the coefficient of the highest power of X
in p
Equations
- p.leadingCoeff = p.coeff p.natDegree
Instances For
a polynomial is Monic
if its leading coefficient is 1
Instances For
instance
Polynomial.Monic.decidable
{R : Type u}
[Semiring R]
{p : Polynomial R}
[DecidableEq R]
:
Decidable p.Monic
@[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]
@[simp]
theorem
Polynomial.coeff_natDegree
{R : Type u}
[Semiring R]
{p : Polynomial R}
:
p.coeff p.natDegree = p.leadingCoeff
@[simp]
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)
:
theorem
Polynomial.degree_eq_iff_natDegree_eq_of_pos
{R : Type u}
[Semiring R]
{p : Polynomial R}
{n : ℕ}
(hn : 0 < 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
@[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 : ℕ}
:
theorem
Polynomial.natDegree_lt_iff_degree_lt
{R : Type u}
{n : ℕ}
[Semiring R]
{p : Polynomial R}
(hp : p ≠ 0)
:
Alias of the reverse direction of Polynomial.natDegree_le_iff_degree_le
.
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]
@[simp]
@[deprecated Polynomial.natDegree_natCast]
Alias of Polynomial.natDegree_natCast
.
@[simp]
theorem
Polynomial.natDegree_ofNat
{R : Type u}
[Semiring R]
(n : ℕ)
[n.AtLeastTwo]
:
(OfNat.ofNat n).natDegree = 0
@[deprecated Polynomial.degree_natCast_le]
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
theorem
Polynomial.degree_monomial_le
{R : Type u}
[Semiring R]
(n : ℕ)
(a : R)
:
((Polynomial.monomial n) a).degree ≤ ↑n
@[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
@[simp]
@[simp]
@[simp]
@[simp]
theorem
Polynomial.degree_neg_le_of_le
{R : Type u}
[Ring R]
{a : WithBot ℕ}
{p : Polynomial R}
(hp : p.degree ≤ a)
:
@[simp]
theorem
Polynomial.natDegree_neg_le_of_le
{R : Type u}
{m : ℕ}
[Ring R]
{p : Polynomial R}
(hp : p.natDegree ≤ m)
:
@[deprecated Polynomial.natDegree_intCast]
Alias of Polynomial.natDegree_intCast
.
@[deprecated Polynomial.degree_intCast_le]
Alias of Polynomial.degree_intCast_le
.
@[simp]
The second-highest coefficient, or 0 for constants
Instances For
@[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)
:
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)
:
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)
:
@[simp]
@[simp]
theorem
Polynomial.leadingCoeff_eq_zero_iff_deg_eq_bot
{R : Type u}
[Semiring R]
{p : Polynomial R}
:
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_sum_le
{R : Type u}
[Semiring R]
{ι : Type u_1}
(s : Finset ι)
(f : ι → Polynomial R)
:
(∑ i ∈ s, f i).degree ≤ s.sup fun (b : ι) => (f b).degree
@[simp]
theorem
Polynomial.leadingCoeff_monomial
{R : Type u}
[Semiring R]
(a : R)
(n : ℕ)
:
((Polynomial.monomial n) a).leadingCoeff = a
@[simp]
theorem
Polynomial.leadingCoeff_C
{R : Type u}
[Semiring R]
(a : R)
:
(Polynomial.C a).leadingCoeff = a
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_eq_zero_iff_degree_le_zero
{R : Type u}
[Semiring R]
{p : Polynomial R}
:
@[simp]
@[simp]
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)
: