Theorem: MvPolynomial.sum_weightedHomogeneousComponent
File: Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean

tactic: rw [finsum_eq_sum _ (weightedHomogeneousComponent_finsupp φ)]
state_before: R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
⊢ (∑ᶠ (m : M), ↑(weightedHomogeneousComponent w m) φ) = φ

tactic: ext1 d
state_before: R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
⊢ ∑ i in Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ)),
      ↑(weightedHomogeneousComponent w i) φ =
    φ

tactic: simp only [coeff_sum, coeff_weightedHomogeneousComponent]
state_before: case a
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ coeff d
      (∑ i in Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ)),
        ↑(weightedHomogeneousComponent w i) φ) =
    coeff d φ

tactic: rw [Finset.sum_eq_single (weightedDegree' w d)]
state_before: case a
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ (∑ x in Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ)),
      if ↑(weightedDegree' w) d = x then coeff d φ else 0) =
    coeff d φ

tactic: rw [if_pos rfl]
state_before: case a
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ (if ↑(weightedDegree' w) d = ↑(weightedDegree' w) d then coeff d φ else 0) = coeff d φ

tactic: intro m _ hm'
state_before: case a.h₀
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ ∀ (b : (fun x => M) d),
    b ∈ Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ)) →
      b ≠ ↑(weightedDegree' w) d → (if ↑(weightedDegree' w) d = b then coeff d φ else 0) = 0

tactic: rw [if_neg hm'.symm]
state_before: case a.h₀
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
m : M
a✝ : m ∈ Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ))
hm' : m ≠ ↑(weightedDegree' w) d
⊢ (if ↑(weightedDegree' w) d = m then coeff d φ else 0) = 0

tactic: intro hm
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ ¬↑(weightedDegree' w) d ∈
        Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ)) →
    (if ↑(weightedDegree' w) d = ↑(weightedDegree' w) d then coeff d φ else 0) = 0

tactic: rw [if_pos rfl]
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hm :
  ¬↑(weightedDegree' w) d ∈
      Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ))
⊢ (if ↑(weightedDegree' w) d = ↑(weightedDegree' w) d then coeff d φ else 0) = 0

tactic: simp only [Finite.mem_toFinset, mem_support, Ne.def, Classical.not_not] at hm
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hm :
  ¬↑(weightedDegree' w) d ∈
      Finite.toFinset (_ : Set.Finite (Function.support fun m => ↑(weightedHomogeneousComponent w m) φ))
⊢ coeff d φ = 0

tactic: have := coeff_weightedHomogeneousComponent (w := w) (weightedDegree' w d) φ d
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hm : ↑(weightedHomogeneousComponent w (↑(weightedDegree' w) d)) φ = 0
⊢ coeff d φ = 0

tactic: rw [hm, if_pos rfl, coeff_zero] at this
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hm : ↑(weightedHomogeneousComponent w (↑(weightedDegree' w) d)) φ = 0
this :
  coeff d (↑(weightedHomogeneousComponent w (↑(weightedDegree' w) d)) φ) =
    if ↑(weightedDegree' w) d = ↑(weightedDegree' w) d then coeff d φ else 0
⊢ coeff d φ = 0

tactic: exact this.symm
state_before: case a.h₁
R : Type u_1
M : Type u_3
inst✝¹ : CommSemiring R
σ : Type u_2
inst✝ : AddCommMonoid M
w : σ → M
n : M
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hm : ↑(weightedHomogeneousComponent w (↑(weightedDegree' w) d)) φ = 0
this : 0 = coeff d φ
⊢ coeff d φ = 0