ring_theory.local_propertiesMathlib.RingTheory.LocalProperties

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -8,7 +8,7 @@ import RingTheory.Localization.AtPrime
 import RingTheory.Localization.Away.Basic
 import RingTheory.Localization.Integer
 import RingTheory.Localization.Submodule
-import RingTheory.Nilpotent
+import RingTheory.Nilpotent.Defs
 import RingTheory.RingHomProperties
 
 #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"cff8231f04dfa33fd8f2f45792eebd862ef30cad"
Diff
@@ -364,7 +364,7 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
   apply_fun (· * m' ^ n) at hm'
   simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm'
-  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
+  rw [← mul_left_comm, ← pow_succ', ← mul_pow] at hm'
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
   rw [← (IsLocalization.map_units S m).mul_left_inj, hx, MulZeroClass.zero_mul,
     IsLocalization.map_eq_zero_iff M]
Diff
@@ -239,8 +239,8 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
     RingHom.OfLocalizationSpan @P := by
   introv R hs hs'
   skip
-  apply_fun Ideal.map f at hs 
-  rw [Ideal.map_span, Ideal.map_top] at hs 
+  apply_fun Ideal.map f at hs
+  rw [Ideal.map_span, Ideal.map_top] at hs
   apply hP.of_localization_span_target _ _ hs
   rintro ⟨_, r, hr, rfl⟩
   have := hs' ⟨r, hr⟩
@@ -280,10 +280,10 @@ theorem Ideal.le_of_localization_maximal {I J : Ideal R}
   intro P hP le
   obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ :=
     (IsLocalization.mem_map_algebraMap_iff P.prime_compl _).mp (h P hP (Ideal.mem_map_of_mem _ hx))
-  rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq 
+  rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq
   obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.prime_compl _ _).mp Eq
   refine' hs ((hP.is_prime.mem_or_mem (le (ideal.mem_colon_singleton.mpr _))).resolve_right hm)
-  simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq 
+  simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq
   simpa only [mul_assoc, Eq] using J.mul_mem_left m ha
 #align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
 -/
@@ -357,14 +357,14 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   rintro x ⟨_ | n, e⟩
   · simpa using congr_arg (· * x) e
   obtain ⟨⟨y, m⟩, hx⟩ := IsLocalization.surj M x
-  dsimp only at hx 
+  dsimp only at hx
   let hx' := congr_arg (· ^ n.succ) hx
-  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx' 
-  rw [← (algebraMap R S).map_zero] at hx' 
+  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx'
+  rw [← (algebraMap R S).map_zero] at hx'
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
-  apply_fun (· * m' ^ n) at hm' 
-  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm' 
-  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm' 
+  apply_fun (· * m' ^ n) at hm'
+  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm'
+  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
   rw [← (IsLocalization.map_units S m).mul_left_inj, hx, MulZeroClass.zero_mul,
     IsLocalization.map_eq_zero_iff M]
@@ -420,10 +420,10 @@ theorem surjective_ofLocalizationSpan :
   intro r
   obtain ⟨a, e'⟩ := H r (algebraMap _ _ x)
   obtain ⟨b, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.mk'_surjective (Submonoid.powers (r : R)) a
-  erw [IsLocalization.map_mk'] at e' 
-  rw [eq_comm, IsLocalization.eq_mk'_iff_mul_eq, Subtype.coe_mk, Subtype.coe_mk, ← map_mul] at e' 
+  erw [IsLocalization.map_mk'] at e'
+  rw [eq_comm, IsLocalization.eq_mk'_iff_mul_eq, Subtype.coe_mk, Subtype.coe_mk, ← map_mul] at e'
   obtain ⟨⟨_, n', rfl⟩, e''⟩ := (IsLocalization.eq_iff_exists (Submonoid.powers (f r)) _).mp e'
-  rw [Subtype.coe_mk, mul_comm x, ← mul_assoc, ← map_pow, ← map_mul, ← map_mul, ← pow_add] at e'' 
+  rw [Subtype.coe_mk, mul_comm x, ← mul_assoc, ← map_pow, ← map_mul, ← map_mul, ← pow_add] at e''
   exact ⟨n' + n, _, e''.symm⟩
 #align surjective_of_localization_span surjective_ofLocalizationSpan
 -/
@@ -458,7 +458,7 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
   have hy : y ∈ Submodule.span R ↑T := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ Submodule.map fₐ.to_linear_map (Submodule.span R T) :=
     Submodule.mem_map_of_mem hy
-  rw [Submodule.map_span fₐ.to_linear_map T] at hy 
+  rw [Submodule.map_span fₐ.to_linear_map T] at hy
   have H :
     Submodule.span R (algebraMap S S' '' T) ≤
       (Submodule.span R' (algebraMap S S' '' T)).restrictScalars R :=
@@ -504,12 +504,12 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
   obtain ⟨y', hy', e : algebraMap R S y' = y⟩ := y.prop
   have : algebraMap R S y' • (s : Set S') = y' • s := by
     simp_rw [Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]
-  rw [← e, this] at hx₁ 
+  rw [← e, this] at hx₁
   replace hx₁ := congr_arg (Submodule.span R) hx₁
-  rw [Submodule.span_smul] at hx₁ 
+  rw [Submodule.span_smul] at hx₁
   replace hx : _ ∈ y' • Submodule.span R (s : Set S') := Set.smul_mem_smul_set hx
-  rw [hx₁] at hx 
-  erw [← g.map_smul, ← Submodule.map_span (g : S →ₗ[R] S')] at hx 
+  rw [hx₁] at hx
+  erw [← g.map_smul, ← Submodule.map_span (g : S →ₗ[R] S')] at hx
   -- Since `x` falls in the span of `s` in `S'`, `y' • x : S` falls in the span of `s'` in `S'`.
   -- That is, there exists some `x' : S` in the span of `s'` in `S` and `x' = y' • x` in `S'`.
   -- Thus `a • (y' • x) = a • x' ∈ span s'` in `S` for some `a ∈ M`.
@@ -551,7 +551,7 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
   rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
   replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
   simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
-    mul_assoc, ← Algebra.smul_def] at e 
+    mul_assoc, ← Algebra.smul_def] at e
   rcases hs _ hz with ⟨t, ht⟩
   refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
   rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
@@ -567,7 +567,7 @@ theorem multiple_mem_adjoin_of_mem_localization_adjoin [Algebra R' S] [Algebra R
     (hx : x ∈ Algebra.adjoin R' s) : ∃ t : M, t • x ∈ Algebra.adjoin R s :=
   by
   change ∃ t : M, t • x ∈ (Algebra.adjoin R s).toSubmodule
-  change x ∈ (Algebra.adjoin R' s).toSubmodule at hx 
+  change x ∈ (Algebra.adjoin R' s).toSubmodule at hx
   simp_rw [Algebra.adjoin_eq_span] at hx ⊢
   exact multiple_mem_span_of_mem_localization_span M R' _ _ hx
 #align multiple_mem_adjoin_of_mem_localization_adjoin multiple_mem_adjoin_of_mem_localization_adjoin
@@ -609,12 +609,12 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r))) (algebraMap S _ x)
       (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
-    map_mul] at hn₁ 
+    map_mul] at hn₁
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
     IsLocalization.smul_mem_finsetIntegerMultiple_span (Submonoid.powers (r : R))
       (Localization.Away (f r)) _ (s₁ r) hn₁
-  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂ 
-  simp_rw [Submonoid.map_powers] at hn₂ 
+  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
+  simp_rw [Submonoid.map_powers] at hn₂
   use n₂ + n₁
   exact le_iSup (fun x : s => Submodule.span R (sf x : Set S)) r hn₂
 #align finite_of_localization_span finite_ofLocalizationSpan
@@ -645,7 +645,7 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
   have hy : y ∈ Algebra.adjoin R (T : Set S) := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ (Algebra.adjoin R (T : Set S)).map fₐ :=
     subalgebra.mem_map.mpr ⟨_, hy, rfl⟩
-  rw [fₐ.map_adjoin T] at hy 
+  rw [fₐ.map_adjoin T] at hy
   have H :
     Algebra.adjoin R (algebraMap S S' '' T) ≤
       (Algebra.adjoin R' (algebraMap S S' '' T)).restrictScalars R :=
@@ -690,7 +690,7 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
     Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin (y : S) (s : Set S') (A.map g)
       (by rw [hx₁]; exact Set.image_subset _ hA₁) hx (Set.mem_image_of_mem _ (hA₂ y.2))
   obtain ⟨x', hx', hx''⟩ := hn n (le_of_eq rfl)
-  rw [Algebra.smul_def, ← _root_.map_mul] at hx'' 
+  rw [Algebra.smul_def, ← _root_.map_mul] at hx''
   obtain ⟨a, ha₂⟩ := (IsLocalization.eq_iff_exists M S').mp hx''
   use a * y ^ n
   convert A.mul_mem hx' (hA₂ a.prop)
@@ -753,11 +753,11 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r)))
       (algebraMap S (Localization.Away (f r)) x) (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
-    map_mul] at hn₁ 
+    map_mul] at hn₁
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
     IsLocalization.lift_mem_adjoin_finsetIntegerMultiple (Submonoid.powers (r : R)) _ (s₁ r) hn₁
-  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂ 
-  simp_rw [Submonoid.map_powers] at hn₂ 
+  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
+  simp_rw [Submonoid.map_powers] at hn₂
   use n₂ + n₁
   exact le_iSup (fun x : s => Algebra.adjoin R (sf x : Set S)) r hn₂
 #align finite_type_of_localization_span finiteType_ofLocalizationSpan
Diff
@@ -535,7 +535,27 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
 then `t • x ∈ span R s` for some `t : M`.-/
 theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     [IsScalarTower R R' S] [IsLocalization M R'] (s : Set S) (x : S)
-    (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by classical
+    (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by
+  classical
+  obtain ⟨s', hss', hs'⟩ := Submodule.mem_span_finite_of_mem_span hx
+  rsuffices ⟨t, ht⟩ : ∃ t : M, t • x ∈ Submodule.span R (s' : Set S)
+  · exact ⟨t, Submodule.span_mono hss' ht⟩
+  clear hx hss' s
+  revert x
+  apply s'.induction_on
+  · intro x hx; use 1; simpa using hx
+  rintro a s ha hs x hx
+  simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
+    Submodule.mem_span_insert] at hx ⊢
+  rcases hx with ⟨y, z, hz, rfl⟩
+  rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
+  replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
+  simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
+    mul_assoc, ← Algebra.smul_def] at e 
+  rcases hs _ hz with ⟨t, ht⟩
+  refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
+  rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
+  rfl
 #align multiple_mem_span_of_mem_localization_span multiple_mem_span_of_mem_localization_span
 -/
 
Diff
@@ -535,27 +535,7 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
 then `t • x ∈ span R s` for some `t : M`.-/
 theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     [IsScalarTower R R' S] [IsLocalization M R'] (s : Set S) (x : S)
-    (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by
-  classical
-  obtain ⟨s', hss', hs'⟩ := Submodule.mem_span_finite_of_mem_span hx
-  rsuffices ⟨t, ht⟩ : ∃ t : M, t • x ∈ Submodule.span R (s' : Set S)
-  · exact ⟨t, Submodule.span_mono hss' ht⟩
-  clear hx hss' s
-  revert x
-  apply s'.induction_on
-  · intro x hx; use 1; simpa using hx
-  rintro a s ha hs x hx
-  simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
-    Submodule.mem_span_insert] at hx ⊢
-  rcases hx with ⟨y, z, hz, rfl⟩
-  rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
-  replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
-  simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
-    mul_assoc, ← Algebra.smul_def] at e 
-  rcases hs _ hz with ⟨t, ht⟩
-  refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
-  rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
-  rfl
+    (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by classical
 #align multiple_mem_span_of_mem_localization_span multiple_mem_span_of_mem_localization_span
 -/
 
Diff
@@ -3,13 +3,13 @@ Copyright (c) 2021 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.RingTheory.FiniteType
-import Mathbin.RingTheory.Localization.AtPrime
-import Mathbin.RingTheory.Localization.Away.Basic
-import Mathbin.RingTheory.Localization.Integer
-import Mathbin.RingTheory.Localization.Submodule
-import Mathbin.RingTheory.Nilpotent
-import Mathbin.RingTheory.RingHomProperties
+import RingTheory.FiniteType
+import RingTheory.Localization.AtPrime
+import RingTheory.Localization.Away.Basic
+import RingTheory.Localization.Integer
+import RingTheory.Localization.Submodule
+import RingTheory.Nilpotent
+import RingTheory.RingHomProperties
 
 #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"cff8231f04dfa33fd8f2f45792eebd862ef30cad"
 
Diff
@@ -516,7 +516,7 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
   obtain ⟨x', hx', hx'' : algebraMap _ _ _ = _⟩ := hx
   obtain ⟨⟨_, a, ha₁, rfl⟩, ha₂⟩ :=
     (IsLocalization.eq_iff_exists (M.map (algebraMap R S)) S').mp hx''
-  use (⟨a, ha₁⟩ : M) * (⟨y', hy'⟩ : M)
+  use(⟨a, ha₁⟩ : M) * (⟨y', hy'⟩ : M)
   convert
     (Submodule.span R
           (IsLocalization.finsetIntegerMultiple (Submonoid.map (algebraMap R S) M) s :
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 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.local_properties
-! leanprover-community/mathlib commit cff8231f04dfa33fd8f2f45792eebd862ef30cad
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.FiniteType
 import Mathbin.RingTheory.Localization.AtPrime
@@ -16,6 +11,8 @@ import Mathbin.RingTheory.Localization.Submodule
 import Mathbin.RingTheory.Nilpotent
 import Mathbin.RingTheory.RingHomProperties
 
+#align_import ring_theory.local_properties from "leanprover-community/mathlib"@"cff8231f04dfa33fd8f2f45792eebd862ef30cad"
+
 /-!
 # Local properties of commutative rings
 
Diff
@@ -61,19 +61,23 @@ section CommRing
 
 variable (P : ∀ (R : Type u) [CommRing R], Prop)
 
+#print LocalizationPreserves /-
 /-- A property `P` of comm rings is said to be preserved by localization
   if `P` holds for `M⁻¹R` whenever `P` holds for `R`. -/
 def LocalizationPreserves : Prop :=
   ∀ {R : Type u} [hR : CommRing R] (M : Submonoid R) (S : Type u) [hS : CommRing S] [Algebra R S]
     [IsLocalization M S], @P R hR → @P S hS
 #align localization_preserves LocalizationPreserves
+-/
 
+#print OfLocalizationMaximal /-
 /-- A property `P` of comm rings satisfies `of_localization_maximal` if
   if `P` holds for `R` whenever `P` holds for `Rₘ` for all maximal ideal `m`. -/
 def OfLocalizationMaximal : Prop :=
   ∀ (R : Type u) [CommRing R],
     (∀ (J : Ideal R) (hJ : J.IsMaximal), P (Localization.AtPrime J)) → P R
 #align of_localization_maximal OfLocalizationMaximal
+-/
 
 end CommRing
 
@@ -81,6 +85,7 @@ section RingHom
 
 variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S] (f : R →+* S), Prop)
 
+#print RingHom.LocalizationPreserves /-
 /-- A property `P` of ring homs is said to be preserved by localization
  if `P` holds for `M⁻¹R →+* M⁻¹S` whenever `P` holds for `R →+* S`. -/
 def RingHom.LocalizationPreserves :=
@@ -89,7 +94,9 @@ def RingHom.LocalizationPreserves :=
     [IsLocalization (M.map f) S'],
     P f → P (IsLocalization.map S' f (Submonoid.le_comap_map M) : R' →+* S')
 #align ring_hom.localization_preserves RingHom.LocalizationPreserves
+-/
 
+#print RingHom.OfLocalizationFiniteSpan /-
 /-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span`
 if `P` holds for `R →+* S` whenever there exists a finite set `{ r }` that spans `R` such that
 `P` holds for `Rᵣ →+* Sᵣ`.
@@ -100,7 +107,9 @@ def RingHom.OfLocalizationFiniteSpan :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Finset R)
     (hs : Ideal.span (s : Set R) = ⊤) (H : ∀ r : s, P (Localization.awayMap f r)), P f
 #align ring_hom.of_localization_finite_span RingHom.OfLocalizationFiniteSpan
+-/
 
+#print RingHom.OfLocalizationSpan /-
 /-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span`
 if `P` holds for `R →+* S` whenever there exists a set `{ r }` that spans `R` such that
 `P` holds for `Rᵣ →+* Sᵣ`.
@@ -111,14 +120,18 @@ def RingHom.OfLocalizationSpan :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set R) (hs : Ideal.span s = ⊤)
     (H : ∀ r : s, P (Localization.awayMap f r)), P f
 #align ring_hom.of_localization_span RingHom.OfLocalizationSpan
+-/
 
+#print RingHom.HoldsForLocalizationAway /-
 /-- A property `P` of ring homs satisfies `ring_hom.holds_for_localization_away`
  if `P` holds for each localization map `R →+* Rᵣ`. -/
 def RingHom.HoldsForLocalizationAway : Prop :=
   ∀ ⦃R : Type u⦄ (S : Type u) [CommRing R] [CommRing S] [Algebra R S] (r : R)
     [IsLocalization.Away r S], P (algebraMap R S)
 #align ring_hom.holds_for_localization_away RingHom.HoldsForLocalizationAway
+-/
 
+#print RingHom.OfLocalizationFiniteSpanTarget /-
 /-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span_target`
 if `P` holds for `R →+* S` whenever there exists a finite set `{ r }` that spans `S` such that
 `P` holds for `R →+* Sᵣ`.
@@ -130,7 +143,9 @@ def RingHom.OfLocalizationFiniteSpanTarget : Prop :=
     (hs : Ideal.span (s : Set S) = ⊤)
     (H : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f
 #align ring_hom.of_localization_finite_span_target RingHom.OfLocalizationFiniteSpanTarget
+-/
 
+#print RingHom.OfLocalizationSpanTarget /-
 /-- A property `P` of ring homs satisfies `ring_hom.of_localization_span_target`
 if `P` holds for `R →+* S` whenever there exists a set `{ r }` that spans `S` such that
 `P` holds for `R →+* Sᵣ`.
@@ -141,14 +156,18 @@ def RingHom.OfLocalizationSpanTarget : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set S) (hs : Ideal.span s = ⊤)
     (H : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f
 #align ring_hom.of_localization_span_target RingHom.OfLocalizationSpanTarget
+-/
 
+#print RingHom.OfLocalizationPrime /-
 /-- A property `P` of ring homs satisfies `of_localization_prime` if
   if `P` holds for `R` whenever `P` holds for `Rₘ` for all prime ideals `p`. -/
 def RingHom.OfLocalizationPrime : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S),
     (∀ (J : Ideal S) (hJ : J.IsPrime), P (Localization.localRingHom _ J f rfl)) → P f
 #align ring_hom.of_localization_prime RingHom.OfLocalizationPrime
+-/
 
+#print RingHom.PropertyIsLocal /-
 /-- A property of ring homs is local if it is preserved by localizations and compositions, and for
 each `{ r }` that spans `S`, we have `P (R →+* S) ↔ ∀ r, P (R →+* Sᵣ)`. -/
 structure RingHom.PropertyIsLocal : Prop where
@@ -157,7 +176,9 @@ structure RingHom.PropertyIsLocal : Prop where
   StableUnderComposition : RingHom.StableUnderComposition @P
   HoldsForLocalizationAway : RingHom.HoldsForLocalizationAway @P
 #align ring_hom.property_is_local RingHom.PropertyIsLocal
+-/
 
+#print RingHom.ofLocalizationSpan_iff_finite /-
 theorem RingHom.ofLocalizationSpan_iff_finite :
     RingHom.OfLocalizationSpan @P ↔ RingHom.OfLocalizationFiniteSpan @P :=
   by
@@ -171,7 +192,9 @@ theorem RingHom.ofLocalizationSpan_iff_finite :
     obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs
     exact h s' h₂ fun x => hs' ⟨_, h₁ x.Prop⟩
 #align ring_hom.of_localization_span_iff_finite RingHom.ofLocalizationSpan_iff_finite
+-/
 
+#print RingHom.ofLocalizationSpanTarget_iff_finite /-
 theorem RingHom.ofLocalizationSpanTarget_iff_finite :
     RingHom.OfLocalizationSpanTarget @P ↔ RingHom.OfLocalizationFiniteSpanTarget @P :=
   by
@@ -185,9 +208,11 @@ theorem RingHom.ofLocalizationSpanTarget_iff_finite :
     obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs
     exact h s' h₂ fun x => hs' ⟨_, h₁ x.Prop⟩
 #align ring_hom.of_localization_span_target_iff_finite RingHom.ofLocalizationSpanTarget_iff_finite
+-/
 
 variable {P f R' S'}
 
+#print RingHom.PropertyIsLocal.respectsIso /-
 theorem RingHom.PropertyIsLocal.respectsIso (hP : RingHom.PropertyIsLocal @P) :
     RingHom.RespectsIso @P :=
   by
@@ -199,7 +224,9 @@ theorem RingHom.PropertyIsLocal.respectsIso (hP : RingHom.PropertyIsLocal @P) :
   apply IsLocalization.away_of_isUnit_of_bijective _ isUnit_one
   exact e.bijective
 #align ring_hom.property_is_local.respects_iso RingHom.PropertyIsLocal.respectsIso
+-/
 
+#print RingHom.LocalizationPreserves.away /-
 -- Almost all arguments are implicit since this is not intended to use mid-proof.
 theorem RingHom.LocalizationPreserves.away (H : RingHom.LocalizationPreserves @P) (r : R)
     [IsLocalization.Away r R'] [IsLocalization.Away (f r) S'] (hf : P f) :
@@ -208,7 +235,9 @@ theorem RingHom.LocalizationPreserves.away (H : RingHom.LocalizationPreserves @P
   have : IsLocalization ((Submonoid.powers r).map f) S' := by rw [Submonoid.map_powers]; assumption
   exact H f (Submonoid.powers r) R' S' hf
 #align ring_hom.localization_preserves.away RingHom.LocalizationPreserves.away
+-/
 
+#print RingHom.PropertyIsLocal.ofLocalizationSpan /-
 theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal @P) :
     RingHom.OfLocalizationSpan @P := by
   introv R hs hs'
@@ -224,6 +253,7 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
     1
   exact (IsLocalization.map_comp _).symm
 #align ring_hom.property_is_local.of_localization_span RingHom.PropertyIsLocal.ofLocalizationSpan
+-/
 
 end RingHom
 
@@ -233,6 +263,7 @@ section Ideal
 
 open scoped nonZeroDivisors
 
+#print Ideal.le_of_localization_maximal /-
 /-- Let `I J : ideal R`. If the localization of `I` at each maximal ideal `P` is included in
 the localization of `J` at `P`, then `I ≤ J`. -/
 theorem Ideal.le_of_localization_maximal {I J : Ideal R}
@@ -258,7 +289,9 @@ theorem Ideal.le_of_localization_maximal {I J : Ideal R}
   simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq 
   simpa only [mul_assoc, Eq] using J.mul_mem_left m ha
 #align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
+-/
 
+#print Ideal.eq_of_localization_maximal /-
 /-- Let `I J : ideal R`. If the localization of `I` at each maximal ideal `P` is equal to
 the localization of `J` at `P`, then `I = J`. -/
 theorem Ideal.eq_of_localization_maximal {I J : Ideal R}
@@ -270,7 +303,9 @@ theorem Ideal.eq_of_localization_maximal {I J : Ideal R}
   le_antisymm (Ideal.le_of_localization_maximal fun P hP => (h P hP).le)
     (Ideal.le_of_localization_maximal fun P hP => (h P hP).ge)
 #align ideal.eq_of_localization_maximal Ideal.eq_of_localization_maximal
+-/
 
+#print ideal_eq_bot_of_localization' /-
 /-- An ideal is trivial if its localization at every maximal ideal is trivial. -/
 theorem ideal_eq_bot_of_localization' (I : Ideal R)
     (h :
@@ -278,7 +313,9 @@ theorem ideal_eq_bot_of_localization' (I : Ideal R)
     I = ⊥ :=
   Ideal.eq_of_localization_maximal fun P hP => by simpa using h P hP
 #align ideal_eq_bot_of_localization' ideal_eq_bot_of_localization'
+-/
 
+#print ideal_eq_bot_of_localization /-
 -- TODO: This proof should work for all modules, once we have enough material on submodules of
 -- localized modules.
 /-- An ideal is trivial if its localization at every maximal ideal is trivial. -/
@@ -293,7 +330,9 @@ theorem ideal_eq_bot_of_localization (I : Ideal R)
       rw [RingHom.mem_ker, ← Submodule.mem_bot R, ← h P hP, IsLocalization.mem_coeSubmodule]
       exact ⟨x, hx, rfl⟩
 #align ideal_eq_bot_of_localization ideal_eq_bot_of_localization
+-/
 
+#print eq_zero_of_localization /-
 theorem eq_zero_of_localization (r : R)
     (h : ∀ (J : Ideal R) (hJ : J.IsMaximal), algebraMap R (Localization.AtPrime J) r = 0) : r = 0 :=
   by
@@ -306,11 +345,13 @@ theorem eq_zero_of_localization (r : R)
   cases set.mem_singleton_iff.mpr h'
   exact h J hJ
 #align eq_zero_of_localization eq_zero_of_localization
+-/
 
 end Ideal
 
 section Reduced
 
+#print localization_isReduced /-
 theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :=
   by
   introv R _ _
@@ -332,10 +373,12 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
     IsLocalization.map_eq_zero_iff M]
   exact ⟨m', by rw [← hm', mul_comm]⟩
 #align localization_is_reduced localization_isReduced
+-/
 
 instance [IsReduced R] : IsReduced (Localization M) :=
   localization_isReduced M _ inferInstance
 
+#print isReduced_ofLocalizationMaximal /-
 theorem isReduced_ofLocalizationMaximal : OfLocalizationMaximal fun R hR => IsReduced R :=
   by
   introv R h
@@ -347,11 +390,13 @@ theorem isReduced_ofLocalizationMaximal : OfLocalizationMaximal fun R hR => IsRe
   skip
   exact (hx.map <| algebraMap R <| Localization.AtPrime J).eq_zero
 #align is_reduced_of_localization_maximal isReduced_ofLocalizationMaximal
+-/
 
 end Reduced
 
 section Surjective
 
+#print localizationPreserves_surjective /-
 theorem localizationPreserves_surjective :
     RingHom.LocalizationPreserves fun R S _ _ f => Function.Surjective f :=
   by
@@ -363,7 +408,9 @@ theorem localizationPreserves_surjective :
   rw [IsLocalization.map_mk']
   rfl
 #align localization_preserves_surjective localizationPreserves_surjective
+-/
 
+#print surjective_ofLocalizationSpan /-
 theorem surjective_ofLocalizationSpan :
     RingHom.OfLocalizationSpan fun R S _ _ f => Function.Surjective f :=
   by
@@ -382,11 +429,13 @@ theorem surjective_ofLocalizationSpan :
   rw [Subtype.coe_mk, mul_comm x, ← mul_assoc, ← map_pow, ← map_mul, ← map_mul, ← pow_add] at e'' 
   exact ⟨n' + n, _, e''.symm⟩
 #align surjective_of_localization_span surjective_ofLocalizationSpan
+-/
 
 end Surjective
 
 section Finite
 
+#print localization_finite /-
 /-- If `S` is a finite `R`-algebra, then `S' = M⁻¹S` is a finite `R' = M⁻¹R`-algebra. -/
 theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
   by
@@ -427,12 +476,16 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
   rw [map_one]
   rfl
 #align localization_finite localization_finite
+-/
 
+#print localization_away_map_finite /-
 theorem localization_away_map_finite (r : R) [IsLocalization.Away r R']
     [IsLocalization.Away (f r) S'] (hf : f.Finite) : (IsLocalization.Away.map R' S' f r).Finite :=
   localization_finite.Away r hf
 #align localization_away_map_finite localization_away_map_finite
+-/
 
+#print IsLocalization.smul_mem_finsetIntegerMultiple_span /-
 /-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the span of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
@@ -478,7 +531,9 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
     exact Algebra.smul_def _ _
   · exact Algebra.smul_def _ _
 #align is_localization.smul_mem_finset_integer_multiple_span IsLocalization.smul_mem_finsetIntegerMultiple_span
+-/
 
+#print multiple_mem_span_of_mem_localization_span /-
 /-- If `S` is an `R' = M⁻¹R` algebra, and `x ∈ span R' s`,
 then `t • x ∈ span R s` for some `t : M`.-/
 theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
@@ -505,7 +560,9 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
   rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
   rfl
 #align multiple_mem_span_of_mem_localization_span multiple_mem_span_of_mem_localization_span
+-/
 
+#print multiple_mem_adjoin_of_mem_localization_adjoin /-
 /-- If `S` is an `R' = M⁻¹R` algebra, and `x ∈ adjoin R' s`,
 then `t • x ∈ adjoin R s` for some `t : M`.-/
 theorem multiple_mem_adjoin_of_mem_localization_adjoin [Algebra R' S] [Algebra R S]
@@ -517,7 +574,9 @@ theorem multiple_mem_adjoin_of_mem_localization_adjoin [Algebra R' S] [Algebra R
   simp_rw [Algebra.adjoin_eq_span] at hx ⊢
   exact multiple_mem_span_of_mem_localization_span M R' _ _ hx
 #align multiple_mem_adjoin_of_mem_localization_adjoin multiple_mem_adjoin_of_mem_localization_adjoin
+-/
 
+#print finite_ofLocalizationSpan /-
 theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :=
   by
   rw [RingHom.ofLocalizationSpan_iff_finite]
@@ -562,11 +621,13 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
   use n₂ + n₁
   exact le_iSup (fun x : s => Submodule.span R (sf x : Set S)) r hn₂
 #align finite_of_localization_span finite_ofLocalizationSpan
+-/
 
 end Finite
 
 section FiniteType
 
+#print localization_finiteType /-
 theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteType :=
   by
   introv R hf
@@ -601,15 +662,19 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
   rw [map_one]
   rfl
 #align localization_finite_type localization_finiteType
+-/
 
+#print localization_away_map_finiteType /-
 theorem localization_away_map_finiteType (r : R) [IsLocalization.Away r R']
     [IsLocalization.Away (f r) S'] (hf : f.FiniteType) :
     (IsLocalization.Away.map R' S' f r).FiniteType :=
   localization_finiteType.Away r hf
 #align localization_away_map_finite_type localization_away_map_finiteType
+-/
 
 variable {S'}
 
+#print IsLocalization.exists_smul_mem_of_mem_adjoin /-
 /-- Let `S` be an `R`-algebra, `M` a submonoid of `S`, `S' = M⁻¹S`.
 Suppose the image of some `x : S` falls in the adjoin of some finite `s ⊆ S'` over `R`,
 and `A` is an `R`-subalgebra of `S` containing both `M` and the numerators of `s`.
@@ -635,7 +700,9 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
   rw [Submonoid.smul_def, smul_eq_mul, Submonoid.coe_mul, Submonoid.coe_pow, mul_assoc, ← ha₂,
     mul_comm]
 #align is_localization.exists_smul_mem_of_mem_adjoin IsLocalization.exists_smul_mem_of_mem_adjoin
+-/
 
+#print IsLocalization.lift_mem_adjoin_finsetIntegerMultiple /-
 /-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the adjoin of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
@@ -655,7 +722,9 @@ theorem IsLocalization.lift_mem_adjoin_finsetIntegerMultiple [Algebra R S] [Alge
   · exact ⟨⟨a, ha⟩, by simpa [Submonoid.smul_def] using e⟩
   · rintro _ ⟨a, ha, rfl⟩; exact Subalgebra.algebraMap_mem _ a
 #align is_localization.lift_mem_adjoin_finset_integer_multiple IsLocalization.lift_mem_adjoin_finsetIntegerMultiple
+-/
 
+#print finiteType_ofLocalizationSpan /-
 theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.FiniteType :=
   by
   rw [RingHom.ofLocalizationSpan_iff_finite]
@@ -695,6 +764,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   use n₂ + n₁
   exact le_iSup (fun x : s => Algebra.adjoin R (sf x : Set S)) r hn₂
 #align finite_type_of_localization_span finiteType_ofLocalizationSpan
+-/
 
 end FiniteType
 
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.local_properties
-! leanprover-community/mathlib commit a7c017d750512a352b623b1824d75da5998457d0
+! leanprover-community/mathlib commit cff8231f04dfa33fd8f2f45792eebd862ef30cad
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -19,6 +19,9 @@ import Mathbin.RingTheory.RingHomProperties
 /-!
 # Local properties of commutative rings
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file, we provide the proofs of various local properties.
 
 ## Naming Conventions
Diff
@@ -58,8 +58,6 @@ section CommRing
 
 variable (P : ∀ (R : Type u) [CommRing R], Prop)
 
-include P
-
 /-- A property `P` of comm rings is said to be preserved by localization
   if `P` holds for `M⁻¹R` whenever `P` holds for `R`. -/
 def LocalizationPreserves : Prop :=
@@ -80,8 +78,6 @@ section RingHom
 
 variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S] (f : R →+* S), Prop)
 
-include P
-
 /-- A property `P` of ring homs is said to be preserved by localization
  if `P` holds for `M⁻¹R →+* M⁻¹S` whenever `P` holds for `R →+* S`. -/
 def RingHom.LocalizationPreserves :=
Diff
@@ -214,12 +214,13 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
     RingHom.OfLocalizationSpan @P := by
   introv R hs hs'
   skip
-  apply_fun Ideal.map f  at hs 
+  apply_fun Ideal.map f at hs 
   rw [Ideal.map_span, Ideal.map_top] at hs 
   apply hP.of_localization_span_target _ _ hs
   rintro ⟨_, r, hr, rfl⟩
   have := hs' ⟨r, hr⟩
-  convert hP.stable_under_composition _ _ (hP.holds_for_localization_away (Localization.Away r) r)
+  convert
+    hP.stable_under_composition _ _ (hP.holds_for_localization_away (Localization.Away r) r)
       (hs' ⟨r, hr⟩) using
     1
   exact (IsLocalization.map_comp _).symm
@@ -324,7 +325,7 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx' 
   rw [← (algebraMap R S).map_zero] at hx' 
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
-  apply_fun (· * m' ^ n)  at hm' 
+  apply_fun (· * m' ^ n) at hm' 
   simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm' 
   rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm' 
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
@@ -418,7 +419,8 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
       (Submodule.span R' (algebraMap S S' '' T)).restrictScalars R :=
     by rw [Submodule.span_le]; exact Submodule.subset_span
   -- Now, since `y ∈ span T`, and `(f r)⁻¹ ∈ R'`, `x / (f r)` is in `span T` as well.
-  convert(Submodule.span R' (algebraMap S S' '' T)).smul_mem (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩)
+  convert
+    (Submodule.span R' (algebraMap S S' '' T)).smul_mem (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩)
       (H hy) using
     1
   rw [Algebra.smul_def]
@@ -466,7 +468,8 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
   obtain ⟨⟨_, a, ha₁, rfl⟩, ha₂⟩ :=
     (IsLocalization.eq_iff_exists (M.map (algebraMap R S)) S').mp hx''
   use (⟨a, ha₁⟩ : M) * (⟨y', hy'⟩ : M)
-  convert(Submodule.span R
+  convert
+    (Submodule.span R
           (IsLocalization.finsetIntegerMultiple (Submonoid.map (algebraMap R S) M) s :
             Set S)).smul_mem
       a hx' using
@@ -483,25 +486,25 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     [IsScalarTower R R' S] [IsLocalization M R'] (s : Set S) (x : S)
     (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by
   classical
-    obtain ⟨s', hss', hs'⟩ := Submodule.mem_span_finite_of_mem_span hx
-    rsuffices ⟨t, ht⟩ : ∃ t : M, t • x ∈ Submodule.span R (s' : Set S)
-    · exact ⟨t, Submodule.span_mono hss' ht⟩
-    clear hx hss' s
-    revert x
-    apply s'.induction_on
-    · intro x hx; use 1; simpa using hx
-    rintro a s ha hs x hx
-    simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
-      Submodule.mem_span_insert] at hx ⊢
-    rcases hx with ⟨y, z, hz, rfl⟩
-    rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
-    replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
-    simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
-      mul_assoc, ← Algebra.smul_def] at e 
-    rcases hs _ hz with ⟨t, ht⟩
-    refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
-    rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
-    rfl
+  obtain ⟨s', hss', hs'⟩ := Submodule.mem_span_finite_of_mem_span hx
+  rsuffices ⟨t, ht⟩ : ∃ t : M, t • x ∈ Submodule.span R (s' : Set S)
+  · exact ⟨t, Submodule.span_mono hss' ht⟩
+  clear hx hss' s
+  revert x
+  apply s'.induction_on
+  · intro x hx; use 1; simpa using hx
+  rintro a s ha hs x hx
+  simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
+    Submodule.mem_span_insert] at hx ⊢
+  rcases hx with ⟨y, z, hz, rfl⟩
+  rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
+  replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
+  simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
+    mul_assoc, ← Algebra.smul_def] at e 
+  rcases hs _ hz with ⟨t, ht⟩
+  refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
+  rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
+  rfl
 #align multiple_mem_span_of_mem_localization_span multiple_mem_span_of_mem_localization_span
 
 /-- If `S` is an `R' = M⁻¹R` algebra, and `x ∈ adjoin R' s`,
@@ -590,7 +593,8 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
     Algebra.adjoin R (algebraMap S S' '' T) ≤
       (Algebra.adjoin R' (algebraMap S S' '' T)).restrictScalars R :=
     by rw [Algebra.adjoin_le_iff]; exact Algebra.subset_adjoin
-  convert(Algebra.adjoin R' (algebraMap S S' '' T)).smul_mem (H hy)
+  convert
+    (Algebra.adjoin R' (algebraMap S S' '' T)).smul_mem (H hy)
       (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩) using
     1
   rw [Algebra.smul_def]
@@ -672,7 +676,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   choose s₁ s₂ using H
   let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (f x)) (s₁ x)
   use s.attach.bUnion sf
-  convert(Algebra.adjoin_attach_biUnion sf).trans _
+  convert (Algebra.adjoin_attach_biUnion sf).trans _
   rw [eq_top_iff]
   rintro x -
   apply
Diff
@@ -214,8 +214,8 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
     RingHom.OfLocalizationSpan @P := by
   introv R hs hs'
   skip
-  apply_fun Ideal.map f  at hs
-  rw [Ideal.map_span, Ideal.map_top] at hs
+  apply_fun Ideal.map f  at hs 
+  rw [Ideal.map_span, Ideal.map_top] at hs 
   apply hP.of_localization_span_target _ _ hs
   rintro ⟨_, r, hr, rfl⟩
   have := hs' ⟨r, hr⟩
@@ -252,10 +252,10 @@ theorem Ideal.le_of_localization_maximal {I J : Ideal R}
   intro P hP le
   obtain ⟨⟨⟨a, ha⟩, ⟨s, hs⟩⟩, eq⟩ :=
     (IsLocalization.mem_map_algebraMap_iff P.prime_compl _).mp (h P hP (Ideal.mem_map_of_mem _ hx))
-  rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq
+  rw [← _root_.map_mul, ← sub_eq_zero, ← map_sub] at eq 
   obtain ⟨⟨m, hm⟩, eq⟩ := (IsLocalization.map_eq_zero_iff P.prime_compl _ _).mp Eq
   refine' hs ((hP.is_prime.mem_or_mem (le (ideal.mem_colon_singleton.mpr _))).resolve_right hm)
-  simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq
+  simp only [Subtype.coe_mk, mul_sub, sub_eq_zero, mul_comm x s, mul_left_comm] at eq 
   simpa only [mul_assoc, Eq] using J.mul_mem_left m ha
 #align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
 
@@ -319,14 +319,14 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   rintro x ⟨_ | n, e⟩
   · simpa using congr_arg (· * x) e
   obtain ⟨⟨y, m⟩, hx⟩ := IsLocalization.surj M x
-  dsimp only at hx
+  dsimp only at hx 
   let hx' := congr_arg (· ^ n.succ) hx
-  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx'
-  rw [← (algebraMap R S).map_zero] at hx'
+  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx' 
+  rw [← (algebraMap R S).map_zero] at hx' 
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
-  apply_fun (· * m' ^ n)  at hm'
-  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm'
-  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
+  apply_fun (· * m' ^ n)  at hm' 
+  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm' 
+  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm' 
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
   rw [← (IsLocalization.map_units S m).mul_left_inj, hx, MulZeroClass.zero_mul,
     IsLocalization.map_eq_zero_iff M]
@@ -376,10 +376,10 @@ theorem surjective_ofLocalizationSpan :
   intro r
   obtain ⟨a, e'⟩ := H r (algebraMap _ _ x)
   obtain ⟨b, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.mk'_surjective (Submonoid.powers (r : R)) a
-  erw [IsLocalization.map_mk'] at e'
-  rw [eq_comm, IsLocalization.eq_mk'_iff_mul_eq, Subtype.coe_mk, Subtype.coe_mk, ← map_mul] at e'
+  erw [IsLocalization.map_mk'] at e' 
+  rw [eq_comm, IsLocalization.eq_mk'_iff_mul_eq, Subtype.coe_mk, Subtype.coe_mk, ← map_mul] at e' 
   obtain ⟨⟨_, n', rfl⟩, e''⟩ := (IsLocalization.eq_iff_exists (Submonoid.powers (f r)) _).mp e'
-  rw [Subtype.coe_mk, mul_comm x, ← mul_assoc, ← map_pow, ← map_mul, ← map_mul, ← pow_add] at e''
+  rw [Subtype.coe_mk, mul_comm x, ← mul_assoc, ← map_pow, ← map_mul, ← map_mul, ← pow_add] at e'' 
   exact ⟨n' + n, _, e''.symm⟩
 #align surjective_of_localization_span surjective_ofLocalizationSpan
 
@@ -412,7 +412,7 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
   have hy : y ∈ Submodule.span R ↑T := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ Submodule.map fₐ.to_linear_map (Submodule.span R T) :=
     Submodule.mem_map_of_mem hy
-  rw [Submodule.map_span fₐ.to_linear_map T] at hy
+  rw [Submodule.map_span fₐ.to_linear_map T] at hy 
   have H :
     Submodule.span R (algebraMap S S' '' T) ≤
       (Submodule.span R' (algebraMap S S' '' T)).restrictScalars R :=
@@ -453,12 +453,12 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
   obtain ⟨y', hy', e : algebraMap R S y' = y⟩ := y.prop
   have : algebraMap R S y' • (s : Set S') = y' • s := by
     simp_rw [Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]
-  rw [← e, this] at hx₁
+  rw [← e, this] at hx₁ 
   replace hx₁ := congr_arg (Submodule.span R) hx₁
-  rw [Submodule.span_smul] at hx₁
+  rw [Submodule.span_smul] at hx₁ 
   replace hx : _ ∈ y' • Submodule.span R (s : Set S') := Set.smul_mem_smul_set hx
-  rw [hx₁] at hx
-  erw [← g.map_smul, ← Submodule.map_span (g : S →ₗ[R] S')] at hx
+  rw [hx₁] at hx 
+  erw [← g.map_smul, ← Submodule.map_span (g : S →ₗ[R] S')] at hx 
   -- Since `x` falls in the span of `s` in `S'`, `y' • x : S` falls in the span of `s'` in `S'`.
   -- That is, there exists some `x' : S` in the span of `s'` in `S` and `x' = y' • x` in `S'`.
   -- Thus `a • (y' • x) = a • x' ∈ span s'` in `S` for some `a ∈ M`.
@@ -492,12 +492,12 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     · intro x hx; use 1; simpa using hx
     rintro a s ha hs x hx
     simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
-      Submodule.mem_span_insert] at hx⊢
+      Submodule.mem_span_insert] at hx ⊢
     rcases hx with ⟨y, z, hz, rfl⟩
     rcases IsLocalization.surj M y with ⟨⟨y', s'⟩, e⟩
     replace e : _ * a = _ * a := (congr_arg (fun x => algebraMap R' S x * a) e : _)
     simp_rw [RingHom.map_mul, ← IsScalarTower.algebraMap_apply, mul_comm (algebraMap R' S y),
-      mul_assoc, ← Algebra.smul_def] at e
+      mul_assoc, ← Algebra.smul_def] at e 
     rcases hs _ hz with ⟨t, ht⟩
     refine' ⟨t * s', t * y', _, (Submodule.span R (s : Set S)).smul_mem s' ht, _⟩
     rw [smul_add, ← smul_smul, mul_comm, ← smul_smul, ← smul_smul, ← e]
@@ -511,8 +511,8 @@ theorem multiple_mem_adjoin_of_mem_localization_adjoin [Algebra R' S] [Algebra R
     (hx : x ∈ Algebra.adjoin R' s) : ∃ t : M, t • x ∈ Algebra.adjoin R s :=
   by
   change ∃ t : M, t • x ∈ (Algebra.adjoin R s).toSubmodule
-  change x ∈ (Algebra.adjoin R' s).toSubmodule at hx
-  simp_rw [Algebra.adjoin_eq_span] at hx⊢
+  change x ∈ (Algebra.adjoin R' s).toSubmodule at hx 
+  simp_rw [Algebra.adjoin_eq_span] at hx ⊢
   exact multiple_mem_span_of_mem_localization_span M R' _ _ hx
 #align multiple_mem_adjoin_of_mem_localization_adjoin multiple_mem_adjoin_of_mem_localization_adjoin
 
@@ -551,12 +551,12 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r))) (algebraMap S _ x)
       (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
-    map_mul] at hn₁
+    map_mul] at hn₁ 
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
     IsLocalization.smul_mem_finsetIntegerMultiple_span (Submonoid.powers (r : R))
       (Localization.Away (f r)) _ (s₁ r) hn₁
-  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
-  simp_rw [Submonoid.map_powers] at hn₂
+  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂ 
+  simp_rw [Submonoid.map_powers] at hn₂ 
   use n₂ + n₁
   exact le_iSup (fun x : s => Submodule.span R (sf x : Set S)) r hn₂
 #align finite_of_localization_span finite_ofLocalizationSpan
@@ -585,7 +585,7 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
   have hy : y ∈ Algebra.adjoin R (T : Set S) := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ (Algebra.adjoin R (T : Set S)).map fₐ :=
     subalgebra.mem_map.mpr ⟨_, hy, rfl⟩
-  rw [fₐ.map_adjoin T] at hy
+  rw [fₐ.map_adjoin T] at hy 
   have H :
     Algebra.adjoin R (algebraMap S S' '' T) ≤
       (Algebra.adjoin R' (algebraMap S S' '' T)).restrictScalars R :=
@@ -625,7 +625,7 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
     Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin (y : S) (s : Set S') (A.map g)
       (by rw [hx₁]; exact Set.image_subset _ hA₁) hx (Set.mem_image_of_mem _ (hA₂ y.2))
   obtain ⟨x', hx', hx''⟩ := hn n (le_of_eq rfl)
-  rw [Algebra.smul_def, ← _root_.map_mul] at hx''
+  rw [Algebra.smul_def, ← _root_.map_mul] at hx'' 
   obtain ⟨a, ha₂⟩ := (IsLocalization.eq_iff_exists M S').mp hx''
   use a * y ^ n
   convert A.mul_mem hx' (hA₂ a.prop)
@@ -684,11 +684,11 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r)))
       (algebraMap S (Localization.Away (f r)) x) (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
-    map_mul] at hn₁
+    map_mul] at hn₁ 
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
     IsLocalization.lift_mem_adjoin_finsetIntegerMultiple (Submonoid.powers (r : R)) _ (s₁ r) hn₁
-  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
-  simp_rw [Submonoid.map_powers] at hn₂
+  rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂ 
+  simp_rw [Submonoid.map_powers] at hn₂ 
   use n₂ + n₁
   exact le_iSup (fun x : s => Algebra.adjoin R (sf x : Set S)) r hn₂
 #align finite_type_of_localization_span finiteType_ofLocalizationSpan
Diff
@@ -629,7 +629,8 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
   obtain ⟨a, ha₂⟩ := (IsLocalization.eq_iff_exists M S').mp hx''
   use a * y ^ n
   convert A.mul_mem hx' (hA₂ a.prop)
-  rw [Submonoid.smul_def, smul_eq_mul, Submonoid.coe_mul, [anonymous], mul_assoc, ← ha₂, mul_comm]
+  rw [Submonoid.smul_def, smul_eq_mul, Submonoid.coe_mul, Submonoid.coe_pow, mul_assoc, ← ha₂,
+    mul_comm]
 #align is_localization.exists_smul_mem_of_mem_adjoin IsLocalization.exists_smul_mem_of_mem_adjoin
 
 /-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
Diff
@@ -42,7 +42,7 @@ The following properties are covered:
 -/
 
 
-open Pointwise Classical BigOperators
+open scoped Pointwise Classical BigOperators
 
 universe u
 
@@ -231,7 +231,7 @@ end Properties
 
 section Ideal
 
-open nonZeroDivisors
+open scoped nonZeroDivisors
 
 /-- Let `I J : ideal R`. If the localization of `I` at each maximal ideal `P` is included in
 the localization of `J` at `P`, then `I ≤ J`. -/
Diff
@@ -167,8 +167,7 @@ theorem RingHom.ofLocalizationSpan_iff_finite :
   -- TODO: Using `refine` here breaks `resetI`.
   intros
   constructor
-  · intro h s
-    exact h s
+  · intro h s; exact h s
   · intro h s hs hs'
     obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs
     exact h s' h₂ fun x => hs' ⟨_, h₁ x.Prop⟩
@@ -182,8 +181,7 @@ theorem RingHom.ofLocalizationSpanTarget_iff_finite :
   -- TODO: Using `refine` here breaks `resetI`.
   intros
   constructor
-  · intro h s
-    exact h s
+  · intro h s; exact h s
   · intro h s hs hs'
     obtain ⟨s', h₁, h₂⟩ := (Ideal.span_eq_top_iff_finite s).mp hs
     exact h s' h₂ fun x => hs' ⟨_, h₁ x.Prop⟩
@@ -208,10 +206,7 @@ theorem RingHom.LocalizationPreserves.away (H : RingHom.LocalizationPreserves @P
     [IsLocalization.Away r R'] [IsLocalization.Away (f r) S'] (hf : P f) :
     P (IsLocalization.Away.map R' S' f r) := by
   skip
-  have : IsLocalization ((Submonoid.powers r).map f) S' :=
-    by
-    rw [Submonoid.map_powers]
-    assumption
+  have : IsLocalization ((Submonoid.powers r).map f) S' := by rw [Submonoid.map_powers]; assumption
   exact H f (Submonoid.powers r) R' S' hf
 #align ring_hom.localization_preserves.away RingHom.LocalizationPreserves.away
 
@@ -414,18 +409,14 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
   -- Since `S` is generated by `T`, the image of `y` should fall in the span of the image of `T`.
   obtain ⟨y, ⟨_, ⟨r, hr, rfl⟩⟩, rfl⟩ := IsLocalization.mk'_surjective (M.map f) x
   rw [IsLocalization.mk'_eq_mul_mk'_one, mul_comm, Finset.coe_image]
-  have hy : y ∈ Submodule.span R ↑T := by
-    rw [hT]
-    trivial
+  have hy : y ∈ Submodule.span R ↑T := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ Submodule.map fₐ.to_linear_map (Submodule.span R T) :=
     Submodule.mem_map_of_mem hy
   rw [Submodule.map_span fₐ.to_linear_map T] at hy
   have H :
     Submodule.span R (algebraMap S S' '' T) ≤
       (Submodule.span R' (algebraMap S S' '' T)).restrictScalars R :=
-    by
-    rw [Submodule.span_le]
-    exact Submodule.subset_span
+    by rw [Submodule.span_le]; exact Submodule.subset_span
   -- Now, since `y ∈ span T`, and `(f r)⁻¹ ∈ R'`, `x / (f r)` is in `span T` as well.
   convert(Submodule.span R' (algebraMap S S' '' T)).smul_mem (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩)
       (H hy) using
@@ -498,9 +489,7 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     clear hx hss' s
     revert x
     apply s'.induction_on
-    · intro x hx
-      use 1
-      simpa using hx
+    · intro x hx; use 1; simpa using hx
     rintro a s ha hs x hx
     simp only [Finset.coe_insert, Finset.image_insert, Finset.coe_image, Subtype.coe_mk,
       Submodule.mem_span_insert] at hx⊢
@@ -538,10 +527,7 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
   have :
     ∀ r : s,
       IsLocalization ((Submonoid.powers (r : R)).map (algebraMap R S)) (Localization.Away (f r)) :=
-    by
-    intro r
-    rw [Submonoid.map_powers]
-    exact Localization.isLocalization
+    by intro r; rw [Submonoid.map_powers]; exact Localization.isLocalization
   haveI : ∀ r : s, IsScalarTower R (Localization.Away (r : R)) (Localization.Away (f r)) := fun r =>
     IsScalarTower.of_algebraMap_eq' (IsLocalization.map_comp _).symm
   -- By the hypothesis, we may find a finite generating set for each `Sᵣ`. This set can then be
@@ -563,9 +549,7 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
   obtain ⟨⟨_, n₁, rfl⟩, hn₁⟩ :=
     multiple_mem_span_of_mem_localization_span (Submonoid.powers (r : R))
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r))) (algebraMap S _ x)
-      (by
-        rw [s₂ r]
-        trivial)
+      (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
     map_mul] at hn₁
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
@@ -598,19 +582,14 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
   rintro x -
   obtain ⟨y, ⟨_, ⟨r, hr, rfl⟩⟩, rfl⟩ := IsLocalization.mk'_surjective (M.map f) x
   rw [IsLocalization.mk'_eq_mul_mk'_one, mul_comm, Finset.coe_image]
-  have hy : y ∈ Algebra.adjoin R (T : Set S) :=
-    by
-    rw [hT]
-    trivial
+  have hy : y ∈ Algebra.adjoin R (T : Set S) := by rw [hT]; trivial
   replace hy : algebraMap S S' y ∈ (Algebra.adjoin R (T : Set S)).map fₐ :=
     subalgebra.mem_map.mpr ⟨_, hy, rfl⟩
   rw [fₐ.map_adjoin T] at hy
   have H :
     Algebra.adjoin R (algebraMap S S' '' T) ≤
       (Algebra.adjoin R' (algebraMap S S' '' T)).restrictScalars R :=
-    by
-    rw [Algebra.adjoin_le_iff]
-    exact Algebra.subset_adjoin
+    by rw [Algebra.adjoin_le_iff]; exact Algebra.subset_adjoin
   convert(Algebra.adjoin R' (algebraMap S S' '' T)).smul_mem (H hy)
       (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩) using
     1
@@ -644,10 +623,7 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
   have hx₁ : (y : S) • ↑s = g '' _ := (IsLocalization.finsetIntegerMultiple_image _ s).symm
   obtain ⟨n, hn⟩ :=
     Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin (y : S) (s : Set S') (A.map g)
-      (by
-        rw [hx₁]
-        exact Set.image_subset _ hA₁)
-      hx (Set.mem_image_of_mem _ (hA₂ y.2))
+      (by rw [hx₁]; exact Set.image_subset _ hA₁) hx (Set.mem_image_of_mem _ (hA₂ y.2))
   obtain ⟨x', hx', hx''⟩ := hn n (le_of_eq rfl)
   rw [Algebra.smul_def, ← _root_.map_mul] at hx''
   obtain ⟨a, ha₂⟩ := (IsLocalization.eq_iff_exists M S').mp hx''
@@ -673,8 +649,7 @@ theorem IsLocalization.lift_mem_adjoin_finsetIntegerMultiple [Algebra R S] [Alge
     IsLocalization.exists_smul_mem_of_mem_adjoin (M.map (algebraMap R S)) x s (Algebra.adjoin R _)
       Algebra.subset_adjoin _ hx
   · exact ⟨⟨a, ha⟩, by simpa [Submonoid.smul_def] using e⟩
-  · rintro _ ⟨a, ha, rfl⟩
-    exact Subalgebra.algebraMap_mem _ a
+  · rintro _ ⟨a, ha, rfl⟩; exact Subalgebra.algebraMap_mem _ a
 #align is_localization.lift_mem_adjoin_finset_integer_multiple IsLocalization.lift_mem_adjoin_finsetIntegerMultiple
 
 theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.FiniteType :=
@@ -688,10 +663,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   have :
     ∀ r : s,
       IsLocalization ((Submonoid.powers (r : R)).map (algebraMap R S)) (Localization.Away (f r)) :=
-    by
-    intro r
-    rw [Submonoid.map_powers]
-    exact Localization.isLocalization
+    by intro r; rw [Submonoid.map_powers]; exact Localization.isLocalization
   haveI : ∀ r : s, IsScalarTower R (Localization.Away (r : R)) (Localization.Away (f r)) := fun r =>
     IsScalarTower.of_algebraMap_eq' (IsLocalization.map_comp _).symm
   constructor
@@ -709,10 +681,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   obtain ⟨⟨_, n₁, rfl⟩, hn₁⟩ :=
     multiple_mem_adjoin_of_mem_localization_adjoin (Submonoid.powers (r : R))
       (Localization.Away (r : R)) (s₁ r : Set (Localization.Away (f r)))
-      (algebraMap S (Localization.Away (f r)) x)
-      (by
-        rw [s₂ r]
-        trivial)
+      (algebraMap S (Localization.Away (f r)) x) (by rw [s₂ r]; trivial)
   rw [Submonoid.smul_def, Algebra.smul_def, IsScalarTower.algebraMap_apply R S, Subtype.coe_mk, ←
     map_mul] at hn₁
   obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ :=
Diff
@@ -4,13 +4,13 @@ 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.local_properties
-! leanprover-community/mathlib commit 831c494092374cfe9f50591ed0ac81a25efc5b86
+! leanprover-community/mathlib commit a7c017d750512a352b623b1824d75da5998457d0
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.FiniteType
 import Mathbin.RingTheory.Localization.AtPrime
-import Mathbin.RingTheory.Localization.Away
+import Mathbin.RingTheory.Localization.Away.Basic
 import Mathbin.RingTheory.Localization.Integer
 import Mathbin.RingTheory.Localization.Submodule
 import Mathbin.RingTheory.Nilpotent
Diff
@@ -552,7 +552,7 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
   choose s₁ s₂ using H
   let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (f x)) (s₁ x)
   use s.attach.bUnion sf
-  rw [Submodule.span_attach_bunionᵢ, eq_top_iff]
+  rw [Submodule.span_attach_biUnion, eq_top_iff]
   -- It suffices to show that `r ^ n • x ∈ span T` for each `r : s`, since `{ r ^ n }` spans `R`.
   -- This then follows from the fact that each `x : R` is a linear combination of the generating set
   -- of `Sᵣ`. By multiplying a sufficiently large power of `r`, we can cancel out the `r`s in the
@@ -574,7 +574,7 @@ theorem finite_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Finite :
   rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
   simp_rw [Submonoid.map_powers] at hn₂
   use n₂ + n₁
-  exact le_supᵢ (fun x : s => Submodule.span R (sf x : Set S)) r hn₂
+  exact le_iSup (fun x : s => Submodule.span R (sf x : Set S)) r hn₂
 #align finite_of_localization_span finite_ofLocalizationSpan
 
 end Finite
@@ -699,7 +699,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   choose s₁ s₂ using H
   let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (f x)) (s₁ x)
   use s.attach.bUnion sf
-  convert(Algebra.adjoin_attach_bunionᵢ sf).trans _
+  convert(Algebra.adjoin_attach_biUnion sf).trans _
   rw [eq_top_iff]
   rintro x -
   apply
@@ -720,7 +720,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   rw [Submonoid.smul_def, ← Algebra.smul_def, smul_smul, Subtype.coe_mk, ← pow_add] at hn₂
   simp_rw [Submonoid.map_powers] at hn₂
   use n₂ + n₁
-  exact le_supᵢ (fun x : s => Algebra.adjoin R (sf x : Set S)) r hn₂
+  exact le_iSup (fun x : s => Algebra.adjoin R (sf x : Set S)) r hn₂
 #align finite_type_of_localization_span finiteType_ofLocalizationSpan
 
 end FiniteType
Diff
@@ -224,8 +224,7 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
   apply hP.of_localization_span_target _ _ hs
   rintro ⟨_, r, hr, rfl⟩
   have := hs' ⟨r, hr⟩
-  convert
-    hP.stable_under_composition _ _ (hP.holds_for_localization_away (Localization.Away r) r)
+  convert hP.stable_under_composition _ _ (hP.holds_for_localization_away (Localization.Away r) r)
       (hs' ⟨r, hr⟩) using
     1
   exact (IsLocalization.map_comp _).symm
@@ -428,8 +427,7 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite :=
     rw [Submodule.span_le]
     exact Submodule.subset_span
   -- Now, since `y ∈ span T`, and `(f r)⁻¹ ∈ R'`, `x / (f r)` is in `span T` as well.
-  convert
-    (Submodule.span R' (algebraMap S S' '' T)).smul_mem (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩)
+  convert(Submodule.span R' (algebraMap S S' '' T)).smul_mem (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩)
       (H hy) using
     1
   rw [Algebra.smul_def]
@@ -477,8 +475,7 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
   obtain ⟨⟨_, a, ha₁, rfl⟩, ha₂⟩ :=
     (IsLocalization.eq_iff_exists (M.map (algebraMap R S)) S').mp hx''
   use (⟨a, ha₁⟩ : M) * (⟨y', hy'⟩ : M)
-  convert
-    (Submodule.span R
+  convert(Submodule.span R
           (IsLocalization.finsetIntegerMultiple (Submonoid.map (algebraMap R S) M) s :
             Set S)).smul_mem
       a hx' using
@@ -614,8 +611,7 @@ theorem localization_finiteType : RingHom.LocalizationPreserves @RingHom.FiniteT
     by
     rw [Algebra.adjoin_le_iff]
     exact Algebra.subset_adjoin
-  convert
-    (Algebra.adjoin R' (algebraMap S S' '' T)).smul_mem (H hy)
+  convert(Algebra.adjoin R' (algebraMap S S' '' T)).smul_mem (H hy)
       (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩) using
     1
   rw [Algebra.smul_def]
@@ -703,7 +699,7 @@ theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.Fini
   choose s₁ s₂ using H
   let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (f x)) (s₁ x)
   use s.attach.bUnion sf
-  convert (Algebra.adjoin_attach_bunionᵢ sf).trans _
+  convert(Algebra.adjoin_attach_bunionᵢ sf).trans _
   rw [eq_top_iff]
   rintro x -
   apply
Diff
@@ -327,14 +327,15 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   obtain ⟨⟨y, m⟩, hx⟩ := IsLocalization.surj M x
   dsimp only at hx
   let hx' := congr_arg (· ^ n.succ) hx
-  simp only [mul_pow, e, zero_mul, ← RingHom.map_pow] at hx'
+  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx'
   rw [← (algebraMap R S).map_zero] at hx'
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
   apply_fun (· * m' ^ n)  at hm'
-  simp only [mul_assoc, zero_mul, mul_zero] at hm'
+  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm'
   rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
-  rw [← (IsLocalization.map_units S m).mul_left_inj, hx, zero_mul, IsLocalization.map_eq_zero_iff M]
+  rw [← (IsLocalization.map_units S m).mul_left_inj, hx, MulZeroClass.zero_mul,
+    IsLocalization.map_eq_zero_iff M]
   exact ⟨m', by rw [← hm', mul_comm]⟩
 #align localization_is_reduced localization_isReduced
 

Changes in mathlib4

mathlib3
mathlib4
chore: split RingTheory.Nilpotent (#12184)

Mathlib.RingTheory.Nilpotent has a few very simple definitions (Mathlib.Data.Nat.Lattice is sufficient to state them), but needs some pretty heavy imports (ideals, linear algebra) towards the end. This change moves the heavier parts into a new file.

Diff
@@ -8,7 +8,7 @@ import Mathlib.RingTheory.Localization.AtPrime
 import Mathlib.RingTheory.Localization.Away.Basic
 import Mathlib.RingTheory.Localization.Integer
 import Mathlib.RingTheory.Localization.Submodule
-import Mathlib.RingTheory.Nilpotent
+import Mathlib.RingTheory.Nilpotent.Lemmas
 import Mathlib.RingTheory.RingHomProperties
 import Mathlib.Data.Set.Subsingleton
 
chore: split Subsingleton,Nontrivial off of Data.Set.Basic (#11832)

Moves definition of and lemmas related to Set.Subsingleton and Set.Nontrivial to a new file, so that Basic can be shorter.

Diff
@@ -10,7 +10,7 @@ import Mathlib.RingTheory.Localization.Integer
 import Mathlib.RingTheory.Localization.Submodule
 import Mathlib.RingTheory.Nilpotent
 import Mathlib.RingTheory.RingHomProperties
-import Mathlib.Data.Set.Basic
+import Mathlib.Data.Set.Subsingleton
 
 #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
 
style: replace '.-/' by '. -/' (#11938)

Purely automatic replacement. If this is in any way controversial; I'm happy to just close this PR.

Diff
@@ -472,7 +472,7 @@ theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebr
 #align is_localization.smul_mem_finset_integer_multiple_span IsLocalization.smul_mem_finsetIntegerMultiple_span
 
 /-- If `S` is an `R' = M⁻¹R` algebra, and `x ∈ span R' s`,
-then `t • x ∈ span R s` for some `t : M`.-/
+then `t • x ∈ span R s` for some `t : M`. -/
 theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
     [IsScalarTower R R' S] [IsLocalization M R'] (s : Set S) (x : S)
     (hx : x ∈ Submodule.span R' s) : ∃ t : M, t • x ∈ Submodule.span R s := by
@@ -497,7 +497,7 @@ theorem multiple_mem_span_of_mem_localization_span [Algebra R' S] [Algebra R S]
 #align multiple_mem_span_of_mem_localization_span multiple_mem_span_of_mem_localization_span
 
 /-- If `S` is an `R' = M⁻¹R` algebra, and `x ∈ adjoin R' s`,
-then `t • x ∈ adjoin R s` for some `t : M`.-/
+then `t • x ∈ adjoin R s` for some `t : M`. -/
 theorem multiple_mem_adjoin_of_mem_localization_adjoin [Algebra R' S] [Algebra R S]
     [IsScalarTower R R' S] [IsLocalization M R'] (s : Set S) (x : S)
     (hx : x ∈ Algebra.adjoin R' s) : ∃ t : M, t • x ∈ Algebra.adjoin R s := by
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -317,7 +317,7 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
   apply_fun (· * (m' : R) ^ n) at hm'
   simp only [mul_assoc, zero_mul, mul_zero] at hm'
-  rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
+  rw [← mul_left_comm, ← pow_succ', ← mul_pow] at hm'
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
   rw [← (IsLocalization.map_units S m).mul_left_inj, hx, zero_mul,
     IsLocalization.map_eq_zero_iff M]
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
@@ -44,9 +44,7 @@ open scoped Pointwise Classical BigOperators
 universe u
 
 variable {R S : Type u} [CommRing R] [CommRing S] (M : Submonoid R)
-
 variable (N : Submonoid S) (R' S' : Type u) [CommRing R'] [CommRing S'] (f : R →+* S)
-
 variable [Algebra R R'] [Algebra S S']
 
 section Properties
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -382,8 +382,8 @@ lemma Module.Finite_of_isLocalization (R S Rₚ Sₚ) [CommSemiring R] [CommRing
     Module.Finite Rₚ Sₚ := by
   classical
   have : algebraMap Rₚ Sₚ = IsLocalization.map (T := Algebra.algebraMapSubmonoid S M) Sₚ
-    (algebraMap R S) (Submonoid.le_comap_map M)
-  · apply IsLocalization.ringHom_ext M
+      (algebraMap R S) (Submonoid.le_comap_map M) := by
+    apply IsLocalization.ringHom_ext M
     simp only [IsLocalization.map_comp, ← IsScalarTower.algebraMap_eq]
   -- We claim that if `S` is generated by `T` as an `R`-module,
   -- then `S'` is generated by `T` as an `R'`-module.
@@ -420,8 +420,8 @@ theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite := b
   have : IsScalarTower R R' S' := IsScalarTower.of_algebraMap_eq'
     (IsLocalization.map_comp M.le_comap_map).symm
   have : IsScalarTower R S S' := IsScalarTower.of_algebraMap_eq' rfl
-  have : IsLocalization (Algebra.algebraMapSubmonoid S M) S'
-  · rwa [Algebra.algebraMapSubmonoid, RingHom.algebraMap_toAlgebra]
+  have : IsLocalization (Algebra.algebraMapSubmonoid S M) S' := by
+    rwa [Algebra.algebraMapSubmonoid, RingHom.algebraMap_toAlgebra]
   have : Module.Finite R S := hf
   apply Module.Finite_of_isLocalization R S R' S' M
 #align localization_finite localization_finite
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -398,7 +398,9 @@ lemma Module.Finite_of_isLocalization (R S Rₚ Sₚ) [CommSemiring R] [CommRing
   rw [IsLocalization.mk'_eq_mul_mk'_one, mul_comm, Finset.coe_image]
   have hy : y ∈ Submodule.span R ↑T := by rw [hT]; trivial
   replace hy : algebraMap S Sₚ y ∈ Submodule.map (IsScalarTower.toAlgHom R S Sₚ).toLinearMap
-    (Submodule.span R (T : Set S)) := Submodule.mem_map_of_mem hy
+    (Submodule.span R (T : Set S)) := Submodule.mem_map_of_mem
+--     -- Note: #8386 had to specify the value of `f` below
+      (f := (IsScalarTower.toAlgHom R S Sₚ).toLinearMap) hy
   rw [Submodule.map_span (IsScalarTower.toAlgHom R S Sₚ).toLinearMap T] at hy
   have H : Submodule.span R (algebraMap S Sₚ '' T) ≤
       (Submodule.span Rₚ (algebraMap S Sₚ '' T)).restrictScalars R := by
chore(*): shake imports (#10199)
  • Remove Data.Set.Basic from scripts/noshake.json.
  • Remove an exception that was used by examples only, move these examples to a new test file.
  • Drop an exception for Order.Filter.Basic dependency on Control.Traversable.Instances, as the relevant parts were moved to Order.Filter.ListTraverse.
  • Run lake exe shake --fix.
Diff
@@ -10,6 +10,7 @@ import Mathlib.RingTheory.Localization.Integer
 import Mathlib.RingTheory.Localization.Submodule
 import Mathlib.RingTheory.Nilpotent
 import Mathlib.RingTheory.RingHomProperties
+import Mathlib.Data.Set.Basic
 
 #align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
 
feat: Define intNorm and intTrace. (#9265)

Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com>

Diff
@@ -374,40 +374,53 @@ end Surjective
 
 section Finite
 
-/-- If `S` is a finite `R`-algebra, then `S' = M⁻¹S` is a finite `R' = M⁻¹R`-algebra. -/
-theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite := by
-  introv R hf
-  -- Setting up the `algebra` and `is_scalar_tower` instances needed
-  letI := f.toAlgebra
-  letI := ((algebraMap S S').comp f).toAlgebra
-  let f' : R' →+* S' := IsLocalization.map S' f (Submonoid.le_comap_map M)
-  letI := f'.toAlgebra
-  haveI : IsScalarTower R R' S' := IsScalarTower.of_algebraMap_eq'
-    (IsLocalization.map_comp M.le_comap_map).symm
-  let fₐ : S →ₐ[R] S' := AlgHom.mk' (algebraMap S S') fun c x => RingHom.map_mul _ _ _
+lemma Module.Finite_of_isLocalization (R S Rₚ Sₚ) [CommSemiring R] [CommRing S] [CommRing Rₚ]
+    [CommRing Sₚ] [Algebra R S] [Algebra R Rₚ] [Algebra R Sₚ] [Algebra S Sₚ] [Algebra Rₚ Sₚ]
+    [IsScalarTower R S Sₚ] [IsScalarTower R Rₚ Sₚ] (M : Submonoid R) [IsLocalization M Rₚ]
+    [IsLocalization (Algebra.algebraMapSubmonoid S M) Sₚ] [hRS : Module.Finite R S] :
+    Module.Finite Rₚ Sₚ := by
+  classical
+  have : algebraMap Rₚ Sₚ = IsLocalization.map (T := Algebra.algebraMapSubmonoid S M) Sₚ
+    (algebraMap R S) (Submonoid.le_comap_map M)
+  · apply IsLocalization.ringHom_ext M
+    simp only [IsLocalization.map_comp, ← IsScalarTower.algebraMap_eq]
   -- We claim that if `S` is generated by `T` as an `R`-module,
   -- then `S'` is generated by `T` as an `R'`-module.
-  obtain ⟨T, hT⟩ := hf
-  use T.image (algebraMap S S')
+  obtain ⟨T, hT⟩ := hRS
+  use T.image (algebraMap S Sₚ)
   rw [eq_top_iff]
   rintro x -
   -- By the hypotheses, for each `x : S'`, we have `x = y / (f r)` for some `y : S` and `r : M`.
   -- Since `S` is generated by `T`, the image of `y` should fall in the span of the image of `T`.
-  obtain ⟨y, ⟨_, ⟨r, hr, rfl⟩⟩, rfl⟩ := IsLocalization.mk'_surjective (M.map f) x
+  obtain ⟨y, ⟨_, ⟨r, hr, rfl⟩⟩, rfl⟩ :=
+    IsLocalization.mk'_surjective (Algebra.algebraMapSubmonoid S M) x
   rw [IsLocalization.mk'_eq_mul_mk'_one, mul_comm, Finset.coe_image]
   have hy : y ∈ Submodule.span R ↑T := by rw [hT]; trivial
-  replace hy : algebraMap S S' y ∈ Submodule.map fₐ.toLinearMap (Submodule.span R (T : Set S)) :=
-    Submodule.mem_map_of_mem hy
-  rw [Submodule.map_span fₐ.toLinearMap T] at hy
-  have H : Submodule.span R (algebraMap S S' '' T) ≤
-      (Submodule.span R' (algebraMap S S' '' T)).restrictScalars R := by
+  replace hy : algebraMap S Sₚ y ∈ Submodule.map (IsScalarTower.toAlgHom R S Sₚ).toLinearMap
+    (Submodule.span R (T : Set S)) := Submodule.mem_map_of_mem hy
+  rw [Submodule.map_span (IsScalarTower.toAlgHom R S Sₚ).toLinearMap T] at hy
+  have H : Submodule.span R (algebraMap S Sₚ '' T) ≤
+      (Submodule.span Rₚ (algebraMap S Sₚ '' T)).restrictScalars R := by
     rw [Submodule.span_le]; exact Submodule.subset_span
   -- Now, since `y ∈ span T`, and `(f r)⁻¹ ∈ R'`, `x / (f r)` is in `span T` as well.
-  convert (Submodule.span R' (algebraMap S S' '' T)).smul_mem
-    (IsLocalization.mk' R' (1 : R) ⟨r, hr⟩) (H hy) using 1
-  rw [Algebra.smul_def]
-  erw [IsLocalization.map_mk' M.le_comap_map]
-  rw [map_one]
+  convert (Submodule.span Rₚ (algebraMap S Sₚ '' T)).smul_mem
+    (IsLocalization.mk' Rₚ (1 : R) ⟨r, hr⟩) (H hy) using 1
+  rw [Algebra.smul_def, this, IsLocalization.map_mk', map_one]
+
+/-- If `S` is a finite `R`-algebra, then `S' = M⁻¹S` is a finite `R' = M⁻¹R`-algebra. -/
+theorem localization_finite : RingHom.LocalizationPreserves @RingHom.Finite := by
+  introv R hf
+  letI := f.toAlgebra
+  letI := ((algebraMap S S').comp f).toAlgebra
+  let f' : R' →+* S' := IsLocalization.map S' f (Submonoid.le_comap_map M)
+  letI := f'.toAlgebra
+  have : IsScalarTower R R' S' := IsScalarTower.of_algebraMap_eq'
+    (IsLocalization.map_comp M.le_comap_map).symm
+  have : IsScalarTower R S S' := IsScalarTower.of_algebraMap_eq' rfl
+  have : IsLocalization (Algebra.algebraMapSubmonoid S M) S'
+  · rwa [Algebra.algebraMapSubmonoid, RingHom.algebraMap_toAlgebra]
+  have : Module.Finite R S := hf
+  apply Module.Finite_of_isLocalization R S R' S' M
 #align localization_finite localization_finite
 
 theorem localization_away_map_finite (r : R) [IsLocalization.Away r R']
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -38,8 +38,6 @@ The following properties are covered:
 
 -/
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 open scoped Pointwise Classical BigOperators
 
 universe u
perf(AlgebraicGeometry): Fix slow and bad proofs (#7747)

Fixed AlgebraicGeometry/AffineSchemes.lean, AlgebraicGeometry/Morphisms/QuasiSeparated.lean and AlgebraicGeometry/Morphisms/RingHomProperties.lean.

Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -212,6 +212,20 @@ theorem RingHom.PropertyIsLocal.ofLocalizationSpan (hP : RingHom.PropertyIsLocal
   exact (IsLocalization.map_comp _).symm
 #align ring_hom.property_is_local.of_localization_span RingHom.PropertyIsLocal.ofLocalizationSpan
 
+lemma RingHom.OfLocalizationSpanTarget.ofIsLocalization
+    (hP : RingHom.OfLocalizationSpanTarget P) (hP' : RingHom.RespectsIso P)
+    {R S : Type u} [CommRing R] [CommRing S] (f : R →+* S) (s : Set S) (hs : Ideal.span s = ⊤)
+    (hT : ∀ r : s, ∃ (T : Type u) (_ : CommRing T) (_ : Algebra S T)
+      (_ : IsLocalization.Away (r : S) T), P ((algebraMap S T).comp f)) : P f := by
+  apply hP _ s hs
+  intros r
+  obtain ⟨T, _, _, _, hT⟩ := hT r
+  convert hP'.1 _
+    (Localization.algEquiv (R := S) (Submonoid.powers (r : S)) T).symm.toRingEquiv hT
+  rw [← RingHom.comp_assoc, RingEquiv.toRingHom_eq_coe, AlgEquiv.toRingEquiv_eq_coe,
+    AlgEquiv.toRingEquiv_toRingHom, Localization.coe_algEquiv_symm, IsLocalization.map_comp,
+    RingHom.comp_id]
+
 end RingHom
 
 end Properties
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -301,14 +301,14 @@ theorem localization_isReduced : LocalizationPreserves fun R hR => IsReduced R :
   obtain ⟨⟨y, m⟩, hx⟩ := IsLocalization.surj M x
   dsimp only at hx
   let hx' := congr_arg (· ^ n.succ) hx
-  simp only [mul_pow, e, MulZeroClass.zero_mul, ← RingHom.map_pow] at hx'
+  simp only [mul_pow, e, zero_mul, ← RingHom.map_pow] at hx'
   rw [← (algebraMap R S).map_zero] at hx'
   obtain ⟨m', hm'⟩ := (IsLocalization.eq_iff_exists M S).mp hx'
   apply_fun (· * (m' : R) ^ n) at hm'
-  simp only [mul_assoc, MulZeroClass.zero_mul, MulZeroClass.mul_zero] at hm'
+  simp only [mul_assoc, zero_mul, mul_zero] at hm'
   rw [← mul_left_comm, ← pow_succ, ← mul_pow] at hm'
   replace hm' := IsNilpotent.eq_zero ⟨_, hm'.symm⟩
-  rw [← (IsLocalization.map_units S m).mul_left_inj, hx, MulZeroClass.zero_mul,
+  rw [← (IsLocalization.map_units S m).mul_left_inj, hx, zero_mul,
     IsLocalization.map_eq_zero_iff M]
   exact ⟨m', by rw [← hm', mul_comm]⟩
 #align localization_is_reduced localization_isReduced
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -38,7 +38,7 @@ The following properties are covered:
 
 -/
 
-local macro_rules | `($x ^ $y)   => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 open scoped Pointwise Classical BigOperators
 
chore: replace (Algebra.ofId R A).toLinearMap with Algebra.linearMap R A (#6208)

A tiny bit of clean up, with the aim of increasing awareness of Algebra.linearMap

Diff
@@ -346,7 +346,7 @@ theorem surjective_ofLocalizationSpan :
   letI := f.toAlgebra
   intro x
   apply Submodule.mem_of_span_eq_top_of_smul_pow_mem
-    (LinearMap.range (Algebra.ofId R S).toLinearMap) s e
+    (LinearMap.range (Algebra.linearMap R S)) s e
   intro r
   obtain ⟨a, e'⟩ := H r (algebraMap _ _ x)
   obtain ⟨b, ⟨_, n, rfl⟩, rfl⟩ := IsLocalization.mk'_surjective (Submonoid.powers (r : R)) a
chore: fix grammar mistakes (#6121)
Diff
@@ -63,7 +63,7 @@ def LocalizationPreserves : Prop :=
     [IsLocalization M S], @P R hR → @P S hS
 #align localization_preserves LocalizationPreserves
 
-/-- A property `P` of comm rings satisfies `OfLocalizationMaximal` if
+/-- A property `P` of comm rings satisfies `OfLocalizationMaximal`
   if `P` holds for `R` whenever `P` holds for `Rₘ` for all maximal ideal `m`. -/
 def OfLocalizationMaximal : Prop :=
   ∀ (R : Type u) [CommRing R],
@@ -137,8 +137,8 @@ def RingHom.OfLocalizationSpanTarget : Prop :=
     (_ : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f
 #align ring_hom.of_localization_span_target RingHom.OfLocalizationSpanTarget
 
-/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationPrime` if
-  if `P` holds for `R` whenever `P` holds for `Rₘ` for all prime ideals `p`. -/
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationPrime`
+if `P` holds for `R` whenever `P` holds for `Rₘ` for all prime ideals `p`. -/
 def RingHom.OfLocalizationPrime : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S),
     (∀ (J : Ideal S) (_ : J.IsPrime), P (Localization.localRingHom _ J f rfl)) → P f
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,11 +2,6 @@
 Copyright (c) 2021 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.local_properties
-! leanprover-community/mathlib commit a7c017d750512a352b623b1824d75da5998457d0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.FiniteType
 import Mathlib.RingTheory.Localization.AtPrime
@@ -16,6 +11,8 @@ import Mathlib.RingTheory.Localization.Submodule
 import Mathlib.RingTheory.Nilpotent
 import Mathlib.RingTheory.RingHomProperties
 
+#align_import ring_theory.local_properties from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
+
 /-!
 # Local properties of commutative rings
 
chore: fix grammar in docs (#5668)
Diff
@@ -406,7 +406,7 @@ theorem localization_away_map_finite (r : R) [IsLocalization.Away r R']
   localization_finite.away r hf
 #align localization_away_map_finite localization_away_map_finite
 
-/-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
+/-- Let `S` be an `R`-algebra, `M` a submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the span of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
 span of `IsLocalization.finsetIntegerMultiple _ s` over `R`.
@@ -595,7 +595,7 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
     mul_comm]
 #align is_localization.exists_smul_mem_of_mem_adjoin IsLocalization.exists_smul_mem_of_mem_adjoin
 
-/-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
+/-- Let `S` be an `R`-algebra, `M` a submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the adjoin of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
 adjoin of `IsLocalization.finsetIntegerMultiple _ s` over `R`.
chore: tidy various files (#5233)
Diff
@@ -26,7 +26,7 @@ In this file, we provide the proofs of various local properties.
 * `localization_P` : `P` holds for `S⁻¹R` if `P` holds for `R`.
 * `P_of_localization_maximal` : `P` holds for `R` if `P` holds for `Rₘ` for all maximal `m`.
 * `P_of_localization_prime` : `P` holds for `R` if `P` holds for `Rₘ` for all prime `m`.
-* `P_of_localization_span` : `P` holds for `R` if given a spanning set `{fᵢ}`, `P` holds for all
+* `P_ofLocalizationSpan` : `P` holds for `R` if given a spanning set `{fᵢ}`, `P` holds for all
   `R_{fᵢ}`.
 
 ## Main results
@@ -35,9 +35,9 @@ The following properties are covered:
 
 * The triviality of an ideal or an element:
   `ideal_eq_bot_of_localization`, `eq_zero_of_localization`
-* `is_reduced` : `localization_is_reduced`, `is_reduced_of_localization_maximal`.
-* `finite`: `localization_finite`, `finite_of_localization_span`
-* `finite_type`: `localization_finite_type`, `finite_type_of_localization_span`
+* `isReduced` : `localization_isReduced`, `isReduced_of_localization_maximal`.
+* `finite`: `localization_finite`, `finite_ofLocalizationSpan`
+* `finiteType`: `localization_finiteType`, `finiteType_ofLocalizationSpan`
 
 -/
 
@@ -66,7 +66,7 @@ def LocalizationPreserves : Prop :=
     [IsLocalization M S], @P R hR → @P S hS
 #align localization_preserves LocalizationPreserves
 
-/-- A property `P` of comm rings satisfies `of_localization_maximal` if
+/-- A property `P` of comm rings satisfies `OfLocalizationMaximal` if
   if `P` holds for `R` whenever `P` holds for `Rₘ` for all maximal ideal `m`. -/
 def OfLocalizationMaximal : Prop :=
   ∀ (R : Type u) [CommRing R],
@@ -88,59 +88,59 @@ def RingHom.LocalizationPreserves :=
     P f → P (IsLocalization.map S' f (Submonoid.le_comap_map M) : R' →+* S')
 #align ring_hom.localization_preserves RingHom.LocalizationPreserves
 
-/-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span`
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationFiniteSpan`
 if `P` holds for `R →+* S` whenever there exists a finite set `{ r }` that spans `R` such that
 `P` holds for `Rᵣ →+* Sᵣ`.
 
-Note that this is equivalent to `ring_hom.of_localization_span` via
-`ring_hom.of_localization_span_iff_finite`, but this is easier to prove. -/
+Note that this is equivalent to `RingHom.OfLocalizationSpan` via
+`RingHom.ofLocalizationSpan_iff_finite`, but this is easier to prove. -/
 def RingHom.OfLocalizationFiniteSpan :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Finset R)
     (_ : Ideal.span (s : Set R) = ⊤) (_ : ∀ r : s, P (Localization.awayMap f r)), P f
 #align ring_hom.of_localization_finite_span RingHom.OfLocalizationFiniteSpan
 
-/-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span`
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationFiniteSpan`
 if `P` holds for `R →+* S` whenever there exists a set `{ r }` that spans `R` such that
 `P` holds for `Rᵣ →+* Sᵣ`.
 
-Note that this is equivalent to `ring_hom.of_localization_finite_span` via
-`ring_hom.of_localization_span_iff_finite`, but this has less restrictions when applying. -/
+Note that this is equivalent to `RingHom.OfLocalizationFiniteSpan` via
+`RingHom.ofLocalizationSpan_iff_finite`, but this has less restrictions when applying. -/
 def RingHom.OfLocalizationSpan :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set R) (_ : Ideal.span s = ⊤)
     (_ : ∀ r : s, P (Localization.awayMap f r)), P f
 #align ring_hom.of_localization_span RingHom.OfLocalizationSpan
 
-/-- A property `P` of ring homs satisfies `ring_hom.holds_for_localization_away`
+/-- A property `P` of ring homs satisfies `RingHom.HoldsForLocalizationAway`
  if `P` holds for each localization map `R →+* Rᵣ`. -/
 def RingHom.HoldsForLocalizationAway : Prop :=
   ∀ ⦃R : Type u⦄ (S : Type u) [CommRing R] [CommRing S] [Algebra R S] (r : R)
     [IsLocalization.Away r S], P (algebraMap R S)
 #align ring_hom.holds_for_localization_away RingHom.HoldsForLocalizationAway
 
-/-- A property `P` of ring homs satisfies `ring_hom.of_localization_finite_span_target`
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationFiniteSpanTarget`
 if `P` holds for `R →+* S` whenever there exists a finite set `{ r }` that spans `S` such that
 `P` holds for `R →+* Sᵣ`.
 
-Note that this is equivalent to `ring_hom.of_localization_span_target` via
-`ring_hom.of_localization_span_target_iff_finite`, but this is easier to prove. -/
+Note that this is equivalent to `RingHom.OfLocalizationSpanTarget` via
+`RingHom.ofLocalizationSpanTarget_iff_finite`, but this is easier to prove. -/
 def RingHom.OfLocalizationFiniteSpanTarget : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Finset S)
     (_ : Ideal.span (s : Set S) = ⊤)
     (_ : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f
 #align ring_hom.of_localization_finite_span_target RingHom.OfLocalizationFiniteSpanTarget
 
-/-- A property `P` of ring homs satisfies `ring_hom.of_localization_span_target`
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationSpanTarget`
 if `P` holds for `R →+* S` whenever there exists a set `{ r }` that spans `S` such that
 `P` holds for `R →+* Sᵣ`.
 
-Note that this is equivalent to `ring_hom.of_localization_finite_span_target` via
-`ring_hom.of_localization_span_target_iff_finite`, but this has less restrictions when applying. -/
+Note that this is equivalent to `RingHom.OfLocalizationFiniteSpanTarget` via
+`RingHom.ofLocalizationSpanTarget_iff_finite`, but this has less restrictions when applying. -/
 def RingHom.OfLocalizationSpanTarget : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S) (s : Set S) (_ : Ideal.span s = ⊤)
     (_ : ∀ r : s, P ((algebraMap S (Localization.Away (r : S))).comp f)), P f
 #align ring_hom.of_localization_span_target RingHom.OfLocalizationSpanTarget
 
-/-- A property `P` of ring homs satisfies `of_localization_prime` if
+/-- A property `P` of ring homs satisfies `RingHom.OfLocalizationPrime` if
   if `P` holds for `R` whenever `P` holds for `Rₘ` for all prime ideals `p`. -/
 def RingHom.OfLocalizationPrime : Prop :=
   ∀ ⦃R S : Type u⦄ [CommRing R] [CommRing S] (f : R →+* S),
@@ -223,7 +223,7 @@ section Ideal
 
 open scoped nonZeroDivisors
 
-/-- Let `I J : ideal R`. If the localization of `I` at each maximal ideal `P` is included in
+/-- Let `I J : Ideal R`. If the localization of `I` at each maximal ideal `P` is included in
 the localization of `J` at `P`, then `I ≤ J`. -/
 theorem Ideal.le_of_localization_maximal {I J : Ideal R}
     (h : ∀ (P : Ideal R) (hP : P.IsMaximal),
@@ -247,7 +247,7 @@ theorem Ideal.le_of_localization_maximal {I J : Ideal R}
   simpa only [mul_assoc, eq] using J.mul_mem_left m ha
 #align ideal.le_of_localization_maximal Ideal.le_of_localization_maximal
 
-/-- Let `I J : ideal R`. If the localization of `I` at each maximal ideal `P` is equal to
+/-- Let `I J : Ideal R`. If the localization of `I` at each maximal ideal `P` is equal to
 the localization of `J` at `P`, then `I = J`. -/
 theorem Ideal.eq_of_localization_maximal {I J : Ideal R}
     (h : ∀ (P : Ideal R) (_ : P.IsMaximal),
@@ -409,7 +409,7 @@ theorem localization_away_map_finite (r : R) [IsLocalization.Away r R']
 /-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the span of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
-span of `finset_integer_multiple _ s` over `R`.
+span of `IsLocalization.finsetIntegerMultiple _ s` over `R`.
 -/
 theorem IsLocalization.smul_mem_finsetIntegerMultiple_span [Algebra R S] [Algebra R S']
     [IsScalarTower R S S'] [IsLocalization (M.map (algebraMap R S)) S'] (x : S) (s : Finset S')
@@ -598,7 +598,7 @@ theorem IsLocalization.exists_smul_mem_of_mem_adjoin [Algebra R S] [Algebra R S'
 /-- Let `S` be an `R`-algebra, `M` an submonoid of `R`, and `S' = M⁻¹S`.
 If the image of some `x : S` falls in the adjoin of some finite `s ⊆ S'` over `R`,
 then there exists some `m : M` such that `m • x` falls in the
-adjoin of `finset_integer_multiple _ s` over `R`.
+adjoin of `IsLocalization.finsetIntegerMultiple _ s` over `R`.
 -/
 theorem IsLocalization.lift_mem_adjoin_finsetIntegerMultiple [Algebra R S] [Algebra R S']
     [IsScalarTower R S S'] [IsLocalization (M.map (algebraMap R S)) S'] (x : S) (s : Finset S')
@@ -616,7 +616,7 @@ theorem IsLocalization.lift_mem_adjoin_finsetIntegerMultiple [Algebra R S] [Alge
 theorem finiteType_ofLocalizationSpan : RingHom.OfLocalizationSpan @RingHom.FiniteType := by
   rw [RingHom.ofLocalizationSpan_iff_finite]
   introv R hs H
-  -- mirrors the proof of `finite_of_localization_span`
+  -- mirrors the proof of `finite_ofLocalizationSpan`
   letI := f.toAlgebra
   letI := fun r : s => (Localization.awayMap f r).toAlgebra
   have : ∀ r : s,
feat: port RingTheory.LocalProperties (#5010)

Co-authored-by: int-y1 <jason_yuen2007@hotmail.com> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Dependencies 10 + 685

686 files ported (98.6%)
279297 lines ported (98.8%)
Show graph

The unported dependencies are