l3lab/ntp-mathlib huggingface dataset:
instance FormallyUnramified.base_change [FormallyUnramified R A] :
    FormallyUnramified B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f₁ f₂ e
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  

Proof state:
case comp_injective
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallyUnramified R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f₁ f₂ : B ⊗[R] A →ₐ[B] C
e : AlgHom.comp (Ideal.Quotient.mkₐ B I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ B I) f₂
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ f₁ = f₂

Next tactic:
ext : 1
instance FormallyUnramified.base_change [FormallyUnramified R A] :
    FormallyUnramified B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f₁ f₂ e
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  ext : 1
  · 

Proof state:
case comp_injective.ha
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallyUnramified R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f₁ f₂ : B ⊗[R] A →ₐ[B] C
e : AlgHom.comp (Ideal.Quotient.mkₐ B I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ B I) f₂
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ AlgHom.comp f₁ TensorProduct.includeLeft = AlgHom.comp f₂ TensorProduct.includeLeft

Next tactic:
exact Subsingleton.elim _ _
instance FormallyUnramified.base_change [FormallyUnramified R A] :
    FormallyUnramified B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f₁ f₂ e
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  ext : 1
  · exact Subsingleton.elim _ _
  · 

Proof state:
case comp_injective.hb
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallyUnramified R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f₁ f₂ : B ⊗[R] A →ₐ[B] C
e : AlgHom.comp (Ideal.Quotient.mkₐ B I) f₁ = AlgHom.comp (Ideal.Quotient.mkₐ B I) f₂
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ AlgHom.comp (AlgHom.restrictScalars R f₁) TensorProduct.includeRight =
    AlgHom.comp (AlgHom.restrictScalars R f₂) TensorProduct.includeRight

Next tactic:
exact FormallyUnramified.ext I ⟨2, hI⟩ fun x => AlgHom.congr_fun e (1 ⊗ₜ x)
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  

Proof state:
R : Type u
inst✝⁵ : CommSemiring R
A : Type u
inst✝⁴ : Semiring A
inst✝³ : Algebra R A
B : Type u
inst✝² : CommSemiring B
inst✝¹ : Algebra R B
inst✝ : FormallySmooth R A
⊢ FormallySmooth B (B ⊗[R] A)

Next tactic:
constructor
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  

Proof state:
case comp_surjective
R : Type u
inst✝⁵ : CommSemiring R
A : Type u
inst✝⁴ : Semiring A
inst✝³ : Algebra R A
B : Type u
inst✝² : CommSemiring B
inst✝¹ : Algebra R B
inst✝ : FormallySmooth R A
⊢ ∀ ⦃B_1 : Type u⦄ [inst : CommRing B_1] [inst_1 : Algebra B B_1] (I : Ideal B_1),
    I ^ 2 = ⊥ → Function.Surjective (AlgHom.comp (Ideal.Quotient.mkₐ B I))

Next tactic:
intro C _ _ I hI f
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  

Proof state:
case comp_surjective
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ B I) a = f

Next tactic:
letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  

Proof state:
case comp_surjective
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ B I) a = f

Next tactic:
haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  

Proof state:
case comp_surjective
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ B I) a = f

Next tactic:
refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · 

Proof state:
case comp_surjective.refine'_1
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ A →ₐ[R] C

Next tactic:
exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · 

Proof state:
case comp_surjective.refine'_2
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ AlgHom.comp (Ideal.Quotient.mkₐ B I)
      (TensorProduct.productLeftAlgHom (ofId B C)
        (lift I (_ : ∃ n, I ^ n = 0) (AlgHom.comp (AlgHom.restrictScalars R f) TensorProduct.includeRight))) =
    f

Next tactic:
apply AlgHom.restrictScalars_injective R
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · apply AlgHom.restrictScalars_injective R
    

Proof state:
case comp_surjective.refine'_2.a
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ AlgHom.restrictScalars R
      (AlgHom.comp (Ideal.Quotient.mkₐ B I)
        (TensorProduct.productLeftAlgHom (ofId B C)
          (lift I (_ : ∃ n, I ^ n = 0) (AlgHom.comp (AlgHom.restrictScalars R f) TensorProduct.includeRight)))) =
    AlgHom.restrictScalars R f

Next tactic:
apply TensorProduct.ext'
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · apply AlgHom.restrictScalars_injective R
    apply TensorProduct.ext'
    

Proof state:
case comp_surjective.refine'_2.a.H
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
⊢ ∀ (a : B) (b : A),
    (AlgHom.restrictScalars R
          (AlgHom.comp (Ideal.Quotient.mkₐ B I)
            (TensorProduct.productLeftAlgHom (ofId B C)
              (lift I (_ : ∃ n, I ^ n = 0) (AlgHom.comp (AlgHom.restrictScalars R f) TensorProduct.includeRight)))))
        (a ⊗ₜ[R] b) =
      (AlgHom.restrictScalars R f) (a ⊗ₜ[R] b)

Next tactic:
intro b a
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · apply AlgHom.restrictScalars_injective R
    apply TensorProduct.ext'
    intro b a
    

Proof state:
case comp_surjective.refine'_2.a.H
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
b : B
a : A
⊢ (AlgHom.restrictScalars R
        (AlgHom.comp (Ideal.Quotient.mkₐ B I)
          (TensorProduct.productLeftAlgHom (ofId B C)
            (lift I (_ : ∃ n, I ^ n = 0) (AlgHom.comp (AlgHom.restrictScalars R f) TensorProduct.includeRight)))))
      (b ⊗ₜ[R] a) =
    (AlgHom.restrictScalars R f) (b ⊗ₜ[R] a)

Next tactic:
suffices algebraMap B _ b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a) by simpa [Algebra.ofId_apply]
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · apply AlgHom.restrictScalars_injective R
    apply TensorProduct.ext'
    intro b a
    suffices algebraMap B _ b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a) by 

Proof state:
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝¹ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this✝ : IsScalarTower R B C
b : B
a : A
this : (algebraMap B (C ⧸ I)) b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a)
⊢ (AlgHom.restrictScalars R
        (AlgHom.comp (Ideal.Quotient.mkₐ B I)
          (TensorProduct.productLeftAlgHom (ofId B C)
            (lift I (_ : ∃ n, I ^ n = 0) (AlgHom.comp (AlgHom.restrictScalars R f) TensorProduct.includeRight)))))
      (b ⊗ₜ[R] a) =
    (AlgHom.restrictScalars R f) (b ⊗ₜ[R] a)

Next tactic:
simpa [Algebra.ofId_apply]
instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
  constructor
  intro C _ _ I hI f
  letI := ((algebraMap B C).comp (algebraMap R B)).toAlgebra
  haveI : IsScalarTower R B C := IsScalarTower.of_algebraMap_eq' rfl
  refine' ⟨TensorProduct.productLeftAlgHom (Algebra.ofId B C) _, _⟩
  · exact FormallySmooth.lift I ⟨2, hI⟩ ((f.restrictScalars R).comp TensorProduct.includeRight)
  · apply AlgHom.restrictScalars_injective R
    apply TensorProduct.ext'
    intro b a
    suffices algebraMap B _ b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a) by simpa [Algebra.ofId_apply]
    

Proof state:
case comp_surjective.refine'_2.a.H
R : Type u
inst✝⁷ : CommSemiring R
A : Type u
inst✝⁶ : Semiring A
inst✝⁵ : Algebra R A
B : Type u
inst✝⁴ : CommSemiring B
inst✝³ : Algebra R B
inst✝² : FormallySmooth R A
C : Type u
inst✝¹ : CommRing C
inst✝ : Algebra B C
I : Ideal C
hI : I ^ 2 = ⊥
f : B ⊗[R] A →ₐ[B] C ⧸ I
this✝ : Algebra R C := RingHom.toAlgebra (RingHom.comp (algebraMap B C) (algebraMap R B))
this : IsScalarTower R B C
b : B
a : A
⊢ (algebraMap B (C ⧸ I)) b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a)

Next tactic:
rw [← Algebra.smul_def, ← map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one]
theorem FormallySmooth.of_isLocalization : FormallySmooth 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ₘ
⊢ FormallySmooth R Rₘ

Next tactic:
constructor
theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := 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ₘ
⊢ ∀ ⦃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.of_isLocalization : FormallySmooth R Rₘ := 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ₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ R I) a = f

Next tactic:
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]
theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
  constructor
  intro Q _ _ I e f
  have : ∀ x : M, IsUnit (algebraMap R Q x) := 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ₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
⊢ ∀ (x : ↥M), IsUnit ((algebraMap R Q) ↑x)

Next tactic:
intro x
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
    

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ₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
x : ↥M
⊢ IsUnit ((algebraMap R Q) ↑x)

Next tactic:
apply (IsNilpotent.isUnit_quotient_mk_iff ⟨2, e⟩).mp
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
    

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ₘ
Q : Type u
inst✝¹ : CommRing Q
inst✝ : Algebra R Q
I : Ideal Q
e : I ^ 2 = ⊥
f : Rₘ →ₐ[R] Q ⧸ I
x : ↥M
⊢ IsUnit ((Ideal.Quotient.mk I) ((algebraMap R Q) ↑x))

Next tactic:
convert (IsLocalization.map_units Rₘ x).map f
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
    

Proof state:
case h.e'_3
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
x : ↥M
⊢ (Ideal.Quotient.mk I) ((algebraMap R Q) ↑x) = f ((algebraMap R Rₘ) ↑x)

Next tactic:
simp only [Ideal.Quotient.mk_algebraMap, AlgHom.commutes]
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]
  

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ₘ
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)
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ R I) a = f

Next tactic:
let this : Rₘ →ₐ[R] Q :=
    { IsLocalization.lift this with commutes' := IsLocalization.lift_eq this }
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 }
  

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ₘ
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) }
⊢ ∃ a, AlgHom.comp (Ideal.Quotient.mkₐ R I) a = f

Next tactic:
use this
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
  

Proof state:
case h
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:
apply AlgHom.coe_ringHom_injective