ring_theory.etaleMathlib.RingTheory.Etale

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -235,7 +235,7 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
     formally_smooth.mk_lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).Injective
   rw [AlgEquiv.apply_symm_apply, Ideal.quotientKerAlgEquivOfSurjective,
-    Ideal.quotientKerAlgEquivOfRightInverse.apply]
+    Ideal.quotientKerAlgEquivOfRightInverse_apply]
   exact (Ideal.kerLiftAlg_mk _ _).symm
 #align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
 -/
@@ -336,7 +336,7 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   letI := f'.to_ring_hom.to_algebra
   obtain ⟨f'', e'⟩ :=
     formally_smooth.comp_surjective I hI { f.to_ring_hom with commutes' := AlgHom.congr_fun e.symm }
-  apply_fun AlgHom.restrictScalars R at e' 
+  apply_fun AlgHom.restrictScalars R at e'
   exact ⟨f''.restrict_scalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
 -/
@@ -403,10 +403,10 @@ theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ f.to
       by
       rintro x (hx : f x = 0)
       have : _ = i (f x) := (formally_smooth.mk_lift I ⟨2, hI⟩ (i.comp f) x : _)
-      rwa [hx, map_zero, ← Ideal.Quotient.mk_eq_mk, Submodule.Quotient.mk_eq_zero] at this 
+      rwa [hx, map_zero, ← Ideal.Quotient.mk_eq_mk, Submodule.Quotient.mk_eq_zero] at this
     intro x hx
     have := (Ideal.pow_mono this 2).trans (Ideal.le_comap_pow _ 2) hx
-    rwa [hI] at this 
+    rwa [hI] at this
   have : i.comp f.ker_square_lift = (Ideal.Quotient.mkₐ R _).comp l :=
     by
     apply AlgHom.coe_ringHom_injective
@@ -440,8 +440,8 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
       (Ideal.quotientKerAlgEquivOfSurjective surj).toAlgHom.congr_arg
         (formally_smooth.mk_lift _ ⟨2, sqz⟩
           (Ideal.quotientKerAlgEquivOfSurjective surj).symm.toAlgHom x)
-    dsimp at this 
-    rw [AlgEquiv.apply_symm_apply] at this 
+    dsimp at this
+    rw [AlgEquiv.apply_symm_apply] at this
     conv_rhs => rw [← this, AlgHom.id_apply]
     obtain ⟨y, e⟩ :=
       Ideal.Quotient.mk_surjective
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.RingTheory.QuotientNilpotent
-import Mathbin.RingTheory.Kaehler
+import RingTheory.QuotientNilpotent
+import RingTheory.Kaehler
 
 #align_import ring_theory.etale from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
 
Diff
@@ -262,7 +262,7 @@ theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : Forma
   by
   constructor
   intro C _ _ I hI f
-  use (formally_smooth.lift I ⟨2, hI⟩ (f.comp e : A →ₐ[R] C ⧸ I)).comp e.symm
+  use(formally_smooth.lift I ⟨2, hI⟩ (f.comp e : A →ₐ[R] C ⧸ I)).comp e.symm
   rw [← AlgHom.comp_assoc, formally_smooth.comp_lift, AlgHom.comp_assoc, AlgEquiv.comp_symm,
     AlgHom.comp_id]
 #align algebra.formally_smooth.of_equiv Algebra.FormallySmooth.of_equiv
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.etale
-! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.QuotientNilpotent
 import Mathbin.RingTheory.Kaehler
 
+#align_import ring_theory.etale from "leanprover-community/mathlib"@"2fe465deb81bcd7ccafa065bb686888a82f15372"
+
 /-!
 
 # Formally étale morphisms
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module ring_theory.etale
-! leanprover-community/mathlib commit 73f96237417835f148a1f7bc1ff55f67119b7166
+! leanprover-community/mathlib commit 2fe465deb81bcd7ccafa065bb686888a82f15372
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.RingTheory.Kaehler
 
 # Formally étale morphisms
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 An `R`-algebra `A` is formally étale (resp. unramified, smooth) if for every `R`-algebra,
 every square-zero ideal `I : ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists
 exactly (resp. at most, at least) one lift `A →ₐ[R] B`.
Diff
@@ -37,6 +37,7 @@ variable (A : Type u) [Semiring A] [Algebra R A]
 
 variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
+#print Algebra.FormallyUnramified /-
 /-- An `R`-algebra `A` is formally unramified if for every `R`-algebra, every square-zero ideal
 `I : ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at most one lift `A →ₐ[R] B`. -/
 @[mk_iff]
@@ -46,7 +47,9 @@ class FormallyUnramified : Prop where
       ∀ [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥),
         Function.Injective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_unramified Algebra.FormallyUnramified
+-/
 
+#print Algebra.FormallySmooth /-
 /-- An `R` algebra `A` is formally smooth if for every `R`-algebra, every square-zero ideal
 `I : ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at least one lift `A →ₐ[R] B`. -/
 @[mk_iff]
@@ -56,7 +59,9 @@ class FormallySmooth : Prop where
       ∀ [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥),
         Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_smooth Algebra.FormallySmooth
+-/
 
+#print Algebra.FormallyEtale /-
 /-- An `R` algebra `A` is formally étale if for every `R`-algebra, every square-zero ideal
 `I : ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists exactly one lift `A →ₐ[R] B`. -/
 @[mk_iff]
@@ -66,9 +71,11 @@ class FormallyEtale : Prop where
       ∀ [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥),
         Function.Bijective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_etale Algebra.FormallyEtale
+-/
 
 variable {R A}
 
+#print Algebra.FormallyEtale.iff_unramified_and_smooth /-
 theorem FormallyEtale.iff_unramified_and_smooth :
     FormallyEtale R A ↔ FormallyUnramified R A ∧ FormallySmooth R A :=
   by
@@ -76,21 +83,29 @@ theorem FormallyEtale.iff_unramified_and_smooth :
   simp_rw [← forall_and]
   rfl
 #align algebra.formally_etale.iff_unramified_and_smooth Algebra.FormallyEtale.iff_unramified_and_smooth
+-/
 
+#print Algebra.FormallyEtale.to_unramified /-
 instance (priority := 100) FormallyEtale.to_unramified [h : FormallyEtale R A] :
     FormallyUnramified R A :=
   (FormallyEtale.iff_unramified_and_smooth.mp h).1
 #align algebra.formally_etale.to_unramified Algebra.FormallyEtale.to_unramified
+-/
 
+#print Algebra.FormallyEtale.to_smooth /-
 instance (priority := 100) FormallyEtale.to_smooth [h : FormallyEtale R A] : FormallySmooth R A :=
   (FormallyEtale.iff_unramified_and_smooth.mp h).2
 #align algebra.formally_etale.to_smooth Algebra.FormallyEtale.to_smooth
+-/
 
+#print Algebra.FormallyEtale.of_unramified_and_smooth /-
 theorem FormallyEtale.of_unramified_and_smooth [h₁ : FormallyUnramified R A]
     [h₂ : FormallySmooth R A] : FormallyEtale R A :=
   FormallyEtale.iff_unramified_and_smooth.mpr ⟨h₁, h₂⟩
 #align algebra.formally_etale.of_unramified_and_smooth Algebra.FormallyEtale.of_unramified_and_smooth
+-/
 
+#print Algebra.FormallyUnramified.lift_unique /-
 theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra R B]
     [FormallyUnramified R A] (I : Ideal B) (hI : IsNilpotent I) (g₁ g₂ : A →ₐ[R] B)
     (h : (Ideal.Quotient.mkₐ R I).comp g₁ = (Ideal.Quotient.mkₐ R I).comp g₂) : g₁ = g₂ :=
@@ -108,12 +123,16 @@ theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra
     dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e ⊢
     rwa [Ideal.Quotient.eq, ← map_sub, Ideal.mem_quotient_iff_mem hIJ, ← Ideal.Quotient.eq]
 #align algebra.formally_unramified.lift_unique Algebra.FormallyUnramified.lift_unique
+-/
 
+#print Algebra.FormallyUnramified.ext /-
 theorem FormallyUnramified.ext [FormallyUnramified R A] (hI : IsNilpotent I) {g₁ g₂ : A →ₐ[R] B}
     (H : ∀ x, Ideal.Quotient.mk I (g₁ x) = Ideal.Quotient.mk I (g₂ x)) : g₁ = g₂ :=
   FormallyUnramified.lift_unique I hI g₁ g₂ (AlgHom.ext H)
 #align algebra.formally_unramified.ext Algebra.FormallyUnramified.ext
+-/
 
+#print Algebra.FormallyUnramified.lift_unique_of_ringHom /-
 theorem FormallyUnramified.lift_unique_of_ringHom [FormallyUnramified R A] {C : Type u} [CommRing C]
     (f : B →+* C) (hf : IsNilpotent f.ker) (g₁ g₂ : A →ₐ[R] B)
     (h : f.comp ↑g₁ = f.comp (g₂ : A →+* B)) : g₁ = g₂ :=
@@ -124,18 +143,24 @@ theorem FormallyUnramified.lift_unique_of_ringHom [FormallyUnramified R A] {C :
       simpa only [Ideal.Quotient.eq, Function.comp_apply, AlgHom.coe_comp, Ideal.Quotient.mkₐ_eq_mk,
         RingHom.mem_ker, map_sub, sub_eq_zero])
 #align algebra.formally_unramified.lift_unique_of_ring_hom Algebra.FormallyUnramified.lift_unique_of_ringHom
+-/
 
+#print Algebra.FormallyUnramified.ext' /-
 theorem FormallyUnramified.ext' [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C)
     (hf : IsNilpotent f.ker) (g₁ g₂ : A →ₐ[R] B) (h : ∀ x, f (g₁ x) = f (g₂ x)) : g₁ = g₂ :=
   FormallyUnramified.lift_unique_of_ringHom f hf g₁ g₂ (RingHom.ext h)
 #align algebra.formally_unramified.ext' Algebra.FormallyUnramified.ext'
+-/
 
+#print Algebra.FormallyUnramified.lift_unique' /-
 theorem FormallyUnramified.lift_unique' [FormallyUnramified R A] {C : Type u} [CommRing C]
     [Algebra R C] (f : B →ₐ[R] C) (hf : IsNilpotent (f : B →+* C).ker) (g₁ g₂ : A →ₐ[R] B)
     (h : f.comp g₁ = f.comp g₂) : g₁ = g₂ :=
   FormallyUnramified.ext' _ hf g₁ g₂ (AlgHom.congr_fun h)
 #align algebra.formally_unramified.lift_unique' Algebra.FormallyUnramified.lift_unique'
+-/
 
+#print Algebra.FormallySmooth.exists_lift /-
 theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
     [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
     ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g :=
@@ -159,28 +184,36 @@ theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
         AlgEquiv.comp_symm, AlgHom.id_comp]
     exact ⟨g', e⟩
 #align algebra.formally_smooth.exists_lift Algebra.FormallySmooth.exists_lift
+-/
 
+#print Algebra.FormallySmooth.lift /-
 /-- For a formally smooth `R`-algebra `A` and a map `f : A →ₐ[R] B ⧸ I` with `I` square-zero,
 this is an arbitrary lift `A →ₐ[R] B`. -/
 noncomputable def FormallySmooth.lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B :=
   (FormallySmooth.exists_lift I hI g).some
 #align algebra.formally_smooth.lift Algebra.FormallySmooth.lift
+-/
 
+#print Algebra.FormallySmooth.comp_lift /-
 @[simp]
 theorem FormallySmooth.comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g :=
   (FormallySmooth.exists_lift I hI g).choose_spec
 #align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift
+-/
 
+#print Algebra.FormallySmooth.mk_lift /-
 @[simp]
 theorem FormallySmooth.mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x :=
   AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x
 #align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift
+-/
 
 variable {C : Type u} [CommRing C] [Algebra R C]
 
+#print Algebra.FormallySmooth.liftOfSurjective /-
 /-- For a formally smooth `R`-algebra `A` and a map `f : A →ₐ[R] B ⧸ I` with `I` nilpotent,
 this is an arbitrary lift `A →ₐ[R] B`. -/
 noncomputable def FormallySmooth.liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
@@ -188,7 +221,9 @@ noncomputable def FormallySmooth.liftOfSurjective [FormallySmooth R A] (f : A 
     A →ₐ[R] B :=
   FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)
 #align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective
+-/
 
+#print Algebra.FormallySmooth.liftOfSurjective_apply /-
 @[simp]
 theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
     (hg : Function.Surjective g) (hg' : IsNilpotent (g : B →+* C).ker) (x : A) :
@@ -203,13 +238,16 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
     Ideal.quotientKerAlgEquivOfRightInverse.apply]
   exact (Ideal.kerLiftAlg_mk _ _).symm
 #align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
+-/
 
+#print Algebra.FormallySmooth.comp_liftOfSurjective /-
 @[simp]
 theorem FormallySmooth.comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
     (hg : Function.Surjective g) (hg' : IsNilpotent (g : B →+* C).ker) :
     g.comp (FormallySmooth.liftOfSurjective f g hg hg') = f :=
   AlgHom.ext (FormallySmooth.liftOfSurjective_apply f g hg hg')
 #align algebra.formally_smooth.comp_lift_of_surjective Algebra.FormallySmooth.comp_liftOfSurjective
+-/
 
 end
 
@@ -219,6 +257,7 @@ variable {R : Type u} [CommSemiring R]
 
 variable {A B : Type u} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
 
+#print Algebra.FormallySmooth.of_equiv /-
 theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : FormallySmooth R B :=
   by
   constructor
@@ -227,7 +266,9 @@ theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : Forma
   rw [← AlgHom.comp_assoc, formally_smooth.comp_lift, AlgHom.comp_assoc, AlgEquiv.comp_symm,
     AlgHom.comp_id]
 #align algebra.formally_smooth.of_equiv Algebra.FormallySmooth.of_equiv
+-/
 
+#print Algebra.FormallyUnramified.of_equiv /-
 theorem FormallyUnramified.of_equiv [FormallyUnramified R A] (e : A ≃ₐ[R] B) :
     FormallyUnramified R B := by
   constructor
@@ -237,11 +278,14 @@ theorem FormallyUnramified.of_equiv [FormallyUnramified R A] (e : A ≃ₐ[R] B)
   refine' formally_unramified.comp_injective I hI _
   rw [← AlgHom.comp_assoc, e', AlgHom.comp_assoc]
 #align algebra.formally_unramified.of_equiv Algebra.FormallyUnramified.of_equiv
+-/
 
+#print Algebra.FormallyEtale.of_equiv /-
 theorem FormallyEtale.of_equiv [FormallyEtale R A] (e : A ≃ₐ[R] B) : FormallyEtale R B :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.of_equiv e, FormallySmooth.of_equiv e⟩
 #align algebra.formally_etale.of_equiv Algebra.FormallyEtale.of_equiv
+-/
 
 end OfEquiv
 
@@ -251,6 +295,7 @@ open scoped Polynomial
 
 variable (R : Type u) [CommSemiring R]
 
+#print Algebra.FormallySmooth.mvPolynomial /-
 instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynomial σ R) :=
   by
   constructor
@@ -263,11 +308,14 @@ instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynom
   rw [← hg, AlgHom.comp_apply, MvPolynomial.aeval_X]
   rfl
 #align algebra.formally_smooth.mv_polynomial Algebra.FormallySmooth.mvPolynomial
+-/
 
+#print Algebra.FormallySmooth.polynomial /-
 instance FormallySmooth.polynomial : FormallySmooth R R[X] :=
   @FormallySmooth.of_equiv _ _ _ _ _ (FormallySmooth.mvPolynomial R PUnit)
     (MvPolynomial.pUnitAlgEquiv R)
 #align algebra.formally_smooth.polynomial Algebra.FormallySmooth.polynomial
+-/
 
 end Polynomial
 
@@ -279,6 +327,7 @@ variable (A : Type u) [CommSemiring A] [Algebra R A]
 
 variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
 
+#print Algebra.FormallySmooth.comp /-
 theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B :=
   by
   constructor
@@ -290,7 +339,9 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   apply_fun AlgHom.restrictScalars R at e' 
   exact ⟨f''.restrict_scalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
+-/
 
+#print Algebra.FormallyUnramified.comp /-
 theorem FormallyUnramified.comp [FormallyUnramified R A] [FormallyUnramified A B] :
     FormallyUnramified R B := by
   constructor
@@ -306,7 +357,9 @@ theorem FormallyUnramified.comp [FormallyUnramified R A] [FormallyUnramified A B
   congr
   exact formally_unramified.ext I ⟨2, hI⟩ (AlgHom.congr_fun e)
 #align algebra.formally_unramified.comp Algebra.FormallyUnramified.comp
+-/
 
+#print Algebra.FormallyUnramified.of_comp /-
 theorem FormallyUnramified.of_comp [FormallyUnramified R B] : FormallyUnramified A B :=
   by
   constructor
@@ -318,11 +371,14 @@ theorem FormallyUnramified.of_comp [FormallyUnramified R B] : FormallyUnramified
   intro x
   exact AlgHom.congr_fun e' x
 #align algebra.formally_unramified.of_comp Algebra.FormallyUnramified.of_comp
+-/
 
+#print Algebra.FormallyEtale.comp /-
 theorem FormallyEtale.comp [FormallyEtale R A] [FormallyEtale A B] : FormallyEtale R B :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.comp R A B, FormallySmooth.comp R A B⟩
 #align algebra.formally_etale.comp Algebra.FormallyEtale.comp
+-/
 
 end Comp
 
@@ -334,6 +390,7 @@ variable {P A : Type u} [CommRing A] [Algebra R A] [CommRing P] [Algebra R P]
 
 variable (I : Ideal P) (f : P →ₐ[R] A) (hf : Function.Surjective f)
 
+#print Algebra.FormallySmooth.of_split /-
 theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ f.toRingHom.ker ^ 2)
     (hg : f.kerSquareLift.comp g = AlgHom.id R A) : FormallySmooth R A :=
   by
@@ -358,7 +415,9 @@ theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ f.to
     exact (formally_smooth.mk_lift I ⟨2, hI⟩ (i.comp f) x).symm
   exact ⟨l.comp g, by rw [← AlgHom.comp_assoc, ← this, AlgHom.comp_assoc, hg, AlgHom.comp_id]⟩
 #align algebra.formally_smooth.of_split Algebra.FormallySmooth.of_split
+-/
 
+#print Algebra.FormallySmooth.iff_split_surjection /-
 /-- Let `P →ₐ[R] A` be a surjection with kernel `J`, and `P` a formally smooth `R`-algebra,
 then `A` is formally smooth over `R` iff the surjection `P ⧸ J ^ 2 →ₐ[R] A` has a section.
 
@@ -372,7 +431,7 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
     have surj : Function.Surjective f.ker_square_lift := fun x =>
       ⟨Submodule.Quotient.mk (hf x).some, (hf x).choose_spec⟩
     have sqz : RingHom.ker f.ker_square_lift.to_ring_hom ^ 2 = 0 := by
-      rw [AlgHom.ker_ker_sqare_lift, Ideal.cotangentIdeal_square, Ideal.zero_eq_bot]
+      rw [AlgHom.ker_kerSquareLift, Ideal.cotangentIdeal_square, Ideal.zero_eq_bot]
     refine'
       ⟨formally_smooth.lift _ ⟨2, sqz⟩ (Ideal.quotientKerAlgEquivOfSurjective surj).symm.toAlgHom,
         _⟩
@@ -393,6 +452,7 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
     rfl
   · rintro ⟨g, hg⟩; exact formally_smooth.of_split f g hg
 #align algebra.formally_smooth.iff_split_surjection Algebra.FormallySmooth.iff_split_surjection
+-/
 
 end OfSurjective
 
@@ -402,6 +462,7 @@ open scoped TensorProduct
 
 variable {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
 
+#print Algebra.FormallyUnramified.subsingleton_kaehlerDifferential /-
 instance FormallyUnramified.subsingleton_kaehlerDifferential [FormallyUnramified R S] :
     Subsingleton (Ω[S⁄R]) := by
   rw [← not_nontrivial_iff_subsingleton]
@@ -410,10 +471,12 @@ instance FormallyUnramified.subsingleton_kaehlerDifferential [FormallyUnramified
   apply e
   ext1
   apply formally_unramified.lift_unique' _ _ _ _ (f₁.2.trans f₂.2.symm)
-  rw [← AlgHom.toRingHom_eq_coe, AlgHom.ker_ker_sqare_lift]
+  rw [← AlgHom.toRingHom_eq_coe, AlgHom.ker_kerSquareLift]
   exact ⟨_, Ideal.cotangentIdeal_square _⟩
 #align algebra.formally_unramified.subsingleton_kaehler_differential Algebra.FormallyUnramified.subsingleton_kaehlerDifferential
+-/
 
+#print Algebra.FormallyUnramified.iff_subsingleton_kaehlerDifferential /-
 theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
     FormallyUnramified R S ↔ Subsingleton (Ω[S⁄R]) :=
   by
@@ -429,6 +492,7 @@ theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
             (derivationToSquareZeroEquivLift I hI)).Surjective.Subsingleton
     exact subtype.ext_iff.mp (@Subsingleton.elim this ⟨f₁, rfl⟩ ⟨f₂, e.symm⟩)
 #align algebra.formally_unramified.iff_subsingleton_kaehler_differential Algebra.FormallyUnramified.iff_subsingleton_kaehlerDifferential
+-/
 
 end UnramifiedDerivation
 
@@ -442,6 +506,7 @@ variable {A : Type u} [Semiring A] [Algebra R A]
 
 variable (B : Type u) [CommSemiring B] [Algebra R B]
 
+#print Algebra.FormallyUnramified.base_change /-
 instance FormallyUnramified.base_change [FormallyUnramified R A] :
     FormallyUnramified B (B ⊗[R] A) := by
   constructor
@@ -463,7 +528,9 @@ instance FormallyUnramified.base_change [FormallyUnramified R A] :
   intro x
   exact AlgHom.congr_fun e (1 ⊗ₜ x)
 #align algebra.formally_unramified.base_change Algebra.FormallyUnramified.base_change
+-/
 
+#print Algebra.FormallySmooth.base_change /-
 instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) :=
   by
   constructor
@@ -479,10 +546,13 @@ instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B 
     suffices algebraMap B _ b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a) by simpa [Algebra.ofId_apply]
     rw [← Algebra.smul_def, ← map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one]
 #align algebra.formally_smooth.base_change Algebra.FormallySmooth.base_change
+-/
 
+#print Algebra.FormallyEtale.base_change /-
 instance FormallyEtale.base_change [FormallyEtale R A] : FormallyEtale B (B ⊗[R] A) :=
   FormallyEtale.iff_unramified_and_smooth.mpr ⟨inferInstance, inferInstance⟩
 #align algebra.formally_etale.base_change Algebra.FormallyEtale.base_change
+-/
 
 end BaseChange
 
@@ -500,6 +570,7 @@ variable [IsLocalization M Rₘ] [IsLocalization (M.map (algebraMap R S)) Sₘ]
 
 attribute [local elab_as_elim] Ideal.IsNilpotent.induction_on
 
+#print Algebra.FormallySmooth.of_isLocalization /-
 theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
   by
   constructor
@@ -517,7 +588,9 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
   ext
   simp
 #align algebra.formally_smooth.of_is_localization Algebra.FormallySmooth.of_isLocalization
+-/
 
+#print Algebra.FormallyUnramified.of_isLocalization /-
 /-- This holds in general for epimorphisms. -/
 theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ :=
   by
@@ -528,12 +601,16 @@ theorem FormallyUnramified.of_isLocalization : FormallyUnramified R Rₘ :=
   ext
   simp
 #align algebra.formally_unramified.of_is_localization Algebra.FormallyUnramified.of_isLocalization
+-/
 
+#print Algebra.FormallyEtale.of_isLocalization /-
 theorem FormallyEtale.of_isLocalization : FormallyEtale R Rₘ :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.of_isLocalization M, FormallySmooth.of_isLocalization M⟩
 #align algebra.formally_etale.of_is_localization Algebra.FormallyEtale.of_isLocalization
+-/
 
+#print Algebra.FormallySmooth.localization_base /-
 theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ :=
   by
   constructor
@@ -557,7 +634,9 @@ theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmoot
   ext
   simp
 #align algebra.formally_smooth.localization_base Algebra.FormallySmooth.localization_base
+-/
 
+#print Algebra.FormallyUnramified.localization_base /-
 /-- This actually does not need the localization instance, and is stated here again for
 consistency. See `algebra.formally_unramified.of_comp` instead.
 
@@ -567,19 +646,25 @@ consistency. See `algebra.formally_unramified.of_comp` instead.
 theorem FormallyUnramified.localization_base [FormallyUnramified R Sₘ] : FormallyUnramified Rₘ Sₘ :=
   FormallyUnramified.of_comp R Rₘ Sₘ
 #align algebra.formally_unramified.localization_base Algebra.FormallyUnramified.localization_base
+-/
 
+#print Algebra.FormallyEtale.localization_base /-
 theorem FormallyEtale.localization_base [FormallyEtale R Sₘ] : FormallyEtale Rₘ Sₘ :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.localization_base M, FormallySmooth.localization_base M⟩
 #align algebra.formally_etale.localization_base Algebra.FormallyEtale.localization_base
+-/
 
+#print Algebra.FormallySmooth.localization_map /-
 theorem FormallySmooth.localization_map [FormallySmooth R S] : FormallySmooth Rₘ Sₘ :=
   by
   haveI : formally_smooth S Sₘ := formally_smooth.of_is_localization (M.map (algebraMap R S))
   haveI : formally_smooth R Sₘ := formally_smooth.comp R S Sₘ
   exact formally_smooth.localization_base M
 #align algebra.formally_smooth.localization_map Algebra.FormallySmooth.localization_map
+-/
 
+#print Algebra.FormallyUnramified.localization_map /-
 theorem FormallyUnramified.localization_map [FormallyUnramified R S] : FormallyUnramified Rₘ Sₘ :=
   by
   haveI : formally_unramified S Sₘ :=
@@ -587,13 +672,16 @@ theorem FormallyUnramified.localization_map [FormallyUnramified R S] : FormallyU
   haveI : formally_unramified R Sₘ := formally_unramified.comp R S Sₘ
   exact formally_unramified.localization_base M
 #align algebra.formally_unramified.localization_map Algebra.FormallyUnramified.localization_map
+-/
 
+#print Algebra.FormallyEtale.localization_map /-
 theorem FormallyEtale.localization_map [FormallyEtale R S] : FormallyEtale Rₘ Sₘ :=
   by
   haveI : formally_etale S Sₘ := formally_etale.of_is_localization (M.map (algebraMap R S))
   haveI : formally_etale R Sₘ := formally_etale.comp R S Sₘ
   exact formally_etale.localization_base M
 #align algebra.formally_etale.localization_map Algebra.FormallyEtale.localization_map
+-/
 
 end Localization
 
Diff
@@ -37,8 +37,6 @@ variable (A : Type u) [Semiring A] [Algebra R A]
 
 variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
-include R A
-
 /-- An `R`-algebra `A` is formally unramified if for every `R`-algebra, every square-zero ideal
 `I : ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at most one lift `A →ₐ[R] B`. -/
 @[mk_iff]
@@ -93,8 +91,6 @@ theorem FormallyEtale.of_unramified_and_smooth [h₁ : FormallyUnramified R A]
   FormallyEtale.iff_unramified_and_smooth.mpr ⟨h₁, h₂⟩
 #align algebra.formally_etale.of_unramified_and_smooth Algebra.FormallyEtale.of_unramified_and_smooth
 
-omit R A
-
 theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra R B]
     [FormallyUnramified R A] (I : Ideal B) (hI : IsNilpotent I) (g₁ g₂ : A →ₐ[R] B)
     (h : (Ideal.Quotient.mkₐ R I).comp g₁ = (Ideal.Quotient.mkₐ R I).comp g₂) : g₁ = g₂ :=
@@ -363,8 +359,6 @@ theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ f.to
   exact ⟨l.comp g, by rw [← AlgHom.comp_assoc, ← this, AlgHom.comp_assoc, hg, AlgHom.comp_id]⟩
 #align algebra.formally_smooth.of_split Algebra.FormallySmooth.of_split
 
-include hf
-
 /-- Let `P →ₐ[R] A` be a surjection with kernel `J`, and `P` a formally smooth `R`-algebra,
 then `A` is formally smooth over `R` iff the surjection `P ⧸ J ^ 2 →ₐ[R] A` has a section.
 
@@ -506,8 +500,6 @@ variable [IsLocalization M Rₘ] [IsLocalization (M.map (algebraMap R S)) Sₘ]
 
 attribute [local elab_as_elim] Ideal.IsNilpotent.induction_on
 
-include M
-
 theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
   by
   constructor
Diff
@@ -150,7 +150,7 @@ theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
   apply Ideal.IsNilpotent.induction_on I hI
   · intro B _ I hI _; exact formally_smooth.comp_surjective I hI
   · intro B _ I J hIJ h₁ h₂ _ g
-    let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
+    let this.1 : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
       {
         (DoubleQuot.quotQuotEquivQuotSup I J).trans
           (Ideal.quotEquivOfEq (sup_eq_right.mpr hIJ)) with
@@ -517,7 +517,7 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
     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 :=
+  let this.1 : Rₘ →ₐ[R] Q :=
     { IsLocalization.lift this with commutes' := IsLocalization.lift_eq this }
   use this
   apply AlgHom.coe_ringHom_injective
Diff
@@ -291,7 +291,7 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   letI := f'.to_ring_hom.to_algebra
   obtain ⟨f'', e'⟩ :=
     formally_smooth.comp_surjective I hI { f.to_ring_hom with commutes' := AlgHom.congr_fun e.symm }
-  apply_fun AlgHom.restrictScalars R  at e' 
+  apply_fun AlgHom.restrictScalars R at e' 
   exact ⟨f''.restrict_scalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
 
@@ -515,7 +515,7 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
   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
+    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 }
Diff
@@ -109,7 +109,7 @@ theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra
     apply h₂
     ext x
     replace e := AlgHom.congr_fun e x
-    dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e⊢
+    dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e ⊢
     rwa [Ideal.Quotient.eq, ← map_sub, Ideal.mem_quotient_iff_mem hIJ, ← Ideal.Quotient.eq]
 #align algebra.formally_unramified.lift_unique Algebra.FormallyUnramified.lift_unique
 
@@ -126,7 +126,7 @@ theorem FormallyUnramified.lift_unique_of_ringHom [FormallyUnramified R A] {C :
       ext x
       have := RingHom.congr_fun h x
       simpa only [Ideal.Quotient.eq, Function.comp_apply, AlgHom.coe_comp, Ideal.Quotient.mkₐ_eq_mk,
-        RingHom.mem_ker, map_sub, sub_eq_zero] )
+        RingHom.mem_ker, map_sub, sub_eq_zero])
 #align algebra.formally_unramified.lift_unique_of_ring_hom Algebra.FormallyUnramified.lift_unique_of_ringHom
 
 theorem FormallyUnramified.ext' [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C)
@@ -291,7 +291,7 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   letI := f'.to_ring_hom.to_algebra
   obtain ⟨f'', e'⟩ :=
     formally_smooth.comp_surjective I hI { f.to_ring_hom with commutes' := AlgHom.congr_fun e.symm }
-  apply_fun AlgHom.restrictScalars R  at e'
+  apply_fun AlgHom.restrictScalars R  at e' 
   exact ⟨f''.restrict_scalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
 
@@ -350,10 +350,10 @@ theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ f.to
       by
       rintro x (hx : f x = 0)
       have : _ = i (f x) := (formally_smooth.mk_lift I ⟨2, hI⟩ (i.comp f) x : _)
-      rwa [hx, map_zero, ← Ideal.Quotient.mk_eq_mk, Submodule.Quotient.mk_eq_zero] at this
+      rwa [hx, map_zero, ← Ideal.Quotient.mk_eq_mk, Submodule.Quotient.mk_eq_zero] at this 
     intro x hx
     have := (Ideal.pow_mono this 2).trans (Ideal.le_comap_pow _ 2) hx
-    rwa [hI] at this
+    rwa [hI] at this 
   have : i.comp f.ker_square_lift = (Ideal.Quotient.mkₐ R _).comp l :=
     by
     apply AlgHom.coe_ringHom_injective
@@ -387,14 +387,14 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
       (Ideal.quotientKerAlgEquivOfSurjective surj).toAlgHom.congr_arg
         (formally_smooth.mk_lift _ ⟨2, sqz⟩
           (Ideal.quotientKerAlgEquivOfSurjective surj).symm.toAlgHom x)
-    dsimp at this
-    rw [AlgEquiv.apply_symm_apply] at this
+    dsimp at this 
+    rw [AlgEquiv.apply_symm_apply] at this 
     conv_rhs => rw [← this, AlgHom.id_apply]
     obtain ⟨y, e⟩ :=
       Ideal.Quotient.mk_surjective
         (formally_smooth.lift _ ⟨2, sqz⟩ (Ideal.quotientKerAlgEquivOfSurjective surj).symm.toAlgHom
           x)
-    dsimp at e⊢
+    dsimp at e ⊢
     rw [← e]
     rfl
   · rintro ⟨g, hg⟩; exact formally_smooth.of_split f g hg
@@ -424,7 +424,7 @@ theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
     FormallyUnramified R S ↔ Subsingleton (Ω[S⁄R]) :=
   by
   constructor
-  · intros ; infer_instance
+  · intros; infer_instance
   · intro H
     constructor
     intro B _ _ I hI f₁ f₂ e
Diff
@@ -251,7 +251,7 @@ end OfEquiv
 
 section Polynomial
 
-open Polynomial
+open scoped Polynomial
 
 variable (R : Type u) [CommSemiring R]
 
@@ -404,7 +404,7 @@ end OfSurjective
 
 section UnramifiedDerivation
 
-open TensorProduct
+open scoped TensorProduct
 
 variable {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
 
@@ -440,7 +440,7 @@ end UnramifiedDerivation
 
 section BaseChange
 
-open TensorProduct
+open scoped TensorProduct
 
 variable {R : Type u} [CommSemiring R]
 
Diff
@@ -103,8 +103,7 @@ theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra
   change Function.Injective (Ideal.Quotient.mkₐ R I).comp
   revert _RB
   apply Ideal.IsNilpotent.induction_on I hI
-  · intro B _ I hI _
-    exact formally_unramified.comp_injective I hI
+  · intro B _ I hI _; exact formally_unramified.comp_injective I hI
   · intro B _ I J hIJ h₁ h₂ _ g₁ g₂ e
     apply h₁
     apply h₂
@@ -149,8 +148,7 @@ theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
   change Function.Surjective (Ideal.Quotient.mkₐ R I).comp
   revert _RB
   apply Ideal.IsNilpotent.induction_on I hI
-  · intro B _ I hI _
-    exact formally_smooth.comp_surjective I hI
+  · intro B _ I hI _; exact formally_smooth.comp_surjective I hI
   · intro B _ I J hIJ h₁ h₂ _ g
     let this : ((B ⧸ I) ⧸ J.map (Ideal.Quotient.mk I)) ≃ₐ[R] B ⧸ J :=
       {
@@ -399,8 +397,7 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
     dsimp at e⊢
     rw [← e]
     rfl
-  · rintro ⟨g, hg⟩
-    exact formally_smooth.of_split f g hg
+  · rintro ⟨g, hg⟩; exact formally_smooth.of_split f g hg
 #align algebra.formally_smooth.iff_split_surjection Algebra.FormallySmooth.iff_split_surjection
 
 end OfSurjective
@@ -427,8 +424,7 @@ theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
     FormallyUnramified R S ↔ Subsingleton (Ω[S⁄R]) :=
   by
   constructor
-  · intros
-    infer_instance
+  · intros ; infer_instance
   · intro H
     constructor
     intro B _ _ I hI f₁ f₂ e
Diff
@@ -4,12 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module ring_theory.etale
-! leanprover-community/mathlib commit da420a8c6dd5bdfb85c4ced85c34388f633bc6ff
+! leanprover-community/mathlib commit 73f96237417835f148a1f7bc1ff55f67119b7166
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.QuotientNilpotent
-import Mathbin.RingTheory.Derivation
+import Mathbin.RingTheory.Kaehler
 
 /-!
 
Diff
@@ -272,7 +272,7 @@ instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynom
 
 instance FormallySmooth.polynomial : FormallySmooth R R[X] :=
   @FormallySmooth.of_equiv _ _ _ _ _ (FormallySmooth.mvPolynomial R PUnit)
-    (MvPolynomial.punitAlgEquiv R)
+    (MvPolynomial.pUnitAlgEquiv R)
 #align algebra.formally_smooth.polynomial Algebra.FormallySmooth.polynomial
 
 end Polynomial
Diff
@@ -519,7 +519,7 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ :=
   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
+    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 }
Diff
@@ -261,12 +261,12 @@ instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynom
   by
   constructor
   intro C _ _ I hI f
-  have : ∀ s : σ, ∃ c : C, Ideal.Quotient.mk I c = f (MvPolynomial.x s) := fun s =>
+  have : ∀ s : σ, ∃ c : C, Ideal.Quotient.mk I c = f (MvPolynomial.X s) := fun s =>
     Ideal.Quotient.mk_surjective _
   choose g hg
   refine' ⟨MvPolynomial.aeval g, _⟩
   ext s
-  rw [← hg, AlgHom.comp_apply, MvPolynomial.aeval_x]
+  rw [← hg, AlgHom.comp_apply, MvPolynomial.aeval_X]
   rfl
 #align algebra.formally_smooth.mv_polynomial Algebra.FormallySmooth.mvPolynomial
 
Diff
@@ -4,11 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
 ! This file was ported from Lean 3 source module ring_theory.etale
-! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a
+! leanprover-community/mathlib commit da420a8c6dd5bdfb85c4ced85c34388f633bc6ff
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.RingTheory.Nilpotent
+import Mathbin.RingTheory.QuotientNilpotent
 import Mathbin.RingTheory.Derivation
 
 /-!

Changes in mathlib4

mathlib3
mathlib4
feat(RingTheory/Etale): add definition of unramified, smooth and etale (#12044)

Adds definitions for unramified, smooth and étale algebras and shows basic permanence properties.

In a follow-up PR we show that these notions are stable under base change.

Co-authored-by: Judith Ludwig <ludwig@mathi.uni-heidelberg.de>

Co-authored-by: Christian Merten <christian@merten.dev> Co-authored-by: judithludwig <150042763+judithludwig@users.noreply.github.com>

Diff
@@ -6,7 +6,9 @@ Authors: Andrew Yang
 import Mathlib.RingTheory.Ideal.Cotangent
 import Mathlib.RingTheory.QuotientNilpotent
 import Mathlib.RingTheory.TensorProduct.Basic
-
+import Mathlib.RingTheory.FinitePresentation
+import Mathlib.RingTheory.Localization.Away.Basic
+import Mathlib.RingTheory.Localization.Away.AdjoinRoot
 #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
 
 /-!
@@ -16,16 +18,20 @@ import Mathlib.RingTheory.TensorProduct.Basic
 An `R`-algebra `A` is formally smooth if for every `R`-algebra,
 every square-zero ideal `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists
 at least one lift `A →ₐ[R] B`.
+It is smooth if it is formally smooth and of finite presentation.
 
-We show that the property extends onto nilpotent ideals, and that these properties are stable
-under `R`-algebra homomorphisms and compositions.
+We show that the property of being formally smooth extends onto nilpotent ideals,
+and that it is stable under `R`-algebra homomorphisms and compositions.
 
-## TODO:
+We show that smooth is stable under algebra isomorphisms, composition and
+localization at an element.
 
-- Define smooth morphisms
 
--/
+# TODO
 
+- Show that smooth is stable under base change.
+
+-/
 
 -- Porting note: added to make the syntax work below.
 open scoped TensorProduct
@@ -38,7 +44,6 @@ section
 
 variable (R : Type u) [CommSemiring R]
 variable (A : Type u) [Semiring A] [Algebra R A]
-variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
 /-- An `R` algebra `A` is formally smooth if for every `R`-algebra, every square-zero ideal
 `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at least one lift `A →ₐ[R] B`. -/
@@ -50,9 +55,17 @@ class FormallySmooth : Prop where
         Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_smooth Algebra.FormallySmooth
 
-variable {R A}
+end
+
+namespace FormallySmooth
+
+section
+
+variable {R : Type u} [CommSemiring R]
+variable {A : Type u} [Semiring A] [Algebra R A]
+variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
-theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
+theorem exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
     [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
     ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
   revert g
@@ -77,19 +90,19 @@ theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
 
 /-- For a formally smooth `R`-algebra `A` and a map `f : A →ₐ[R] B ⧸ I` with `I` square-zero,
 this is an arbitrary lift `A →ₐ[R] B`. -/
-noncomputable def FormallySmooth.lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
+noncomputable def lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) : A →ₐ[R] B :=
   (FormallySmooth.exists_lift I hI g).choose
 #align algebra.formally_smooth.lift Algebra.FormallySmooth.lift
 
 @[simp]
-theorem FormallySmooth.comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
+theorem comp_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) : (Ideal.Quotient.mkₐ R I).comp (FormallySmooth.lift I hI g) = g :=
   (FormallySmooth.exists_lift I hI g).choose_spec
 #align algebra.formally_smooth.comp_lift Algebra.FormallySmooth.comp_lift
 
 @[simp]
-theorem FormallySmooth.mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
+theorem mk_lift [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I)
     (g : A →ₐ[R] B ⧸ I) (x : A) : Ideal.Quotient.mk I (FormallySmooth.lift I hI g x) = g x :=
   AlgHom.congr_fun (FormallySmooth.comp_lift I hI g : _) x
 #align algebra.formally_smooth.mk_lift Algebra.FormallySmooth.mk_lift
@@ -98,14 +111,14 @@ variable {C : Type u} [CommRing C] [Algebra R C]
 
 /-- For a formally smooth `R`-algebra `A` and a map `f : A →ₐ[R] B ⧸ I` with `I` nilpotent,
 this is an arbitrary lift `A →ₐ[R] B`. -/
-noncomputable def FormallySmooth.liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
+noncomputable def liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C)
     (g : B →ₐ[R] C) (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
     A →ₐ[R] B :=
   FormallySmooth.lift _ hg' ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)
 #align algebra.formally_smooth.lift_of_surjective Algebra.FormallySmooth.liftOfSurjective
 
 @[simp]
-theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
+theorem liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
     (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) (x : A) :
     g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
@@ -119,7 +132,7 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
 #align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
 
 @[simp]
-theorem FormallySmooth.comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
+theorem comp_liftOfSurjective [FormallySmooth R A] (f : A →ₐ[R] C) (g : B →ₐ[R] C)
     (hg : Function.Surjective g) (hg' : IsNilpotent <| RingHom.ker (g : B →+* C)) :
     g.comp (FormallySmooth.liftOfSurjective f g hg hg') = f :=
   AlgHom.ext (FormallySmooth.liftOfSurjective_apply f g hg hg')
@@ -132,7 +145,7 @@ section OfEquiv
 variable {R : Type u} [CommSemiring R]
 variable {A B : Type u} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
 
-theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : FormallySmooth R B := by
+theorem of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : FormallySmooth R B := by
   constructor
   intro C _ _ I hI f
   use (FormallySmooth.lift I ⟨2, hI⟩ (f.comp e : A →ₐ[R] C ⧸ I)).comp e.symm
@@ -148,7 +161,7 @@ open scoped Polynomial
 
 variable (R : Type u) [CommSemiring R]
 
-instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynomial σ R) := by
+instance mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynomial σ R) := by
   constructor
   intro C _ _ I _ f
   have : ∀ s : σ, ∃ c : C, Ideal.Quotient.mk I c = f (MvPolynomial.X s) := fun s =>
@@ -160,7 +173,7 @@ instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynom
   rfl
 #align algebra.formally_smooth.mv_polynomial Algebra.FormallySmooth.mvPolynomial
 
-instance FormallySmooth.polynomial : FormallySmooth R R[X] :=
+instance polynomial : FormallySmooth R R[X] :=
   FormallySmooth.of_equiv (MvPolynomial.pUnitAlgEquiv R)
 #align algebra.formally_smooth.polynomial Algebra.FormallySmooth.polynomial
 
@@ -172,7 +185,7 @@ variable (R : Type u) [CommSemiring R]
 variable (A : Type u) [CommSemiring A] [Algebra R A]
 variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
 
-theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B := by
+theorem comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B := by
   constructor
   intro C _ _ I hI f
   obtain ⟨f', e⟩ := FormallySmooth.comp_surjective I hI (f.comp (IsScalarTower.toAlgHom R A B))
@@ -183,6 +196,7 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   exact ⟨f''.restrictScalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
 
+
 end Comp
 
 section OfSurjective
@@ -191,7 +205,7 @@ variable {R S : Type u} [CommRing R] [CommSemiring S]
 variable {P A : Type u} [CommRing A] [Algebra R A] [CommRing P] [Algebra R P]
 variable (I : Ideal P) (f : P →ₐ[R] A) (hf : Function.Surjective f)
 
-theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ (RingHom.ker f.toRingHom) ^ 2)
+theorem of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ (RingHom.ker f.toRingHom) ^ 2)
     (hg : f.kerSquareLift.comp g = AlgHom.id R A) : FormallySmooth R A := by
   constructor
   intro C _ _ I hI i
@@ -217,7 +231,7 @@ then `A` is formally smooth over `R` iff the surjection `P ⧸ J ^ 2 →ₐ[R] A
 
 Geometric intuition: we require that a first-order thickening of `Spec A` inside `Spec P` admits
 a retraction. -/
-theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
+theorem iff_split_surjection [FormallySmooth R P] :
     FormallySmooth R A ↔ ∃ g, f.kerSquareLift.comp g = AlgHom.id R A := by
   constructor
   · intro
@@ -252,14 +266,6 @@ theorem FormallySmooth.iff_split_surjection [FormallySmooth R P] :
 
 end OfSurjective
 
-section UnramifiedDerivation
-
-open scoped TensorProduct
-
-variable {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
-
-end UnramifiedDerivation
-
 section BaseChange
 
 open scoped TensorProduct
@@ -268,7 +274,7 @@ variable {R : Type u} [CommSemiring R]
 variable {A : Type u} [Semiring A] [Algebra R A]
 variable (B : Type u) [CommSemiring B] [Algebra R B]
 
-instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
+instance 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
@@ -295,7 +301,7 @@ variable [IsLocalization M Rₘ] [IsLocalization (M.map (algebraMap R S)) Sₘ]
 -- Porting note: no longer supported
 -- attribute [local elab_as_elim] Ideal.IsNilpotent.induction_on
 
-theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
+theorem of_isLocalization : FormallySmooth R Rₘ := by
   constructor
   intro Q _ _ I e f
   have : ∀ x : M, IsUnit (algebraMap R Q x) := by
@@ -312,7 +318,7 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
   simp
 #align algebra.formally_smooth.of_is_localization Algebra.FormallySmooth.of_isLocalization
 
-theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
+theorem localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
   constructor
   intro Q _ _ I e f
   letI := ((algebraMap Rₘ Q).comp (algebraMap R Rₘ)).toAlgebra
@@ -334,7 +340,7 @@ theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmoot
   simp [f]
 #align algebra.formally_smooth.localization_base Algebra.FormallySmooth.localization_base
 
-theorem FormallySmooth.localization_map [FormallySmooth R S] : FormallySmooth Rₘ Sₘ := by
+theorem localization_map [FormallySmooth R S] : FormallySmooth Rₘ Sₘ := by
   haveI : FormallySmooth S Sₘ := FormallySmooth.of_isLocalization (M.map (algebraMap R S))
   haveI : FormallySmooth R Sₘ := FormallySmooth.comp R S Sₘ
   exact FormallySmooth.localization_base M
@@ -342,4 +348,49 @@ theorem FormallySmooth.localization_map [FormallySmooth R S] : FormallySmooth R
 
 end Localization
 
+end FormallySmooth
+
+section
+
+variable (R : Type u) [CommSemiring R]
+variable (A : Type u) [Semiring A] [Algebra R A]
+
+/-- An `R` algebra `A` is smooth if it is formally smooth and of finite presentation. -/
+class Smooth [CommSemiring R] (A : Type u) [Semiring A] [Algebra R A] : Prop where
+  formallySmooth : FormallySmooth R A := by infer_instance
+  finitePresentation : FinitePresentation R A := by infer_instance
+
+end
+
+namespace Smooth
+
+attribute [instance] formallySmooth finitePresentation
+
+variable {R : Type u} [CommRing R]
+variable {A B : Type u} [CommRing A] [Algebra R A] [CommRing B] [Algebra R B]
+
+/-- Being smooth is transported via algebra isomorphisms. -/
+theorem of_equiv [Smooth R A] (e : A ≃ₐ[R] B) : Smooth R B where
+  formallySmooth := FormallySmooth.of_equiv e
+  finitePresentation := FinitePresentation.equiv e
+
+/-- Localization at an element is smooth. -/
+theorem of_isLocalization_Away (r : R) [IsLocalization.Away r A] : Smooth R A where
+  formallySmooth := Algebra.FormallySmooth.of_isLocalization (Submonoid.powers r)
+  finitePresentation := IsLocalization.Away.finitePresentation r
+
+section Comp
+
+variable (R A B)
+variable [Algebra A B] [IsScalarTower R A B]
+
+/-- Smooth is stable under composition. -/
+theorem comp [Smooth R A] [Smooth A B] : Smooth R B where
+  formallySmooth := FormallySmooth.comp R A B
+  finitePresentation := FinitePresentation.trans R A B
+
+end Comp
+
+end Smooth
+
 end Algebra
feat(RingTheory/Etale): add definition of unramified, smooth and etale (#12044)

Adds definitions for unramified, smooth and étale algebras and shows basic permanence properties.

In a follow-up PR we show that these notions are stable under base change.

Co-authored-by: Judith Ludwig <ludwig@mathi.uni-heidelberg.de>

Co-authored-by: Christian Merten <christian@merten.dev> Co-authored-by: judithludwig <150042763+judithludwig@users.noreply.github.com>

Diff
@@ -16,13 +16,17 @@ import Mathlib.RingTheory.Unramified.Basic
 An `R`-algebra `A` is formally étale if for every `R`-algebra,
 every square-zero ideal `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists
 exactly one lift `A →ₐ[R] B`.
+It is étale if it is formally étale and of finite presentation.
 
 We show that the property extends onto nilpotent ideals, and that these properties are stable
 under `R`-algebra homomorphisms and compositions.
 
+We show that étale is stable under algebra isomorphisms, composition and
+localization at an element.
+
 ## TODO:
 
-- Define étale morphisms
+- Show that étale is stable under base change.
 
 -/
 
@@ -38,7 +42,6 @@ section
 
 variable (R : Type u) [CommSemiring R]
 variable (A : Type u) [Semiring A] [Algebra R A]
-variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
 /-- An `R` algebra `A` is formally étale if for every `R`-algebra, every square-zero ideal
 `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists exactly one lift `A →ₐ[R] B`. -/
@@ -50,24 +53,32 @@ class FormallyEtale : Prop where
         Function.Bijective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_etale Algebra.FormallyEtale
 
-variable {R A}
+end
+
+namespace FormallyEtale
+
+section
+
+variable {R : Type u} [CommSemiring R]
+variable {A : Type u} [Semiring A] [Algebra R A]
+variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
-theorem FormallyEtale.iff_unramified_and_smooth :
+theorem iff_unramified_and_smooth :
     FormallyEtale R A ↔ FormallyUnramified R A ∧ FormallySmooth R A := by
   rw [formallyUnramified_iff, formallySmooth_iff, formallyEtale_iff]
   simp_rw [← forall_and, Function.Bijective]
 #align algebra.formally_etale.iff_unramified_and_smooth Algebra.FormallyEtale.iff_unramified_and_smooth
 
-instance (priority := 100) FormallyEtale.to_unramified [h : FormallyEtale R A] :
+instance (priority := 100) to_unramified [h : FormallyEtale R A] :
     FormallyUnramified R A :=
   (FormallyEtale.iff_unramified_and_smooth.mp h).1
 #align algebra.formally_etale.to_unramified Algebra.FormallyEtale.to_unramified
 
-instance (priority := 100) FormallyEtale.to_smooth [h : FormallyEtale R A] : FormallySmooth R A :=
+instance (priority := 100) to_smooth [h : FormallyEtale R A] : FormallySmooth R A :=
   (FormallyEtale.iff_unramified_and_smooth.mp h).2
 #align algebra.formally_etale.to_smooth Algebra.FormallyEtale.to_smooth
 
-theorem FormallyEtale.of_unramified_and_smooth [h₁ : FormallyUnramified R A]
+theorem of_unramified_and_smooth [h₁ : FormallyUnramified R A]
     [h₂ : FormallySmooth R A] : FormallyEtale R A :=
   FormallyEtale.iff_unramified_and_smooth.mpr ⟨h₁, h₂⟩
 #align algebra.formally_etale.of_unramified_and_smooth Algebra.FormallyEtale.of_unramified_and_smooth
@@ -79,7 +90,7 @@ section OfEquiv
 variable {R : Type u} [CommSemiring R]
 variable {A B : Type u} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
 
-theorem FormallyEtale.of_equiv [FormallyEtale R A] (e : A ≃ₐ[R] B) : FormallyEtale R B :=
+theorem of_equiv [FormallyEtale R A] (e : A ≃ₐ[R] B) : FormallyEtale R B :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.of_equiv e, FormallySmooth.of_equiv e⟩
 #align algebra.formally_etale.of_equiv Algebra.FormallyEtale.of_equiv
@@ -92,7 +103,7 @@ variable (R : Type u) [CommSemiring R]
 variable (A : Type u) [CommSemiring A] [Algebra R A]
 variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
 
-theorem FormallyEtale.comp [FormallyEtale R A] [FormallyEtale A B] : FormallyEtale R B :=
+theorem comp [FormallyEtale R A] [FormallyEtale A B] : FormallyEtale R B :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.comp R A B, FormallySmooth.comp R A B⟩
 #align algebra.formally_etale.comp Algebra.FormallyEtale.comp
@@ -107,7 +118,7 @@ variable {R : Type u} [CommSemiring R]
 variable {A : Type u} [Semiring A] [Algebra R A]
 variable (B : Type u) [CommSemiring B] [Algebra R B]
 
-instance FormallyEtale.base_change [FormallyEtale R A] : FormallyEtale B (B ⊗[R] A) :=
+instance base_change [FormallyEtale R A] : FormallyEtale B (B ⊗[R] A) :=
   FormallyEtale.iff_unramified_and_smooth.mpr ⟨inferInstance, inferInstance⟩
 #align algebra.formally_etale.base_change Algebra.FormallyEtale.base_change
 
@@ -124,17 +135,17 @@ variable [IsLocalization M Rₘ] [IsLocalization (M.map (algebraMap R S)) Sₘ]
 -- Porting note: no longer supported
 -- attribute [local elab_as_elim] Ideal.IsNilpotent.induction_on
 
-theorem FormallyEtale.of_isLocalization : FormallyEtale R Rₘ :=
+theorem of_isLocalization : FormallyEtale R Rₘ :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.of_isLocalization M, FormallySmooth.of_isLocalization M⟩
 #align algebra.formally_etale.of_is_localization Algebra.FormallyEtale.of_isLocalization
 
-theorem FormallyEtale.localization_base [FormallyEtale R Sₘ] : FormallyEtale Rₘ Sₘ :=
+theorem localization_base [FormallyEtale R Sₘ] : FormallyEtale Rₘ Sₘ :=
   FormallyEtale.iff_unramified_and_smooth.mpr
     ⟨FormallyUnramified.localization_base M, FormallySmooth.localization_base M⟩
 #align algebra.formally_etale.localization_base Algebra.FormallyEtale.localization_base
 
-theorem FormallyEtale.localization_map [FormallyEtale R S] : FormallyEtale Rₘ Sₘ := by
+theorem localization_map [FormallyEtale R S] : FormallyEtale Rₘ Sₘ := by
   haveI : FormallyEtale S Sₘ := FormallyEtale.of_isLocalization (M.map (algebraMap R S))
   haveI : FormallyEtale R Sₘ := FormallyEtale.comp R S Sₘ
   exact FormallyEtale.localization_base M
@@ -142,4 +153,49 @@ theorem FormallyEtale.localization_map [FormallyEtale R S] : FormallyEtale Rₘ
 
 end Localization
 
+end FormallyEtale
+
+section
+
+variable (R : Type u) [CommSemiring R]
+variable (A : Type u) [Semiring A] [Algebra R A]
+
+/-- An `R`-algebra `A` is étale if it is formally étale and of finite presentation. -/
+class Etale : Prop where
+  formallyEtale : FormallyEtale R A := by infer_instance
+  finitePresentation : FinitePresentation R A := by infer_instance
+
+end
+
+namespace Etale
+
+attribute [instance] formallyEtale finitePresentation
+
+variable {R : Type u} [CommRing R]
+variable {A B : Type u} [CommRing A] [Algebra R A] [CommRing B] [Algebra R B]
+
+/-- Being étale is transported via algebra isomorphisms. -/
+theorem of_equiv [Etale R A] (e : A ≃ₐ[R] B) : Etale R B where
+  formallyEtale := FormallyEtale.of_equiv e
+  finitePresentation := FinitePresentation.equiv e
+
+section Comp
+
+variable (R A B)
+variable [Algebra A B] [IsScalarTower R A B]
+
+/-- Étale is stable under composition. -/
+theorem comp [Etale R A] [Etale A B] : Etale R B where
+  formallyEtale := FormallyEtale.comp R A B
+  finitePresentation := FinitePresentation.trans R A B
+
+end Comp
+
+/-- Localization at an element is étale. -/
+theorem of_isLocalization_Away (r : R) [IsLocalization.Away r A] : Etale R A where
+  formallyEtale := Algebra.FormallyEtale.of_isLocalization (Submonoid.powers r)
+  finitePresentation := IsLocalization.Away.finitePresentation r
+
+end Etale
+
 end Algebra
chore(RingTheory/Unramified): move differential properties (#12030)
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathlib.RingTheory.Kaehler
 import Mathlib.RingTheory.QuotientNilpotent
+import Mathlib.RingTheory.TensorProduct.Basic
 
 #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
 
@@ -214,39 +214,4 @@ theorem FormallyUnramified.localization_map [FormallyUnramified R S] :
 
 end Localization
 
-section UnramifiedDerivation
-
-open scoped TensorProduct
-
-variable {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
-
-instance FormallyUnramified.subsingleton_kaehlerDifferential [FormallyUnramified R S] :
-    Subsingleton (Ω[S⁄R]) := by
-  rw [← not_nontrivial_iff_subsingleton]
-  intro h
-  obtain ⟨f₁, f₂, e⟩ := (KaehlerDifferential.endEquiv R S).injective.nontrivial
-  apply e
-  ext1
-  apply FormallyUnramified.lift_unique' _ _ _ _ (f₁.2.trans f₂.2.symm)
-  rw [← AlgHom.toRingHom_eq_coe, AlgHom.ker_kerSquareLift]
-  exact ⟨_, Ideal.cotangentIdeal_square _⟩
-#align algebra.formally_unramified.subsingleton_kaehler_differential Algebra.FormallyUnramified.subsingleton_kaehlerDifferential
-
-theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
-    FormallyUnramified R S ↔ Subsingleton (Ω[S⁄R]) := by
-  constructor
-  · intros; infer_instance
-  · intro H
-    constructor
-    intro B _ _ I hI f₁ f₂ e
-    letI := f₁.toRingHom.toAlgebra
-    haveI := IsScalarTower.of_algebraMap_eq' f₁.comp_algebraMap.symm
-    have :=
-      ((KaehlerDifferential.linearMapEquivDerivation R S).toEquiv.trans
-            (derivationToSquareZeroEquivLift I hI)).surjective.subsingleton
-    exact Subtype.ext_iff.mp (@Subsingleton.elim _ this ⟨f₁, rfl⟩ ⟨f₂, e.symm⟩)
-#align algebra.formally_unramified.iff_subsingleton_kaehler_differential Algebra.FormallyUnramified.iff_subsingleton_kaehlerDifferential
-
-end UnramifiedDerivation
-
 end Algebra
chore(RingTheory/Unramified): move differential properties (#12030)
Diff
@@ -3,7 +3,6 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathlib.RingTheory.Kaehler
 import Mathlib.RingTheory.QuotientNilpotent
 import Mathlib.RingTheory.Smooth.Basic
 import Mathlib.RingTheory.Unramified.Basic
chore(RingTheory/Etale): split in multiple folders and files (#12017)

Splits RingTheory/Etale.lean into 3 new separate folders for étale (resp. unramified, resp. smooth) morphisms.

chore(RingTheory/Etale): split in multiple folders and files (#12017)

Splits RingTheory/Etale.lean into 3 new separate folders for étale (resp. unramified, resp. smooth) morphisms.

Diff
@@ -3,22 +3,27 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
+import Mathlib.RingTheory.Ideal.Cotangent
 import Mathlib.RingTheory.QuotientNilpotent
-import Mathlib.RingTheory.Kaehler
+import Mathlib.RingTheory.TensorProduct.Basic
 
 #align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
 
 /-!
 
-# Formally étale morphisms
+# Smooth morphisms
 
-An `R`-algebra `A` is formally étale (resp. unramified, smooth) if for every `R`-algebra,
+An `R`-algebra `A` is formally smooth if for every `R`-algebra,
 every square-zero ideal `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists
-exactly (resp. at most, at least) one lift `A →ₐ[R] B`.
+at least one lift `A →ₐ[R] B`.
 
 We show that the property extends onto nilpotent ideals, and that these properties are stable
 under `R`-algebra homomorphisms and compositions.
 
+## TODO:
+
+- Define smooth morphisms
+
 -/
 
 
@@ -35,16 +40,6 @@ variable (R : Type u) [CommSemiring R]
 variable (A : Type u) [Semiring A] [Algebra R A]
 variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
-/-- An `R`-algebra `A` is formally unramified if for every `R`-algebra, every square-zero ideal
-`I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at most one lift `A →ₐ[R] B`. -/
-@[mk_iff]
-class FormallyUnramified : Prop where
-  comp_injective :
-    ∀ ⦃B : Type u⦄ [CommRing B],
-      ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥),
-        Function.Injective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
-#align algebra.formally_unramified Algebra.FormallyUnramified
-
 /-- An `R` algebra `A` is formally smooth if for every `R`-algebra, every square-zero ideal
 `I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists at least one lift `A →ₐ[R] B`. -/
 @[mk_iff]
@@ -55,83 +50,8 @@ class FormallySmooth : Prop where
         Function.Surjective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
 #align algebra.formally_smooth Algebra.FormallySmooth
 
-/-- An `R` algebra `A` is formally étale if for every `R`-algebra, every square-zero ideal
-`I : Ideal B` and `f : A →ₐ[R] B ⧸ I`, there exists exactly one lift `A →ₐ[R] B`. -/
-@[mk_iff]
-class FormallyEtale : Prop where
-  comp_bijective :
-    ∀ ⦃B : Type u⦄ [CommRing B],
-      ∀ [Algebra R B] (I : Ideal B) (_ : I ^ 2 = ⊥),
-        Function.Bijective ((Ideal.Quotient.mkₐ R I).comp : (A →ₐ[R] B) → A →ₐ[R] B ⧸ I)
-#align algebra.formally_etale Algebra.FormallyEtale
-
 variable {R A}
 
-theorem FormallyEtale.iff_unramified_and_smooth :
-    FormallyEtale R A ↔ FormallyUnramified R A ∧ FormallySmooth R A := by
-  rw [formallyUnramified_iff, formallySmooth_iff, formallyEtale_iff]
-  simp_rw [← forall_and, Function.Bijective]
-#align algebra.formally_etale.iff_unramified_and_smooth Algebra.FormallyEtale.iff_unramified_and_smooth
-
-instance (priority := 100) FormallyEtale.to_unramified [h : FormallyEtale R A] :
-    FormallyUnramified R A :=
-  (FormallyEtale.iff_unramified_and_smooth.mp h).1
-#align algebra.formally_etale.to_unramified Algebra.FormallyEtale.to_unramified
-
-instance (priority := 100) FormallyEtale.to_smooth [h : FormallyEtale R A] : FormallySmooth R A :=
-  (FormallyEtale.iff_unramified_and_smooth.mp h).2
-#align algebra.formally_etale.to_smooth Algebra.FormallyEtale.to_smooth
-
-theorem FormallyEtale.of_unramified_and_smooth [h₁ : FormallyUnramified R A]
-    [h₂ : FormallySmooth R A] : FormallyEtale R A :=
-  FormallyEtale.iff_unramified_and_smooth.mpr ⟨h₁, h₂⟩
-#align algebra.formally_etale.of_unramified_and_smooth Algebra.FormallyEtale.of_unramified_and_smooth
-
-theorem FormallyUnramified.lift_unique {B : Type u} [CommRing B] [_RB : Algebra R B]
-    [FormallyUnramified R A] (I : Ideal B) (hI : IsNilpotent I) (g₁ g₂ : A →ₐ[R] B)
-    (h : (Ideal.Quotient.mkₐ R I).comp g₁ = (Ideal.Quotient.mkₐ R I).comp g₂) : g₁ = g₂ := by
-  revert g₁ g₂
-  change Function.Injective (Ideal.Quotient.mkₐ R I).comp
-  revert _RB
-  apply Ideal.IsNilpotent.induction_on (R := B) I hI
-  · intro B _ I hI _; exact FormallyUnramified.comp_injective I hI
-  · intro B _ I J hIJ h₁ h₂ _ g₁ g₂ e
-    apply h₁
-    apply h₂
-    ext x
-    replace e := AlgHom.congr_fun e x
-    dsimp only [AlgHom.comp_apply, Ideal.Quotient.mkₐ_eq_mk] at e ⊢
-    rwa [Ideal.Quotient.eq, ← map_sub, Ideal.mem_quotient_iff_mem hIJ, ← Ideal.Quotient.eq]
-#align algebra.formally_unramified.lift_unique Algebra.FormallyUnramified.lift_unique
-
-theorem FormallyUnramified.ext [FormallyUnramified R A] (hI : IsNilpotent I) {g₁ g₂ : A →ₐ[R] B}
-    (H : ∀ x, Ideal.Quotient.mk I (g₁ x) = Ideal.Quotient.mk I (g₂ x)) : g₁ = g₂ :=
-  FormallyUnramified.lift_unique I hI g₁ g₂ (AlgHom.ext H)
-#align algebra.formally_unramified.ext Algebra.FormallyUnramified.ext
-
-theorem FormallyUnramified.lift_unique_of_ringHom [FormallyUnramified R A] {C : Type u} [CommRing C]
-    (f : B →+* C) (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B)
-    (h : f.comp ↑g₁ = f.comp (g₂ : A →+* B)) : g₁ = g₂ :=
-  FormallyUnramified.lift_unique _ hf _ _
-    (by
-      ext x
-      have := RingHom.congr_fun h x
-      simpa only [Ideal.Quotient.eq, Function.comp_apply, AlgHom.coe_comp, Ideal.Quotient.mkₐ_eq_mk,
-        RingHom.mem_ker, map_sub, sub_eq_zero])
-#align algebra.formally_unramified.lift_unique_of_ring_hom Algebra.FormallyUnramified.lift_unique_of_ringHom
-
-theorem FormallyUnramified.ext' [FormallyUnramified R A] {C : Type u} [CommRing C] (f : B →+* C)
-    (hf : IsNilpotent <| RingHom.ker f) (g₁ g₂ : A →ₐ[R] B) (h : ∀ x, f (g₁ x) = f (g₂ x)) :
-    g₁ = g₂ :=
-  FormallyUnramified.lift_unique_of_ringHom f hf g₁ g₂ (RingHom.ext h)
-#align algebra.formally_unramified.ext' Algebra.FormallyUnramified.ext'
-
-theorem FormallyUnramified.lift_unique' [FormallyUnramified R A] {C : Type u} [CommRing C]
-    [Algebra R C] (f : B →ₐ[R] C) (hf : IsNilpotent <| RingHom.ker (f : B →+* C))
-    (g₁ g₂ : A →ₐ[R] B) (h : f.comp g₁ = f.comp g₂) : g₁ = g₂ :=
-  FormallyUnramified.ext' _ hf g₁ g₂ (AlgHom.congr_fun h)
-#align algebra.formally_unramified.lift_unique' Algebra.FormallyUnramified.lift_unique'
-
 theorem FormallySmooth.exists_lift {B : Type u} [CommRing B] [_RB : Algebra R B]
     [FormallySmooth R A] (I : Ideal B) (hI : IsNilpotent I) (g : A →ₐ[R] B ⧸ I) :
     ∃ f : A →ₐ[R] B, (Ideal.Quotient.mkₐ R I).comp f = g := by
@@ -220,21 +140,6 @@ theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : Forma
     AlgHom.comp_id]
 #align algebra.formally_smooth.of_equiv Algebra.FormallySmooth.of_equiv
 
-theorem FormallyUnramified.of_equiv [FormallyUnramified R A] (e : A ≃ₐ[R] B) :
-    FormallyUnramified R B := by
-  constructor
-  intro C _ _ I hI f₁ f₂ e'
-  rw [← f₁.comp_id, ← f₂.comp_id, ← e.comp_symm, ← AlgHom.comp_assoc, ← AlgHom.comp_assoc]
-  congr 1
-  refine' FormallyUnramified.comp_injective I hI _
-  rw [← AlgHom.comp_assoc, e', AlgHom.comp_assoc]
-#align algebra.formally_unramified.of_equiv Algebra.FormallyUnramified.of_equiv
-
-theorem FormallyEtale.of_equiv [FormallyEtale R A] (e : A ≃ₐ[R] B) : FormallyEtale R B :=
-  FormallyEtale.iff_unramified_and_smooth.mpr
-    ⟨FormallyUnramified.of_equiv e, FormallySmooth.of_equiv e⟩
-#align algebra.formally_etale.of_equiv Algebra.FormallyEtale.of_equiv
-
 end OfEquiv
 
 section Polynomial
@@ -278,38 +183,6 @@ theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : Formally
   exact ⟨f''.restrictScalars _, e'.trans (AlgHom.ext fun _ => rfl)⟩
 #align algebra.formally_smooth.comp Algebra.FormallySmooth.comp
 
-theorem FormallyUnramified.comp [FormallyUnramified R A] [FormallyUnramified A B] :
-    FormallyUnramified R B := by
-  constructor
-  intro C _ _ I hI f₁ f₂ e
-  have e' :=
-    FormallyUnramified.lift_unique I ⟨2, hI⟩ (f₁.comp <| IsScalarTower.toAlgHom R A B)
-      (f₂.comp <| IsScalarTower.toAlgHom R A B) (by rw [← AlgHom.comp_assoc, e, AlgHom.comp_assoc])
-  letI := (f₁.comp (IsScalarTower.toAlgHom R A B)).toRingHom.toAlgebra
-  let F₁ : B →ₐ[A] C := { f₁ with commutes' := fun r => rfl }
-  let F₂ : B →ₐ[A] C := { f₂ with commutes' := AlgHom.congr_fun e'.symm }
-  ext1 x
-  change F₁ x = F₂ x
-  congr
-  exact FormallyUnramified.ext I ⟨2, hI⟩ (AlgHom.congr_fun e)
-#align algebra.formally_unramified.comp Algebra.FormallyUnramified.comp
-
-theorem FormallyUnramified.of_comp [FormallyUnramified R B] : FormallyUnramified A B := by
-  constructor
-  intro Q _ _ I e f₁ f₂ e'
-  letI := ((algebraMap A Q).comp (algebraMap R A)).toAlgebra
-  letI : IsScalarTower R A Q := IsScalarTower.of_algebraMap_eq' rfl
-  refine' AlgHom.restrictScalars_injective R _
-  refine' FormallyUnramified.ext I ⟨2, e⟩ _
-  intro x
-  exact AlgHom.congr_fun e' x
-#align algebra.formally_unramified.of_comp Algebra.FormallyUnramified.of_comp
-
-theorem FormallyEtale.comp [FormallyEtale R A] [FormallyEtale A B] : FormallyEtale R B :=
-  FormallyEtale.iff_unramified_and_smooth.mpr
-    ⟨FormallyUnramified.comp R A B, FormallySmooth.comp R A B⟩
-#align algebra.formally_etale.comp Algebra.FormallyEtale.comp
-
 end Comp
 
 section OfSurjective
@@ -385,33 +258,6 @@ open scoped TensorProduct
 
 variable {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
 
-instance FormallyUnramified.subsingleton_kaehlerDifferential [FormallyUnramified R S] :
-    Subsingleton (Ω[S⁄R]) := by
-  rw [← not_nontrivial_iff_subsingleton]
-  intro h
-  obtain ⟨f₁, f₂, e⟩ := (KaehlerDifferential.endEquiv R S).injective.nontrivial
-  apply e
-  ext1
-  apply FormallyUnramified.lift_unique' _ _ _ _ (f₁.2.trans f₂.2.symm)
-  rw [← AlgHom.toRingHom_eq_coe, AlgHom.ker_kerSquareLift]
-  exact ⟨_, Ideal.cotangentIdeal_square _⟩
-#align algebra.formally_unramified.subsingleton_kaehler_differential Algebra.FormallyUnramified.subsingleton_kaehlerDifferential
-
-theorem FormallyUnramified.iff_subsingleton_kaehlerDifferential :
-    FormallyUnramified R S ↔ Subsingleton (Ω[S⁄R]) := by
-  constructor
-  · intros; infer_instance
-  · intro H
-    constructor
-    intro B _ _ I hI f₁ f₂ e
-    letI := f₁.toRingHom.toAlgebra
-    haveI := IsScalarTower.of_algebraMap_eq' f₁.comp_algebraMap.symm
-    have :=
-      ((KaehlerDifferential.linearMapEquivDerivation R S).toEquiv.trans
-            (derivationToSquareZeroEquivLift I hI)).surjective.subsingleton
-    exact Subtype.ext_iff.mp (@Subsingleton.elim _ this ⟨f₁, rfl⟩ ⟨f₂, e.symm⟩)
-#align algebra.formally_unramified.iff_subsingleton_kaehler_differential Algebra.FormallyUnramified.iff_subsingleton_kaehlerDifferential
-
 end UnramifiedDerivation
 
 section BaseChange
@@ -422,17 +268,6 @@ variable {R : Type u} [CommSemiring R]
 variable {A : Type u} [Semiring A] [Algebra R A]
 variable (B : Type u) [CommSemiring B] [Algebra R B]
 
-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 _ _
-  · exact FormallyUnramified.ext I ⟨2, hI⟩ fun x => AlgHom.congr_fun e (1 ⊗ₜ x)
-#align algebra.formally_unramified.base_change Algebra.FormallyUnramified.base_change
-
 instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
   constructor
   intro C _ _ I hI f
@@ -447,10 +282,6 @@ instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B 
     rw [← Algebra.smul_def, ← map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one]
 #align algebra.formally_smooth.base_change Algebra.FormallySmooth.base_change
 
-instance FormallyEtale.base_change [FormallyEtale R A] : FormallyEtale B (B ⊗[R] A) :=
-  FormallyEtale.iff_unramified_and_smooth.mpr ⟨inferInstance, inferInstance⟩
-#align algebra.formally_etale.base_change Algebra.FormallyEtale.base_change
-
 end BaseChange
 
 section Localization
@@ -481,21 +312,6 @@ theorem FormallySmooth.of_isLocalization : FormallySmooth R Rₘ := by
   simp
 #align algebra.formally_smooth.of_is_localization Algebra.FormallySmooth.of_isLocalization
 
-/-- 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
-  simp
-#align algebra.formally_unramified.of_is_localization Algebra.FormallyUnramified.of_isLocalization
-
-theorem FormallyEtale.of_isLocalization : FormallyEtale R Rₘ :=
-  FormallyEtale.iff_unramified_and_smooth.mpr
-    ⟨FormallyUnramified.of_isLocalization M, FormallySmooth.of_isLocalization M⟩
-#align algebra.formally_etale.of_is_localization Algebra.FormallyEtale.of_isLocalization
-
 theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmooth Rₘ Sₘ := by
   constructor
   intro Q _ _ I e f
@@ -518,43 +334,12 @@ theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmoot
   simp [f]
 #align algebra.formally_smooth.localization_base Algebra.FormallySmooth.localization_base
 
-/-- This actually does not need the localization instance, and is stated here again for
-consistency. See `Algebra.FormallyUnramified.of_comp` instead.
-
- The intended use is for copying proofs between `Formally{Unramified, Smooth, Etale}`
- without the need to change anything (including removing redundant arguments). -/
--- @[nolint unusedArguments] -- Porting note: removed
-theorem FormallyUnramified.localization_base [FormallyUnramified R Sₘ] : FormallyUnramified Rₘ Sₘ :=
-  -- Porting note: added
-  let _ := M
-  FormallyUnramified.of_comp R Rₘ Sₘ
-#align algebra.formally_unramified.localization_base Algebra.FormallyUnramified.localization_base
-
-theorem FormallyEtale.localization_base [FormallyEtale R Sₘ] : FormallyEtale Rₘ Sₘ :=
-  FormallyEtale.iff_unramified_and_smooth.mpr
-    ⟨FormallyUnramified.localization_base M, FormallySmooth.localization_base M⟩
-#align algebra.formally_etale.localization_base Algebra.FormallyEtale.localization_base
-
 theorem FormallySmooth.localization_map [FormallySmooth R S] : FormallySmooth Rₘ Sₘ := by
   haveI : FormallySmooth S Sₘ := FormallySmooth.of_isLocalization (M.map (algebraMap R S))
   haveI : FormallySmooth R Sₘ := FormallySmooth.comp R S Sₘ
   exact FormallySmooth.localization_base M
 #align algebra.formally_smooth.localization_map Algebra.FormallySmooth.localization_map
 
-theorem FormallyUnramified.localization_map [FormallyUnramified R S] :
-    FormallyUnramified Rₘ Sₘ := by
-  haveI : FormallyUnramified S Sₘ :=
-    FormallyUnramified.of_isLocalization (M.map (algebraMap R S))
-  haveI : FormallyUnramified R Sₘ := FormallyUnramified.comp R S Sₘ
-  exact FormallyUnramified.localization_base M
-#align algebra.formally_unramified.localization_map Algebra.FormallyUnramified.localization_map
-
-theorem FormallyEtale.localization_map [FormallyEtale R S] : FormallyEtale Rₘ Sₘ := by
-  haveI : FormallyEtale S Sₘ := FormallyEtale.of_isLocalization (M.map (algebraMap R S))
-  haveI : FormallyEtale R Sₘ := FormallyEtale.comp R S Sₘ
-  exact FormallyEtale.localization_base M
-#align algebra.formally_etale.localization_map Algebra.FormallyEtale.localization_map
-
 end Localization
 
 end Algebra
chore(RingTheory/Etale): split in multiple folders and files (#12017)

Splits RingTheory/Etale.lean into 3 new separate folders for étale (resp. unramified, resp. smooth) morphisms.

chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -32,9 +32,7 @@ namespace Algebra
 section
 
 variable (R : Type u) [CommSemiring R]
-
 variable (A : Type u) [Semiring A] [Algebra R A]
-
 variable {B : Type u} [CommRing B] [Algebra R B] (I : Ideal B)
 
 /-- An `R`-algebra `A` is formally unramified if for every `R`-algebra, every square-zero ideal
@@ -212,7 +210,6 @@ end
 section OfEquiv
 
 variable {R : Type u} [CommSemiring R]
-
 variable {A B : Type u} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
 
 theorem FormallySmooth.of_equiv [FormallySmooth R A] (e : A ≃ₐ[R] B) : FormallySmooth R B := by
@@ -267,9 +264,7 @@ end Polynomial
 section Comp
 
 variable (R : Type u) [CommSemiring R]
-
 variable (A : Type u) [CommSemiring A] [Algebra R A]
-
 variable (B : Type u) [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
 
 theorem FormallySmooth.comp [FormallySmooth R A] [FormallySmooth A B] : FormallySmooth R B := by
@@ -320,9 +315,7 @@ end Comp
 section OfSurjective
 
 variable {R S : Type u} [CommRing R] [CommSemiring S]
-
 variable {P A : Type u} [CommRing A] [Algebra R A] [CommRing P] [Algebra R P]
-
 variable (I : Ideal P) (f : P →ₐ[R] A) (hf : Function.Surjective f)
 
 theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ (RingHom.ker f.toRingHom) ^ 2)
@@ -426,9 +419,7 @@ section BaseChange
 open scoped TensorProduct
 
 variable {R : Type u} [CommSemiring R]
-
 variable {A : Type u} [Semiring A] [Algebra R A]
-
 variable (B : Type u) [CommSemiring B] [Algebra R B]
 
 instance FormallyUnramified.base_change [FormallyUnramified R A] :
@@ -465,13 +456,9 @@ end BaseChange
 section Localization
 
 variable {R S Rₘ Sₘ : Type u} [CommRing R] [CommRing S] [CommRing Rₘ] [CommRing Sₘ]
-
 variable (M : Submonoid R)
-
 variable [Algebra R S] [Algebra R Sₘ] [Algebra S Sₘ] [Algebra R Rₘ] [Algebra Rₘ Sₘ]
-
 variable [IsScalarTower R Rₘ Sₘ] [IsScalarTower R S Sₘ]
-
 variable [IsLocalization M Rₘ] [IsLocalization (M.map (algebraMap R S)) Sₘ]
 
 -- Porting note: no longer supported
chore: fix simp issues around Ideal.quotientKerAlgEquivOfRightInverse (#11014)

Several simp lemmas were poorly named and not in simp normal form.

Diff
@@ -196,9 +196,8 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
   erw [← FormallySmooth.mk_lift _ hg'
     ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
-  rw [AlgEquiv.apply_symm_apply, Ideal.quotientKerAlgEquivOfSurjective,
-    Ideal.quotientKerAlgEquivOfRightInverse.apply]
-  exact (Ideal.kerLiftAlg_mk _ _).symm
+  simp only [liftOfSurjective, AlgEquiv.apply_symm_apply, AlgEquiv.toAlgHom_eq_coe,
+    Ideal.quotientKerAlgEquivOfSurjective_apply, RingHom.kerLift_mk, RingHom.coe_coe]
 #align algebra.formally_smooth.lift_of_surjective_apply Algebra.FormallySmooth.liftOfSurjective_apply
 
 @[simp]
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -529,7 +529,7 @@ theorem FormallySmooth.localization_base [FormallySmooth R Sₘ] : FormallySmoot
       AlgHom.comp_algebraMap]
   use f
   ext
-  simp
+  simp [f]
 #align algebra.formally_smooth.localization_base Algebra.FormallySmooth.localization_base
 
 /-- This actually does not need the localization instance, and is stated here again for
refactor: decapitalize names in @[mk_iff] (#9378)
  • @[mk_iff] class MyPred now generates myPred_iff, not MyPred_iff
  • add Lean.Name.decapitalize
  • fix indentation and a few typos in the docs/comments.

Partially addresses issue #9129

Diff
@@ -71,9 +71,8 @@ variable {R A}
 
 theorem FormallyEtale.iff_unramified_and_smooth :
     FormallyEtale R A ↔ FormallyUnramified R A ∧ FormallySmooth R A := by
-  rw [FormallyUnramified_iff, FormallySmooth_iff, FormallyEtale_iff]
-  simp_rw [← forall_and]
-  rfl
+  rw [formallyUnramified_iff, formallySmooth_iff, formallyEtale_iff]
+  simp_rw [← forall_and, Function.Bijective]
 #align algebra.formally_etale.iff_unramified_and_smooth Algebra.FormallyEtale.iff_unramified_and_smooth
 
 instance (priority := 100) FormallyEtale.to_unramified [h : FormallyEtale R A] :
chore: Rename pow monotonicity lemmas (#9095)

The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.

Renames

Algebra.GroupPower.Order

  • pow_monopow_right_mono
  • pow_le_powpow_le_pow_right
  • pow_le_pow_of_le_leftpow_le_pow_left
  • pow_lt_pow_of_lt_leftpow_lt_pow_left
  • strictMonoOn_powpow_left_strictMonoOn
  • pow_strictMono_rightpow_right_strictMono
  • pow_lt_powpow_lt_pow_right
  • pow_lt_pow_iffpow_lt_pow_iff_right
  • pow_le_pow_iffpow_le_pow_iff_right
  • self_lt_powlt_self_pow
  • strictAnti_powpow_right_strictAnti
  • pow_lt_pow_iff_of_lt_onepow_lt_pow_iff_right_of_lt_one
  • pow_lt_pow_of_lt_onepow_lt_pow_right_of_lt_one
  • lt_of_pow_lt_powlt_of_pow_lt_pow_left
  • le_of_pow_le_powle_of_pow_le_pow_left
  • pow_lt_pow₀pow_lt_pow_right₀

Algebra.GroupPower.CovariantClass

  • pow_le_pow_of_le_left'pow_le_pow_left'
  • nsmul_le_nsmul_of_le_rightnsmul_le_nsmul_right
  • pow_lt_pow'pow_lt_pow_right'
  • nsmul_lt_nsmulnsmul_lt_nsmul_left
  • pow_strictMono_leftpow_right_strictMono'
  • nsmul_strictMono_rightnsmul_left_strictMono
  • StrictMono.pow_right'StrictMono.pow_const
  • StrictMono.nsmul_leftStrictMono.const_nsmul
  • pow_strictMono_right'pow_left_strictMono
  • nsmul_strictMono_leftnsmul_right_strictMono
  • Monotone.pow_rightMonotone.pow_const
  • Monotone.nsmul_leftMonotone.const_nsmul
  • lt_of_pow_lt_pow'lt_of_pow_lt_pow_left'
  • lt_of_nsmul_lt_nsmullt_of_nsmul_lt_nsmul_right
  • pow_le_pow'pow_le_pow_right'
  • nsmul_le_nsmulnsmul_le_nsmul_left
  • pow_le_pow_of_le_one'pow_le_pow_right_of_le_one'
  • nsmul_le_nsmul_of_nonposnsmul_le_nsmul_left_of_nonpos
  • le_of_pow_le_pow'le_of_pow_le_pow_left'
  • le_of_nsmul_le_nsmul'le_of_nsmul_le_nsmul_right'
  • pow_le_pow_iff'pow_le_pow_iff_right'
  • nsmul_le_nsmul_iffnsmul_le_nsmul_iff_left
  • pow_lt_pow_iff'pow_lt_pow_iff_right'
  • nsmul_lt_nsmul_iffnsmul_lt_nsmul_iff_left

Data.Nat.Pow

  • Nat.pow_lt_pow_of_lt_leftNat.pow_lt_pow_left
  • Nat.pow_le_iff_le_leftNat.pow_le_pow_iff_left
  • Nat.pow_lt_iff_lt_leftNat.pow_lt_pow_iff_left

Lemmas added

  • pow_le_pow_iff_left
  • pow_lt_pow_iff_left
  • pow_right_injective
  • pow_right_inj
  • Nat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.
  • Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.

Lemmas removed

  • self_le_pow was a duplicate of le_self_pow.
  • Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.
  • Nat.pow_right_strictMono is defeq to pow_right_strictMono.
  • Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.
  • Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -338,7 +338,7 @@ theorem FormallySmooth.of_split [FormallySmooth R P] (g : A →ₐ[R] P ⧸ (Rin
       have : _ = i (f x) := (FormallySmooth.mk_lift I ⟨2, hI⟩ (i.comp f) x : _)
       rwa [hx, map_zero, ← Ideal.Quotient.mk_eq_mk, Submodule.Quotient.mk_eq_zero] at this
     intro x hx
-    have := (Ideal.pow_mono this 2).trans (Ideal.le_comap_pow _ 2) hx
+    have := (Ideal.pow_right_mono this 2).trans (Ideal.le_comap_pow _ 2) hx
     rwa [hI] at this
   have : i.comp f.kerSquareLift = (Ideal.Quotient.mkₐ R _).comp l := by
     apply AlgHom.coe_ringHom_injective
refactor: replace some [@foo](https://github.com/foo) _ _ _ _ _ ... by named arguments (#8702)

Using Lean4's named arguments, we manage to remove a few hard-to-read explicit function calls [@foo](https://github.com/foo) _ _ _ _ _ ... which used to be necessary in Lean3.

Occasionally, this results in slightly longer code. The benefit of named arguments is readability, as well as to reduce the brittleness of the code when the argument order is changed.

Co-authored-by: Michael Rothgang <rothgami@math.hu-berlin.de>

Diff
@@ -261,9 +261,7 @@ instance FormallySmooth.mvPolynomial (σ : Type u) : FormallySmooth R (MvPolynom
 #align algebra.formally_smooth.mv_polynomial Algebra.FormallySmooth.mvPolynomial
 
 instance FormallySmooth.polynomial : FormallySmooth R R[X] :=
-  -- Porting note: this needed more underscores than in lean3.
-  @FormallySmooth.of_equiv _ _ _ _ _ _ _ _ (FormallySmooth.mvPolynomial R PUnit)
-    (MvPolynomial.pUnitAlgEquiv R)
+  FormallySmooth.of_equiv (MvPolynomial.pUnitAlgEquiv R)
 #align algebra.formally_smooth.polynomial Algebra.FormallySmooth.polynomial
 
 end Polynomial
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -193,7 +193,8 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
     g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
   change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-  rw [← FormallySmooth.mk_lift _ hg'
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [← FormallySmooth.mk_lift _ hg'
     ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
   rw [AlgEquiv.apply_symm_apply, Ideal.quotientKerAlgEquivOfSurjective,
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -193,8 +193,7 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
     g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
   change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-  erw [← FormallySmooth.mk_lift _ hg'
+  rw [← FormallySmooth.mk_lift _ hg'
     ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
   rw [AlgEquiv.apply_symm_apply, Ideal.quotientKerAlgEquivOfSurjective,
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -193,7 +193,8 @@ theorem FormallySmooth.liftOfSurjective_apply [FormallySmooth R A] (f : A →ₐ
     g (FormallySmooth.liftOfSurjective f g hg hg' x) = f x := by
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).symm.injective
   change _ = ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f) x
-  rw [← FormallySmooth.mk_lift _ hg'
+  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+  erw [← FormallySmooth.mk_lift _ hg'
     ((Ideal.quotientKerAlgEquivOfSurjective hg).symm.toAlgHom.comp f)]
   apply (Ideal.quotientKerAlgEquivOfSurjective hg).injective
   rw [AlgEquiv.apply_symm_apply, Ideal.quotientKerAlgEquivOfSurjective,
feat(RingTheory/TensorProduct): heterogenize (#6417)

This:

  • Improves the module docstring, which was both out of date and not very informative
  • Addresses a TODO to generalize includeLeft to commuting actions. As a result a few downstream results are changed to be about includeLeftRingHom or a ⊗ₜ 1, as carrying around the extra useless ring just makes the lemmas harder to use. Nothing seems to suffer from this change.
  • Introduces TensorProduct.AlgebraTensorModule.rid
  • Generalizes the following to work for towers of rings:
    • Algebra.TensorProduct.algHomOfLinearMapTensorProduct
    • Algebra.TensorProduct.map
    • Algebra.TensorProduct.congr
    • Algebra.TensorProduct.endTensorEndAlgHom
    • Algebra.TensorProduct.ext (and renames it to Algebra.TensorProduct.ext')
    • Algebra.TensorProduct.rid
  • Introduces a new Algebra.TensorProduct.ext which follows "partially-applied ext lemmas", and uses it to golf a proof in RingTheory/Etale.lean

I need many of these results for building AlgEquivs relating to the base change of clifford algebras.

Diff
@@ -440,19 +440,9 @@ instance FormallyUnramified.base_change [FormallyUnramified R A] :
   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
-  apply AlgHom.restrictScalars_injective R
-  apply TensorProduct.ext
-  intro b a
-  have : b ⊗ₜ[R] a = b • (1 : B) ⊗ₜ a := by rw [TensorProduct.smul_tmul', smul_eq_mul, mul_one]
-  rw [this, AlgHom.restrictScalars_apply, AlgHom.restrictScalars_apply, map_smul, map_smul]
-  congr 1
-  change
-    ((f₁.restrictScalars R).comp TensorProduct.includeRight) a =
-      ((f₂.restrictScalars R).comp TensorProduct.includeRight) a
-  congr 1
-  refine' FormallyUnramified.ext I ⟨2, hI⟩ _
-  intro x
-  exact AlgHom.congr_fun e (1 ⊗ₜ x)
+  ext : 1
+  · exact Subsingleton.elim _ _
+  · exact FormallyUnramified.ext I ⟨2, hI⟩ fun x => AlgHom.congr_fun e (1 ⊗ₜ x)
 #align algebra.formally_unramified.base_change Algebra.FormallyUnramified.base_change
 
 instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B ⊗[R] A) := by
@@ -463,7 +453,7 @@ instance FormallySmooth.base_change [FormallySmooth R A] : FormallySmooth B (B 
   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
+    apply TensorProduct.ext'
     intro b a
     suffices algebraMap B _ b * f (1 ⊗ₜ[R] a) = f (b ⊗ₜ[R] a) by simpa [Algebra.ofId_apply]
     rw [← Algebra.smul_def, ← map_smul, TensorProduct.smul_tmul', smul_eq_mul, mul_one]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.etale
-! leanprover-community/mathlib commit 73f96237417835f148a1f7bc1ff55f67119b7166
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.QuotientNilpotent
 import Mathlib.RingTheory.Kaehler
 
+#align_import ring_theory.etale from "leanprover-community/mathlib"@"73f96237417835f148a1f7bc1ff55f67119b7166"
+
 /-!
 
 # Formally étale morphisms
feat: port RingTheory.Etale (#5781)

Co-authored-by: Matthew Ballard <matt@mrb.email>

Dependencies 10 + 627

628 files ported (98.4%)
264319 lines ported (98.7%)
Show graph

The unported dependencies are