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))))
⊢ FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[Rp] Sq)

Tactic:
have : e'.toAlgHom.comp (IsScalarTower.toAlgHom R p.ResidueField _) =
        IsScalarTower.toAlgHom _ _ _ := by ext

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)
⊢ FormallySmooth 𝓀[Rp] (𝓀[Rp] ⊗[Rp] Sq)