ring_theory.discrete_valuation_ring.tfaeMathlib.RingTheory.DiscreteValuationRing.TFAE

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -127,7 +127,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
   have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
     by
     intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
-    rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
+    rw [hn, pow_succ]; exact Ideal.mul_mem_mul hb₁ hm
   have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
   let K := FractionRing R
   let x : K := algebraMap R K b / algebraMap R K a
@@ -138,7 +138,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
       refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
       apply IsFractionRing.injective R K
-      rw [map_mul, e, div_mul_cancel _ ha₃]
+      rw [map_mul, e, div_mul_cancel₀ _ ha₃]
     · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
       exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
     · apply Submodule.FG.map; exact IsNoetherian.noetherian _
@@ -148,7 +148,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
       obtain ⟨k, hk⟩ := hb₃ m hm
       have hk' : x * algebraMap R K m = algebraMap R K k := by
-        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
+        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel_right₀ _ ha₃]
       exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
     obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
       by
@@ -164,7 +164,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
 #print DiscreteValuationRing.TFAE /-
 theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
Diff
@@ -73,7 +73,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
       exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
   have : ∃ n : ℕ, x ^ n ∈ I :=
     by
-    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg at h ; apply hI;
+    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg at h; apply hI;
       rw [eq_bot_iff]; exact h
     obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
     use n
@@ -82,7 +82,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
   apply le_antisymm
   · change ∀ s ∈ I, s ∈ _
     by_contra hI''
-    push_neg at hI'' 
+    push_neg at hI''
     obtain ⟨s, hs₁, hs₂⟩ := hI''
     apply hs₂
     by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
@@ -102,7 +102,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
   classical
   by_cases ne_bot : maximal_ideal R = ⊥
   · rw [ne_bot]; infer_instance
-  obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg at h' ;
+  obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg at h';
     apply ne_bot; rwa [eq_bot_iff]
   have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
   have : (Ideal.span {a}).radical = maximal_ideal R :=
@@ -118,11 +118,11 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
   cases hn : Nat.find this
   · have := Nat.find_spec this
-    rw [hn, pow_zero, Ideal.one_eq_top] at this 
+    rw [hn, pow_zero, Ideal.one_eq_top] at this
     exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
   obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
     by
-    by_contra h'; push_neg at h' ; rw [Nat.find_eq_iff] at hn 
+    by_contra h'; push_neg at h'; rw [Nat.find_eq_iff] at hn
     exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
   have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
     by
@@ -152,13 +152,13 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
     obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
       by
-      rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
+      rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this
       obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
-      rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
+      rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy'
       exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
     refine' ⟨⟨y, _⟩⟩
     apply le_antisymm
-    · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
+    · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk
       rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
     · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
@@ -205,17 +205,17 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     use Submodule.Quotient.mk x'
     constructor
     · intro e
-      rw [Submodule.Quotient.mk_eq_zero] at e 
+      rw [Submodule.Quotient.mk_eq_zero] at e
       apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
       apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
       · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
       · conv_lhs => rw [hx]
-        rw [Submodule.mem_smul_top_iff] at e 
+        rw [Submodule.mem_smul_top_iff] at e
         rwa [Submodule.span_le, Set.singleton_subset_iff]
       · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
     · refine' fun w => Quotient.inductionOn' w fun y => _
       obtain ⟨y, hy⟩ := y
-      rw [hx, Submodule.mem_span_singleton] at hy 
+      rw [hx, Submodule.mem_span_singleton] at hy
       obtain ⟨a, rfl⟩ := hy
       exact ⟨Ideal.Quotient.mk _ a, rfl⟩
   tfae_have 6 → 5
@@ -237,13 +237,13 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
       · infer_instance
       · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
       · have := (Submodule.Quotient.eq _).mp hc
-        rw [Submodule.mem_smul_top_iff] at this 
+        rw [Submodule.mem_smul_top_iff] at this
         exact Ideal.mem_sup_right this
     have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
       rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
     have :=
       Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
-    rw [Submodule.bot_smul, sup_bot_eq] at this 
+    rw [Submodule.bot_smul, sup_bot_eq] at this
     rw [← sup_eq_left, eq_comm]
     exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
   tfae_have 5 → 7
Diff
@@ -182,7 +182,7 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   tfae_have 2 → 1
   · intro
     haveI := IsBezout.toGCDDomain R
-    haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
+    haveI : UniqueFactorizationMonoid R := ufm_of_decomposition_of_wfDvdMonoid
     apply DiscreteValuationRing.of_ufd_of_unique_irreducible
     · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
       obtain ⟨p, hp₁, hp₂⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
Diff
@@ -41,13 +41,126 @@ open scoped BigOperators
 #print exists_maximalIdeal_pow_eq_of_principal /-
 theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
-    ∃ n : ℕ, I = maximalIdeal R ^ n := by classical
+    ∃ n : ℕ, I = maximalIdeal R ^ n := by
+  classical
+  obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
+  by_cases hI' : I = ⊤
+  · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
+  have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
+    (set_like.ext_iff.mp hx r).trans Ideal.mem_span_singleton
+  have : x ≠ 0 := by
+    rintro rfl
+    apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
+    simp [hx]
+  have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
+  have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r :=
+    by
+    intro r hr₁ hr₂
+    obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
+    have : ∀ b ∈ f, Associated x b := by
+      intro b hb
+      exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
+    clear hr₁ hr₂ hf₁
+    induction' f using Multiset.induction with fa fs fh
+    · exact (hf₂ rfl).elim
+    rcases eq_or_ne fs ∅ with (rfl | hf')
+    · use 1
+      rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
+      exact this _ (Multiset.mem_cons_self _ _)
+    · obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
+      use n + 1
+      rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
+      exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
+  have : ∃ n : ℕ, x ^ n ∈ I :=
+    by
+    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg at h ; apply hI;
+      rw [eq_bot_iff]; exact h
+    obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
+    use n
+    rwa [← I.unit_mul_mem_iff_mem u.is_unit, mul_comm]
+  use Nat.find this
+  apply le_antisymm
+  · change ∀ s ∈ I, s ∈ _
+    by_contra hI''
+    push_neg at hI'' 
+    obtain ⟨s, hs₁, hs₂⟩ := hI''
+    apply hs₂
+    by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
+    obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
+    rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁ ⊢
+    apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
+    apply Ideal.pow_mem_pow
+    exact (H _).mpr (dvd_refl _)
+  · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
+    exact Nat.find_spec this
 #align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
 -/
 
 #print maximalIdeal_isPrincipal_of_isDedekindDomain /-
 theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
-    [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by classical
+    [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by
+  classical
+  by_cases ne_bot : maximal_ideal R = ⊥
+  · rw [ne_bot]; infer_instance
+  obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg at h' ;
+    apply ne_bot; rwa [eq_bot_iff]
+  have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
+  have : (Ideal.span {a}).radical = maximal_ideal R :=
+    by
+    rw [Ideal.radical_eq_sInf]
+    apply le_antisymm
+    · exact sInf_le ⟨hle, inferInstance⟩
+    · refine'
+        le_sInf fun I hI =>
+          (eq_maximal_ideal <| IsDedekindDomain.dimensionLEOne _ (fun e => ha₂ _) hI.2).ge
+      rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
+  have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} := by rw [← this];
+    apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
+  cases hn : Nat.find this
+  · have := Nat.find_spec this
+    rw [hn, pow_zero, Ideal.one_eq_top] at this 
+    exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
+  obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
+    by
+    by_contra h'; push_neg at h' ; rw [Nat.find_eq_iff] at hn 
+    exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
+  have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
+    by
+    intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
+    rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
+  have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
+  let K := FractionRing R
+  let x : K := algebraMap R K b / algebraMap R K a
+  let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximal_ideal R)
+  have ha₃ : algebraMap R K a ≠ 0 := is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
+  by_cases hx : ∀ y ∈ M, x * y ∈ M
+  · have := isIntegral_of_smul_mem_submodule M _ _ x hx
+    · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
+      refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
+      apply IsFractionRing.injective R K
+      rw [map_mul, e, div_mul_cancel _ ha₃]
+    · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
+      exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
+    · apply Submodule.FG.map; exact IsNoetherian.noetherian _
+  · have : (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
+      by
+      by_contra h; apply hx
+      rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
+      obtain ⟨k, hk⟩ := hb₃ m hm
+      have hk' : x * algebraMap R K m = algebraMap R K k := by
+        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
+      exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
+    obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
+      by
+      rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
+      obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
+      rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
+      exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
+    refine' ⟨⟨y, _⟩⟩
+    apply le_antisymm
+    · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
+      rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
+    · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
@@ -63,6 +176,91 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   by
   have ne_bot := Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
   classical
+  rw [finrank_eq_one_iff']
+  tfae_have 1 → 2
+  · intro; infer_instance
+  tfae_have 2 → 1
+  · intro
+    haveI := IsBezout.toGCDDomain R
+    haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
+    apply DiscreteValuationRing.of_ufd_of_unique_irreducible
+    · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
+      obtain ⟨p, hp₁, hp₂⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
+      exact ⟨p, hp₁⟩
+    · exact ValuationRing.unique_irreducible
+  tfae_have 1 → 4
+  · intro H
+    exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
+  tfae_have 4 → 3
+  · rintro ⟨h₁, h₂⟩;
+    exact
+      ⟨inferInstance, fun I hI hI' =>
+        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximal_ideal.is_maximal R, h₁⟩
+  tfae_have 3 → 5
+  · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
+  tfae_have 5 → 6
+  · rintro ⟨x, hx⟩
+    have : x ∈ maximal_ideal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
+    let x' : maximal_ideal R := ⟨x, this⟩
+    use Submodule.Quotient.mk x'
+    constructor
+    · intro e
+      rw [Submodule.Quotient.mk_eq_zero] at e 
+      apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
+      apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
+      · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
+      · conv_lhs => rw [hx]
+        rw [Submodule.mem_smul_top_iff] at e 
+        rwa [Submodule.span_le, Set.singleton_subset_iff]
+      · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
+    · refine' fun w => Quotient.inductionOn' w fun y => _
+      obtain ⟨y, hy⟩ := y
+      rw [hx, Submodule.mem_span_singleton] at hy 
+      obtain ⟨a, rfl⟩ := hy
+      exact ⟨Ideal.Quotient.mk _ a, rfl⟩
+  tfae_have 6 → 5
+  · rintro ⟨x, hx, hx'⟩
+    induction x using Quotient.inductionOn'
+    use x
+    apply le_antisymm
+    swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
+    have h₁ :
+      (Ideal.span {x} : Ideal R) ⊔ maximal_ideal R ≤
+        Ideal.span {x} ⊔ maximal_ideal R • maximal_ideal R :=
+      by
+      refine' sup_le le_sup_left _
+      rintro m hm
+      obtain ⟨c, hc⟩ := hx' (Submodule.Quotient.mk ⟨m, hm⟩)
+      induction c using Quotient.inductionOn'
+      rw [← sub_sub_cancel (c * x) m]
+      apply sub_mem _ _
+      · infer_instance
+      · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
+      · have := (Submodule.Quotient.eq _).mp hc
+        rw [Submodule.mem_smul_top_iff] at this 
+        exact Ideal.mem_sup_right this
+    have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
+      rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
+    have :=
+      Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
+    rw [Submodule.bot_smul, sup_bot_eq] at this 
+    rw [← sup_eq_left, eq_comm]
+    exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
+  tfae_have 5 → 7
+  · exact exists_maximalIdeal_pow_eq_of_principal R h
+  tfae_have 7 → 2
+  · rw [ValuationRing.iff_ideal_total]
+    intro H
+    constructor
+    intro I J
+    by_cases hI : I = ⊥; · subst hI; left; exact bot_le
+    by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
+    obtain ⟨n, rfl⟩ := H I hI
+    obtain ⟨m, rfl⟩ := H J hJ
+    cases' le_total m n with h' h'
+    · left; exact Ideal.pow_le_pow h'
+    · right; exact Ideal.pow_le_pow h'
+  tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
 -/
 
Diff
@@ -41,126 +41,13 @@ open scoped BigOperators
 #print exists_maximalIdeal_pow_eq_of_principal /-
 theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
-    ∃ n : ℕ, I = maximalIdeal R ^ n := by
-  classical
-  obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
-  by_cases hI' : I = ⊤
-  · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
-  have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
-    (set_like.ext_iff.mp hx r).trans Ideal.mem_span_singleton
-  have : x ≠ 0 := by
-    rintro rfl
-    apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
-    simp [hx]
-  have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
-  have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r :=
-    by
-    intro r hr₁ hr₂
-    obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
-    have : ∀ b ∈ f, Associated x b := by
-      intro b hb
-      exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
-    clear hr₁ hr₂ hf₁
-    induction' f using Multiset.induction with fa fs fh
-    · exact (hf₂ rfl).elim
-    rcases eq_or_ne fs ∅ with (rfl | hf')
-    · use 1
-      rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
-      exact this _ (Multiset.mem_cons_self _ _)
-    · obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
-      use n + 1
-      rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
-      exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
-  have : ∃ n : ℕ, x ^ n ∈ I :=
-    by
-    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg at h ; apply hI;
-      rw [eq_bot_iff]; exact h
-    obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
-    use n
-    rwa [← I.unit_mul_mem_iff_mem u.is_unit, mul_comm]
-  use Nat.find this
-  apply le_antisymm
-  · change ∀ s ∈ I, s ∈ _
-    by_contra hI''
-    push_neg at hI'' 
-    obtain ⟨s, hs₁, hs₂⟩ := hI''
-    apply hs₂
-    by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
-    obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
-    rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁ ⊢
-    apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
-    apply Ideal.pow_mem_pow
-    exact (H _).mpr (dvd_refl _)
-  · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
-    exact Nat.find_spec this
+    ∃ n : ℕ, I = maximalIdeal R ^ n := by classical
 #align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
 -/
 
 #print maximalIdeal_isPrincipal_of_isDedekindDomain /-
 theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
-    [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by
-  classical
-  by_cases ne_bot : maximal_ideal R = ⊥
-  · rw [ne_bot]; infer_instance
-  obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg at h' ;
-    apply ne_bot; rwa [eq_bot_iff]
-  have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
-  have : (Ideal.span {a}).radical = maximal_ideal R :=
-    by
-    rw [Ideal.radical_eq_sInf]
-    apply le_antisymm
-    · exact sInf_le ⟨hle, inferInstance⟩
-    · refine'
-        le_sInf fun I hI =>
-          (eq_maximal_ideal <| IsDedekindDomain.dimensionLEOne _ (fun e => ha₂ _) hI.2).ge
-      rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
-  have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} := by rw [← this];
-    apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
-  cases hn : Nat.find this
-  · have := Nat.find_spec this
-    rw [hn, pow_zero, Ideal.one_eq_top] at this 
-    exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
-  obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
-    by
-    by_contra h'; push_neg at h' ; rw [Nat.find_eq_iff] at hn 
-    exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
-  have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
-    by
-    intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
-    rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
-  have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
-  let K := FractionRing R
-  let x : K := algebraMap R K b / algebraMap R K a
-  let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximal_ideal R)
-  have ha₃ : algebraMap R K a ≠ 0 := is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-  by_cases hx : ∀ y ∈ M, x * y ∈ M
-  · have := isIntegral_of_smul_mem_submodule M _ _ x hx
-    · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
-      refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
-      apply IsFractionRing.injective R K
-      rw [map_mul, e, div_mul_cancel _ ha₃]
-    · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
-      exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-    · apply Submodule.FG.map; exact IsNoetherian.noetherian _
-  · have : (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
-      by
-      by_contra h; apply hx
-      rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
-      obtain ⟨k, hk⟩ := hb₃ m hm
-      have hk' : x * algebraMap R K m = algebraMap R K k := by
-        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
-      exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
-    obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
-      by
-      rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
-      obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
-      rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
-      exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
-    refine' ⟨⟨y, _⟩⟩
-    apply le_antisymm
-    · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
-      rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
-    · rwa [Submodule.span_le, Set.singleton_subset_iff]
+    [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by classical
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
@@ -176,91 +63,6 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   by
   have ne_bot := Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
   classical
-  rw [finrank_eq_one_iff']
-  tfae_have 1 → 2
-  · intro; infer_instance
-  tfae_have 2 → 1
-  · intro
-    haveI := IsBezout.toGCDDomain R
-    haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
-    apply DiscreteValuationRing.of_ufd_of_unique_irreducible
-    · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
-      obtain ⟨p, hp₁, hp₂⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
-      exact ⟨p, hp₁⟩
-    · exact ValuationRing.unique_irreducible
-  tfae_have 1 → 4
-  · intro H
-    exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
-  tfae_have 4 → 3
-  · rintro ⟨h₁, h₂⟩;
-    exact
-      ⟨inferInstance, fun I hI hI' =>
-        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximal_ideal.is_maximal R, h₁⟩
-  tfae_have 3 → 5
-  · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
-  tfae_have 5 → 6
-  · rintro ⟨x, hx⟩
-    have : x ∈ maximal_ideal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
-    let x' : maximal_ideal R := ⟨x, this⟩
-    use Submodule.Quotient.mk x'
-    constructor
-    · intro e
-      rw [Submodule.Quotient.mk_eq_zero] at e 
-      apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
-      apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
-      · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
-      · conv_lhs => rw [hx]
-        rw [Submodule.mem_smul_top_iff] at e 
-        rwa [Submodule.span_le, Set.singleton_subset_iff]
-      · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
-    · refine' fun w => Quotient.inductionOn' w fun y => _
-      obtain ⟨y, hy⟩ := y
-      rw [hx, Submodule.mem_span_singleton] at hy 
-      obtain ⟨a, rfl⟩ := hy
-      exact ⟨Ideal.Quotient.mk _ a, rfl⟩
-  tfae_have 6 → 5
-  · rintro ⟨x, hx, hx'⟩
-    induction x using Quotient.inductionOn'
-    use x
-    apply le_antisymm
-    swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
-    have h₁ :
-      (Ideal.span {x} : Ideal R) ⊔ maximal_ideal R ≤
-        Ideal.span {x} ⊔ maximal_ideal R • maximal_ideal R :=
-      by
-      refine' sup_le le_sup_left _
-      rintro m hm
-      obtain ⟨c, hc⟩ := hx' (Submodule.Quotient.mk ⟨m, hm⟩)
-      induction c using Quotient.inductionOn'
-      rw [← sub_sub_cancel (c * x) m]
-      apply sub_mem _ _
-      · infer_instance
-      · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
-      · have := (Submodule.Quotient.eq _).mp hc
-        rw [Submodule.mem_smul_top_iff] at this 
-        exact Ideal.mem_sup_right this
-    have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
-      rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
-    have :=
-      Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
-    rw [Submodule.bot_smul, sup_bot_eq] at this 
-    rw [← sup_eq_left, eq_comm]
-    exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
-  tfae_have 5 → 7
-  · exact exists_maximalIdeal_pow_eq_of_principal R h
-  tfae_have 7 → 2
-  · rw [ValuationRing.iff_ideal_total]
-    intro H
-    constructor
-    intro I J
-    by_cases hI : I = ⊥; · subst hI; left; exact bot_le
-    by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
-    obtain ⟨n, rfl⟩ := H I hI
-    obtain ⟨m, rfl⟩ := H J hJ
-    cases' le_total m n with h' h'
-    · left; exact Ideal.pow_le_pow h'
-    · right; exact Ideal.pow_le_pow h'
-  tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
 -/
 
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 -/
-import Mathbin.RingTheory.Ideal.Cotangent
-import Mathbin.RingTheory.DedekindDomain.Basic
-import Mathbin.RingTheory.Valuation.ValuationRing
-import Mathbin.RingTheory.Nakayama
+import RingTheory.Ideal.Cotangent
+import RingTheory.DedekindDomain.Basic
+import RingTheory.Valuation.ValuationRing
+import RingTheory.Nakayama
 
 #align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
 
@@ -164,7 +164,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
 #print DiscreteValuationRing.TFAE /-
 theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.discrete_valuation_ring.tfae
-! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.Ideal.Cotangent
 import Mathbin.RingTheory.DedekindDomain.Basic
 import Mathbin.RingTheory.Valuation.ValuationRing
 import Mathbin.RingTheory.Nakayama
 
+#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
+
 /-!
 
 # Equivalent conditions for DVR
@@ -167,7 +164,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
 #print DiscreteValuationRing.TFAE /-
 theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
Diff
@@ -41,6 +41,7 @@ open LocalRing
 
 open scoped BigOperators
 
+#print exists_maximalIdeal_pow_eq_of_principal /-
 theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
     ∃ n : ℕ, I = maximalIdeal R ^ n := by
@@ -96,6 +97,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
   · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
     exact Nat.find_spec this
 #align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
+-/
 
 #print maximalIdeal_isPrincipal_of_isDedekindDomain /-
 theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
@@ -166,6 +168,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
 -/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
+#print DiscreteValuationRing.TFAE /-
 theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
     TFAE
@@ -262,4 +265,5 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     · right; exact Ideal.pow_le_pow h'
   tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
+-/
 
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.discrete_valuation_ring.tfae
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
+! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.RingTheory.Nakayama
 
 # Equivalent conditions for DVR
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In `discrete_valuation_ring.tfae`, we show that the following are equivalent for a
 noetherian local domain `(R, m, k)`:
 - `R` is a discrete valuation ring
Diff
@@ -162,7 +162,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
 theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
     TFAE
Diff
@@ -94,6 +94,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
     exact Nat.find_spec this
 #align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
 
+#print maximalIdeal_isPrincipal_of_isDedekindDomain /-
 theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by
   classical
@@ -159,9 +160,10 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
     · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
+-/
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
-theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
+theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) :
     TFAE
       [DiscreteValuationRing R, ValuationRing R, IsDedekindDomain R,
@@ -256,5 +258,5 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     · left; exact Ideal.pow_le_pow h'
     · right; exact Ideal.pow_le_pow h'
   tfae_finish
-#align discrete_valuation_ring.tfae DiscreteValuationRing.tFAE
+#align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
 
Diff
@@ -42,123 +42,122 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
     (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
     ∃ n : ℕ, I = maximalIdeal R ^ n := by
   classical
-    obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
-    by_cases hI' : I = ⊤
-    · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
-    have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
-      (set_like.ext_iff.mp hx r).trans Ideal.mem_span_singleton
-    have : x ≠ 0 := by
-      rintro rfl
-      apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
-      simp [hx]
-    have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
-    have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r :=
-      by
-      intro r hr₁ hr₂
-      obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
-      have : ∀ b ∈ f, Associated x b := by
-        intro b hb
-        exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
-      clear hr₁ hr₂ hf₁
-      induction' f using Multiset.induction with fa fs fh
-      · exact (hf₂ rfl).elim
-      rcases eq_or_ne fs ∅ with (rfl | hf')
-      · use 1
-        rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
-        exact this _ (Multiset.mem_cons_self _ _)
-      · obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
-        use n + 1
-        rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
-        exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
-    have : ∃ n : ℕ, x ^ n ∈ I :=
-      by
-      obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg  at h ; apply hI;
-        rw [eq_bot_iff]; exact h
-      obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
-      use n
-      rwa [← I.unit_mul_mem_iff_mem u.is_unit, mul_comm]
-    use Nat.find this
-    apply le_antisymm
-    · change ∀ s ∈ I, s ∈ _
-      by_contra hI''
-      push_neg  at hI'' 
-      obtain ⟨s, hs₁, hs₂⟩ := hI''
-      apply hs₂
-      by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
-      obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
-      rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁ ⊢
-      apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
-      apply Ideal.pow_mem_pow
-      exact (H _).mpr (dvd_refl _)
-    · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
-      exact Nat.find_spec this
+  obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
+  by_cases hI' : I = ⊤
+  · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
+  have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
+    (set_like.ext_iff.mp hx r).trans Ideal.mem_span_singleton
+  have : x ≠ 0 := by
+    rintro rfl
+    apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
+    simp [hx]
+  have hx' := DiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
+  have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r :=
+    by
+    intro r hr₁ hr₂
+    obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
+    have : ∀ b ∈ f, Associated x b := by
+      intro b hb
+      exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
+    clear hr₁ hr₂ hf₁
+    induction' f using Multiset.induction with fa fs fh
+    · exact (hf₂ rfl).elim
+    rcases eq_or_ne fs ∅ with (rfl | hf')
+    · use 1
+      rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
+      exact this _ (Multiset.mem_cons_self _ _)
+    · obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
+      use n + 1
+      rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
+      exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
+  have : ∃ n : ℕ, x ^ n ∈ I :=
+    by
+    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg at h ; apply hI;
+      rw [eq_bot_iff]; exact h
+    obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
+    use n
+    rwa [← I.unit_mul_mem_iff_mem u.is_unit, mul_comm]
+  use Nat.find this
+  apply le_antisymm
+  · change ∀ s ∈ I, s ∈ _
+    by_contra hI''
+    push_neg at hI'' 
+    obtain ⟨s, hs₁, hs₂⟩ := hI''
+    apply hs₂
+    by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
+    obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
+    rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁ ⊢
+    apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
+    apply Ideal.pow_mem_pow
+    exact (H _).mpr (dvd_refl _)
+  · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
+    exact Nat.find_spec this
 #align exists_maximal_ideal_pow_eq_of_principal exists_maximalIdeal_pow_eq_of_principal
 
 theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by
   classical
-    by_cases ne_bot : maximal_ideal R = ⊥
-    · rw [ne_bot]; infer_instance
-    obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg  at h' ;
-      apply ne_bot; rwa [eq_bot_iff]
-    have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
-    have : (Ideal.span {a}).radical = maximal_ideal R :=
-      by
-      rw [Ideal.radical_eq_sInf]
-      apply le_antisymm
-      · exact sInf_le ⟨hle, inferInstance⟩
-      · refine'
-          le_sInf fun I hI =>
-            (eq_maximal_ideal <| IsDedekindDomain.dimensionLeOne _ (fun e => ha₂ _) hI.2).ge
-        rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
-    have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} := by rw [← this];
-      apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
-    cases hn : Nat.find this
-    · have := Nat.find_spec this
-      rw [hn, pow_zero, Ideal.one_eq_top] at this 
-      exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
-    obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
+  by_cases ne_bot : maximal_ideal R = ⊥
+  · rw [ne_bot]; infer_instance
+  obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg at h' ;
+    apply ne_bot; rwa [eq_bot_iff]
+  have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
+  have : (Ideal.span {a}).radical = maximal_ideal R :=
+    by
+    rw [Ideal.radical_eq_sInf]
+    apply le_antisymm
+    · exact sInf_le ⟨hle, inferInstance⟩
+    · refine'
+        le_sInf fun I hI =>
+          (eq_maximal_ideal <| IsDedekindDomain.dimensionLEOne _ (fun e => ha₂ _) hI.2).ge
+      rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
+  have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} := by rw [← this];
+    apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
+  cases hn : Nat.find this
+  · have := Nat.find_spec this
+    rw [hn, pow_zero, Ideal.one_eq_top] at this 
+    exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
+  obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
+    by
+    by_contra h'; push_neg at h' ; rw [Nat.find_eq_iff] at hn 
+    exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
+  have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
+    by
+    intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
+    rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
+  have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
+  let K := FractionRing R
+  let x : K := algebraMap R K b / algebraMap R K a
+  let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximal_ideal R)
+  have ha₃ : algebraMap R K a ≠ 0 := is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
+  by_cases hx : ∀ y ∈ M, x * y ∈ M
+  · have := isIntegral_of_smul_mem_submodule M _ _ x hx
+    · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
+      refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
+      apply IsFractionRing.injective R K
+      rw [map_mul, e, div_mul_cancel _ ha₃]
+    · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
+      exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
+    · apply Submodule.FG.map; exact IsNoetherian.noetherian _
+  · have : (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
       by
-      by_contra h'; push_neg  at h' ; rw [Nat.find_eq_iff] at hn 
-      exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
-    have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
+      by_contra h; apply hx
+      rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
+      obtain ⟨k, hk⟩ := hb₃ m hm
+      have hk' : x * algebraMap R K m = algebraMap R K k := by
+        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
+      exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
+    obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
       by
-      intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
-      rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
-    have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
-    let K := FractionRing R
-    let x : K := algebraMap R K b / algebraMap R K a
-    let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximal_ideal R)
-    have ha₃ : algebraMap R K a ≠ 0 := is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-    by_cases hx : ∀ y ∈ M, x * y ∈ M
-    · have := isIntegral_of_smul_mem_submodule M _ _ x hx
-      · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
-        refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
-        apply IsFractionRing.injective R K
-        rw [map_mul, e, div_mul_cancel _ ha₃]
-      · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
-        exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-      · apply Submodule.FG.map; exact IsNoetherian.noetherian _
-    · have :
-        (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
-        by
-        by_contra h; apply hx
-        rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
-        obtain ⟨k, hk⟩ := hb₃ m hm
-        have hk' : x * algebraMap R K m = algebraMap R K k := by
-          rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
-        exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
-      obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
-        by
-        rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
-        obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
-        rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
-        exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
-      refine' ⟨⟨y, _⟩⟩
-      apply le_antisymm
-      · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
-        rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
-      · rwa [Submodule.span_le, Set.singleton_subset_iff]
+      rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
+      obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
+      rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
+      exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
+    refine' ⟨⟨y, _⟩⟩
+    apply le_antisymm
+    · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
+      rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
+    · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (I «expr ≠ » «expr⊥»()) -/
@@ -172,90 +171,90 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   by
   have ne_bot := Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
   classical
-    rw [finrank_eq_one_iff']
-    tfae_have 1 → 2
-    · intro; infer_instance
-    tfae_have 2 → 1
-    · intro
-      haveI := IsBezout.toGcdDomain R
-      haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
-      apply DiscreteValuationRing.of_ufd_of_unique_irreducible
-      · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
-        obtain ⟨p, hp₁, hp₂⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
-        exact ⟨p, hp₁⟩
-      · exact ValuationRing.unique_irreducible
-    tfae_have 1 → 4
-    · intro H
-      exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
-    tfae_have 4 → 3
-    · rintro ⟨h₁, h₂⟩;
-      exact
-        ⟨inferInstance, fun I hI hI' =>
-          ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximal_ideal.is_maximal R, h₁⟩
-    tfae_have 3 → 5
-    · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
-    tfae_have 5 → 6
-    · rintro ⟨x, hx⟩
-      have : x ∈ maximal_ideal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
-      let x' : maximal_ideal R := ⟨x, this⟩
-      use Submodule.Quotient.mk x'
-      constructor
-      · intro e
-        rw [Submodule.Quotient.mk_eq_zero] at e 
-        apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
-        apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
-        · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
-        · conv_lhs => rw [hx]
-          rw [Submodule.mem_smul_top_iff] at e 
-          rwa [Submodule.span_le, Set.singleton_subset_iff]
-        · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
-      · refine' fun w => Quotient.inductionOn' w fun y => _
-        obtain ⟨y, hy⟩ := y
-        rw [hx, Submodule.mem_span_singleton] at hy 
-        obtain ⟨a, rfl⟩ := hy
-        exact ⟨Ideal.Quotient.mk _ a, rfl⟩
-    tfae_have 6 → 5
-    · rintro ⟨x, hx, hx'⟩
-      induction x using Quotient.inductionOn'
-      use x
-      apply le_antisymm
-      swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
-      have h₁ :
-        (Ideal.span {x} : Ideal R) ⊔ maximal_ideal R ≤
-          Ideal.span {x} ⊔ maximal_ideal R • maximal_ideal R :=
-        by
-        refine' sup_le le_sup_left _
-        rintro m hm
-        obtain ⟨c, hc⟩ := hx' (Submodule.Quotient.mk ⟨m, hm⟩)
-        induction c using Quotient.inductionOn'
-        rw [← sub_sub_cancel (c * x) m]
-        apply sub_mem _ _
-        · infer_instance
-        · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
-        · have := (Submodule.Quotient.eq _).mp hc
-          rw [Submodule.mem_smul_top_iff] at this 
-          exact Ideal.mem_sup_right this
-      have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
-        rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
-      have :=
-        Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
-      rw [Submodule.bot_smul, sup_bot_eq] at this 
-      rw [← sup_eq_left, eq_comm]
-      exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
-    tfae_have 5 → 7
-    · exact exists_maximalIdeal_pow_eq_of_principal R h
-    tfae_have 7 → 2
-    · rw [ValuationRing.iff_ideal_total]
-      intro H
-      constructor
-      intro I J
-      by_cases hI : I = ⊥; · subst hI; left; exact bot_le
-      by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
-      obtain ⟨n, rfl⟩ := H I hI
-      obtain ⟨m, rfl⟩ := H J hJ
-      cases' le_total m n with h' h'
-      · left; exact Ideal.pow_le_pow h'
-      · right; exact Ideal.pow_le_pow h'
-    tfae_finish
+  rw [finrank_eq_one_iff']
+  tfae_have 1 → 2
+  · intro; infer_instance
+  tfae_have 2 → 1
+  · intro
+    haveI := IsBezout.toGCDDomain R
+    haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
+    apply DiscreteValuationRing.of_ufd_of_unique_irreducible
+    · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
+      obtain ⟨p, hp₁, hp₂⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
+      exact ⟨p, hp₁⟩
+    · exact ValuationRing.unique_irreducible
+  tfae_have 1 → 4
+  · intro H
+    exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
+  tfae_have 4 → 3
+  · rintro ⟨h₁, h₂⟩;
+    exact
+      ⟨inferInstance, fun I hI hI' =>
+        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximal_ideal.is_maximal R, h₁⟩
+  tfae_have 3 → 5
+  · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
+  tfae_have 5 → 6
+  · rintro ⟨x, hx⟩
+    have : x ∈ maximal_ideal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
+    let x' : maximal_ideal R := ⟨x, this⟩
+    use Submodule.Quotient.mk x'
+    constructor
+    · intro e
+      rw [Submodule.Quotient.mk_eq_zero] at e 
+      apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
+      apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
+      · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
+      · conv_lhs => rw [hx]
+        rw [Submodule.mem_smul_top_iff] at e 
+        rwa [Submodule.span_le, Set.singleton_subset_iff]
+      · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
+    · refine' fun w => Quotient.inductionOn' w fun y => _
+      obtain ⟨y, hy⟩ := y
+      rw [hx, Submodule.mem_span_singleton] at hy 
+      obtain ⟨a, rfl⟩ := hy
+      exact ⟨Ideal.Quotient.mk _ a, rfl⟩
+  tfae_have 6 → 5
+  · rintro ⟨x, hx, hx'⟩
+    induction x using Quotient.inductionOn'
+    use x
+    apply le_antisymm
+    swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
+    have h₁ :
+      (Ideal.span {x} : Ideal R) ⊔ maximal_ideal R ≤
+        Ideal.span {x} ⊔ maximal_ideal R • maximal_ideal R :=
+      by
+      refine' sup_le le_sup_left _
+      rintro m hm
+      obtain ⟨c, hc⟩ := hx' (Submodule.Quotient.mk ⟨m, hm⟩)
+      induction c using Quotient.inductionOn'
+      rw [← sub_sub_cancel (c * x) m]
+      apply sub_mem _ _
+      · infer_instance
+      · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
+      · have := (Submodule.Quotient.eq _).mp hc
+        rw [Submodule.mem_smul_top_iff] at this 
+        exact Ideal.mem_sup_right this
+    have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
+      rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
+    have :=
+      Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
+    rw [Submodule.bot_smul, sup_bot_eq] at this 
+    rw [← sup_eq_left, eq_comm]
+    exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
+  tfae_have 5 → 7
+  · exact exists_maximalIdeal_pow_eq_of_principal R h
+  tfae_have 7 → 2
+  · rw [ValuationRing.iff_ideal_total]
+    intro H
+    constructor
+    intro I J
+    by_cases hI : I = ⊥; · subst hI; left; exact bot_le
+    by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
+    obtain ⟨n, rfl⟩ := H I hI
+    obtain ⟨m, rfl⟩ := H J hJ
+    cases' le_total m n with h' h'
+    · left; exact Ideal.pow_le_pow h'
+    · right; exact Ideal.pow_le_pow h'
+  tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.tFAE
 
Diff
@@ -72,7 +72,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
         exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
     have : ∃ n : ℕ, x ^ n ∈ I :=
       by
-      obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg  at h; apply hI;
+      obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg  at h ; apply hI;
         rw [eq_bot_iff]; exact h
       obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
       use n
@@ -81,12 +81,12 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
     apply le_antisymm
     · change ∀ s ∈ I, s ∈ _
       by_contra hI''
-      push_neg  at hI''
+      push_neg  at hI'' 
       obtain ⟨s, hs₁, hs₂⟩ := hI''
       apply hs₂
       by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
       obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
-      rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁⊢
+      rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁ ⊢
       apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
       apply Ideal.pow_mem_pow
       exact (H _).mpr (dvd_refl _)
@@ -99,7 +99,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
   classical
     by_cases ne_bot : maximal_ideal R = ⊥
     · rw [ne_bot]; infer_instance
-    obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg  at h';
+    obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg  at h' ;
       apply ne_bot; rwa [eq_bot_iff]
     have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
     have : (Ideal.span {a}).radical = maximal_ideal R :=
@@ -115,11 +115,11 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
     cases hn : Nat.find this
     · have := Nat.find_spec this
-      rw [hn, pow_zero, Ideal.one_eq_top] at this
+      rw [hn, pow_zero, Ideal.one_eq_top] at this 
       exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
     obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
       by
-      by_contra h'; push_neg  at h'; rw [Nat.find_eq_iff] at hn
+      by_contra h'; push_neg  at h' ; rw [Nat.find_eq_iff] at hn 
       exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
     have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
       by
@@ -150,13 +150,13 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
         exact ⟨k, le_maximal_ideal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
       obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximal_ideal R, b * y = a :=
         by
-        rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this
+        rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this 
         obtain ⟨_, ⟨y, hy, rfl⟩, hy' : x * algebraMap R K y = algebraMap R K 1⟩ := this
-        rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy'
+        rw [map_one, ← mul_div_right_comm, div_eq_one_iff_eq ha₃, ← map_mul] at hy' 
         exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
       refine' ⟨⟨y, _⟩⟩
       apply le_antisymm
-      · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk
+      · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk 
         rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
       · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
@@ -174,7 +174,7 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   classical
     rw [finrank_eq_one_iff']
     tfae_have 1 → 2
-    · intro ; infer_instance
+    · intro; infer_instance
     tfae_have 2 → 1
     · intro
       haveI := IsBezout.toGcdDomain R
@@ -201,17 +201,17 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
       use Submodule.Quotient.mk x'
       constructor
       · intro e
-        rw [Submodule.Quotient.mk_eq_zero] at e
+        rw [Submodule.Quotient.mk_eq_zero] at e 
         apply Ring.ne_bot_of_isMaximal_of_not_isField (maximal_ideal.is_maximal R) h
         apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximal_ideal R)
         · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
         · conv_lhs => rw [hx]
-          rw [Submodule.mem_smul_top_iff] at e
+          rw [Submodule.mem_smul_top_iff] at e 
           rwa [Submodule.span_le, Set.singleton_subset_iff]
         · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
       · refine' fun w => Quotient.inductionOn' w fun y => _
         obtain ⟨y, hy⟩ := y
-        rw [hx, Submodule.mem_span_singleton] at hy
+        rw [hx, Submodule.mem_span_singleton] at hy 
         obtain ⟨a, rfl⟩ := hy
         exact ⟨Ideal.Quotient.mk _ a, rfl⟩
     tfae_have 6 → 5
@@ -233,13 +233,13 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
         · infer_instance
         · refine' Ideal.mem_sup_left (ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
         · have := (Submodule.Quotient.eq _).mp hc
-          rw [Submodule.mem_smul_top_iff] at this
+          rw [Submodule.mem_smul_top_iff] at this 
           exact Ideal.mem_sup_right this
       have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
-        rw [LocalRing.jacobson_eq_maximalIdeal]; exacts[le_refl _, bot_ne_top]
+        rw [LocalRing.jacobson_eq_maximalIdeal]; exacts [le_refl _, bot_ne_top]
       have :=
         Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
-      rw [Submodule.bot_smul, sup_bot_eq] at this
+      rw [Submodule.bot_smul, sup_bot_eq] at this 
       rw [← sup_eq_left, eq_comm]
       exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
     tfae_have 5 → 7
Diff
@@ -32,11 +32,11 @@ noetherian local domain `(R, m, k)`:
 
 variable (R : Type _) [CommRing R] (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
 
-open DiscreteValuation
+open scoped DiscreteValuation
 
 open LocalRing
 
-open BigOperators
+open scoped BigOperators
 
 theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
     (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
Diff
@@ -44,8 +44,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
   classical
     obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
     by_cases hI' : I = ⊤
-    · use 0
-      rw [pow_zero, hI', Ideal.one_eq_top]
+    · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
     have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
       (set_like.ext_iff.mp hx r).trans Ideal.mem_span_singleton
     have : x ≠ 0 := by
@@ -73,13 +72,8 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
         exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
     have : ∃ n : ℕ, x ^ n ∈ I :=
       by
-      obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 :=
-        by
-        by_contra h
-        push_neg  at h
-        apply hI
-        rw [eq_bot_iff]
-        exact h
+      obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by by_contra h; push_neg  at h; apply hI;
+        rw [eq_bot_iff]; exact h
       obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximal_ideal hI' hr₁)
       use n
       rwa [← I.unit_mul_mem_iff_mem u.is_unit, mul_comm]
@@ -90,9 +84,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
       push_neg  at hI''
       obtain ⟨s, hs₁, hs₂⟩ := hI''
       apply hs₂
-      by_cases hs₃ : s = 0
-      · rw [hs₃]
-        exact zero_mem _
+      by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
       obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximal_ideal hI' hs₁)
       rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.is_unit] at hs₁⊢
       apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
@@ -106,14 +98,9 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     [IsDedekindDomain R] : (maximalIdeal R).IsPrincipal := by
   classical
     by_cases ne_bot : maximal_ideal R = ⊥
-    · rw [ne_bot]
-      infer_instance
-    obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) :=
-      by
-      by_contra h'
-      push_neg  at h'
-      apply ne_bot
-      rwa [eq_bot_iff]
+    · rw [ne_bot]; infer_instance
+    obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximal_ideal R, a ≠ (0 : R) := by by_contra h'; push_neg  at h';
+      apply ne_bot; rwa [eq_bot_iff]
     have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
     have : (Ideal.span {a}).radical = maximal_ideal R :=
       by
@@ -123,34 +110,22 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       · refine'
           le_sInf fun I hI =>
             (eq_maximal_ideal <| IsDedekindDomain.dimensionLeOne _ (fun e => ha₂ _) hI.2).ge
-        rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]
-        exact hI.1
-    have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} :=
-      by
-      rw [← this]
-      apply Ideal.exists_radical_pow_le_of_fg
-      exact IsNoetherian.noetherian _
+        rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
+    have : ∃ n, maximal_ideal R ^ n ≤ Ideal.span {a} := by rw [← this];
+      apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
     cases hn : Nat.find this
     · have := Nat.find_spec this
       rw [hn, pow_zero, Ideal.one_eq_top] at this
       exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
     obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximal_ideal R ^ n, ¬b ∈ Ideal.span {a} :=
       by
-      by_contra h'
-      push_neg  at h'
-      rw [Nat.find_eq_iff] at hn
+      by_contra h'; push_neg  at h'; rw [Nat.find_eq_iff] at hn
       exact hn.2 n n.lt_succ_self fun x hx => not_not.mp (h' x hx)
     have hb₃ : ∀ m ∈ maximal_ideal R, ∃ k : R, k * a = b * m :=
       by
-      intro m hm
-      rw [← Ideal.mem_span_singleton']
-      apply Nat.find_spec this
-      rw [hn, pow_succ']
-      exact Ideal.mul_mem_mul hb₁ hm
-    have hb₄ : b ≠ 0 := by
-      rintro rfl
-      apply hb₂
-      exact zero_mem _
+      intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
+      rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
+    have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
     let K := FractionRing R
     let x : K := algebraMap R K b / algebraMap R K a
     let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximal_ideal R)
@@ -161,16 +136,13 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
         refine' (hb₂ (ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
         apply IsFractionRing.injective R K
         rw [map_mul, e, div_mul_cancel _ ha₃]
-      · rw [Submodule.ne_bot_iff]
-        refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
+      · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
         exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-      · apply Submodule.FG.map
-        exact IsNoetherian.noetherian _
+      · apply Submodule.FG.map; exact IsNoetherian.noetherian _
     · have :
         (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
         by
-        by_contra h
-        apply hx
+        by_contra h; apply hx
         rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
         obtain ⟨k, hk⟩ := hb₃ m hm
         have hk' : x * algebraMap R K m = algebraMap R K k := by
@@ -184,11 +156,8 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
         exact ⟨y, hy, IsFractionRing.injective R K hy'⟩
       refine' ⟨⟨y, _⟩⟩
       apply le_antisymm
-      · intro m hm
-        obtain ⟨k, hk⟩ := hb₃ m hm
-        rw [← hy₂, mul_comm, mul_assoc] at hk
-        rw [← mul_left_cancel₀ hb₄ hk, mul_comm]
-        exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
+      · intro m hm; obtain ⟨k, hk⟩ := hb₃ m hm; rw [← hy₂, mul_comm, mul_assoc] at hk
+        rw [← mul_left_cancel₀ hb₄ hk, mul_comm]; exact ideal.mem_span_singleton'.mpr ⟨_, rfl⟩
       · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 
@@ -205,8 +174,7 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   classical
     rw [finrank_eq_one_iff']
     tfae_have 1 → 2
-    · intro
-      infer_instance
+    · intro ; infer_instance
     tfae_have 2 → 1
     · intro
       haveI := IsBezout.toGcdDomain R
@@ -220,18 +188,15 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     · intro H
       exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
     tfae_have 4 → 3
-    · rintro ⟨h₁, h₂⟩
+    · rintro ⟨h₁, h₂⟩;
       exact
         ⟨inferInstance, fun I hI hI' =>
           ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximal_ideal.is_maximal R, h₁⟩
     tfae_have 3 → 5
-    · intro h
-      exact maximalIdeal_isPrincipal_of_isDedekindDomain R
+    · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
     tfae_have 5 → 6
     · rintro ⟨x, hx⟩
-      have : x ∈ maximal_ideal R := by
-        rw [hx]
-        exact Submodule.subset_span (Set.mem_singleton x)
+      have : x ∈ maximal_ideal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
       let x' : maximal_ideal R := ⟨x, this⟩
       use Submodule.Quotient.mk x'
       constructor
@@ -243,8 +208,7 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
         · conv_lhs => rw [hx]
           rw [Submodule.mem_smul_top_iff] at e
           rwa [Submodule.span_le, Set.singleton_subset_iff]
-        · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]
-          exact le_refl _
+        · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]; exact le_refl _
       · refine' fun w => Quotient.inductionOn' w fun y => _
         obtain ⟨y, hy⟩ := y
         rw [hx, Submodule.mem_span_singleton] at hy
@@ -255,9 +219,7 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
       induction x using Quotient.inductionOn'
       use x
       apply le_antisymm
-      swap
-      · rw [Submodule.span_le, Set.singleton_subset_iff]
-        exact x.prop
+      swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
       have h₁ :
         (Ideal.span {x} : Ideal R) ⊔ maximal_ideal R ≤
           Ideal.span {x} ⊔ maximal_ideal R • maximal_ideal R :=
@@ -273,10 +235,8 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
         · have := (Submodule.Quotient.eq _).mp hc
           rw [Submodule.mem_smul_top_iff] at this
           exact Ideal.mem_sup_right this
-      have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson :=
-        by
-        rw [LocalRing.jacobson_eq_maximalIdeal]
-        exacts[le_refl _, bot_ne_top]
+      have h₂ : maximal_ideal R ≤ (⊥ : Ideal R).jacobson := by
+        rw [LocalRing.jacobson_eq_maximalIdeal]; exacts[le_refl _, bot_ne_top]
       have :=
         Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
       rw [Submodule.bot_smul, sup_bot_eq] at this
@@ -289,21 +249,13 @@ theorem DiscreteValuationRing.tFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
       intro H
       constructor
       intro I J
-      by_cases hI : I = ⊥
-      · subst hI
-        left
-        exact bot_le
-      by_cases hJ : J = ⊥
-      · subst hJ
-        right
-        exact bot_le
+      by_cases hI : I = ⊥; · subst hI; left; exact bot_le
+      by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
       obtain ⟨n, rfl⟩ := H I hI
       obtain ⟨m, rfl⟩ := H J hJ
       cases' le_total m n with h' h'
-      · left
-        exact Ideal.pow_le_pow h'
-      · right
-        exact Ideal.pow_le_pow h'
+      · left; exact Ideal.pow_le_pow h'
+      · right; exact Ideal.pow_le_pow h'
     tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.tFAE
 
Diff
@@ -164,7 +164,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       · rw [Submodule.ne_bot_iff]
         refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
         exact is_fraction_ring.to_map_eq_zero_iff.not.mpr ha₂
-      · apply Submodule.Fg.map
+      · apply Submodule.FG.map
         exact IsNoetherian.noetherian _
     · have :
         (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ :=
Diff
@@ -117,11 +117,11 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     have hle : Ideal.span {a} ≤ maximal_ideal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
     have : (Ideal.span {a}).radical = maximal_ideal R :=
       by
-      rw [Ideal.radical_eq_infₛ]
+      rw [Ideal.radical_eq_sInf]
       apply le_antisymm
-      · exact infₛ_le ⟨hle, inferInstance⟩
+      · exact sInf_le ⟨hle, inferInstance⟩
       · refine'
-          le_infₛ fun I hI =>
+          le_sInf fun I hI =>
             (eq_maximal_ideal <| IsDedekindDomain.dimensionLeOne _ (fun e => ha₂ _) hI.2).ge
         rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]
         exact hI.1
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.discrete_valuation_ring.tfae
-! leanprover-community/mathlib commit c163ec99dfc664628ca15d215fce0a5b9c265b68
+! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
 
-! This file was ported from Lean 3 source module ring_theory.valuation.tfae
-! leanprover-community/mathlib commit 70fd9563a21e7b963887c9360bd29b2393e6225a
+! This file was ported from Lean 3 source module ring_theory.discrete_valuation_ring.tfae
+! leanprover-community/mathlib commit c163ec99dfc664628ca15d215fce0a5b9c265b68
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/

Changes in mathlib4

mathlib3
mathlib4
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
@@ -115,7 +115,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     by_contra! h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
   have hb₃ : ∀ m ∈ maximalIdeal R, ∃ k : R, k * a = b * m := by
     intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
-    rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
+    rw [hn, pow_succ]; exact Ideal.mul_mem_mul hb₁ hm
   have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
   let K := FractionRing R
   let x : K := algebraMap R K b / algebraMap R K a
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -126,7 +126,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     · obtain ⟨y, e⟩ := IsIntegrallyClosed.algebraMap_eq_of_integral this
       refine' (hb₂ (Ideal.mem_span_singleton'.mpr ⟨y, _⟩)).elim
       apply IsFractionRing.injective R K
-      rw [map_mul, e, div_mul_cancel _ ha₃]
+      rw [map_mul, e, div_mul_cancel₀ _ ha₃]
     · rw [Submodule.ne_bot_iff]; refine' ⟨_, ⟨a, ha₁, rfl⟩, _⟩
       exact (IsFractionRing.to_map_eq_zero_iff (K := K)).not.mpr ha₂
     · apply Submodule.FG.map; exact IsNoetherian.noetherian _
@@ -136,7 +136,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
       obtain ⟨k, hk⟩ := hb₃ m hm
       have hk' : x * algebraMap R K m = algebraMap R K k := by
-        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel _ ha₃]
+        rw [← mul_div_right_comm, ← map_mul, ← hk, map_mul, mul_div_cancel_right₀ _ ha₃]
       exact ⟨k, le_maximalIdeal h ⟨_, ⟨_, hm, rfl⟩, hk'⟩, hk'.symm⟩
     obtain ⟨y, hy₁, hy₂⟩ : ∃ y ∈ maximalIdeal R, b * y = a := by
       rw [Ideal.eq_top_iff_one, Submodule.mem_comap] at this
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
@@ -225,8 +225,8 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
         finrank (ResidueField R) (CotangentSpace R) = 1,
         ∀ (I) (_ : I ≠ ⊥), ∃ n : ℕ, I = maximalIdeal R ^ n] := by
   have : finrank (ResidueField R) (CotangentSpace R) = 1 ↔
-    finrank (ResidueField R) (CotangentSpace R) ≤ 1
-  · simp [Nat.le_one_iff_eq_zero_or_eq_one, finrank_cotangentSpace_eq_zero_iff, h]
+      finrank (ResidueField R) (CotangentSpace R) ≤ 1 := by
+    simp [Nat.le_one_iff_eq_zero_or_eq_one, finrank_cotangentSpace_eq_zero_iff, h]
   rw [this]
   have : maximalIdeal R ≠ ⊥ := isField_iff_maximalIdeal_eq.not.mp h
   convert tfae_of_isNoetherianRing_of_localRing_of_isDomain R
chore: tidy various files (#9851)
Diff
@@ -201,9 +201,7 @@ theorem tfae_of_isNoetherianRing_of_localRing_of_isDomain
     by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
     obtain ⟨n, rfl⟩ := H I hI
     obtain ⟨m, rfl⟩ := H J hJ
-    rcases le_total m n with h' | h'
-    · left; exact Ideal.pow_le_pow_right h'
-    · right; exact Ideal.pow_le_pow_right h'
+    exact (le_total m n).imp Ideal.pow_le_pow_right Ideal.pow_le_pow_right
   tfae_finish
 
 /--
feat: A dedekind domain that is local is a PID. (#9282)

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

Diff
@@ -15,7 +15,7 @@ import Mathlib.RingTheory.Nakayama
 # Equivalent conditions for DVR
 
 In `DiscreteValuationRing.TFAE`, we show that the following are equivalent for a
-noetherian local domain `(R, m, k)`:
+noetherian local domain that is not a field `(R, m, k)`:
 - `R` is a discrete valuation ring
 - `R` is a valuation ring
 - `R` is a dedekind domain
@@ -24,20 +24,21 @@ noetherian local domain `(R, m, k)`:
 - `dimₖ m/m² = 1`
 - Every nonzero ideal is a power of `m`.
 
+Also see `tfae_of_isNoetherianRing_of_localRing_of_isDomain` for a version without `¬ IsField R`.
 -/
 
 
 variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
 
-open scoped DiscreteValuation
+open scoped DiscreteValuation BigOperators
 
-open LocalRing
-
-open scoped BigOperators
+open LocalRing FiniteDimensional
 
 theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing R] [IsDomain R]
-    (h : ¬IsField R) (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
+    (h' : (maximalIdeal R).IsPrincipal) (I : Ideal R) (hI : I ≠ ⊥) :
     ∃ n : ℕ, I = maximalIdeal R ^ n := by
+  by_cases h : IsField R;
+  · exact ⟨0, by simp [letI := h.toField; (eq_bot_or_eq_top I).resolve_left hI]⟩
   classical
   obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
   by_cases hI' : I = ⊤
@@ -149,87 +150,42 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     · rwa [Submodule.span_le, Set.singleton_subset_iff]
 #align maximal_ideal_is_principal_of_is_dedekind_domain maximalIdeal_isPrincipal_of_isDedekindDomain
 
-theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
-    (h : ¬IsField R) :
+/--
+Let `(R, m, k)` be a noetherian local domain (possibly a field).
+The following are equivalent:
+0. `R` is a PID
+1. `R` is a valuation ring
+2. `R` is a dedekind domain
+3. `R` is integrally closed with at most one non-zero prime ideal
+4. `m` is principal
+5. `dimₖ m/m² ≤ 1`
+6. Every nonzero ideal is a power of `m`.
+
+Also see `DiscreteValuationRing.TFAE` for a version assuming `¬ IsField R`.
+-/
+theorem tfae_of_isNoetherianRing_of_localRing_of_isDomain
+    [IsNoetherianRing R] [LocalRing R] [IsDomain R] :
     List.TFAE
-      [DiscreteValuationRing R, ValuationRing R, IsDedekindDomain R,
-        IsIntegrallyClosed R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ P.IsPrime, (maximalIdeal R).IsPrincipal,
-        FiniteDimensional.finrank (ResidueField R) (CotangentSpace R) = 1,
+      [IsPrincipalIdealRing R, ValuationRing R, IsDedekindDomain R,
+        IsIntegrallyClosed R ∧ ∀ P : Ideal R, P ≠ ⊥ → P.IsPrime → P = maximalIdeal R,
+        (maximalIdeal R).IsPrincipal,
+        finrank (ResidueField R) (CotangentSpace R) ≤ 1,
         ∀ (I) (_ : I ≠ ⊥), ∃ n : ℕ, I = maximalIdeal R ^ n] := by
-  have ne_bot := Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
-  classical
-  rw [finrank_eq_one_iff']
   tfae_have 1 → 2
-  · intro; infer_instance
+  · exact fun _ ↦ inferInstance
   tfae_have 2 → 1
-  · intro
-    haveI := IsBezout.toGCDDomain R
-    haveI : UniqueFactorizationMonoid R := ufm_of_gcd_of_wfDvdMonoid
-    apply DiscreteValuationRing.of_ufd_of_unique_irreducible
-    · obtain ⟨x, hx₁, hx₂⟩ := Ring.exists_not_isUnit_of_not_isField h
-      obtain ⟨p, hp₁, -⟩ := WfDvdMonoid.exists_irreducible_factor hx₂ hx₁
-      exact ⟨p, hp₁⟩
-    · exact ValuationRing.unique_irreducible
+  · exact fun _ ↦ ((IsBezout.TFAE (R := R)).out 0 1).mp ‹_›
   tfae_have 1 → 4
   · intro H
-    exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
+    exact ⟨inferInstance, fun P hP hP' ↦ eq_maximalIdeal (hP'.isMaximal hP)⟩
   tfae_have 4 → 3
-  · rintro ⟨h₁, h₂⟩;
-    exact { h₁ with
-      maximalOfPrime := fun hI hI' => ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸
-        maximalIdeal.isMaximal R, }
+  · exact fun ⟨h₁, h₂⟩ ↦ { h₁ with maximalOfPrime := (h₂ _ · · ▸ maximalIdeal.isMaximal R) }
   tfae_have 3 → 5
-  · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
-  tfae_have 5 → 6
-  · rintro ⟨x, hx⟩
-    have : x ∈ maximalIdeal R := by rw [hx]; exact Submodule.subset_span (Set.mem_singleton x)
-    let x' : maximalIdeal R := ⟨x, this⟩
-    use Submodule.Quotient.mk x'
-    constructor
-    swap
-    · intro e
-      rw [Submodule.Quotient.mk_eq_zero] at e
-      apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
-      apply Submodule.eq_bot_of_le_smul_of_le_jacobson_bot (maximalIdeal R)
-      · exact ⟨{x}, (Finset.coe_singleton x).symm ▸ hx.symm⟩
-      · conv_lhs => rw [hx]
-        rw [Submodule.mem_smul_top_iff] at e
-        rwa [Submodule.span_le, Set.singleton_subset_iff]
-      · rw [LocalRing.jacobson_eq_maximalIdeal (⊥ : Ideal R) bot_ne_top]
-    · refine' fun w => Quotient.inductionOn' w fun y => _
-      obtain ⟨y, hy⟩ := y
-      rw [hx, Submodule.mem_span_singleton] at hy
-      obtain ⟨a, rfl⟩ := hy
-      exact ⟨Ideal.Quotient.mk _ a, rfl⟩
-  tfae_have 6 → 5
-  · rintro ⟨x, hx, hx'⟩
-    induction x using Quotient.inductionOn' with | h x => ?_
-    use x
-    apply le_antisymm
-    swap; · rw [Submodule.span_le, Set.singleton_subset_iff]; exact x.prop
-    have h₁ :
-      (Ideal.span {(x : R)} : Ideal R) ⊔ maximalIdeal R ≤
-        Ideal.span {(x : R)} ⊔ maximalIdeal R • maximalIdeal R := by
-      refine' sup_le le_sup_left _
-      rintro m hm
-      obtain ⟨c, hc⟩ := hx' (Submodule.Quotient.mk ⟨m, hm⟩)
-      induction c using Quotient.inductionOn' with | h c => ?_
-      rw [← sub_sub_cancel (c * x) m]
-      apply sub_mem _ _
-      · refine' Ideal.mem_sup_left (Ideal.mem_span_singleton'.mpr ⟨c, rfl⟩)
-      · have := (Submodule.Quotient.eq _).mp hc
-        rw [Submodule.mem_smul_top_iff] at this
-        exact Ideal.mem_sup_right this
-    have h₂ : maximalIdeal R ≤ (⊥ : Ideal R).jacobson := by
-      rw [LocalRing.jacobson_eq_maximalIdeal]
-      exact bot_ne_top
-    have :=
-      Submodule.sup_smul_eq_sup_smul_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
-    rw [Submodule.bot_smul, sup_bot_eq] at this
-    rw [← sup_eq_left, eq_comm]
-    exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
+  · exact fun h ↦ maximalIdeal_isPrincipal_of_isDedekindDomain R
+  tfae_have 6 ↔ 5
+  · exact finrank_cotangentSpace_le_one_iff
   tfae_have 5 → 7
-  · exact exists_maximalIdeal_pow_eq_of_principal R h
+  · exact exists_maximalIdeal_pow_eq_of_principal R
   tfae_have 7 → 2
   · rw [ValuationRing.iff_ideal_total]
     intro H
@@ -249,4 +205,54 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     · left; exact Ideal.pow_le_pow_right h'
     · right; exact Ideal.pow_le_pow_right h'
   tfae_finish
+
+/--
+The following are equivalent for a
+noetherian local domain that is not a field `(R, m, k)`:
+0. `R` is a discrete valuation ring
+1. `R` is a valuation ring
+2. `R` is a dedekind domain
+3. `R` is integrally closed with a unique non-zero prime ideal
+4. `m` is principal
+5. `dimₖ m/m² = 1`
+6. Every nonzero ideal is a power of `m`.
+
+Also see `tfae_of_isNoetherianRing_of_localRing_of_isDomain` for a version without `¬ IsField R`.
+-/
+theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain R]
+    (h : ¬IsField R) :
+    List.TFAE
+      [DiscreteValuationRing R, ValuationRing R, IsDedekindDomain R,
+        IsIntegrallyClosed R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ P.IsPrime, (maximalIdeal R).IsPrincipal,
+        finrank (ResidueField R) (CotangentSpace R) = 1,
+        ∀ (I) (_ : I ≠ ⊥), ∃ n : ℕ, I = maximalIdeal R ^ n] := by
+  have : finrank (ResidueField R) (CotangentSpace R) = 1 ↔
+    finrank (ResidueField R) (CotangentSpace R) ≤ 1
+  · simp [Nat.le_one_iff_eq_zero_or_eq_one, finrank_cotangentSpace_eq_zero_iff, h]
+  rw [this]
+  have : maximalIdeal R ≠ ⊥ := isField_iff_maximalIdeal_eq.not.mp h
+  convert tfae_of_isNoetherianRing_of_localRing_of_isDomain R
+  · exact ⟨fun _ ↦ inferInstance, fun h ↦ { h with not_a_field' := this }⟩
+  · exact ⟨fun h P h₁ h₂ ↦ h.unique ⟨h₁, h₂⟩ ⟨this, inferInstance⟩,
+      fun H ↦ ⟨_, ⟨this, inferInstance⟩, fun P hP ↦ H P hP.1 hP.2⟩⟩
 #align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
+
+variable {R}
+
+lemma LocalRing.finrank_CotangentSpace_eq_one_iff [IsNoetherianRing R] [LocalRing R] [IsDomain R] :
+    finrank (ResidueField R) (CotangentSpace R) = 1 ↔ DiscreteValuationRing R := by
+  by_cases hR : IsField R
+  · letI := hR.toField
+    simp only [finrank_cotangentSpace_eq_zero, zero_ne_one, false_iff]
+    exact fun h ↦ h.3 maximalIdeal_eq_bot
+  · exact (DiscreteValuationRing.TFAE R hR).out 5 0
+
+variable (R)
+
+lemma LocalRing.finrank_CotangentSpace_eq_one [IsDomain R] [DiscreteValuationRing R] :
+    finrank (ResidueField R) (CotangentSpace R) = 1 :=
+  finrank_CotangentSpace_eq_one_iff.mpr ‹_›
+
+instance (priority := 100) IsDedekindDomain.isPrincipalIdealRing
+    [LocalRing R] [IsDedekindDomain R] :
+    IsPrincipalIdealRing R := ((tfae_of_isNoetherianRing_of_localRing_of_isDomain R).out 2 0).mp ‹_›
chore: remove uses of cases' (#9171)

I literally went through and regex'd some uses of cases', replacing them with rcases; this is meant to be a low effort PR as I hope that tools can do this in the future.

rcases is an easier replacement than cases, though with better tools we could in future do a second pass converting simple rcases added here (and existing ones) to cases.

Diff
@@ -245,7 +245,7 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
     obtain ⟨n, rfl⟩ := H I hI
     obtain ⟨m, rfl⟩ := H J hJ
-    cases' le_total m n with h' h'
+    rcases le_total m n with h' | h'
     · left; exact Ideal.pow_le_pow_right h'
     · right; exact Ideal.pow_le_pow_right h'
   tfae_finish
chore: Rename pow monotonicity lemmas (#9095)

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

Renames

Algebra.GroupPower.Order

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

Algebra.GroupPower.CovariantClass

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

Data.Nat.Pow

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

Lemmas added

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

Lemmas removed

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

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -81,7 +81,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
     by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
     obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
     rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
-    apply Ideal.pow_le_pow (Nat.find_min' this hs₁)
+    apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
     apply Ideal.pow_mem_pow
     exact (H _).mpr (dvd_refl _)
   · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
@@ -246,7 +246,7 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     obtain ⟨n, rfl⟩ := H I hI
     obtain ⟨m, rfl⟩ := H J hJ
     cases' le_total m n with h' h'
-    · left; exact Ideal.pow_le_pow h'
-    · right; exact Ideal.pow_le_pow h'
+    · left; exact Ideal.pow_le_pow_right h'
+    · right; exact Ideal.pow_le_pow_right h'
   tfae_finish
 #align discrete_valuation_ring.tfae DiscreteValuationRing.TFAE
feat: Add Submodule.le_of_le_smul_of_le_jacobson_bot. (#8679)
Diff
@@ -224,7 +224,7 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
       rw [LocalRing.jacobson_eq_maximalIdeal]
       exact bot_ne_top
     have :=
-      Submodule.smul_sup_eq_smul_sup_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
+      Submodule.sup_smul_eq_sup_smul_of_le_smul_of_le_jacobson (IsNoetherian.noetherian _) h₂ h₁
     rw [Submodule.bot_smul, sup_bot_eq] at this
     rw [← sup_eq_left, eq_comm]
     exact le_sup_left.antisymm (h₁.trans <| le_of_eq this)
chore: rename by_contra' to by_contra! (#8797)

To fit with the "please try harder" convention of ! tactics.

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

Diff
@@ -68,14 +68,14 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
       exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
   have : ∃ n : ℕ, x ^ n ∈ I := by
     obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
-      by_contra' h; apply hI; rw [eq_bot_iff]; exact h
+      by_contra! h; apply hI; rw [eq_bot_iff]; exact h
     obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
     use n
     rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
   use Nat.find this
   apply le_antisymm
   · change ∀ s ∈ I, s ∈ _
-    by_contra' hI''
+    by_contra! hI''
     obtain ⟨s, hs₁, hs₂⟩ := hI''
     apply hs₂
     by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
@@ -94,7 +94,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
   by_cases ne_bot : maximalIdeal R = ⊥
   · rw [ne_bot]; infer_instance
   obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ maximalIdeal R, a ≠ (0 : R) := by
-    by_contra' h'; apply ne_bot; rwa [eq_bot_iff]
+    by_contra! h'; apply ne_bot; rwa [eq_bot_iff]
   have hle : Ideal.span {a} ≤ maximalIdeal R := by rwa [Ideal.span_le, Set.singleton_subset_iff]
   have : (Ideal.span {a}).radical = maximalIdeal R := by
     rw [Ideal.radical_eq_sInf]
@@ -111,7 +111,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     rw [hn, pow_zero, Ideal.one_eq_top] at this
     exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
   obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximalIdeal R ^ n, ¬b ∈ Ideal.span {a} := by
-    by_contra' h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
+    by_contra! h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
   have hb₃ : ∀ m ∈ maximalIdeal R, ∃ k : R, k * a = b * m := by
     intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
     rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
chore: use by_contra' instead of by_contra + push_neg (#8798)

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

Diff
@@ -75,8 +75,7 @@ theorem exists_maximalIdeal_pow_eq_of_principal [IsNoetherianRing R] [LocalRing
   use Nat.find this
   apply le_antisymm
   · change ∀ s ∈ I, s ∈ _
-    by_contra hI''
-    push_neg at hI''
+    by_contra' hI''
     obtain ⟨s, hs₁, hs₂⟩ := hI''
     apply hs₂
     by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
refactor: make IsDedekindDomain extend the other classes (#5834)

This redefines the IsDedekindDomain class to be the conjunction through extends of the classes IsDomain, IsNoetherianRing, DimensionLEOne and IsIntegrallyClosed.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Should.20.60IsDedekindDomain.60.20extend.20.60IsDomain.60.3F

Diff
@@ -176,9 +176,9 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     exact ⟨inferInstance, ((DiscreteValuationRing.iff_pid_with_one_nonzero_prime R).mp H).2⟩
   tfae_have 4 → 3
   · rintro ⟨h₁, h₂⟩;
-    exact
-      ⟨inferInstance, ⟨fun hI hI' =>
-        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximalIdeal.isMaximal R⟩, h₁⟩
+    exact { h₁ with
+      maximalOfPrime := fun hI hI' => ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸
+        maximalIdeal.isMaximal R, }
   tfae_have 3 → 5
   · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
   tfae_have 5 → 6
@@ -236,6 +236,12 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
     intro H
     constructor
     intro I J
+    -- `by_cases` should invoke `classical` by itself if it can't find a `Decidable` instance,
+    -- however the `tfae` hypotheses trigger a looping instance search.
+    -- See also:
+    -- https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.60by_cases.60.20trying.20to.20find.20a.20weird.20instance
+    -- As a workaround, add the desired instance ourselves.
+    let _ := Classical.decEq (Ideal R)
     by_cases hI : I = ⊥; · subst hI; left; exact bot_le
     by_cases hJ : J = ⊥; · subst hJ; right; exact bot_le
     obtain ⟨n, rfl⟩ := H I hI
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -27,7 +27,7 @@ noetherian local domain `(R, m, k)`:
 -/
 
 
-variable (R : Type _) [CommRing R] (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
+variable (R : Type*) [CommRing R] (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
 
 open scoped DiscreteValuation
 
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
@@ -119,7 +119,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
   have hb₄ : b ≠ 0 := by rintro rfl; apply hb₂; exact zero_mem _
   let K := FractionRing R
   let x : K := algebraMap R K b / algebraMap R K a
-  let M := Submodule.map (Algebra.ofId R K).toLinearMap (maximalIdeal R)
+  let M := Submodule.map (Algebra.linearMap R K) (maximalIdeal R)
   have ha₃ : algebraMap R K a ≠ 0 := IsFractionRing.to_map_eq_zero_iff.not.mpr ha₂
   by_cases hx : ∀ y ∈ M, x * y ∈ M
   · have := isIntegral_of_smul_mem_submodule M ?_ ?_ x hx
@@ -131,7 +131,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
       exact (IsFractionRing.to_map_eq_zero_iff (K := K)).not.mpr ha₂
     · apply Submodule.FG.map; exact IsNoetherian.noetherian _
   · have :
-        (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.ofId R K).toLinearMap = ⊤ := by
+        (M.map (DistribMulAction.toLinearMap R K x)).comap (Algebra.linearMap R K) = ⊤ := by
       by_contra h; apply hx
       rintro m' ⟨m, hm, rfl : algebraMap R K m = m'⟩
       obtain ⟨k, hk⟩ := hb₃ m hm
refactor: turn DimensionLEOne into a class (#5833)

The predicate that a ring has Krull dimension at most one was a regular def. I believe we should turn it into a class because:

  • The property follows from the ring structure, e.g. because it is a PID or because it is an integral closure.
  • We pass it around as a whole hypothesis, something instance synthesis can deal well with.
  • It makes the definition of IsDedekindDomain the conjunction of a number of classes, so we could switch to extends for all its fields.

The main change in API is the addition of Ideal.IsPrime.isMaximal which is a restatement of the Krull dimension property with convenient dot notation: turn a prime ideal into a maximal ideal given the hypothesis that it's not zero.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Should.20.60IsDedekindDomain.60.20extend.20.60IsDomain.60.3F/near/374515392

Diff
@@ -103,7 +103,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     · exact sInf_le ⟨hle, inferInstance⟩
     · refine'
         le_sInf fun I hI =>
-          (eq_maximalIdeal <| IsDedekindDomain.dimensionLEOne _ (fun e => ha₂ _) hI.2).ge
+          (eq_maximalIdeal <| hI.2.isMaximal (fun e => ha₂ _)).ge
       rw [← Ideal.span_singleton_eq_bot, eq_bot_iff, ← e]; exact hI.1
   have : ∃ n, maximalIdeal R ^ n ≤ Ideal.span {a} := by
     rw [← this]; apply Ideal.exists_radical_pow_le_of_fg; exact IsNoetherian.noetherian _
@@ -177,8 +177,8 @@ theorem DiscreteValuationRing.TFAE [IsNoetherianRing R] [LocalRing R] [IsDomain
   tfae_have 4 → 3
   · rintro ⟨h₁, h₂⟩;
     exact
-      ⟨inferInstance, fun I hI hI' =>
-        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximalIdeal.isMaximal R, h₁⟩
+      ⟨inferInstance, ⟨fun hI hI' =>
+        ExistsUnique.unique h₂ ⟨ne_bot, inferInstance⟩ ⟨hI, hI'⟩ ▸ maximalIdeal.isMaximal R⟩, h₁⟩
   tfae_have 3 → 5
   · intro h; exact maximalIdeal_isPrincipal_of_isDedekindDomain R
   tfae_have 5 → 6
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,17 +2,14 @@
 Copyright (c) 2022 Andrew Yang. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.discrete_valuation_ring.tfae
-! leanprover-community/mathlib commit f0c8bf9245297a541f468be517f1bde6195105e9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.Ideal.Cotangent
 import Mathlib.RingTheory.DedekindDomain.Basic
 import Mathlib.RingTheory.Valuation.ValuationRing
 import Mathlib.RingTheory.Nakayama
 
+#align_import ring_theory.discrete_valuation_ring.tfae from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
+
 /-!
 
 # Equivalent conditions for DVR
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -115,7 +115,7 @@ theorem maximalIdeal_isPrincipal_of_isDedekindDomain [LocalRing R] [IsDomain R]
     rw [hn, pow_zero, Ideal.one_eq_top] at this
     exact (Ideal.IsMaximal.ne_top inferInstance (eq_top_iff.mpr <| this.trans hle)).elim
   obtain ⟨b, hb₁, hb₂⟩ : ∃ b ∈ maximalIdeal R ^ n, ¬b ∈ Ideal.span {a} := by
-    by_contra' h'; rw [Nat.find_eq_iff] at hn ; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
+    by_contra' h'; rw [Nat.find_eq_iff] at hn; exact hn.2 n n.lt_succ_self fun x hx => h' x hx
   have hb₃ : ∀ m ∈ maximalIdeal R, ∃ k : R, k * a = b * m := by
     intro m hm; rw [← Ideal.mem_span_singleton']; apply Nat.find_spec this
     rw [hn, pow_succ']; exact Ideal.mul_mem_mul hb₁ hm
feat: port RingTheory.DiscreteValuationRing.TFAE (#4825)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Dependencies 10 + 678

679 files ported (98.5%)
278539 lines ported (98.8%)
Show graph

The unported dependencies are