/-- `leftMulMatrix b x` is the matrix corresponding to the linear map `fun y ↦ x * y`.

`leftMulMatrix_eq_repr_mul` gives a formula for the entries of `leftMulMatrix`.

This definition is useful for doing (more) explicit computations with `LinearMap.mulLeft`,
such as the trace form or norm map for algebras.
-/
noncomputable def leftMulMatrix : S →ₐ[R] Matrix m m R where
  toFun x := LinearMap.toMatrix b b (Algebra.lmul R S x)
  map_zero' := by
    dsimp only  -- porting node: needed due to new-style structures
    rw [AlgHom.map_zero, LinearEquiv.map_zero]
  map_one' := by
    dsimp only  -- porting node: needed due to new-style structures
    rw [AlgHom.map_one, LinearMap.toMatrix_one]
  map_add' x y := by
    dsimp only  -- porting node: needed due to new-style structures
    rw [AlgHom.map_add, LinearEquiv.map_add]
  map_mul' x y := by
    dsimp only  -- porting node: needed due to new-style structures
    rw [AlgHom.map_mul, LinearMap.toMatrix_mul]
  commutes' r := by
    

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Ring S
inst✝² : Algebra R S
m : Type u_3
inst✝¹ : Fintype m
inst✝ : DecidableEq m
b : Basis m R S
r : R
⊢ OneHom.toFun
      (↑↑{
            toMonoidHom :=
              {
                toOneHom :=
                  { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                    map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) },
                map_mul' :=
                  (_ :
                    ∀ (x y : S),
                      OneHom.toFun
                          { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                            map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                          (x * y) =
                        OneHom.toFun
                            { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                              map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                            x *
                          OneHom.toFun
                            { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                              map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                            y) },
            map_zero' :=
              (_ :
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                            map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) },
                        map_mul' :=
                          (_ :
                            ∀ (x y : S),
                              OneHom.toFun
                                  { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                    map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                  (x * y) =
                                OneHom.toFun
                                    { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                      map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                    x *
                                  OneHom.toFun
                                    { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                      map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                    y) })
                    0 =
                  0),
            map_add' :=
              (_ :
                ∀ (x y : S),
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                              map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : S),
                                OneHom.toFun
                                    { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                      map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                    (x * y) =
                                  OneHom.toFun
                                      { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                        map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                      x *
                                    OneHom.toFun
                                      { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                        map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                      y) })
                      (x + y) =
                    OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (x y : S),
                                  OneHom.toFun
                                      { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                        map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                      (x * y) =
                                    OneHom.toFun
                                        { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                          map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                        x *
                                      OneHom.toFun
                                        { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                          map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                        y) })
                        x +
                      OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (x y : S),
                                  OneHom.toFun
                                      { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                        map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                      (x * y) =
                                    OneHom.toFun
                                        { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                          map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                        x *
                                      OneHom.toFun
                                        { toFun := fun x => (toMatrix b b) ((lmul R S) x),
                                          map_one' := (_ : (fun x => (toMatrix b b) ((lmul R S) x)) 1 = 1) }
                                        y) })
                        y) })
      ((algebraMap R S) r) =
    (algebraMap R (Matrix m m R)) r

Next tactic:
dsimp only