l3lab/ntp-mathlib huggingface dataset:
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (AddMonoidHom.comp
        (AddMonoidHom.comp
          ((AddMonoidHom.comp
              (AddMonoidHom.comp (AddMonoidHom.compr₂ AddMonoidHom.mul (AddEquiv.toAddMonoidHom src✝))
                (AddEquiv.toAddMonoidHom opAddEquiv))
              (singleAddHom i₁))
            r₁)
          (AddEquiv.toAddMonoidHom opAddEquiv))
        (singleAddHom i₂))
      r₂ =
    (AddMonoidHom.comp
        (AddMonoidHom.comp
          ((AddMonoidHom.comp
              (AddMonoidHom.comp
                (AddMonoidHom.compl₂ (AddMonoidHom.comp AddMonoidHom.mul (AddEquiv.toAddMonoidHom src✝))
                  (AddEquiv.toAddMonoidHom src✝))
                (AddEquiv.toAddMonoidHom opAddEquiv))
              (singleAddHom i₁))
            r₁)
          (AddEquiv.toAddMonoidHom opAddEquiv))
        (singleAddHom i₂))
      r₂

Next tactic:
dsimp
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      dsimp
      -- 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
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (AddEquiv.toAddMonoidHom (AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)))
      ((opAddEquiv fun₀ | i₁ => r₁) * opAddEquiv fun₀ | i₂ => r₂) =
    (AddEquiv.toAddMonoidHom (AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)))
        (opAddEquiv fun₀ | i₁ => r₁) *
      (AddEquiv.toAddMonoidHom (AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)))
        (opAddEquiv fun₀ | i₂ => r₂)

Next tactic:
erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        MulOpposite.opAddEquiv_symm_apply]
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      dsimp
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        MulOpposite.opAddEquiv_symm_apply]; 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (mapRange.addEquiv opAddEquiv) (unop ((opAddEquiv fun₀ | i₁ => r₁) * opAddEquiv fun₀ | i₂ => r₂)) =
    (mapRange.addEquiv opAddEquiv) (unop (opAddEquiv fun₀ | i₁ => r₁)) *
      (mapRange.addEquiv opAddEquiv) (unop (opAddEquiv fun₀ | i₂ => r₂))

Next tactic:
rw [MulOpposite.unop_mul (α := k[G])]
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      dsimp
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        MulOpposite.opAddEquiv_symm_apply]; rw [MulOpposite.unop_mul (α := k[G])]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (mapRange.addEquiv opAddEquiv) (unop (opAddEquiv fun₀ | i₂ => r₂) * unop (opAddEquiv fun₀ | i₁ => r₁)) =
    (mapRange.addEquiv opAddEquiv) (unop (opAddEquiv fun₀ | i₁ => r₁)) *
      (mapRange.addEquiv opAddEquiv) (unop (opAddEquiv fun₀ | i₂ => r₂))

Next tactic:
dsimp
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      dsimp
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        MulOpposite.opAddEquiv_symm_apply]; rw [MulOpposite.unop_mul (α := k[G])]
      dsimp
      -- This was not needed before leanprover/lean4#2644
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ mapRange op (_ : opAddEquiv 0 = 0) (unop (opAddEquiv fun₀ | i₂ => r₂) * unop (opAddEquiv fun₀ | i₁ => r₁)) =
    mapRange op (_ : opAddEquiv 0 = 0) (unop (opAddEquiv fun₀ | i₁ => r₁)) *
      mapRange op (_ : opAddEquiv 0 = 0) (unop (opAddEquiv fun₀ | i₂ => r₂))

Next tactic:
erw [mapRange_single, single_mul_single, mapRange_single, mapRange_single]
/-- The opposite of an `R[I]` is ring equivalent to
the `AddMonoidAlgebra Rᵐᵒᵖ I` over the opposite ring, taking elements to their opposite. -/
@[simps! (config := { simpRhs := true }) apply symm_apply]
protected noncomputable def opRingEquiv [AddCommMonoid G] :
    k[G]ᵐᵒᵖ ≃+* kᵐᵒᵖ[G] :=
  { MulOpposite.opAddEquiv.symm.trans
      (Finsupp.mapRange.addEquiv (MulOpposite.opAddEquiv : k ≃+ kᵐᵒᵖ)) with
    map_mul' := by
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      rw [Equiv.toFun_as_coe, AddEquiv.toEquiv_eq_coe]; erw [AddEquiv.coe_toEquiv]
      rw [← AddEquiv.coe_toAddMonoidHom]
      refine Iff.mpr (AddMonoidHom.map_mul_iff (R := k[G]ᵐᵒᵖ) (S := kᵐᵒᵖ[G]) _) ?_
      -- Porting note: Was `ext`.
      refine AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₁ => AddMonoidHom.ext fun r₁ =>
        AddMonoidHom.mul_op_ext _ _ <| addHom_ext' fun i₂ => AddMonoidHom.ext fun r₂ => ?_
      -- Porting note: `reducible` cannot be `local` so proof gets long.
      dsimp
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [AddEquiv.trans_apply, AddEquiv.trans_apply, AddEquiv.trans_apply,
        MulOpposite.opAddEquiv_symm_apply]; rw [MulOpposite.unop_mul (α := k[G])]
      dsimp
      -- This was not needed before leanprover/lean4#2644
      erw [mapRange_single, single_mul_single, mapRange_single, mapRange_single]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
src✝ : (G →₀ k)ᵐᵒᵖ ≃+ (G →₀ kᵐᵒᵖ) := AddEquiv.trans (AddEquiv.symm opAddEquiv) (mapRange.addEquiv opAddEquiv)
i₁ : G
r₁ : k
i₂ : G
r₂ : k
⊢ (fun₀ | i₂ + i₁ => op (r₂ * r₁)) = (fun₀ | i₁ => op r₁) * fun₀ | i₂ => op r₂

Next tactic:
simp only [mapRange_single, single_mul_single, ← op_mul, add_comm]
theorem opRingEquiv_single [AddCommMonoid G] (r : k) (x : G) :
    AddMonoidAlgebra.opRingEquiv (op (single x r)) = single x (op r) := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
r : k
x : G
⊢ AddMonoidAlgebra.opRingEquiv (op (single x r)) = single x (op r)

Next tactic:
simp
theorem opRingEquiv_symm_single [AddCommMonoid G] (r : kᵐᵒᵖ) (x : Gᵐᵒᵖ) :
    AddMonoidAlgebra.opRingEquiv.symm (single x r) = op (single x r.unop) := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝¹ : Semiring k
inst✝ : AddCommMonoid G
r : kᵐᵒᵖ
x : Gᵐᵒᵖ
⊢ (RingEquiv.symm AddMonoidAlgebra.opRingEquiv) (single x r) = op (single x (unop r))

Next tactic:
simp
/-- The instance `Algebra R k[G]` whenever we have `Algebra R k`.

In particular this provides the instance `Algebra k k[G]`.
-/
instance algebra [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] :
    Algebra R k[G] :=
  { singleZeroRingHom.comp (algebraMap R k) 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_zero_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
inst✝³ : CommSemiring R
inst✝² : Semiring k
inst✝¹ : Algebra R k
inst✝ : AddMonoid G
src✝ : R →+* k[G] := RingHom.comp singleZeroRingHom (algebraMap R k)
r : R
f : k[G]
⊢ { toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
          map_add' :=
            (_ : ∀ (x y : R), 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 : R), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
        r

Next tactic:
refine Finsupp.ext fun _ => ?_
/-- The instance `Algebra R k[G]` whenever we have `Algebra R k`.

In particular this provides the instance `Algebra k k[G]`.
-/
instance algebra [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] :
    Algebra R k[G] :=
  { singleZeroRingHom.comp (algebraMap R k) 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_zero_mul_apply, Algebra.smul_def, Pi.smul_apply]
    commutes' := fun r f => by
      refine Finsupp.ext fun _ => ?_
      

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

Next tactic:
simp [single_zero_mul_apply, mul_single_zero_apply, Algebra.commutes]
/-- The instance `Algebra R k[G]` whenever we have `Algebra R k`.

In particular this provides the instance `Algebra k k[G]`.
-/
instance algebra [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] :
    Algebra R k[G] :=
  { singleZeroRingHom.comp (algebraMap R k) with
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    smul_def' := fun r a => by
      

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

Next tactic:
refine Finsupp.ext fun _ => ?_
/-- The instance `Algebra R k[G]` whenever we have `Algebra R k`.

In particular this provides the instance `Algebra k k[G]`.
-/
instance algebra [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] :
    Algebra R k[G] :=
  { singleZeroRingHom.comp (algebraMap R k) with
    -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
    smul_def' := fun r a => by
      refine Finsupp.ext fun _ => ?_
      -- Porting note: Newly required.
      

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

Next tactic:
rw [Finsupp.coe_smul]
/-- The instance `Algebra R k[G]` whenever we have `Algebra R k`.

In particular this provides the instance `Algebra k k[G]`.
-/
instance algebra [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] :
    Algebra R k[G] :=
  { singleZeroRingHom.comp (algebraMap R k) 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]
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝³ : CommSemiring R
inst✝² : Semiring k
inst✝¹ : Algebra R k
inst✝ : AddMonoid G
src✝ : R →+* k[G] := RingHom.comp singleZeroRingHom (algebraMap R k)
r : R
a : k[G]
x✝ : G
⊢ (r • ⇑a) x✝ =
    ({ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ : ∀ (x y : R), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) }
          r *
        a)
      x✝

Next tactic:
simp [single_zero_mul_apply, Algebra.smul_def, Pi.smul_apply]
/-- `Finsupp.single 0` as an `AlgHom` -/
@[simps! apply]
def singleZeroAlgHom [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] : k →ₐ[R] k[G] :=
  { singleZeroRingHom with
    commutes' := fun r => by
      -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝³ : CommSemiring R
inst✝² : Semiring k
inst✝¹ : Algebra R k
inst✝ : AddMonoid G
src✝ : k →+* k[G] := singleZeroRingHom
r : R
⊢ OneHom.toFun
      (↑↑{ 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) })
      ((algebraMap R k) r) =
    (algebraMap R k[G]) r

Next tactic:
refine Finsupp.ext fun _ => ?_
/-- `Finsupp.single 0` as an `AlgHom` -/
@[simps! apply]
def singleZeroAlgHom [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] : k →ₐ[R] k[G] :=
  { singleZeroRingHom with
    commutes' := fun r => by
      -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
      refine Finsupp.ext fun _ => ?_
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝³ : CommSemiring R
inst✝² : Semiring k
inst✝¹ : Algebra R k
inst✝ : AddMonoid G
src✝ : k →+* k[G] := singleZeroRingHom
r : R
x✝ : G
⊢ (OneHom.toFun
        (↑↑{ 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) })
        ((algebraMap R k) r))
      x✝ =
    ((algebraMap R k[G]) r) x✝

Next tactic:
simp
/-- `Finsupp.single 0` as an `AlgHom` -/
@[simps! apply]
def singleZeroAlgHom [CommSemiring R] [Semiring k] [Algebra R k] [AddMonoid G] : k →ₐ[R] k[G] :=
  { singleZeroRingHom with
    commutes' := fun r => by
      -- Porting note: `ext` → `refine Finsupp.ext fun _ => ?_`
      refine Finsupp.ext fun _ => ?_
      simp
      

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝³ : CommSemiring R
inst✝² : Semiring k
inst✝¹ : Algebra R k
inst✝ : AddMonoid G
src✝ : k →+* k[G] := singleZeroRingHom
r : R
x✝ : G
⊢ (fun₀ | 0 => (algebraMap R k) r) x✝ = ((algebraMap R k[G]) r) x✝

Next tactic:
rfl
/-- `liftNCRingHom` as an `AlgHom`, for when `f` is an `AlgHom` -/
def liftNCAlgHom (f : A →ₐ[k] B) (g : Multiplicative G →* B) (h_comm : ∀ x y, Commute (f x) (g y)) :
    A[G] →ₐ[k] B :=
  { liftNCRingHom (f : A →+* B) g h_comm with
    commutes' := by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
f : A →ₐ[k] B
g : Multiplicative G →* B
h_comm : ∀ (x : A) (y : Multiplicative G), Commute (f x) (g y)
src✝ : A[G] →+* B := liftNCRingHom (↑f) g h_comm
⊢ ∀ (r : k),
    OneHom.toFun
        (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
              map_add' :=
                (_ :
                  ∀ (x y : A[G]), OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
        ((algebraMap k A[G]) r) =
      (algebraMap k B) r

Next tactic:
simp [liftNCRingHom]
theorem lift_apply (F : Multiplicative G →* A) (f : MonoidAlgebra k G) :
    lift k G A F f = f.sum fun a b => b • F (Multiplicative.ofAdd a) := by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
F : Multiplicative G →* A
f : MonoidAlgebra k G
⊢ ((lift k G A) F) f = sum f fun a b => b • F (Multiplicative.ofAdd a)

Next tactic:
simp only [lift_apply', Algebra.smul_def]
/-- Decomposition of a `k`-algebra homomorphism from `MonoidAlgebra k G` by
its values on `F (single a 1)`. -/
theorem lift_unique (F : k[G] →ₐ[k] A) (f : MonoidAlgebra k G) :
    F f = f.sum fun a b => b • F (single a 1) := by
  

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
F : k[G] →ₐ[k] A
f : MonoidAlgebra k G
⊢ F f = sum f fun a b => b • F (single a 1)

Next tactic:
conv_lhs =>
    rw [lift_unique' F]
    simp [lift_apply]
/-- Decomposition of a `k`-algebra homomorphism from `MonoidAlgebra k G` by
its values on `F (single a 1)`. -/
theorem lift_unique (F : k[G] →ₐ[k] A) (f : MonoidAlgebra k G) :
    F f = f.sum fun a b => b • F (single a 1) := by
  conv_lhs =>
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
F : k[G] →ₐ[k] A
f : MonoidAlgebra k G
| F f

Next tactic:
rw [lift_unique' F]
    simp [lift_apply]
/-- Decomposition of a `k`-algebra homomorphism from `MonoidAlgebra k G` by
its values on `F (single a 1)`. -/
theorem lift_unique (F : k[G] →ₐ[k] A) (f : MonoidAlgebra k G) :
    F f = f.sum fun a b => b • F (single a 1) := by
  conv_lhs =>
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
F : k[G] →ₐ[k] A
f : MonoidAlgebra k G
| F f

Next tactic:
rw [lift_unique' F]
/-- Decomposition of a `k`-algebra homomorphism from `MonoidAlgebra k G` by
its values on `F (single a 1)`. -/
theorem lift_unique (F : k[G] →ₐ[k] A) (f : MonoidAlgebra k G) :
    F f = f.sum fun a b => b • F (single a 1) := by
  conv_lhs =>
    rw [lift_unique' F]
    

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
F : k[G] →ₐ[k] A
f : MonoidAlgebra k G
| ((lift k G A) (MonoidHom.comp (↑F) (of k G))) f

Next tactic:
simp [lift_apply]
theorem algHom_ext_iff {φ₁ φ₂ : k[G] →ₐ[k] A} :
    (∀ x, φ₁ (Finsupp.single x 1) = φ₂ (Finsupp.single x 1)) ↔ φ₁ = φ₂ :=
  ⟨fun h => algHom_ext h, by 

Proof state:
k : Type u₁
G : Type u₂
H : Type u_1
R : Type u_2
inst✝⁵ : CommSemiring k
inst✝⁴ : AddMonoid G
A : Type u₃
inst✝³ : Semiring A
inst✝² : Algebra k A
B : Type u_3
inst✝¹ : Semiring B
inst✝ : Algebra k B
φ₁ φ₂ : k[G] →ₐ[k] A
⊢ φ₁ = φ₂ → ∀ (x : G), (φ₁ fun₀ | x => 1) = φ₂ fun₀ | x => 1

Next tactic:
rintro rfl _