l3lab/ntp-mathlib huggingface dataset:
theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
  constructor
  intro Q _ _ I e f
  have : ∀ x : M, IsUnit (algebraMap R Q x) := by
    intro x
    apply (IsNilpotent.isUnit_quotient_mk_iff ⟨2, e⟩).mp
    convert (IsLocalization.map_units Rₘ x).map f
    simp only [Ideal.Quotient.mk_algebraMap, AlgHom.commutes]
  let this : Rₘ →ₐ[R] Q :=
    { IsLocalization.lift this with commutes' := IsLocalization.lift_eq this }
  use this
  apply AlgHom.coe_ringHom_injective
  

Proof state:
case h.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
this✝ : ∀ (x : ↥M), IsUnit ((algebraMap R Q) ↑x)
this : Rₘ →ₐ[R] Q :=
  let src := IsLocalization.lift this✝;
  {
    toRingHom :=
      { toMonoidHom := ↑src, map_zero' := (_ : OneHom.toFun (↑↑src) 0 = 0),
        map_add' :=
          (_ : ∀ (x y : Rₘ), OneHom.toFun (↑↑src) (x + y) = OneHom.toFun (↑↑src) x + OneHom.toFun (↑↑src) y) },
    commutes' := (_ : ∀ (x : R), (IsLocalization.lift this✝) ((algebraMap R Rₘ) x) = (algebraMap R Q) x) }
⊢ ↑(AlgHom.comp (Ideal.Quotient.mkₐ R I) this) = ↑f

Next tactic:
refine' IsLocalization.ringHom_ext M _
theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
  constructor
  intro Q _ _ I e f
  have : ∀ x : M, IsUnit (algebraMap R Q x) := by
    intro x
    apply (IsNilpotent.isUnit_quotient_mk_iff ⟨2, e⟩).mp
    convert (IsLocalization.map_units Rₘ x).map f
    simp only [Ideal.Quotient.mk_algebraMap, AlgHom.commutes]
  let this : Rₘ →ₐ[R] Q :=
    { IsLocalization.lift this with commutes' := IsLocalization.lift_eq this }
  use this
  apply AlgHom.coe_ringHom_injective
  refine' IsLocalization.ringHom_ext M _
  

Proof state:
case h.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
this✝ : ∀ (x : ↥M), IsUnit ((algebraMap R Q) ↑x)
this : Rₘ →ₐ[R] Q :=
  let src := IsLocalization.lift this✝;
  {
    toRingHom :=
      { toMonoidHom := ↑src, map_zero' := (_ : OneHom.toFun (↑↑src) 0 = 0),
        map_add' :=
          (_ : ∀ (x y : Rₘ), OneHom.toFun (↑↑src) (x + y) = OneHom.toFun (↑↑src) x + OneHom.toFun (↑↑src) y) },
    commutes' := (_ : ∀ (x : R), (IsLocalization.lift this✝) ((algebraMap R Rₘ) x) = (algebraMap R Q) x) }
⊢ RingHom.comp (↑(AlgHom.comp (Ideal.Quotient.mkₐ R I) this)) (algebraMap R Rₘ) = RingHom.comp (↑f) (algebraMap R Rₘ)

Next tactic:
ext
theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
  constructor
  intro Q _ _ I e f
  have : ∀ x : M, IsUnit (algebraMap R Q x) := by
    intro x
    apply (IsNilpotent.isUnit_quotient_mk_iff ⟨2, e⟩).mp
    convert (IsLocalization.map_units Rₘ x).map f
    simp only [Ideal.Quotient.mk_algebraMap, AlgHom.commutes]
  let this : Rₘ →ₐ[R] Q :=
    { IsLocalization.lift this with commutes' := IsLocalization.lift_eq this }
  use this
  apply AlgHom.coe_ringHom_injective
  refine' IsLocalization.ringHom_ext M _
  ext
  

Proof state:
case h.a.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
this✝ : ∀ (x : ↥M), IsUnit ((algebraMap R Q) ↑x)
this : Rₘ →ₐ[R] Q :=
  let src := IsLocalization.lift this✝;
  {
    toRingHom :=
      { toMonoidHom := ↑src, map_zero' := (_ : OneHom.toFun (↑↑src) 0 = 0),
        map_add' :=
          (_ : ∀ (x y : Rₘ), OneHom.toFun (↑↑src) (x + y) = OneHom.toFun (↑↑src) x + OneHom.toFun (↑↑src) y) },
    commutes' := (_ : ∀ (x : R), (IsLocalization.lift this✝) ((algebraMap R Rₘ) x) = (algebraMap R Q) x) }
x✝ : R
⊢ (RingHom.comp (↑(AlgHom.comp (Ideal.Quotient.mkₐ R I) this)) (algebraMap R Rₘ)) x✝ =
    (RingHom.comp (↑f) (algebraMap R Rₘ)) x✝

Next tactic:
simp
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹² : CommRing R
inst✝¹¹ : CommRing S
inst✝¹⁰ : CommRing Rₘ
inst✝⁹ : CommRing Sₘ
M : Submonoid R
inst✝⁸ : Algebra R S
inst✝⁷ : Algebra R Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra R Rₘ
inst✝⁴ : Algebra Rₘ Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
⊢ FormallyUnramified R Rₘ

Next tactic:
constructor
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  constructor
  

Proof state:
case comp_injective
R S Rₘ Sₘ : Type u
inst✝¹² : CommRing R
inst✝¹¹ : CommRing S
inst✝¹⁰ : CommRing Rₘ
inst✝⁹ : CommRing Sₘ
M : Submonoid R
inst✝⁸ : Algebra R S
inst✝⁷ : Algebra R Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra R Rₘ
inst✝⁴ : Algebra Rₘ Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
⊢ ∀ ⦃B : Type u⦄ [inst : CommRing B] [inst_1 : Algebra R B] (I : Ideal B),
    I ^ 2 = ⊥ → Function.Injective (AlgHom.comp (Ideal.Quotient.mkₐ R I))

Next tactic:
intro Q _ _ I _ f₁ f₂ _
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  constructor
  intro Q _ _ I _ f₁ f₂ _
  

Proof state:
case comp_injective
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
x✝ : I ^ 2 = ⊥
f₁ f₂ : Rₘ →ₐ[R] Q
a✝ : AlgHom.comp (Ideal.Quotient.mkₐ R I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ R I) f₂
⊢ f₁ = f₂

Next tactic:
apply AlgHom.coe_ringHom_injective
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  constructor
  intro Q _ _ I _ f₁ f₂ _
  apply AlgHom.coe_ringHom_injective
  

Proof state:
case comp_injective.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
x✝ : I ^ 2 = ⊥
f₁ f₂ : Rₘ →ₐ[R] Q
a✝ : AlgHom.comp (Ideal.Quotient.mkₐ R I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ R I) f₂
⊢ ↑f₁ = ↑f₂

Next tactic:
refine' IsLocalization.ringHom_ext M _
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  constructor
  intro Q _ _ I _ f₁ f₂ _
  apply AlgHom.coe_ringHom_injective
  refine' IsLocalization.ringHom_ext M _
  

Proof state:
case comp_injective.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
x✝ : I ^ 2 = ⊥
f₁ f₂ : Rₘ →ₐ[R] Q
a✝ : AlgHom.comp (Ideal.Quotient.mkₐ R I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ R I) f₂
⊢ RingHom.comp (↑f₁) (algebraMap R Rₘ) = RingHom.comp (↑f₂) (algebraMap R Rₘ)

Next tactic:
ext
/-- This holds in general for epimorphisms. -/
theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ := by
  constructor
  intro Q _ _ I _ f₁ f₂ _
  apply AlgHom.coe_ringHom_injective
  refine' IsLocalization.ringHom_ext M _
  ext
  

Proof state:
case comp_injective.a.a
R S Rₘ Sₘ : Type u
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing S
inst✝¹² : CommRing Rₘ
inst✝¹¹ : CommRing Sₘ
M : Submonoid R
inst✝¹⁰ : Algebra R S
inst✝⁹ : Algebra R Sₘ
inst✝⁸ : Algebra S Sₘ
inst✝⁷ : Algebra R Rₘ
inst✝⁶ : Algebra Rₘ Sₘ
inst✝⁵ : IsScalarTower R Rₘ Sₘ
inst✝⁴ : IsScalarTower R S Sₘ
inst✝³ : IsLocalization M Rₘ
inst✝² : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
x✝¹ : I ^ 2 = ⊥
f₁ f₂ : Rₘ →ₐ[R] Q
a✝ : AlgHom.comp (Ideal.Quotient.mkₐ R I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ R I) f₂
x✝ : R
⊢ (RingHom.comp (↑f₁) (algebraMap R Rₘ)) x✝ = (RingHom.comp (↑f₂) (algebraMap R Rₘ)) x✝

Next tactic:
simp
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹³ : CommRing R
inst✝¹² : CommRing S
inst✝¹¹ : CommRing Rₘ
inst✝¹⁰ : CommRing Sₘ
M : Submonoid R
inst✝⁹ : Algebra R S
inst✝⁸ : Algebra R Sₘ
inst✝⁷ : Algebra S Sₘ
inst✝⁶ : Algebra R Rₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : IsScalarTower R Rₘ Sₘ
inst✝³ : IsScalarTower R S Sₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝ : FormallySmooth R Sₘ
⊢ FormallySmooth Rₘ Sₘ

Next tactic:
constructor
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  

Proof state:
case comp_surjective
R S Rₘ Sₘ : Type u
inst✝¹³ : CommRing R
inst✝¹² : CommRing S
inst✝¹¹ : CommRing Rₘ
inst✝¹⁰ : CommRing Sₘ
M : Submonoid R
inst✝⁹ : Algebra R S
inst✝⁸ : Algebra R Sₘ
inst✝⁷ : Algebra S Sₘ
inst✝⁶ : Algebra R Rₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : IsScalarTower R Rₘ Sₘ
inst✝³ : IsScalarTower R S Sₘ
inst✝² : IsLocalization M Rₘ
inst✝¹ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝ : FormallySmooth R Sₘ
⊢ ∀ ⦃B : Type u⦄ [inst : CommRing B] [inst_1 : Algebra Rₘ B] (I : Ideal B),
    I ^ 2 = ⊥ → Function.Surjective (AlgHom.comp (Ideal.Quotient.mkₐ Rₘ I))

Next tactic:
intro Q _ _ I e f
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  

Proof state:
case comp_surjective
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ Rₘ I) a = f

Next tactic:
letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  

Proof state:
case comp_surjective
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ Rₘ I) a = f

Next tactic:
letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  

Proof state:
case comp_surjective
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ Rₘ I) a = f

Next tactic:
let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    intro r
    change
      (RingHom.comp (FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) : Sₘ →+* Q)
            (algebraMap _ _))
          r =
        algebraMap _ _ r
    congr 1
    refine' IsLocalization.ringHom_ext M _
    rw [RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq,
      AlgHom.comp_algebraMap]
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
⊢ Sₘ →ₐ[Rₘ] Q

Next tactic:
refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
src✝ : Sₘ →ₐ[R] Q := lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f)
⊢ ∀ (r : Rₘ), OneHom.toFun (↑↑↑src✝) ((algebraMap Rₘ Sₘ) r) = (algebraMap Rₘ Q) r

Next tactic:
intro r
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    intro r
    

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
src✝ : Sₘ →ₐ[R] Q := lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f)
r : Rₘ
⊢ OneHom.toFun (↑↑↑src✝) ((algebraMap Rₘ Sₘ) r) = (algebraMap Rₘ Q) r

Next tactic:
change
      (RingHom.comp (FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) : Sₘ →+* Q)
            (algebraMap _ _))
          r =
        algebraMap _ _ r
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    intro r
    change
      (RingHom.comp (FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) : Sₘ →+* Q)
            (algebraMap _ _))
          r =
        algebraMap _ _ r
    

Proof state:
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
src✝ : Sₘ →ₐ[R] Q := lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f)
r : Rₘ
⊢ (RingHom.comp (↑(lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f))) (algebraMap Rₘ Sₘ)) r =
    (algebraMap Rₘ Q) r

Next tactic:
congr 1
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    intro r
    change
      (RingHom.comp (FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) : Sₘ →+* Q)
            (algebraMap _ _))
          r =
        algebraMap _ _ r
    congr 1
    

Proof state:
case e_a
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
src✝ : Sₘ →ₐ[R] Q := lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f)
r : Rₘ
⊢ RingHom.comp (↑(lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f))) (algebraMap Rₘ Sₘ) = algebraMap Rₘ Q

Next tactic:
refine' IsLocalization.ringHom_ext M _
theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
  constructor
  intro Q _ _ I e f
  letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
  letI : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
  let f : Sₘ →ₐ[Rₘ] Q := by
    refine' { FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) with commutes' := _ }
    intro r
    change
      (RingHom.comp (FormallySmooth.lift I ⟨2, e⟩ (f.restrictScalars R) : Sₘ →+* Q)
            (algebraMap _ _))
          r =
        algebraMap _ _ r
    congr 1
    refine' IsLocalization.ringHom_ext M _
    

Proof state:
case e_a
R S Rₘ Sₘ : Type u
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing S
inst✝¹³ : CommRing Rₘ
inst✝¹² : CommRing Sₘ
M : Submonoid R
inst✝¹¹ : Algebra R S
inst✝¹⁰ : Algebra R Sₘ
inst✝⁹ : Algebra S Sₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : Algebra Rₘ Sₘ
inst✝⁶ : IsScalarTower R Rₘ Sₘ
inst✝⁵ : IsScalarTower R S Sₘ
inst✝⁴ : IsLocalization M Rₘ
inst✝³ : IsLocalization (Submonoid.map (algebraMap R S) M) Sₘ
inst✝² : FormallySmooth R Sₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra Rₘ Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Sₘ →ₐ[Rₘ] Q ⧸ I
this✝ : Algebra R Q := RingHom.toAlgebra (RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ))
this : IsScalarTower R Rₘ Q := IsScalarTower.of_algebraMap_eq' rfl
src✝ : Sₘ →ₐ[R] Q := lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f)
r : Rₘ
⊢ RingHom.comp (RingHom.comp (↑(lift I (_ : ∃ n, I ^ n = 0) (AlgHom.restrictScalars R f))) (algebraMap Rₘ Sₘ))
      (algebraMap R Rₘ) =
    RingHom.comp (algebraMap Rₘ Q) (algebraMap R Rₘ)

Next tactic:
rw [RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq,
      AlgHom.comp_algebraMap]