/--
Given `R`-module X and `S`-module Y and a map `X ⟶ (restrictScalars f).obj Y`, i.e `R`-linear map
`X ⟶ Y`, there is a map `(extend_scalars f).obj X ⟶ Y`, i.e `S`-linear map `S ⨂ X → Y` by
`s ⊗ x ↦ s • g x`.
-/
@[simps apply]
def HomEquiv.fromExtendScalars {X Y} (g : X ⟶ (restrictScalars f).obj Y) :
    (extendScalars f).obj X ⟶ Y := by
  letI m1 : Module R S := Module.compHom S f; letI m2 : Module R Y := Module.compHom Y f
  refine {toFun := fun z => TensorProduct.lift ?_ z, map_add' := ?_, map_smul' := ?_}
  · refine
    {toFun := fun s => HomEquiv.evalAt f s g, map_add' := fun (s₁ s₂ : S) => ?_,
      map_smul' := fun (r : R) (s : S) => ?_}
    · ext
      dsimp
      rw [← add_smul]
    · ext x
      apply mul_smul (f r) s (g x)
  · intros z₁ z₂
    change lift _ (z₁ + z₂) = lift _ z₁ + lift _ z₂
    rw [map_add]
  · intro s z
    change lift _ (s • z) = s • lift _ z
    induction' z using TensorProduct.induction_on with s' x x y ih1 ih2
    · rw [smul_zero, map_zero, smul_zero]
    · rw [LinearMap.coe_mk, ExtendScalars.smul_tmul]
      erw [lift.tmul, lift.tmul]
      

Proof state:
case refine_3.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 : S
s' : ↑((restrictScalars f).obj (mk S))
x : ↑X
⊢ ({
          toAddHom :=
            { toFun := fun s => evalAt f s g,
              map_add' :=
                (_ :
                  ∀ (s₁ s₂ : S),
                    (fun s => evalAt f s g) (s₁ + s₂) = (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) },
          map_smul' :=
            (_ :
              ∀ (r : R) (s : S),
                AddHom.toFun
                    { toFun := fun s => evalAt f s g,
                      map_add' :=
                        (_ :
                          ∀ (s₁ s₂ : S),
                            (fun s => evalAt f s g) (s₁ + s₂) =
                              (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) }
                    (r • s) =
                  (RingHom.id R) r •
                    AddHom.toFun
                      { toFun := fun s => evalAt f s g,
                        map_add' :=
                          (_ :
                            ∀ (s₁ s₂ : S),
                              (fun s => evalAt f s g) (s₁ + s₂) =
                                (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) }
                      s) }
        (s * s'))
      x =
    s •
      ({
            toAddHom :=
              { toFun := fun s => evalAt f s g,
                map_add' :=
                  (_ :
                    ∀ (s₁ s₂ : S),
                      (fun s => evalAt f s g) (s₁ + s₂) = (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) },
            map_smul' :=
              (_ :
                ∀ (r : R) (s : S),
                  AddHom.toFun
                      { toFun := fun s => evalAt f s g,
                        map_add' :=
                          (_ :
                            ∀ (s₁ s₂ : S),
                              (fun s => evalAt f s g) (s₁ + s₂) =
                                (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) }
                      (r • s) =
                    (RingHom.id R) r •
                      AddHom.toFun
                        { toFun := fun s => evalAt f s g,
                          map_add' :=
                            (_ :
                              ∀ (s₁ s₂ : S),
                                (fun s => evalAt f s g) (s₁ + s₂) =
                                  (fun s => evalAt f s g) s₁ + (fun s => evalAt f s g) s₂) }
                        s) }
          s')
        x

Next tactic:
set s' : S := s'