Module: Mathlib.RingTheory.Smooth.Fiber

Goal state before:
pp: R : Type u_1
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Module.Flat R S
inst✝⁴ : FinitePresentation R S
p : Ideal R
q : Ideal S
inst✝³ : p.IsPrime
inst✝² : q.IsPrime
inst✝¹ : q.LiesOver p
inst✝ : FormallySmooth p.ResidueField (p.Fiber S)
Rp : Type u_1 := Localization.AtPrime p
Sp : Type u_2 := Localization (algebraMapSubmonoid S p.primeCompl)
Sq : Type u_2 := Localization.AtPrime q
this✝⁶ : Algebra (Localization.AtPrime p) (Localization.AtPrime q) := Localization.AtPrime.algebraOfLiesOver p q
f : Sp →ₐ[S] Sq := IsLocalization.liftAlgHom ⋯
algInst✝ : Algebra Sp Sq := f.toAlgebra
this✝⁵ : IsScalarTower R Sp Sq
this✝⁴ : IsScalarTower Rp Sp Sq
this✝³ : IsLocalization (algebraMapSubmonoid Sp q.primeCompl) Sq
this✝² : FinitePresentation Rp Sp
this✝¹ : Algebra S (𝓀[Rp] ⊗[R] S) := TensorProduct.rightAlgebra
this✝ : FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[R] S ⊗[S] Sq)
e : 𝓀[Rp] ⊗[R] S ≃ₐ[S] S ⊗[R] 𝓀[Rp] :=
  let __spread.0 := TensorProduct.comm R 𝓀[Rp] S;
  { toEquiv := __spread.0.toEquiv, map_mul' := ⋯, map_add' := ⋯, commutes' := ⋯ }
e' : 𝓀[Rp] ⊗[R] S ⊗[S] Sq ≃ₐ[R] 𝓀[Rp] ⊗[Rp] Sq :=
  (AlgEquiv.restrictScalars R (TensorProduct.comm S (𝓀[Rp] ⊗[R] S) Sq)).trans
    ((AlgEquiv.restrictScalars R (TensorProduct.congr AlgEquiv.refl e)).trans
      ((AlgEquiv.restrictScalars R (TensorProduct.cancelBaseChange R S S Sq 𝓀[Rp])).trans
        ((TensorProduct.comm R Sq 𝓀[Rp]).trans (TensorProduct.equivOfCompatibleSMul Rp R R 𝓀[Rp] Sq))))
this :
  (↑e').comp (IsScalarTower.toAlgHom R p.ResidueField (𝓀[Rp] ⊗[R] S ⊗[S] Sq)) =
    IsScalarTower.toAlgHom R p.ResidueField (𝓀[Rp] ⊗[Rp] Sq)
⊢ FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[Rp] Sq)

Tactic:
let e'' : (𝓀[Rp] ⊗[R] S) ⊗[S] Sq ≃ₐ[𝓀[Rp]] 𝓀[Rp] ⊗[Rp] Sq :=
      { __ := e', commutes' r := congr($this r) }

Goal state after:
R : Type u_1
S : Type u_2
inst✝⁸ : CommRing R
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Module.Flat R S
inst✝⁴ : FinitePresentation R S
p : Ideal R
q : Ideal S
inst✝³ : p.IsPrime
inst✝² : q.IsPrime
inst✝¹ : q.LiesOver p
inst✝ : FormallySmooth p.ResidueField (p.Fiber S)
Rp : Type u_1 := Localization.AtPrime p
Sp : Type u_2 := Localization (algebraMapSubmonoid S p.primeCompl)
Sq : Type u_2 := Localization.AtPrime q
this✝⁶ : Algebra (Localization.AtPrime p) (Localization.AtPrime q) := Localization.AtPrime.algebraOfLiesOver p q
f : Sp →ₐ[S] Sq := IsLocalization.liftAlgHom ⋯
algInst✝ : Algebra Sp Sq := f.toAlgebra
this✝⁵ : IsScalarTower R Sp Sq
this✝⁴ : IsScalarTower Rp Sp Sq
this✝³ : IsLocalization (algebraMapSubmonoid Sp q.primeCompl) Sq
this✝² : FinitePresentation Rp Sp
this✝¹ : Algebra S (𝓀[Rp] ⊗[R] S) := TensorProduct.rightAlgebra
this✝ : FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[R] S ⊗[S] Sq)
e : 𝓀[Rp] ⊗[R] S ≃ₐ[S] S ⊗[R] 𝓀[Rp] :=
  let __spread.0 := TensorProduct.comm R 𝓀[Rp] S;
  { toEquiv := __spread.0.toEquiv, map_mul' := ⋯, map_add' := ⋯, commutes' := ⋯ }
e' : 𝓀[Rp] ⊗[R] S ⊗[S] Sq ≃ₐ[R] 𝓀[Rp] ⊗[Rp] Sq :=
  (AlgEquiv.restrictScalars R (TensorProduct.comm S (𝓀[Rp] ⊗[R] S) Sq)).trans
    ((AlgEquiv.restrictScalars R (TensorProduct.congr AlgEquiv.refl e)).trans
      ((AlgEquiv.restrictScalars R (TensorProduct.cancelBaseChange R S S Sq 𝓀[Rp])).trans
        ((TensorProduct.comm R Sq 𝓀[Rp]).trans (TensorProduct.equivOfCompatibleSMul Rp R R 𝓀[Rp] Sq))))
this :
  (↑e').comp (IsScalarTower.toAlgHom R p.ResidueField (𝓀[Rp] ⊗[R] S ⊗[S] Sq)) =
    IsScalarTower.toAlgHom R p.ResidueField (𝓀[Rp] ⊗[Rp] Sq)
e'' : 𝓀[Rp] ⊗[R] S ⊗[S] Sq ≃ₐ[𝓀[Rp]] 𝓀[Rp] ⊗[Rp] Sq :=
  let __spread.0 := e';
  { toEquiv := __spread.0.toEquiv, map_mul' := ⋯, map_add' := ⋯, commutes' := ⋯ }
⊢ FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[Rp] Sq)