l3lab/ntp-mathlib huggingface dataset:
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    intro h
    apply hc
    rw [h]
    exact smul_zero r
  zero_mem' d hd := False.elim (hd <| coeff_zero _)
  add_mem' {a b} ha hb c hc := by
    rw [coeff_add] at hc
    obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by
      contrapose! hc
      simp only [hc, add_zero]
    · 

Proof state:
case inl
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
a b : MvPolynomial σ R
ha : a ∈ {x | IsHomogeneous x n}
hb : b ∈ {x | IsHomogeneous x n}
c : σ →₀ ℕ
hc : coeff c a + coeff c b ≠ 0
h : coeff c a ≠ 0
⊢ ∑ i in c.support, c i = n

Next tactic:
exact ha h
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    intro h
    apply hc
    rw [h]
    exact smul_zero r
  zero_mem' d hd := False.elim (hd <| coeff_zero _)
  add_mem' {a b} ha hb c hc := by
    rw [coeff_add] at hc
    obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by
      contrapose! hc
      simp only [hc, add_zero]
    · exact ha h
    · 

Proof state:
case inr
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
a b : MvPolynomial σ R
ha : a ∈ {x | IsHomogeneous x n}
hb : b ∈ {x | IsHomogeneous x n}
c : σ →₀ ℕ
hc : coeff c a + coeff c b ≠ 0
h : coeff c b ≠ 0
⊢ ∑ i in c.support, c i = n

Next tactic:
exact hb h
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : coeff c (r • a) ≠ 0
⊢ ∑ i in c.support, c i = n

Next tactic:
rw [coeff_smul] at hc
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : r • coeff c a ≠ 0
⊢ ∑ i in c.support, c i = n

Next tactic:
apply ha
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : r • coeff c a ≠ 0
⊢ coeff c a ≠ 0

Next tactic:
intro h
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    intro h
    

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : r • coeff c a ≠ 0
h : coeff c a = 0
⊢ False

Next tactic:
apply hc
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    intro h
    apply hc
    

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : r • coeff c a ≠ 0
h : coeff c a = 0
⊢ r • coeff c a = 0

Next tactic:
rw [h]
/-- The submodule of homogeneous `MvPolynomial`s of degree `n`. -/
def homogeneousSubmodule [CommSemiring R] (n : ℕ) : Submodule R (MvPolynomial σ R) where
  carrier := { x | x.IsHomogeneous n }
  smul_mem' r a ha c hc := by
    rw [coeff_smul] at hc
    apply ha
    intro h
    apply hc
    rw [h]
    

Proof state:
case a
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
r : R
a : MvPolynomial σ R
ha :
  a ∈
    {
          toAddSubsemigroup :=
            { carrier := {x | IsHomogeneous x n},
              add_mem' :=
                (_ :
                  ∀ {a b : MvPolynomial σ R},
                    a ∈ {x | IsHomogeneous x n} →
                      b ∈ {x | IsHomogeneous x n} → ∀ (c : σ →₀ ℕ), coeff c (a + b) ≠ 0 → ∑ i in c.support, c i = n) },
          zero_mem' := (_ : ∀ (d : σ →₀ ℕ), coeff d 0 ≠ 0 → ∑ i in d.support, d i = n) }.toAddSubsemigroup.carrier
c : σ →₀ ℕ
hc : r • coeff c a ≠ 0
h : coeff c a = 0
⊢ r • 0 = 0

Next tactic:
exact smul_zero r
/-- While equal, the former has a convenient definitional reduction. -/
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
    homogeneousSubmodule σ R n = Finsupp.supported _ R { d | ∑ i in d.support, d i = n } := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
⊢ homogeneousSubmodule σ R n = Finsupp.supported R R {d | ∑ i in d.support, d i = n}

Next tactic:
ext
/-- While equal, the former has a convenient definitional reduction. -/
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
    homogeneousSubmodule σ R n = Finsupp.supported _ R { d | ∑ i in d.support, d i = n } := by
  ext
  

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
x✝ : MvPolynomial σ R
⊢ x✝ ∈ homogeneousSubmodule σ R n ↔ x✝ ∈ Finsupp.supported R R {d | ∑ i in d.support, d i = n}

Next tactic:
rw [Finsupp.mem_supported, Set.subset_def]
/-- While equal, the former has a convenient definitional reduction. -/
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
    homogeneousSubmodule σ R n = Finsupp.supported _ R { d | ∑ i in d.support, d i = n } := by
  ext
  rw [Finsupp.mem_supported, Set.subset_def]
  

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
x✝ : MvPolynomial σ R
⊢ x✝ ∈ homogeneousSubmodule σ R n ↔ ∀ x ∈ ↑x✝.support, x ∈ {d | ∑ i in d.support, d i = n}

Next tactic:
simp only [Finsupp.mem_support_iff, Finset.mem_coe]
/-- While equal, the former has a convenient definitional reduction. -/
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
    homogeneousSubmodule σ R n = Finsupp.supported _ R { d | ∑ i in d.support, d i = n } := by
  ext
  rw [Finsupp.mem_supported, Set.subset_def]
  simp only [Finsupp.mem_support_iff, Finset.mem_coe]
  

Proof state:
case h
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
n : ℕ
x✝ : MvPolynomial σ R
⊢ x✝ ∈ homogeneousSubmodule σ R n ↔ ∀ (x : σ →₀ ℕ), x✝ x ≠ 0 → x ∈ {d | ∑ i in d.support, d i = n}

Next tactic:
rfl
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
⊢ homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n)

Next tactic:
rw [Submodule.mul_le]
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
⊢ ∀ m_1 ∈ homogeneousSubmodule σ R m, ∀ n_1 ∈ homogeneousSubmodule σ R n, m_1 * n_1 ∈ homogeneousSubmodule σ R (m + n)

Next tactic:
intro φ hφ ψ hψ c hc
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : coeff c (φ * ψ) ≠ 0
⊢ ∑ i in c.support, c i = m + n

Next tactic:
classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  specialize hψ aux.2
  rw [Finset.mem_antidiagonal] at hde
  classical
  have hd' : d.support ⊆ d.support ∪ e.support := Finset.subset_union_left _ _
  have he' : e.support ⊆ d.support ∪ e.support := Finset.subset_union_right _ _
  rw [← hde, ← hφ, ← hψ, Finset.sum_subset Finsupp.support_add, Finset.sum_subset hd',
    Finset.sum_subset he', ← Finset.sum_add_distrib]
  · congr
  all_goals intro i hi; apply Finsupp.not_mem_support_iff.mp
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : coeff c (φ * ψ) ≠ 0
⊢ ∑ i in c.support, c i = m + n

Next tactic:
rw [coeff_mul] at hc
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
⊢ ∑ i in c.support, c i = m + n

Next tactic:
obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
⊢ ∑ i in c.support, c i = m + n

Next tactic:
have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
⊢ coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0

Next tactic:
contrapose! H
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    

Proof state:
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff d φ ≠ 0 → coeff e ψ = 0
⊢ coeff (d, e).1 φ * coeff (d, e).2 ψ = 0

Next tactic:
by_cases h : coeff d φ = 0
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      

Proof state:
case pos
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff d φ ≠ 0 → coeff e ψ = 0
h : coeff d φ = 0
⊢ coeff (d, e).1 φ * coeff (d, e).2 ψ = 0

Next tactic:
simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      

Proof state:
case neg
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff d φ ≠ 0 → coeff e ψ = 0
h : ¬coeff d φ = 0
⊢ coeff (d, e).1 φ * coeff (d, e).2 ψ = 0

Next tactic:
simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ : MvPolynomial σ R
hφ : φ ∈ homogeneousSubmodule σ R m
ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
⊢ ∑ i in c.support, c i = m + n

Next tactic:
specialize hφ aux.1
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ ψ : MvPolynomial σ R
hψ : ψ ∈ homogeneousSubmodule σ R n
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
hφ : ∑ i in d.support, d i = m
⊢ ∑ i in c.support, c i = m + n

Next tactic:
specialize hψ aux.2
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  specialize hψ aux.2
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ ψ : MvPolynomial σ R
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e) ∈ Finset.antidiagonal c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
hφ : ∑ i in d.support, d i = m
hψ : ∑ i in e.support, e i = n
⊢ ∑ i in c.support, c i = m + n

Next tactic:
rw [Finset.mem_antidiagonal] at hde
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  specialize hψ aux.2
  rw [Finset.mem_antidiagonal] at hde
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ ψ : MvPolynomial σ R
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e).1 + (d, e).2 = c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
hφ : ∑ i in d.support, d i = m
hψ : ∑ i in e.support, e i = n
⊢ ∑ i in c.support, c i = m + n

Next tactic:
classical
  have hd' : d.support ⊆ d.support ∪ e.support := Finset.subset_union_left _ _
  have he' : e.support ⊆ d.support ∪ e.support := Finset.subset_union_right _ _
  rw [← hde, ← hφ, ← hψ, Finset.sum_subset Finsupp.support_add, Finset.sum_subset hd',
    Finset.sum_subset he', ← Finset.sum_add_distrib]
  · congr
  all_goals intro i hi; apply Finsupp.not_mem_support_iff.mp
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  specialize hψ aux.2
  rw [Finset.mem_antidiagonal] at hde
  classical
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ ψ : MvPolynomial σ R
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e).1 + (d, e).2 = c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
hφ : ∑ i in d.support, d i = m
hψ : ∑ i in e.support, e i = n
⊢ ∑ i in c.support, c i = m + n

Next tactic:
have hd' : d.support ⊆ d.support ∪ e.support := Finset.subset_union_left _ _
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
    homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := by
  rw [Submodule.mul_le]
  intro φ hφ ψ hψ c hc
  classical
  rw [coeff_mul] at hc
  obtain ⟨⟨d, e⟩, hde, H⟩ := Finset.exists_ne_zero_of_sum_ne_zero hc
  have aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0 := by
    contrapose! H
    by_cases h : coeff d φ = 0 <;>
      simp_all only [Ne.def, not_false_iff, zero_mul, mul_zero]
  specialize hφ aux.1
  specialize hψ aux.2
  rw [Finset.mem_antidiagonal] at hde
  classical
  have hd' : d.support ⊆ d.support ∪ e.support := Finset.subset_union_left _ _
  

Proof state:
case intro.mk.intro
σ : Type u_1
τ : Type u_2
R : Type u_3
S : Type u_4
inst✝ : CommSemiring R
m n : ℕ
φ ψ : MvPolynomial σ R
c : σ →₀ ℕ
hc : ∑ x in Finset.antidiagonal c, coeff x.1 φ * coeff x.2 ψ ≠ 0
d e : σ →₀ ℕ
hde : (d, e).1 + (d, e).2 = c
H : coeff (d, e).1 φ * coeff (d, e).2 ψ ≠ 0
aux : coeff d φ ≠ 0 ∧ coeff e ψ ≠ 0
hφ : ∑ i in d.support, d i = m
hψ : ∑ i in e.support, e i = n
hd' : d.support ⊆ d.support ∪ e.support
⊢ ∑ i in c.support, c i = m + n

Next tactic:
have he' : e.support ⊆ d.support ∪ e.support := Finset.subset_union_right _ _