/-- 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
        rw [sum_single_index (h₁ _)] }
  invFun F := F.toMulHom.comp (ofMagma k G)
  left_inv f := 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
⊢ (fun F => MulHom.comp (NonUnitalAlgHom.toMulHom F) (ofMagma k G))
      ((fun f =>
          let src := liftAddHom fun x => (AddMonoidHom.flip (smulAddHom k A)) (f x);
          {
            toDistribMulActionHom :=
              {
                toMulActionHom :=
                  { toFun := fun a => sum a fun m t => t • f m,
                    map_smul' :=
                      (_ :
                        ∀ (t' : k) (a : MonoidAlgebra k G),
                          (fun a => sum a fun m t => t • f m) (t' • a) = t' • (fun a => sum a fun m t => t • f m) a) },
                map_zero' := (_ : ZeroHom.toFun (↑src) 0 = 0),
                map_add' :=
                  (_ :
                    ∀ (x y : G →₀ k), ZeroHom.toFun (↑src) (x + y) = ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) },
            map_mul' :=
              (_ :
                ∀ (a₁ a₂ : MonoidAlgebra k G),
                  MulActionHom.toFun
                      {
                          toMulActionHom :=
                            { toFun := fun a => sum a fun m t => t • f m,
                              map_smul' :=
                                (_ :
                                  ∀ (t' : k) (a : MonoidAlgebra k G),
                                    (fun a => sum a fun m t => t • f m) (t' • a) =
                                      t' • (fun a => sum a fun m t => t • f m) a) },
                          map_zero' := (_ : ZeroHom.toFun (↑src) 0 = 0),
                          map_add' :=
                            (_ :
                              ∀ (x y : G →₀ k),
                                ZeroHom.toFun (↑src) (x + y) =
                                  ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }.toMulActionHom
                      (a₁ * a₂) =
                    MulActionHom.toFun
                        {
                            toMulActionHom :=
                              { toFun := fun a => sum a fun m t => t • f m,
                                map_smul' :=
                                  (_ :
                                    ∀ (t' : k) (a : MonoidAlgebra k G),
                                      (fun a => sum a fun m t => t • f m) (t' • a) =
                                        t' • (fun a => sum a fun m t => t • f m) a) },
                            map_zero' := (_ : ZeroHom.toFun (↑src) 0 = 0),
                            map_add' :=
                              (_ :
                                ∀ (x y : G →₀ k),
                                  ZeroHom.toFun (↑src) (x + y) =
                                    ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }.toMulActionHom
                        a₁ *
                      MulActionHom.toFun
                        {
                            toMulActionHom :=
                              { toFun := fun a => sum a fun m t => t • f m,
                                map_smul' :=
                                  (_ :
                                    ∀ (t' : k) (a : MonoidAlgebra k G),
                                      (fun a => sum a fun m t => t • f m) (t' • a) =
                                        t' • (fun a => sum a fun m t => t • f m) a) },
                            map_zero' := (_ : ZeroHom.toFun (↑src) 0 = 0),
                            map_add' :=
                              (_ :
                                ∀ (x y : G →₀ k),
                                  ZeroHom.toFun (↑src) (x + y) =
                                    ZeroHom.toFun (↑src) x + ZeroHom.toFun (↑src) y) }.toMulActionHom
                        a₂) })
        f) =
    f

Next tactic:
ext m