l3lab/ntp-mathlib huggingface dataset:
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  

Proof state:
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
⊢ (Finset.sum (f.support ×ˢ g.support) fun x => if x.1 * x.2 = a0 * b0 then f x.1 * g x.2 else 0) = f a0 * g b0

Next tactic:
refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl)
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> 

Proof state:
case refine'_1
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
⊢ ∀ b ∈ f.support ×ˢ g.support, b ≠ (a0, b0) → (if b.1 * b.2 = a0 * b0 then f b.1 * g b.2 else 0) = 0

Next tactic:
simp_rw [Finset.mem_product]
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> 

Proof state:
case refine'_2
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
⊢ (a0, b0) ∉ f.support ×ˢ g.support → (if (a0, b0).1 * (a0, b0).2 = a0 * b0 then f (a0, b0).1 * g (a0, b0).2 else 0) = 0

Next tactic:
simp_rw [Finset.mem_product]
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · 

Proof state:
case refine'_1
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
⊢ ∀ (b : A × A),
    b.1 ∈ f.support ∧ b.2 ∈ g.support → b ≠ (a0, b0) → (if b.1 * b.2 = a0 * b0 then f b.1 * g b.2 else 0) = 0

Next tactic:
refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
    

Proof state:
case refine'_1.refine_1
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
ab : A × A
hab : ab.1 ∈ f.support ∧ ab.2 ∈ g.support
hne : ab ≠ (a0, b0)
he : ab.1 * ab.2 = a0 * b0
⊢ ab.1 = (a0, b0).1
case refine'_1.refine_2
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
ab : A × A
hab : ab.1 ∈ f.support ∧ ab.2 ∈ g.support
hne : ab ≠ (a0, b0)
he : ab.1 * ab.2 = a0 * b0
⊢ ab.2 = (a0, b0).2

Next tactic:
exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
    exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
  · 

Proof state:
case refine'_2
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
⊢ ¬(a0 ∈ f.support ∧ b0 ∈ g.support) → (if True then f a0 * g b0 else 0) = 0

Next tactic:
refine fun hnmem => ite_eq_right_iff.mpr (fun _ => ?_)
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
    exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
  · refine fun hnmem => ite_eq_right_iff.mpr (fun _ => ?_)
    

Proof state:
case refine'_2
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
hnmem : ¬(a0 ∈ f.support ∧ b0 ∈ g.support)
x✝ : True
⊢ f a0 * g b0 = 0

Next tactic:
rcases not_and_or.mp hnmem with af | bg
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
    exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
  · refine fun hnmem => ite_eq_right_iff.mpr (fun _ => ?_)
    rcases not_and_or.mp hnmem with af | bg
    · 

Proof state:
case refine'_2.inl
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
hnmem : ¬(a0 ∈ f.support ∧ b0 ∈ g.support)
x✝ : True
af : a0 ∉ f.support
⊢ f a0 * g b0 = 0

Next tactic:
rw [not_mem_support_iff.mp af, zero_mul]
/-- The coefficient of a monomial in a product `f * g` that can be reached in at most one way
as a product of monomials in the supports of `f` and `g` is a product. -/
theorem mul_apply_mul_eq_mul_of_uniqueMul [Mul A] {f g : MonoidAlgebra R A} {a0 b0 : A}
    (h : UniqueMul f.support g.support a0 b0) :
    (f * g) (a0 * b0) = f a0 * g b0 := by
  classical
  simp_rw [mul_apply, sum, ← Finset.sum_product']
  refine' (Finset.sum_eq_single (a0, b0) _ _).trans (if_pos rfl) <;> simp_rw [Finset.mem_product]
  · refine fun ab hab hne => if_neg (fun he => hne <| Prod.ext ?_ ?_)
    exacts [(h hab.1 hab.2 he).1, (h hab.1 hab.2 he).2]
  · refine fun hnmem => ite_eq_right_iff.mpr (fun _ => ?_)
    rcases not_and_or.mp hnmem with af | bg
    · rw [not_mem_support_iff.mp af, zero_mul]
    · 

Proof state:
case refine'_2.inr
R : Type u_1
A : Type u_2
inst✝¹ : Semiring R
inst✝ : Mul A
f g : MonoidAlgebra R A
a0 b0 : A
h : UniqueMul f.support g.support a0 b0
hnmem : ¬(a0 ∈ f.support ∧ b0 ∈ g.support)
x✝ : True
bg : b0 ∉ g.support
⊢ f a0 * g b0 = 0

Next tactic:
rw [not_mem_support_iff.mp bg, mul_zero]
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
    NoZeroDivisors (MonoidAlgebra R A) where
  eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
    

Proof state:
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : NoZeroDivisors R
inst✝¹ : Mul A
inst✝ : UniqueProds A
a b : MonoidAlgebra R A
ab : a * b = 0
⊢ a = 0 ∨ b = 0

Next tactic:
contrapose! ab
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
    NoZeroDivisors (MonoidAlgebra R A) where
  eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
    contrapose! ab
    

Proof state:
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : NoZeroDivisors R
inst✝¹ : Mul A
inst✝ : UniqueProds A
a b : MonoidAlgebra R A
ab : a ≠ 0 ∧ b ≠ 0
⊢ a * b ≠ 0

Next tactic:
obtain ⟨da, a0, db, b0, h⟩ := UniqueProds.uniqueMul_of_nonempty
      (support_nonempty_iff.mpr ab.1) (support_nonempty_iff.mpr ab.2)
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
    NoZeroDivisors (MonoidAlgebra R A) where
  eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
    contrapose! ab
    obtain ⟨da, a0, db, b0, h⟩ := UniqueProds.uniqueMul_of_nonempty
      (support_nonempty_iff.mpr ab.1) (support_nonempty_iff.mpr ab.2)
    

Proof state:
case intro.intro.intro.intro
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : NoZeroDivisors R
inst✝¹ : Mul A
inst✝ : UniqueProds A
a b : MonoidAlgebra R A
ab : a ≠ 0 ∧ b ≠ 0
da : A
a0 : da ∈ a.support
db : A
b0 : db ∈ b.support
h : UniqueMul a.support b.support da db
⊢ a * b ≠ 0

Next tactic:
refine support_nonempty_iff.mp ⟨da * db, ?_⟩
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
    NoZeroDivisors (MonoidAlgebra R A) where
  eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
    contrapose! ab
    obtain ⟨da, a0, db, b0, h⟩ := UniqueProds.uniqueMul_of_nonempty
      (support_nonempty_iff.mpr ab.1) (support_nonempty_iff.mpr ab.2)
    refine support_nonempty_iff.mp ⟨da * db, ?_⟩
    

Proof state:
case intro.intro.intro.intro
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : NoZeroDivisors R
inst✝¹ : Mul A
inst✝ : UniqueProds A
a b : MonoidAlgebra R A
ab : a ≠ 0 ∧ b ≠ 0
da : A
a0 : da ∈ a.support
db : A
b0 : db ∈ b.support
h : UniqueMul a.support b.support da db
⊢ da * db ∈ (a * b).support

Next tactic:
rw [mem_support_iff] at a0 b0 ⊢
instance instNoZeroDivisorsOfUniqueProds [NoZeroDivisors R] [Mul A] [UniqueProds A] :
    NoZeroDivisors (MonoidAlgebra R A) where
  eq_zero_or_eq_zero_of_mul_eq_zero {a b} ab := by
    contrapose! ab
    obtain ⟨da, a0, db, b0, h⟩ := UniqueProds.uniqueMul_of_nonempty
      (support_nonempty_iff.mpr ab.1) (support_nonempty_iff.mpr ab.2)
    refine support_nonempty_iff.mp ⟨da * db, ?_⟩
    rw [mem_support_iff] at a0 b0 ⊢
    

Proof state:
case intro.intro.intro.intro
R : Type u_1
A : Type u_2
inst✝³ : Semiring R
inst✝² : NoZeroDivisors R
inst✝¹ : Mul A
inst✝ : UniqueProds A
a b : MonoidAlgebra R A
ab : a ≠ 0 ∧ b ≠ 0
da : A
a0 : a da ≠ 0
db : A
b0 : b db ≠ 0
h : UniqueMul a.support b.support da db
⊢ (a * b) (da * db) ≠ 0

Next tactic:
exact mul_apply_mul_eq_mul_of_uniqueMul h ▸ mul_ne_zero a0 b0
instance _root_.GradedMonoid.smulCommClass_right :
    SMulCommClass R (GradedMonoid A) (GradedMonoid A) where
  smul_comm s x y := by
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
s : R
x y : GradedMonoid A
⊢ s • x • y = x • s • y

Next tactic:
dsimp
instance _root_.GradedMonoid.smulCommClass_right :
    SMulCommClass R (GradedMonoid A) (GradedMonoid A) where
  smul_comm s x y := by
    dsimp
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
s : R
x y : GradedMonoid A
⊢ s • (x * y) = x * s • y

Next tactic:
rw [GAlgebra.smul_def, GAlgebra.smul_def, ← mul_assoc, GAlgebra.commutes, mul_assoc]
instance _root_.GradedMonoid.isScalarTower_right :
    IsScalarTower R (GradedMonoid A) (GradedMonoid A) where
  smul_assoc s x y := by
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
s : R
x y : GradedMonoid A
⊢ (s • x) • y = s • x • y

Next tactic:
dsimp
instance _root_.GradedMonoid.isScalarTower_right :
    IsScalarTower R (GradedMonoid A) (GradedMonoid A) where
  smul_assoc s x y := by
    dsimp
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
s : R
x y : GradedMonoid A
⊢ s • x * y = s • (x * y)

Next tactic:
rw [GAlgebra.smul_def, GAlgebra.smul_def, ← mul_assoc, GAlgebra.commutes, mul_assoc]
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
a b : R
⊢ OneHom.toFun
      { toFun := ⇑(AddMonoidHom.comp (of A 0) GAlgebra.toFun),
        map_one' := (_ : (of A 0) (GAlgebra.toFun 1) = (of A 0) GradedMonoid.GOne.one) }
      (a * b) =
    OneHom.toFun
        { toFun := ⇑(AddMonoidHom.comp (of A 0) GAlgebra.toFun),
          map_one' := (_ : (of A 0) (GAlgebra.toFun 1) = (of A 0) GradedMonoid.GOne.one) }
        a *
      OneHom.toFun
        { toFun := ⇑(AddMonoidHom.comp (of A 0) GAlgebra.toFun),
          map_one' := (_ : (of A 0) (GAlgebra.toFun 1) = (of A 0) GradedMonoid.GOne.one) }
        b

Next tactic:
simp only [AddMonoidHom.comp_apply]
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
a b : R
⊢ (of A 0) (GAlgebra.toFun (a * b)) = (of A 0) (GAlgebra.toFun a) * (of A 0) (GAlgebra.toFun b)

Next tactic:
rw [of_mul_of]
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
a b : R
⊢ (of A 0) (GAlgebra.toFun (a * b)) = (of A (0 + 0)) (GradedMonoid.GMul.mul (GAlgebra.toFun a) (GAlgebra.toFun b))

Next tactic:
apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
  commutes' r x := by
    change AddMonoidHom.mul (DirectSum.of _ _ _) x = AddMonoidHom.mul.flip (DirectSum.of _ _ _) x
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
r : R
x : ⨁ (i : ι), A i
⊢ (AddMonoidHom.mul ((of (fun i => A i) 0) (GAlgebra.toFun r))) x =
    ((AddMonoidHom.flip AddMonoidHom.mul) ((of (fun i => A i) 0) (GAlgebra.toFun r))) x

Next tactic:
apply FunLike.congr_fun _ x
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
  commutes' r x := by
    change AddMonoidHom.mul (DirectSum.of _ _ _) x = AddMonoidHom.mul.flip (DirectSum.of _ _ _) x
    apply FunLike.congr_fun _ x
    

Proof state:
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
r : R
x : ⨁ (i : ι), A i
⊢ AddMonoidHom.mul ((of (fun i => A i) 0) (GAlgebra.toFun r)) =
    (AddMonoidHom.flip AddMonoidHom.mul) ((of (fun i => A i) 0) (GAlgebra.toFun r))

Next tactic:
ext i xi : 2
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
  commutes' r x := by
    change AddMonoidHom.mul (DirectSum.of _ _ _) x = AddMonoidHom.mul.flip (DirectSum.of _ _ _) x
    apply FunLike.congr_fun _ x
    ext i xi : 2
    

Proof state:
case H.h
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
r : R
x : ⨁ (i : ι), A i
i : ι
xi : A i
⊢ (AddMonoidHom.comp (AddMonoidHom.mul ((of (fun i => A i) 0) (GAlgebra.toFun r))) (of (fun i => A i) i)) xi =
    (AddMonoidHom.comp ((AddMonoidHom.flip AddMonoidHom.mul) ((of (fun i => A i) 0) (GAlgebra.toFun r)))
        (of (fun i => A i) i))
      xi

Next tactic:
dsimp only [AddMonoidHom.comp_apply, AddMonoidHom.mul_apply, AddMonoidHom.flip_apply]
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
  commutes' r x := by
    change AddMonoidHom.mul (DirectSum.of _ _ _) x = AddMonoidHom.mul.flip (DirectSum.of _ _ _) x
    apply FunLike.congr_fun _ x
    ext i xi : 2
    dsimp only [AddMonoidHom.comp_apply, AddMonoidHom.mul_apply, AddMonoidHom.flip_apply]
    

Proof state:
case H.h
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
r : R
x : ⨁ (i : ι), A i
i : ι
xi : A i
⊢ (of (fun i => A i) 0) (GAlgebra.toFun r) * (of (fun i => A i) i) xi =
    (of (fun i => A i) i) xi * (of (fun i => A i) 0) (GAlgebra.toFun r)

Next tactic:
rw [of_mul_of, of_mul_of]
instance : Algebra R (⨁ i, A i) where
  toFun := (DirectSum.of A 0).comp GAlgebra.toFun
  map_zero' := AddMonoidHom.map_zero _
  map_add' := AddMonoidHom.map_add _
  map_one' := (DirectSum.of A 0).congr_arg GAlgebra.map_one
  map_mul' a b := by
    simp only [AddMonoidHom.comp_apply]
    rw [of_mul_of]
    apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.map_mul a b)
  commutes' r x := by
    change AddMonoidHom.mul (DirectSum.of _ _ _) x = AddMonoidHom.mul.flip (DirectSum.of _ _ _) x
    apply FunLike.congr_fun _ x
    ext i xi : 2
    dsimp only [AddMonoidHom.comp_apply, AddMonoidHom.mul_apply, AddMonoidHom.flip_apply]
    rw [of_mul_of, of_mul_of]
    

Proof state:
case H.h
ι : Type uι
R : Type uR
A : ι → Type uA
B : Type uB
inst✝⁸ : DecidableEq ι
inst✝⁷ : CommSemiring R
inst✝⁶ : (i : ι) → AddCommMonoid (A i)
inst✝⁵ : (i : ι) → Module R (A i)
inst✝⁴ : AddMonoid ι
inst✝³ : GSemiring A
inst✝² : Semiring B
inst✝¹ : GAlgebra R A
inst✝ : Algebra R B
r : R
x : ⨁ (i : ι), A i
i : ι
xi : A i
⊢ (of (fun i => A i) (0 + i)) (GradedMonoid.GMul.mul (GAlgebra.toFun r) xi) =
    (of (fun i => A i) (i + 0)) (GradedMonoid.GMul.mul xi (GAlgebra.toFun r))

Next tactic:
apply DFinsupp.single_eq_of_sigma_eq (GAlgebra.commutes r ⟨i, xi⟩)