/-- The natural transformation from the composition of coextension and restriction of scalars to
identity functor.
-/
-- @[simps] Porting note: not in normal form and not used
protected def counit' : coextendScalars f ⋙ restrictScalars f ⟶ 𝟭 (ModuleCat R) where
  app X :=
    { toFun := fun g => g.toFun (1 : S)
      map_add' := fun x1 x2 => by
        dsimp
        rw [LinearMap.add_apply]
      map_smul' := fun r (g : (restrictScalars f).obj ((coextendScalars f).obj X)) => by
        dsimp
        rw [← LinearMap.coe_toAddHom, ← AddHom.toFun_eq_coe]
        rw [CoextendScalars.smul_apply (s := f r) (g := g) (s' := 1), one_mul, ← LinearMap.map_smul]
        rw [← LinearMap.coe_toAddHom, ← AddHom.toFun_eq_coe]
        congr
        change f r = (f r) • (1 : S)
        rw [smul_eq_mul (a := f r) (a' := 1), mul_one] }
  naturality X X' g := LinearMap.ext fun h => by
    rw [ModuleCat.coe_comp]
    

Proof state:
R✝ : Type u₁
S✝ : Type u₂
inst✝³ : CommRing R✝
inst✝² : CommRing S✝
f✝ : R✝ →+* S✝
R : Type u₁
S : Type u₂
inst✝¹ : Ring R
inst✝ : Ring S
f : R →+* S
X X' : ModuleCat R
g : X ⟶ X'
h : ↑((coextendScalars f ⋙ restrictScalars f).obj X)
⊢ (⇑((fun X =>
              {
                toAddHom :=
                  { toFun := fun g => AddHom.toFun g.toAddHom 1,
                    map_add' :=
                      (_ :
                        ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                          (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                            (fun g => AddHom.toFun g.toAddHom 1) x1 + (fun g => AddHom.toFun g.toAddHom 1) x2) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (g : ↑((restrictScalars f).obj ((coextendScalars f).obj X))),
                      AddHom.toFun
                          { toFun := fun g => AddHom.toFun g.toAddHom 1,
                            map_add' :=
                              (_ :
                                ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                                  (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                                    (fun g => AddHom.toFun g.toAddHom 1) x1 + (fun g => AddHom.toFun g.toAddHom 1) x2) }
                          (r • g) =
                        (RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun g => AddHom.toFun g.toAddHom 1,
                              map_add' :=
                                (_ :
                                  ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                                    (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                                      (fun g => AddHom.toFun g.toAddHom 1) x1 +
                                        (fun g => AddHom.toFun g.toAddHom 1) x2) }
                            g) })
            X') ∘
        ⇑((coextendScalars f ⋙ restrictScalars f).map g))
      h =
    ((fun X =>
            {
              toAddHom :=
                { toFun := fun g => AddHom.toFun g.toAddHom 1,
                  map_add' :=
                    (_ :
                      ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                        (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                          (fun g => AddHom.toFun g.toAddHom 1) x1 + (fun g => AddHom.toFun g.toAddHom 1) x2) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (g : ↑((restrictScalars f).obj ((coextendScalars f).obj X))),
                    AddHom.toFun
                        { toFun := fun g => AddHom.toFun g.toAddHom 1,
                          map_add' :=
                            (_ :
                              ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                                (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                                  (fun g => AddHom.toFun g.toAddHom 1) x1 + (fun g => AddHom.toFun g.toAddHom 1) x2) }
                        (r • g) =
                      (RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun g => AddHom.toFun g.toAddHom 1,
                            map_add' :=
                              (_ :
                                ∀ (x1 x2 : ↑((coextendScalars f ⋙ restrictScalars f).obj X)),
                                  (fun g => AddHom.toFun g.toAddHom 1) (x1 + x2) =
                                    (fun g => AddHom.toFun g.toAddHom 1) x1 + (fun g => AddHom.toFun g.toAddHom 1) x2) }
                          g) })
          X ≫
        (𝟭 (ModuleCat R)).map g)
      h

Next tactic:
rfl