l3lab/ntp-mathlib huggingface dataset:
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
m : G
⊢ g m 0 = 0

Next tactic:
exact zero_smul k (f m)
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
⊢ ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂

Next tactic:
intros
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
m✝ : G
t₁✝ t₂✝ : k
⊢ g m✝ (t₁✝ + t₂✝) = g m✝ t₁✝ + g m✝ t₂✝

Next tactic:
rw [← add_smul]
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
⊢ (sum (sum a₁ fun a₁ b₁ => sum a₂ fun a₂ b₂ => single (a₁ * a₂) (b₁ * b₂)) fun m t => t • f m) =
    sum a₁ fun x' v' => sum a₂ fun x v => (v' * v) • f (x' * x)

Next tactic:
rw [sum_sum_index h₁ h₂]
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
⊢ (sum a₁ fun a b => sum (sum a₂ fun a₂ b₂ => single (a * a₂) (b * b₂)) fun a => g a) =
    sum a₁ fun x' v' => sum a₂ fun x v => (v' * v) • f (x' * x)

Next tactic:
congr
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; congr; 

Proof state:
case e_g
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
⊢ (fun a b => sum (sum a₂ fun a₂ b₂ => single (a * a₂) (b * b₂)) fun a => g a) = fun x' v' =>
    sum a₂ fun x v => (v' * v) • f (x' * x)

Next tactic:
ext
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; congr; ext
        

Proof state:
case e_g.h.h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
x✝¹ : G
x✝ : k
⊢ (sum (sum a₂ fun a₂ b₂ => single (x✝¹ * a₂) (x✝ * b₂)) fun a => g a) = sum a₂ fun x v => (x✝ * v) • f (x✝¹ * x)

Next tactic:
rw [sum_sum_index h₁ h₂]
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; congr; ext
        rw [sum_sum_index h₁ h₂]; 

Proof state:
case e_g.h.h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
x✝¹ : G
x✝ : k
⊢ (sum a₂ fun a b => sum (single (x✝¹ * a) (x✝ * b)) fun a => g a) = sum a₂ fun x v => (x✝ * v) • f (x✝¹ * x)

Next tactic:
congr
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; congr; ext
        rw [sum_sum_index h₁ h₂]; congr; 

Proof state:
case e_g.h.h.e_g
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
x✝¹ : G
x✝ : k
⊢ (fun a b => sum (single (x✝¹ * a) (x✝ * b)) fun a => g a) = fun x v => (x✝ * v) • f (x✝¹ * x)

Next tactic:
ext
/-- The functor `G ↦ MonoidAlgebra k G`, from the category of magmas to the category of non-unital,
non-associative algebras over `k` is adjoint to the forgetful functor in the other direction. -/
@[simps apply_apply symm_apply]
def liftMagma [Module k A] [IsScalarTower k A A] [SMulCommClass k A A] :
    (G →ₙ* A) ≃ (MonoidAlgebra k G →ₙₐ[k] A) where
  toFun f :=
    { liftAddHom fun x => (smulAddHom k A).flip (f x) with
      toFun := fun a => a.sum fun m t => t • f m
      map_smul' := fun t' a => by
        -- Porting note: `dsimp` is required for beta reduction.
        dsimp only []
        rw [Finsupp.smul_sum, sum_smul_index']
        · simp_rw [smul_assoc]
        · intro m
          exact zero_smul k (f m)
      map_mul' := fun a₁ a₂ => by
        let g : G → k → A := fun m t => t • f m
        have h₁ : ∀ m, g m 0 = 0 := by
          intro m
          exact zero_smul k (f m)
        have h₂ : ∀ (m) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂ := by
          intros
          rw [← add_smul]
        -- Porting note: `reducible` cannot be `local` so proof gets long.
        simp_rw [Finsupp.mul_sum, Finsupp.sum_mul, smul_mul_smul, ← f.map_mul, mul_def,
          sum_comm a₂ a₁]
        rw [sum_sum_index h₁ h₂]; congr; ext
        rw [sum_sum_index h₁ h₂]; congr; ext
        

Proof state:
case e_g.h.h.e_g.h.h
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁶ : Semiring k
inst✝⁵ : DistribSMul R k
inst✝⁴ : Mul G
A : Type u₃
inst✝³ : NonUnitalNonAssocSemiring A
inst✝² : Module k A
inst✝¹ : IsScalarTower k A A
inst✝ : SMulCommClass k A A
f : G →ₙ* A
src✝ : (G →₀ k) →+ A := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x)
a₁ a₂ : MonoidAlgebra k G
g : G → k → A := fun m t => t • f m
h₁ : ∀ (m : G), g m 0 = 0
h₂ : ∀ (m : G) (t₁ t₂ : k), g m (t₁ + t₂) = g m t₁ + g m t₂
x✝³ : G
x✝² : k
x✝¹ : G
x✝ : k
⊢ (sum (single (x✝³ * x✝¹) (x✝² * x✝)) fun a => g a) = (x✝² * x✝) • f (x✝³ * x✝¹)

Next tactic:
rw [sum_single_index (h₁ _)]
/-- `Finsupp.single 1` as a `RingHom` -/
@[simps]
def singleOneRingHom [Semiring k] [MulOneClass G] : k →+* MonoidAlgebra k G :=
  { Finsupp.singleAddHom 1 with
    map_one' := rfl
    map_mul' := fun x y => by
      -- Porting note: Was `rw`.
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : MulOneClass G
src✝ : k →+ G →₀ k := singleAddHom 1
x y : k
⊢ OneHom.toFun { toFun := src✝.toFun, map_one' := (_ : ZeroHom.toFun (↑src✝) 1 = ZeroHom.toFun (↑src✝) 1) } (x * y) =
    OneHom.toFun { toFun := src✝.toFun, map_one' := (_ : ZeroHom.toFun (↑src✝) 1 = ZeroHom.toFun (↑src✝) 1) } x *
      OneHom.toFun { toFun := src✝.toFun, map_one' := (_ : ZeroHom.toFun (↑src✝) 1 = ZeroHom.toFun (↑src✝) 1) } y

Next tactic:
simp only [ZeroHom.toFun_eq_coe, AddMonoidHom.toZeroHom_coe, singleAddHom_apply,
        single_mul_single, mul_one]
/-- If two ring homomorphisms from `MonoidAlgebra k G` are equal on all `single a 1`
and `single 1 b`, then they are equal. -/
theorem ringHom_ext {R} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R}
    (h₁ : ∀ b, f (single 1 b) = g (single 1 b)) (h_of : ∀ a, f (single a 1) = g (single a 1)) :
    f = g :=
  RingHom.coe_addMonoidHom_injective <|
    addHom_ext fun a b => by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R✝ : Type u_2
R : Type u_3
inst✝² : Semiring k
inst✝¹ : MulOneClass G
inst✝ : Semiring R
f g : MonoidAlgebra k G →+* R
h₁ : ∀ (b : k), f (single 1 b) = g (single 1 b)
h_of : ∀ (a : G), f (single a 1) = g (single a 1)
a : G
b : k
⊢ (((fun f => ↑f) f) fun₀ | a => b) = ((fun f => ↑f) g) fun₀ | a => b

Next tactic:
rw [← single, ← one_mul a, ← mul_one b, ← single_mul_single]
/-- If two ring homomorphisms from `MonoidAlgebra k G` are equal on all `single a 1`
and `single 1 b`, then they are equal. -/
theorem ringHom_ext {R} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R}
    (h₁ : ∀ b, f (single 1 b) = g (single 1 b)) (h_of : ∀ a, f (single a 1) = g (single a 1)) :
    f = g :=
  RingHom.coe_addMonoidHom_injective <|
    addHom_ext fun a b => by
      rw [← single, ← one_mul a, ← mul_one b, ← single_mul_single]
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R✝ : Type u_2
R : Type u_3
inst✝² : Semiring k
inst✝¹ : MulOneClass G
inst✝ : Semiring R
f g : MonoidAlgebra k G →+* R
h₁ : ∀ (b : k), f (single 1 b) = g (single 1 b)
h_of : ∀ (a : G), f (single a 1) = g (single a 1)
a : G
b : k
⊢ ((fun f => ↑f) f) (single 1 b * single a 1) = ((fun f => ↑f) g) (single 1 b * single a 1)

Next tactic:
erw [AddMonoidHom.coe_coe f, AddMonoidHom.coe_coe g]
/-- If two ring homomorphisms from `MonoidAlgebra k G` are equal on all `single a 1`
and `single 1 b`, then they are equal. -/
theorem ringHom_ext {R} [Semiring k] [MulOneClass G] [Semiring R] {f g : MonoidAlgebra k G →+* R}
    (h₁ : ∀ b, f (single 1 b) = g (single 1 b)) (h_of : ∀ a, f (single a 1) = g (single a 1)) :
    f = g :=
  RingHom.coe_addMonoidHom_injective <|
    addHom_ext fun a b => by
      rw [← single, ← one_mul a, ← mul_one b, ← single_mul_single]
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddMonoidHom.coe_coe f, AddMonoidHom.coe_coe g]; 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R✝ : Type u_2
R : Type u_3
inst✝² : Semiring k
inst✝¹ : MulOneClass G
inst✝ : Semiring R
f g : MonoidAlgebra k G →+* R
h₁ : ∀ (b : k), f (single 1 b) = g (single 1 b)
h_of : ∀ (a : G), f (single a 1) = g (single a 1)
a : G
b : k
⊢ f (single 1 b * single a 1) = g (single 1 b * single a 1)

Next tactic:
rw [f.map_mul, g.map_mul, h₁, h_of]
/-- The instance `Algebra k (MonoidAlgebra A G)` whenever we have `Algebra k A`.

In particular this provides the instance `Algebra k (MonoidAlgebra k G)`.
-/
instance algebra {A : Type*} [CommSemiring k] [Semiring A] [Algebra k A] [Monoid G] :
    Algebra k (MonoidAlgebra A G) :=
  { singleOneRingHom.comp (algebraMap k A) with
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    smul_def' := fun r a => by
      refine Finsupp.ext fun _ => ?_
      -- Porting note: Newly required.
      rw [Finsupp.coe_smul]
      simp [single_one_mul_apply, Algebra.smul_def, Pi.smul_apply]
    commutes' := fun r f => by
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
A : Type u_3
inst✝³ : CommSemiring k
inst✝² : Semiring A
inst✝¹ : Algebra k A
inst✝ : Monoid G
src✝ : k →+* MonoidAlgebra A G := RingHom.comp singleOneRingHom (algebraMap k A)
r : k
f : MonoidAlgebra A G
⊢ { toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : k), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
        r *
      f =
    f *
      { toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : k), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
        r

Next tactic:
refine Finsupp.ext fun _ => ?_