l3lab/ntp-mathlib huggingface dataset:
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · 

Proof state:
case refine'_1
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
⊢ (∀ i ∈ ∅, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in ∅, φ i) (∑ i in ∅, n i)

Next tactic:
intro
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    

Proof state:
case refine'_1
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
h✝ : ∀ i ∈ ∅, IsHomogeneous (φ i) (n i)
⊢ IsHomogeneous (∏ i in ∅, φ i) (∑ i in ∅, n i)

Next tactic:
simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
  · 

Proof state:
case refine'_2
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
⊢ ∀ ⦃a : ι⦄ {s : Finset ι},
    a ∉ s →
      ((∀ i ∈ s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i)) →
        (∀ i ∈ insert a s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in insert a s, φ i) (∑ i in insert a s, n i)

Next tactic:
intro i s his IH h
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
  · intro i s his IH h
    

Proof state:
case refine'_2
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s✝ : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
i : ι
s : Finset ι
his : i ∉ s
IH : (∀ i ∈ s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i)
h : ∀ i_1 ∈ insert i s, IsHomogeneous (φ i_1) (n i_1)
⊢ IsHomogeneous (∏ i in insert i s, φ i) (∑ i in insert i s, n i)

Next tactic:
simp only [his, Finset.prod_insert, Finset.sum_insert, not_false_iff]
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
  · intro i s his IH h
    simp only [his, Finset.prod_insert, Finset.sum_insert, not_false_iff]
    

Proof state:
case refine'_2
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s✝ : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
i : ι
s : Finset ι
his : i ∉ s
IH : (∀ i ∈ s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i)
h : ∀ i_1 ∈ insert i s, IsHomogeneous (φ i_1) (n i_1)
⊢ IsHomogeneous (φ i * ∏ i in s, φ i) (n i + ∑ i in s, n i)

Next tactic:
apply (h i (Finset.mem_insert_self _ _)).mul (IH _)
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
  · intro i s his IH h
    simp only [his, Finset.prod_insert, Finset.sum_insert, not_false_iff]
    apply (h i (Finset.mem_insert_self _ _)).mul (IH _)
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s✝ : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
i : ι
s : Finset ι
his : i ∉ s
IH : (∀ i ∈ s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i)
h : ∀ i_1 ∈ insert i s, IsHomogeneous (φ i_1) (n i_1)
⊢ ∀ i ∈ s, IsHomogeneous (φ i) (n i)

Next tactic:
intro j hjs
theorem prod {ι : Type*} (s : Finset ι) (φ : ι → MvPolynomial σ R) (n : ι → ℕ)
    (h : ∀ i ∈ s, IsHomogeneous (φ i) (n i)) : IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i) := by
  classical
  revert h
  refine' Finset.induction_on s _ _
  · intro
    simp only [isHomogeneous_one, Finset.sum_empty, Finset.prod_empty]
  · intro i s his IH h
    simp only [his, Finset.prod_insert, Finset.sum_insert, not_false_iff]
    apply (h i (Finset.mem_insert_self _ _)).mul (IH _)
    intro j hjs
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ✝ ψ : MvPolynomial σ R
m n✝ : ℕ
ι : Type u_5
s✝ : Finset ι
φ : ι → MvPolynomial σ R
n : ι → ℕ
i : ι
s : Finset ι
his : i ∉ s
IH : (∀ i ∈ s, IsHomogeneous (φ i) (n i)) → IsHomogeneous (∏ i in s, φ i) (∑ i in s, n i)
h : ∀ i_1 ∈ insert i s, IsHomogeneous (φ i_1) (n i_1)
j : ι
hjs : j ∈ s
⊢ IsHomogeneous (φ j) (n j)

Next tactic:
exact h j (Finset.mem_insert_of_mem hjs)
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
⊢ MvPolynomial.totalDegree φ = n

Next tactic:
rw [MvPolynomial.totalDegree]
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
⊢ (Finset.sup (support φ) fun s => Finsupp.sum s fun x e => e) = n

Next tactic:
apply le_antisymm
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · 

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
⊢ (Finset.sup (support φ) fun s => Finsupp.sum s fun x e => e) ≤ n

Next tactic:
apply Finset.sup_le
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    

Proof state:
case a.a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
⊢ ∀ b ∈ support φ, (Finsupp.sum b fun x e => e) ≤ n

Next tactic:
intro d hd
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    

Proof state:
case a.a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
d : σ →₀ ℕ
hd : d ∈ support φ
⊢ (Finsupp.sum d fun x e => e) ≤ n

Next tactic:
rw [mem_support_iff] at hd
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    rw [mem_support_iff] at hd
    

Proof state:
case a.a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
d : σ →₀ ℕ
hd : coeff d φ ≠ 0
⊢ (Finsupp.sum d fun x e => e) ≤ n

Next tactic:
rw [Finsupp.sum, hφ hd]
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    rw [mem_support_iff] at hd
    rw [Finsupp.sum, hφ hd]
  · 

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
⊢ n ≤ Finset.sup (support φ) fun s => Finsupp.sum s fun x e => e

Next tactic:
obtain ⟨d, hd⟩ : ∃ d, coeff d φ ≠ 0 := exists_coeff_ne_zero h
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    rw [mem_support_iff] at hd
    rw [Finsupp.sum, hφ hd]
  · obtain ⟨d, hd⟩ : ∃ d, coeff d φ ≠ 0 := exists_coeff_ne_zero h
    

Proof state:
case a.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
d : σ →₀ ℕ
hd : coeff d φ ≠ 0
⊢ n ≤ Finset.sup (support φ) fun s => Finsupp.sum s fun x e => e

Next tactic:
simp only [← hφ hd, Finsupp.sum]
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    rw [mem_support_iff] at hd
    rw [Finsupp.sum, hφ hd]
  · obtain ⟨d, hd⟩ : ∃ d, coeff d φ ≠ 0 := exists_coeff_ne_zero h
    simp only [← hφ hd, Finsupp.sum]
    

Proof state:
case a.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
d : σ →₀ ℕ
hd : coeff d φ ≠ 0
⊢ ∑ i in d.support, d i ≤ Finset.sup (support φ) fun s => ∑ a in s.support, s a

Next tactic:
replace hd := Finsupp.mem_support_iff.mpr hd
theorem totalDegree (hφ : IsHomogeneous φ n) (h : φ ≠ 0) : totalDegree φ = n := by
  rw [MvPolynomial.totalDegree]
  apply le_antisymm
  · apply Finset.sup_le
    intro d hd
    rw [mem_support_iff] at hd
    rw [Finsupp.sum, hφ hd]
  · obtain ⟨d, hd⟩ : ∃ d, coeff d φ ≠ 0 := exists_coeff_ne_zero h
    simp only [← hφ hd, Finsupp.sum]
    replace hd := Finsupp.mem_support_iff.mpr hd
    -- Porting note: Original proof did not define `f`
    

Proof state:
case a.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
m n : ℕ
hφ : IsHomogeneous φ n
h : φ ≠ 0
d : σ →₀ ℕ
hd : d ∈ φ.support
⊢ ∑ i in d.support, d i ≤ Finset.sup (support φ) fun s => ∑ a in s.support, s a

Next tactic:
exact Finset.le_sup (f := fun s ↦ ∑ x in s.support, (⇑s) x) hd
theorem homogeneousComponent_isHomogeneous : (homogeneousComponent n φ).IsHomogeneous n := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
⊢ IsHomogeneous ((homogeneousComponent n) φ) n

Next tactic:
intro d hd
theorem homogeneousComponent_isHomogeneous : (homogeneousComponent n φ).IsHomogeneous n := by
  intro d hd
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : coeff d ((homogeneousComponent n) φ) ≠ 0
⊢ ∑ i in d.support, d i = n

Next tactic:
contrapose! hd
theorem homogeneousComponent_isHomogeneous : (homogeneousComponent n φ).IsHomogeneous n := by
  intro d hd
  contrapose! hd
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : ∑ i in d.support, d i ≠ n
⊢ coeff d ((homogeneousComponent n) φ) = 0

Next tactic:
rw [coeff_homogeneousComponent, if_neg hd]
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
⊢ (homogeneousComponent 0) φ = C (coeff 0 φ)

Next tactic:
ext1 d
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ coeff d ((homogeneousComponent 0) φ) = coeff d (C (coeff 0 φ))

Next tactic:
rcases em (d = 0) with (rfl | hd)
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  rcases em (d = 0) with (rfl | hd)
  

Proof state:
case a.inl
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
⊢ coeff 0 ((homogeneousComponent 0) φ) = coeff 0 (C (coeff 0 φ))
case a.inr
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : ¬d = 0
⊢ coeff d ((homogeneousComponent 0) φ) = coeff d (C (coeff 0 φ))

Next tactic:
classical
  · simp only [coeff_homogeneousComponent, sum_eq_zero_iff, Finsupp.zero_apply, if_true, coeff_C,
      eq_self_iff_true, forall_true_iff]
  · rw [coeff_homogeneousComponent, if_neg, coeff_C, if_neg (Ne.symm hd)]
    simp only [FunLike.ext_iff, Finsupp.zero_apply] at hd
    simp [hd]
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  rcases em (d = 0) with (rfl | hd)
  classical
  · 

Proof state:
case a.inl
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
⊢ coeff 0 ((homogeneousComponent 0) φ) = coeff 0 (C (coeff 0 φ))

Next tactic:
simp only [coeff_homogeneousComponent, sum_eq_zero_iff, Finsupp.zero_apply, if_true, coeff_C,
      eq_self_iff_true, forall_true_iff]
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  rcases em (d = 0) with (rfl | hd)
  classical
  · simp only [coeff_homogeneousComponent, sum_eq_zero_iff, Finsupp.zero_apply, if_true, coeff_C,
      eq_self_iff_true, forall_true_iff]
  · 

Proof state:
case a.inr
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : ¬d = 0
⊢ coeff d ((homogeneousComponent 0) φ) = coeff d (C (coeff 0 φ))

Next tactic:
rw [coeff_homogeneousComponent, if_neg, coeff_C, if_neg (Ne.symm hd)]
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  rcases em (d = 0) with (rfl | hd)
  classical
  · simp only [coeff_homogeneousComponent, sum_eq_zero_iff, Finsupp.zero_apply, if_true, coeff_C,
      eq_self_iff_true, forall_true_iff]
  · rw [coeff_homogeneousComponent, if_neg, coeff_C, if_neg (Ne.symm hd)]
    

Proof state:
case a.inr.hnc
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : ¬d = 0
⊢ ¬∑ i in d.support, d i = 0

Next tactic:
simp only [FunLike.ext_iff, Finsupp.zero_apply] at hd
@[simp]
theorem homogeneousComponent_zero : homogeneousComponent 0 φ = C (coeff 0 φ) := by
  ext1 d
  rcases em (d = 0) with (rfl | hd)
  classical
  · simp only [coeff_homogeneousComponent, sum_eq_zero_iff, Finsupp.zero_apply, if_true, coeff_C,
      eq_self_iff_true, forall_true_iff]
  · rw [coeff_homogeneousComponent, if_neg, coeff_C, if_neg (Ne.symm hd)]
    simp only [FunLike.ext_iff, Finsupp.zero_apply] at hd
    

Proof state:
case a.inr.hnc
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
hd : ¬∀ (x : σ), d x = 0
⊢ ¬∑ i in d.support, d i = 0

Next tactic:
simp [hd]
@[simp]
theorem homogeneousComponent_C_mul (n : ℕ) (r : R) :
    homogeneousComponent n (C r * φ) = C r * homogeneousComponent n φ := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
n : ℕ
r : R
⊢ (homogeneousComponent n) (C r * φ) = C r * (homogeneousComponent n) φ

Next tactic:
simp only [C_mul', LinearMap.map_smul]
theorem homogeneousComponent_eq_zero'
    (h : ∀ d : σ →₀ ℕ, d ∈ φ.support → ∑ i in d.support, d i ≠ n) :
    homogeneousComponent n φ = 0 := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n
⊢ (homogeneousComponent n) φ = 0

Next tactic:
rw [homogeneousComponent_apply, sum_eq_zero]
theorem homogeneousComponent_eq_zero'
    (h : ∀ d : σ →₀ ℕ, d ∈ φ.support → ∑ i in d.support, d i ≠ n) :
    homogeneousComponent n φ = 0 := by
  rw [homogeneousComponent_apply, sum_eq_zero]
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n
⊢ ∀ x ∈ filter (fun d => ∑ i in d.support, d i = n) (support φ), (monomial x) (coeff x φ) = 0

Next tactic:
intro d hd
theorem homogeneousComponent_eq_zero'
    (h : ∀ d : σ →₀ ℕ, d ∈ φ.support → ∑ i in d.support, d i ≠ n) :
    homogeneousComponent n φ = 0 := by
  rw [homogeneousComponent_apply, sum_eq_zero]
  intro d hd; 

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n
d : σ →₀ ℕ
hd : d ∈ filter (fun d => ∑ i in d.support, d i = n) (support φ)
⊢ (monomial d) (coeff d φ) = 0

Next tactic:
rw [mem_filter] at hd
theorem homogeneousComponent_eq_zero'
    (h : ∀ d : σ →₀ ℕ, d ∈ φ.support → ∑ i in d.support, d i ≠ n) :
    homogeneousComponent n φ = 0 := by
  rw [homogeneousComponent_apply, sum_eq_zero]
  intro d hd; rw [mem_filter] at hd
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n
d : σ →₀ ℕ
hd : d ∈ support φ ∧ ∑ i in d.support, d i = n
⊢ (monomial d) (coeff d φ) = 0

Next tactic:
exfalso
theorem homogeneousComponent_eq_zero'
    (h : ∀ d : σ →₀ ℕ, d ∈ φ.support → ∑ i in d.support, d i ≠ n) :
    homogeneousComponent n φ = 0 := by
  rw [homogeneousComponent_apply, sum_eq_zero]
  intro d hd; rw [mem_filter] at hd
  exfalso; 

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n
d : σ →₀ ℕ
hd : d ∈ support φ ∧ ∑ i in d.support, d i = n
⊢ False

Next tactic:
exact h _ hd.1 hd.2
theorem homogeneousComponent_eq_zero (h : φ.totalDegree < n) : homogeneousComponent n φ = 0 := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : totalDegree φ < n
⊢ (homogeneousComponent n) φ = 0

Next tactic:
apply homogeneousComponent_eq_zero'
theorem homogeneousComponent_eq_zero (h : φ.totalDegree < n) : homogeneousComponent n φ = 0 := by
  apply homogeneousComponent_eq_zero'
  

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : totalDegree φ < n
⊢ ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n

Next tactic:
rw [totalDegree, Finset.sup_lt_iff] at h
theorem homogeneousComponent_eq_zero (h : φ.totalDegree < n) : homogeneousComponent n φ = 0 := by
  apply homogeneousComponent_eq_zero'
  rw [totalDegree, Finset.sup_lt_iff] at h
  · 

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ b ∈ support φ, (Finsupp.sum b fun x e => e) < n
⊢ ∀ d ∈ support φ, ∑ i in d.support, d i ≠ n

Next tactic:
intro d hd
theorem homogeneousComponent_eq_zero (h : φ.totalDegree < n) : homogeneousComponent n φ = 0 := by
  apply homogeneousComponent_eq_zero'
  rw [totalDegree, Finset.sup_lt_iff] at h
  · intro d hd
    

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : ∀ b ∈ support φ, (Finsupp.sum b fun x e => e) < n
d : σ →₀ ℕ
hd : d ∈ support φ
⊢ ∑ i in d.support, d i ≠ n

Next tactic:
exact ne_of_lt (h d hd)
theorem homogeneousComponent_eq_zero (h : φ.totalDegree < n) : homogeneousComponent n φ = 0 := by
  apply homogeneousComponent_eq_zero'
  rw [totalDegree, Finset.sup_lt_iff] at h
  · intro d hd
    exact ne_of_lt (h d hd)
  · 

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
h : (sup (support φ) fun s => Finsupp.sum s fun x e => e) < n
⊢ ⊥ < n

Next tactic:
exact lt_of_le_of_lt (Nat.zero_le _) h
theorem sum_homogeneousComponent :
    (∑ i in range (φ.totalDegree + 1), homogeneousComponent i φ) = φ := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
⊢ ∑ i in range (totalDegree φ + 1), (homogeneousComponent i) φ = φ

Next tactic:
ext1 d
theorem sum_homogeneousComponent :
    (∑ i in range (φ.totalDegree + 1), homogeneousComponent i φ) = φ := by
  ext1 d
  

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ coeff d (∑ i in range (totalDegree φ + 1), (homogeneousComponent i) φ) = coeff d φ

Next tactic:
suffices φ.totalDegree < d.support.sum d → 0 = coeff d φ by
    simpa [coeff_sum, coeff_homogeneousComponent]
theorem sum_homogeneousComponent :
    (∑ i in range (φ.totalDegree + 1), homogeneousComponent i φ) = φ := by
  ext1 d
  suffices φ.totalDegree < d.support.sum d → 0 = coeff d φ by
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
this : totalDegree φ < Finset.sum d.support ⇑d → 0 = coeff d φ
⊢ coeff d (∑ i in range (totalDegree φ + 1), (homogeneousComponent i) φ) = coeff d φ

Next tactic:
simpa [coeff_sum, coeff_homogeneousComponent]
theorem sum_homogeneousComponent :
    (∑ i in range (φ.totalDegree + 1), homogeneousComponent i φ) = φ := by
  ext1 d
  suffices φ.totalDegree < d.support.sum d → 0 = coeff d φ by
    simpa [coeff_sum, coeff_homogeneousComponent]
  

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
φ ψ : MvPolynomial σ R
d : σ →₀ ℕ
⊢ totalDegree φ < Finset.sum d.support ⇑d → 0 = coeff d φ

Next tactic:
exact fun h => (coeff_eq_zero_of_totalDegree_lt h).symm
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : p ∈ homogeneousSubmodule σ R n
⊢ (homogeneousComponent m) p = if m = n then p else 0

Next tactic:
simp only [mem_homogeneousSubmodule] at h
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
⊢ (homogeneousComponent m) p = if m = n then p else 0

Next tactic:
ext x
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
⊢ coeff x ((homogeneousComponent m) p) = coeff x (if m = n then p else 0)

Next tactic:
rw [coeff_homogeneousComponent]
theorem homogeneousComponent_homogeneous_polynomial (m n : ℕ) (p : MvPolynomial σ R)
    (h : p ∈ homogeneousSubmodule σ R n) : homogeneousComponent m p = if m = n then p else 0 := by
  simp only [mem_homogeneousSubmodule] at h
  ext x
  rw [coeff_homogeneousComponent]
  

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n✝ : ℕ
φ ψ : MvPolynomial σ R
m n : ℕ
p : MvPolynomial σ R
h : IsHomogeneous p n
x : σ →₀ ℕ
⊢ (if ∑ i in x.support, x i = m then coeff x p else 0) = coeff x (if m = n then p else 0)

Next tactic:
by_cases zero_coeff : coeff x p = 0