/-- The natural transformation from the composition of restriction and extension of scalars to the
identity functor on `S`-module.
-/
@[simps app]
def counit : restrictScalars.{max v u₂,u₁,u₂} f ⋙ extendScalars f ⟶ 𝟭 (ModuleCat S) where
  app _ := Counit.map.{u₁,u₂,v} f
  naturality Y Y' g := by
    -- Porting note: this is very annoying; fix instances in concrete categories
    letI m1 : Module R S := Module.compHom S f
    letI m2 : Module R Y := Module.compHom Y f
    letI m2 : Module R Y' := Module.compHom Y' f
    apply LinearMap.ext; intro z
    induction' z using TensorProduct.induction_on with s' y z₁ z₂ ih₁ ih₂
    · rw [map_zero, map_zero]
    · dsimp
      rw [ModuleCat.coe_comp, ModuleCat.coe_comp, Function.comp_apply, Function.comp_apply,
        ExtendScalars.map_tmul, restrictScalars.map_apply]
      -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
      erw [Counit.map_apply]
      

Proof state:
case h.tmul
R✝ : Type u₁
S✝ : Type u₂
inst✝³ : CommRing R✝
inst✝² : CommRing S✝
f✝ : R✝ →+* S✝
R : Type u₁
S : Type u₂
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
Y Y' : ModuleCat S
g : Y ⟶ Y'
m1 : Module R S := Module.compHom S f
m2✝ : Module R ↑Y := Module.compHom (↑Y) f
m2 : Module R ↑Y' := Module.compHom (↑Y') f
s' : ↑((restrictScalars f).obj (mk S))
y : ↑((restrictScalars f).obj Y)
⊢ (lift
        {
          toAddHom :=
            {
              toFun := fun s =>
                {
                  toAddHom :=
                    { toFun := fun y => s • y, map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (y : ↑Y'),
                        AddHom.toFun
                            { toFun := fun y => s • y,
                              map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                            (r • y) =
                          (RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun y => s • y,
                                map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                              y) },
              map_add' :=
                (_ :
                  ∀ (s₁ s₂ : S),
                    (fun s =>
                          {
                            toAddHom :=
                              { toFun := fun y => s • y,
                                map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                            map_smul' :=
                              (_ :
                                ∀ (r : R) (y : ↑Y'),
                                  AddHom.toFun
                                      { toFun := fun y => s • y,
                                        map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                      (r • y) =
                                    (RingHom.id R) r •
                                      AddHom.toFun
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                        y) })
                        (s₁ + s₂) =
                      (fun s =>
                            {
                              toAddHom :=
                                { toFun := fun y => s • y,
                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                              map_smul' :=
                                (_ :
                                  ∀ (r : R) (y : ↑Y'),
                                    AddHom.toFun
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                        (r • y) =
                                      (RingHom.id R) r •
                                        AddHom.toFun
                                          { toFun := fun y => s • y,
                                            map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                          y) })
                          s₁ +
                        (fun s =>
                            {
                              toAddHom :=
                                { toFun := fun y => s • y,
                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                              map_smul' :=
                                (_ :
                                  ∀ (r : R) (y : ↑Y'),
                                    AddHom.toFun
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                        (r • y) =
                                      (RingHom.id R) r •
                                        AddHom.toFun
                                          { toFun := fun y => s • y,
                                            map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                          y) })
                          s₂) },
          map_smul' :=
            (_ :
              ∀ (r : R) (s : S),
                AddHom.toFun
                    {
                      toFun := fun s =>
                        {
                          toAddHom :=
                            { toFun := fun y => s • y,
                              map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                          map_smul' :=
                            (_ :
                              ∀ (r : R) (y : ↑Y'),
                                AddHom.toFun
                                    { toFun := fun y => s • y,
                                      map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                    (r • y) =
                                  (RingHom.id R) r •
                                    AddHom.toFun
                                      { toFun := fun y => s • y,
                                        map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                      y) },
                      map_add' :=
                        (_ :
                          ∀ (s₁ s₂ : S),
                            (fun s =>
                                  {
                                    toAddHom :=
                                      { toFun := fun y => s • y,
                                        map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                    map_smul' :=
                                      (_ :
                                        ∀ (r : R) (y : ↑Y'),
                                          AddHom.toFun
                                              { toFun := fun y => s • y,
                                                map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                              (r • y) =
                                            (RingHom.id R) r •
                                              AddHom.toFun
                                                { toFun := fun y => s • y,
                                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                y) })
                                (s₁ + s₂) =
                              (fun s =>
                                    {
                                      toAddHom :=
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                      map_smul' :=
                                        (_ :
                                          ∀ (r : R) (y : ↑Y'),
                                            AddHom.toFun
                                                { toFun := fun y => s • y,
                                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                (r • y) =
                                              (RingHom.id R) r •
                                                AddHom.toFun
                                                  { toFun := fun y => s • y,
                                                    map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                  y) })
                                  s₁ +
                                (fun s =>
                                    {
                                      toAddHom :=
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                      map_smul' :=
                                        (_ :
                                          ∀ (r : R) (y : ↑Y'),
                                            AddHom.toFun
                                                { toFun := fun y => s • y,
                                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                (r • y) =
                                              (RingHom.id R) r •
                                                AddHom.toFun
                                                  { toFun := fun y => s • y,
                                                    map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                  y) })
                                  s₂) }
                    (r • s) =
                  (RingHom.id R) r •
                    AddHom.toFun
                      {
                        toFun := fun s =>
                          {
                            toAddHom :=
                              { toFun := fun y => s • y,
                                map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                            map_smul' :=
                              (_ :
                                ∀ (r : R) (y : ↑Y'),
                                  AddHom.toFun
                                      { toFun := fun y => s • y,
                                        map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                      (r • y) =
                                    (RingHom.id R) r •
                                      AddHom.toFun
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                        y) },
                        map_add' :=
                          (_ :
                            ∀ (s₁ s₂ : S),
                              (fun s =>
                                    {
                                      toAddHom :=
                                        { toFun := fun y => s • y,
                                          map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                      map_smul' :=
                                        (_ :
                                          ∀ (r : R) (y : ↑Y'),
                                            AddHom.toFun
                                                { toFun := fun y => s • y,
                                                  map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                (r • y) =
                                              (RingHom.id R) r •
                                                AddHom.toFun
                                                  { toFun := fun y => s • y,
                                                    map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                  y) })
                                  (s₁ + s₂) =
                                (fun s =>
                                      {
                                        toAddHom :=
                                          { toFun := fun y => s • y,
                                            map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                        map_smul' :=
                                          (_ :
                                            ∀ (r : R) (y : ↑Y'),
                                              AddHom.toFun
                                                  { toFun := fun y => s • y,
                                                    map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                  (r • y) =
                                                (RingHom.id R) r •
                                                  AddHom.toFun
                                                    { toFun := fun y => s • y,
                                                      map_add' :=
                                                        (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                    y) })
                                    s₁ +
                                  (fun s =>
                                      {
                                        toAddHom :=
                                          { toFun := fun y => s • y,
                                            map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) },
                                        map_smul' :=
                                          (_ :
                                            ∀ (r : R) (y : ↑Y'),
                                              AddHom.toFun
                                                  { toFun := fun y => s • y,
                                                    map_add' := (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                  (r • y) =
                                                (RingHom.id R) r •
                                                  AddHom.toFun
                                                    { toFun := fun y => s • y,
                                                      map_add' :=
                                                        (_ : ∀ (b₁ b₂ : ↑Y'), s • (b₁ + b₂) = s • b₁ + s • b₂) }
                                                    y) })
                                    s₂) }
                      s) })
      (s' ⊗ₜ[R] g y) =
    g ((Counit.map f) (s' ⊗ₜ[R] y))

Next tactic:
rw [lift.tmul, LinearMap.coe_mk, LinearMap.coe_mk]