/-- The scalar multiplication on an object of `ModuleCat R` considered as
a morphism of rings from `R` to the endomorphisms of the underlying abelian group. -/
def smul : R →+* End ((forget₂ (ModuleCat R) AddCommGroupCat).obj M) where
  toFun r :=
    { toFun := fun (m : M) => r • m
      map_zero' := by dsimp; rw [smul_zero]
      map_add' := fun x y => by dsimp; rw [smul_add] }
  map_one' := AddMonoidHom.ext (fun x => by dsimp; rw [one_smul])
  map_zero' := AddMonoidHom.ext (fun x => by 

Proof state:
R : Type u
inst✝ : Ring R
X₁ X₂ : Type v
M N : ModuleCat R
x : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)
⊢ (OneHom.toFun
        (↑{
            toOneHom :=
              {
                toFun := fun r =>
                  { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                    map_add' :=
                      (_ :
                        ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                          ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } (x + y) =
                            ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } x +
                              ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } y) },
                map_one' :=
                  (_ :
                    (fun r =>
                          { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                            map_add' :=
                              (_ :
                                ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                  ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                      (x + y) =
                                    ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                        x +
                                      ZeroHom.toFun
                                        { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } y) })
                        1 =
                      1) },
            map_mul' :=
              (_ :
                ∀ (r s : R),
                  OneHom.toFun
                      {
                        toFun := fun r =>
                          { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                            map_add' :=
                              (_ :
                                ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                  ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                      (x + y) =
                                    ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                        x +
                                      ZeroHom.toFun
                                        { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } y) },
                        map_one' :=
                          (_ :
                            (fun r =>
                                  { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                                    map_add' :=
                                      (_ :
                                        ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                          ZeroHom.toFun
                                              { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                              (x + y) =
                                            ZeroHom.toFun
                                                { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                x +
                                              ZeroHom.toFun
                                                { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                y) })
                                1 =
                              1) }
                      (r * s) =
                    OneHom.toFun
                        {
                          toFun := fun r =>
                            { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                              map_add' :=
                                (_ :
                                  ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                    ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                        (x + y) =
                                      ZeroHom.toFun
                                          { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } x +
                                        ZeroHom.toFun
                                          { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } y) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    {
                                      toZeroHom :=
                                        { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                                      map_add' :=
                                        (_ :
                                          ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                            ZeroHom.toFun
                                                { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                (x + y) =
                                              ZeroHom.toFun
                                                  { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                  x +
                                                ZeroHom.toFun
                                                  { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                  y) })
                                  1 =
                                1) }
                        r *
                      OneHom.toFun
                        {
                          toFun := fun r =>
                            { toZeroHom := { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                              map_add' :=
                                (_ :
                                  ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                    ZeroHom.toFun { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                        (x + y) =
                                      ZeroHom.toFun
                                          { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } x +
                                        ZeroHom.toFun
                                          { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) } y) },
                          map_one' :=
                            (_ :
                              (fun r =>
                                    {
                                      toZeroHom :=
                                        { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) },
                                      map_add' :=
                                        (_ :
                                          ∀ (x y : ↑((forget₂ (ModuleCat R) AddCommGroupCat).obj M)),
                                            ZeroHom.toFun
                                                { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                (x + y) =
                                              ZeroHom.toFun
                                                  { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                  x +
                                                ZeroHom.toFun
                                                  { toFun := fun m => r • m, map_zero' := (_ : (fun m => r • m) 0 = 0) }
                                                  y) })
                                  1 =
                                1) }
                        s) })
        0)
      x =
    0 x

Next tactic:
dsimp