/-- Given commutative rings `R, S` and a ring hom `f : R →+* S`, the extension and restriction of
scalars by `f` are adjoint to each other.
-/
-- @[simps] -- Porting note: removed not in normal form and not used
def extendRestrictScalarsAdj {R : Type u₁} {S : Type u₂} [CommRing R] [CommRing S] (f : R →+* S) :
    extendScalars.{u₁,u₂,max v u₂} f ⊣ restrictScalars.{max v u₂,u₁,u₂} f where
  homEquiv _ _ := ExtendRestrictScalarsAdj.homEquiv.{v,u₁,u₂} f
  unit := ExtendRestrictScalarsAdj.unit.{v,u₁,u₂} f
  counit := ExtendRestrictScalarsAdj.counit.{v,u₁,u₂} f
  homEquiv_unit {X Y g} := LinearMap.ext fun x => by
    dsimp
    rw [ModuleCat.coe_comp, Function.comp_apply, restrictScalars.map_apply]
    rfl
  homEquiv_counit {X Y g} := LinearMap.ext fun x => by
      -- Porting note: once again reminding Lean of the instances
      letI m1 : Module R S := Module.compHom S f
      letI m2 : Module R Y := Module.compHom Y f
      induction' x using TensorProduct.induction_on with s x _ _ _ _
      · rw [map_zero, map_zero]
      · rw [ExtendRestrictScalarsAdj.homEquiv_symm_apply]
        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
        erw [ModuleCat.coe_comp]
        rw [Function.comp_apply, ExtendRestrictScalarsAdj.counit_app]
        -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
        erw [ExtendRestrictScalarsAdj.Counit.map_apply]
        dsimp
        rw [TensorProduct.lift.tmul]
        

Proof state:
case 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
X : ModuleCat R
Y : ModuleCat S
g : X ⟶ (restrictScalars f).obj Y
m1 : Module R S := Module.compHom S f
m2 : Module R ↑Y := Module.compHom (↑Y) f
s : ↑((restrictScalars f).obj (mk S))
x : ↑X
⊢ s • g x =
    ({
          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)
      (g x)

Next tactic:
rfl