@@ -3,6 +3,7 @@ Copyright (c) 2018 Chris Hughes. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Chris Hughes, Johannes Hölzl, Scott Morrison, Jens Wagemaker
55-/
6+ import Mathlib.Algebra.MonoidAlgebra.Degree
67import Mathlib.Data.Fintype.BigOperators
78import Mathlib.Data.Nat.WithBot
89import Mathlib.Data.Polynomial.Monomial
@@ -626,11 +627,9 @@ theorem degree_le_zero_iff : degree p ≤ 0 ↔ p = C (coeff p 0) :=
626627 ⟨eq_C_of_degree_le_zero, fun h => h.symm ▸ degree_C_le⟩
627628#align polynomial.degree_le_zero_iff Polynomial.degree_le_zero_iff
628629
629- theorem degree_add_le (p q : R[X]) : degree (p + q) ≤ max (degree p) (degree q) :=
630- calc
631- degree (p + q) = (p + q).support.sup WithBot.some := rfl
632- _ ≤ (p.support ∪ q.support).sup WithBot.some := (sup_mono support_add)
633- _ = p.support.sup WithBot.some ⊔ q.support.sup WithBot.some := sup_union
630+ theorem degree_add_le (p q : R[X]) : degree (p + q) ≤ max (degree p) (degree q) := by
631+ simpa only [degree, ←support_toFinsupp, toFinsupp_add]
632+ using AddMonoidAlgebra.sup_support_add_le _ _ _
634633#align polynomial.degree_add_le Polynomial.degree_add_le
635634
636635theorem degree_add_le_of_degree_le {p q : R[X]} {n : ℕ} (hp : degree p ≤ n) (hq : degree q ≤ n) :
@@ -776,21 +775,9 @@ theorem degree_sum_le (s : Finset ι) (f : ι → R[X]) :
776775 _ ≤ _ := by rw [sup_insert, sup_eq_max]; exact max_le_max le_rfl ih
777776#align polynomial.degree_sum_le Polynomial.degree_sum_le
778777
779- theorem degree_mul_le (p q : R[X]) : degree (p * q) ≤ degree p + degree q :=
780- calc
781- degree (p * q) ≤
782- p.support.sup fun i => degree (sum q fun j a => C (coeff p i * a) * X ^ (i + j)) := by
783- -- Porting note: Was `simp only [..]; convert ..; exact mul_eq_sum_sum`.
784- simp only [← C_mul_X_pow_eq_monomial.symm, mul_eq_sum_sum (p := p) (q := q)]
785- exact degree_sum_le _ _
786- _ ≤ p.support.sup fun i => q.support.sup fun j =>
787- degree (C (coeff p i * coeff q j) * X ^ (i + j)) :=
788- (Finset.sup_mono_fun fun i _hi => degree_sum_le _ _)
789- _ ≤ degree p + degree q := by
790- refine Finset.sup_le fun a ha ↦ Finset.sup_le fun b hb ↦ (degree_C_mul_X_pow_le _ _).trans ?_
791- rw [Nat.cast_add]
792- rw [mem_support_iff] at ha hb
793- exact add_le_add (le_degree_of_ne_zero ha) (le_degree_of_ne_zero hb)
778+ theorem degree_mul_le (p q : R[X]) : degree (p * q) ≤ degree p + degree q := by
779+ simpa only [degree, ←support_toFinsupp, toFinsupp_mul]
780+ using AddMonoidAlgebra.sup_support_mul_le (WithBot.coe_add _ _).le _ _
794781#align polynomial.degree_mul_le Polynomial.degree_mul_le
795782
796783theorem degree_mul_le_of_le {a b : WithBot ℕ} (hp : degree p ≤ a) (hq : degree q ≤ b) :
0 commit comments