From ff03d3bdecab9ed95c94adaadbe3e8be68b94d97 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 1 Apr 2026 22:22:47 +0800 Subject: [PATCH 01/69] add two lemmas --- Mathlib/RingTheory/Ideal/Height.lean | 3 +++ Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 28ae520c1cff57..a6cf6647278e54 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -197,6 +197,9 @@ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : · rintro ⟨hI, hI'⟩ b hb exact hI' (y := b.asIdeal) b.isPrime hb +lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by + rw [Ideal.height_eq_primeHeight, Ideal.primeHeight_eq_zero_iff] + @[simp] lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 6338b28d7d2623..8c16364ef9a978 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -54,6 +54,9 @@ variable {I J} theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := h.1.1 +theorem minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := + h.1.1 + theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by set S := { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ OrderDual.ofDual p } suffices h : ∃ m, OrderDual.toDual J ≤ m ∧ Maximal (· ∈ S) m by From 1f742557f1d7946e5462c0858b0ae45267d0252e Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 1 Apr 2026 23:50:31 +0800 Subject: [PATCH 02/69] reduce .1.1 --- .../RingTheory/Ideal/AssociatedPrime/Localization.lean | 2 +- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index 37909f3465e6de..408ebe65b172f3 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -131,7 +131,7 @@ variable (R M) in lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] : (Module.annihilator R M).minimalPrimes ⊆ associatedPrimes R M := by intro p hp - have prime := hp.1.1 + have prime := Ideal.minimalPrimes_isPrime hp let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using hp.1.2 diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 0d273c352d3b7b..a8256e59729471 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -106,7 +106,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing has height at most 1. -/ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes (I : Ideal R) [I.IsPrincipal] (p : Ideal R) (hp : p ∈ I.minimalPrimes) : p.height ≤ 1 := by - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ · rwa [← IsLocalization.height_comap p.primeCompl, @@ -117,7 +117,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I - have : p.IsPrime := hp.1.1 + have : p.IsPrime := Ideal.minimalPrimes_isPrime hp have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans hp.1.2) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, map_mono (le_sup_right.trans hp.1.2)⟩, @@ -176,7 +176,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimal_primes induction hn : s.card using Nat.strong_induction_on generalizing R with | h n H => replace hn : s.card ≤ n := hn.le - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp cases n with | zero => rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_primeHeight p, @@ -239,7 +239,7 @@ lemma Ideal.height_le_spanRank_toENat (I : Ideal R) (hI : I ≠ ⊤) : obtain ⟨J, hJ⟩ := nonempty_minimalPrimes hI refine (iInf₂_le J hJ).trans ?_ convert (I.height_le_spanRank_toENat_of_mem_minimal_primes J hJ) - exact Eq.symm (@height_eq_primeHeight _ _ J hJ.1.1) + exact Eq.symm (@height_eq_primeHeight _ _ J (Ideal.minimalPrimes_isPrime hJ)) lemma Ideal.height_le_spanFinrank (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanFinrank := by From 348b7158aa55be5e6740ec33415be6500e022dee Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 00:17:15 +0800 Subject: [PATCH 03/69] add more heoght analogus --- Mathlib/RingTheory/Ideal/Height.lean | 61 +++++++++++++++------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index a6cf6647278e54..c8ee1f1bf9f2dd 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -213,10 +213,7 @@ lemma Ideal.height_of_subsingleton [Subsingleton R] : I.height = ⊤ := by theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := by - have h : I ≠ ⊤ := by - intro h - simp only [h, ← Ideal.height_eq_primeHeight, Ideal.height_top, WithBot.coe_top] at e - exact ringKrullDim_ne_top e.symm + have h : I ≠ ⊤ := Ideal.IsPrime.ne_top' obtain ⟨M, hM, hM'⟩ := Ideal.exists_le_maximal I h rcases lt_or_eq_of_le hM' with (hM' | hM') · have h1 := Ideal.primeHeight_strict_mono hM' @@ -224,6 +221,11 @@ theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] simp [← not_lt, h1] at h2 · exact hM' ▸ hM +theorem Ideal.isMaximal_of_height_eq_ringKrullDim {I : Ideal R} [I.IsPrime] + [FiniteRingKrullDim R] (e : I.height = ringKrullDim R) : I.IsMaximal := by + rw [Ideal.height_eq_primeHeight] at e + exact Ideal.isMaximal_of_primeHeight_eq_ringKrullDim e + /-- The prime height of the maximal ideal equals the Krull dimension in a local ring -/ @[simp] theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : @@ -239,13 +241,17 @@ theorem IsLocalRing.maximalIdeal_height_eq_ringKrullDim [IsLocalRing R] : /-- For a local ring with finite Krull dimension, a prime ideal has height equal to the Krull dimension if and only if it is the maximal ideal. -/ -theorem Ideal.primeHeight_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] {I : Ideal R} - [I.IsPrime] : Ideal.primeHeight I = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by +theorem Ideal.height_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] {I : Ideal R} + [I.IsPrime] : I.height = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by constructor · intro h - exact IsLocalRing.eq_maximalIdeal (Ideal.isMaximal_of_primeHeight_eq_ringKrullDim h) + exact IsLocalRing.eq_maximalIdeal (Ideal.isMaximal_of_height_eq_ringKrullDim h) · rintro rfl - exact IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim + exact IsLocalRing.maximalIdeal_height_eq_ringKrullDim + +theorem Ideal.primeHeight_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] {I : Ideal R} + [I.IsPrime] : Ideal.primeHeight I = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by + rw [← Ideal.height_eq_primeHeight, Ideal.height_eq_ringKrullDim_iff] lemma Ideal.height_le_iff {p : Ideal R} {n : ℕ} [p.IsPrime] : p.height ≤ n ↔ ∀ q : Ideal R, q.IsPrime → q < p → q.height < n := by @@ -378,7 +384,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id refine (Ideal.subset_union_prime ⊥ ⊥ ?_).not.mpr ?_ · rintro K hK - - rw [Set.Finite.mem_toFinset] at hK - exact hK.1.1.1 + exact Ideal.minimalPrimes_isPrime hK.1 · push Not intro K hK e have := hr.trans (Ideal.height_mono e) @@ -394,25 +400,18 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id push_cast exact add_le_add h₂ ((Submodule.spanRank_span_le_card _).trans (by simp)) · refine le_iInf₂ (fun p hp ↦ ?_) - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp + rw [← p.height_eq_primeHeight] by_cases h : p.height = ⊤ - · rw [← p.height_eq_primeHeight, h] - exact le_top + · exact le_of_le_of_eq le_top h.symm have : p.FiniteHeight := ⟨Or.inr h⟩ have := Ideal.height_mono (le_sup_left.trans hp.1.2) - suffices h : (r : ℕ∞) ≠ p.primeHeight by - push_cast - have := h₃.trans this - rw [Ideal.height_eq_primeHeight] at this - exact Order.add_one_le_of_lt (lt_of_le_of_ne this h) + suffices h : (r : ℕ∞) ≠ p.height by + exact Order.add_one_le_of_lt (lt_of_le_of_ne (h₃.trans this) h) intro e apply hx₂ p - · have : J.height = p.primeHeight := by - apply le_antisymm - · rwa [← p.height_eq_primeHeight] - · rwa [← e] - refine ⟨mem_minimalPrimes_of_primeHeight_eq_height (le_sup_left.trans hp.1.2) this.symm, ?_⟩ - rwa [p.height_eq_primeHeight, eq_comm] + · have hteq : J.height = p.height := this.antisymm (le_of_eq_of_le e.symm h₃) + refine ⟨mem_minimalPrimes_of_height_eq (le_sup_left.trans hp.1.2) (ge_of_eq hteq), e.symm⟩ · exact hp.1.2 <| Ideal.mem_sup_right <| Ideal.subset_span <| Set.mem_singleton x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the @@ -451,16 +450,22 @@ lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : /-- In a nontrivial commutative ring `R`, the supremum of prime heights of all maximal ideals is equal to the Krull dimension of `R`. -/ -lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : - ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.primeHeight) = ringKrullDim R := by - rw [← Ideal.sup_primeHeight_eq_ringKrullDim, WithBot.coe_inj] +lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : + ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.height) = ringKrullDim R := by + rw [← Ideal.sup_height_eq_ringKrullDim, WithBot.coe_inj] apply le_antisymm - · exact iSup_mono fun I => iSup_mono' fun hI => ⟨IsMaximal.isPrime hI, le_rfl⟩ + · exact iSup_mono fun I => iSup_mono' fun hI => ⟨hI.isPrime.ne_top , le_rfl⟩ · refine iSup_mono' fun I => ?_ obtain rfl | I_top := eq_or_ne I ⊤ · exact ⟨⊥, by grind [iSup_le_iff, Ideal.IsPrime.ne_top]⟩ · obtain ⟨M, hM, hIM⟩ := exists_le_maximal I I_top - exact ⟨M, iSup_mono' (fun hI ↦ ⟨hM, primeHeight_mono hIM⟩)⟩ + exact ⟨M, iSup_mono' (fun hI ↦ ⟨hM, height_mono hIM⟩)⟩ + +/-- In a nontrivial commutative ring `R`, the supremum of prime heights of all maximal ideals is +equal to the Krull dimension of `R`. -/ +lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : + ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.primeHeight) = ringKrullDim R := by + simp_rw [← Ideal.height_eq_primeHeight, Ideal.sup_height_of_maximal_eq_ringKrullDim] section isLocalization From c24b383bc6bebe6acfc7d57e71638332ed5f4372 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 10:18:05 +0800 Subject: [PATCH 04/69] add le lemma --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 8c16364ef9a978..f2ef9f2c52ac28 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -54,6 +54,9 @@ variable {I J} theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := h.1.1 +theorem Ideal.le_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := + h.1.2 + theorem minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 From a12d523d24d56f3e3840ff58daae8fb615796caa Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 10:59:03 +0800 Subject: [PATCH 05/69] reduce more .1.1 and .1.2 --- .../Ideal/AssociatedPrime/Localization.lean | 3 +- Mathlib/RingTheory/Ideal/Height.lean | 22 ++++++------- .../RingTheory/Ideal/MinimalPrime/Basic.lean | 17 +++++----- .../RingTheory/Ideal/MinimalPrime/Colon.lean | 12 +++---- .../Ideal/MinimalPrime/Localization.lean | 33 ++++++++++--------- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index 408ebe65b172f3..2d07b507186198 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -134,7 +134,8 @@ lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Mo have prime := Ideal.minimalPrimes_isPrime hp let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by - simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using hp.1.2 + simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using + Ideal.le_minimalPrimes hp rcases associatedPrimes.nonempty Rₚ (LocalizedModule p.primeCompl M) with ⟨q, hq⟩ have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq simp only [← preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index c8ee1f1bf9f2dd..5b458b468e9a25 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -117,7 +117,7 @@ theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height simp only [height] refine le_iInf₂ (fun p hp ↦ ?_) have := Ideal.minimalPrimes_isPrime hp - obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans hp.1.2) + obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_minimalPrimes hp)) haveI := Ideal.minimalPrimes_isPrime hq exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @@ -131,7 +131,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) haveI := Ideal.minimalPrimes_isPrime hK - have : I < K := lt_of_lt_of_le h hK.1.2 + have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : @@ -179,10 +179,10 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr obtain ⟨p, h₁, h₂⟩ := Ideal.exists_minimalPrimes_le e convert h₁ refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm - have := h₁.1.1 + have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ - ((height_strict_mono_of_is_prime h₃).trans_le (e'.trans <| height_mono h₁.1.2)) + exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le + (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : @@ -204,7 +204,7 @@ lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] - exact ⟨p, hp, haveI := hp.1.1; primeHeight_eq_zero_iff.mpr hp⟩ + exact ⟨p, hp, haveI := Ideal.minimalPrimes_isPrime hp; primeHeight_eq_zero_iff.mpr hp⟩ /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @[simp, nontriviality] @@ -290,7 +290,7 @@ lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal rw [← Ideal.comap_coe, Ideal.comap_minimalPrimes_eq_of_surjective (f := (↑e : R →+* S)) e.surjective] exact e.idealComapOrderIso.injective.mem_set_image.symm - · have : J.IsPrime := h.1.1 + · have : J.IsPrime := Ideal.minimalPrimes_isPrime h simp only [EquivLike.coe_coe, RingEquiv.idealComapOrderIso_apply, ← Ideal.height_eq_primeHeight, RingEquiv.height_comap_of_isPrime] @@ -405,14 +405,14 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id by_cases h : p.height = ⊤ · exact le_of_le_of_eq le_top h.symm have : p.FiniteHeight := ⟨Or.inr h⟩ - have := Ideal.height_mono (le_sup_left.trans hp.1.2) + have := Ideal.height_mono (le_sup_left.trans (Ideal.le_minimalPrimes hp)) suffices h : (r : ℕ∞) ≠ p.height by exact Order.add_one_le_of_lt (lt_of_le_of_ne (h₃.trans this) h) intro e apply hx₂ p - · have hteq : J.height = p.height := this.antisymm (le_of_eq_of_le e.symm h₃) - refine ⟨mem_minimalPrimes_of_height_eq (le_sup_left.trans hp.1.2) (ge_of_eq hteq), e.symm⟩ - · exact hp.1.2 <| Ideal.mem_sup_right <| Ideal.subset_span <| Set.mem_singleton x + · refine ⟨mem_minimalPrimes_of_height_eq (le_sup_left.trans (Ideal.le_minimalPrimes hp)) + (le_of_eq_of_le e.symm h₃), e.symm⟩ + · exact (Ideal.le_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index f2ef9f2c52ac28..689fddcfb9f092 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -123,17 +123,17 @@ theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes ext J constructor · exact fun H => - let e := H.1.1.radical_le_iff.mpr H.1.2 + let e := (Ideal.minimalPrimes_isPrime H).radical_le_iff.mpr (Ideal.le_minimalPrimes H) (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ theorem Ideal.minimalPrimes_eq_subsingleton_self [I.IsPrime] : I.minimalPrimes = {I} := by ext J - constructor - · exact fun H => (H.2 ⟨inferInstance, rfl.le⟩ H.1.2).antisymm H.1.2 - · rintro (rfl : J = I) - exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ + refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ (Ideal.le_minimalPrimes H)).antisymm + (Ideal.le_minimalPrimes H), ?_⟩ + rintro (rfl : J = I) + exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ variable (R) in theorem IsDomain.minimalPrimes_eq_singleton_bot [IsDomain R] : @@ -150,7 +150,7 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact h.1.1.ne_top (top_le_iff.mp h.1.2) + exact (Ideal.minimalPrimes_isPrime h).ne_top (top_le_iff.mp (Ideal.le_minimalPrimes h)) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by @@ -169,7 +169,8 @@ lemma Ideal.mem_minimalPrimes_sup {R : Type*} [CommRing R] {p I J : Ideal R} [p. p ∈ (I ⊔ J).minimalPrimes := by refine ⟨⟨‹_›, ?_⟩, fun q ⟨_, hq⟩ hqp ↦ ?_⟩ · rw [sup_le_iff] - exact ⟨hle, by simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) h.1.2⟩ + refine ⟨hle, ?_⟩ + simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) (Ideal.le_minimalPrimes h) · rw [sup_le_iff] at hq have h2 : p.map (Quotient.mk I) ≤ q.map (Quotient.mk I) := h.2 ⟨isPrime_map_quotientMk_of_isPrime hq.1, map_mono hq.2⟩ (map_mono hqp) @@ -189,7 +190,7 @@ lemma Ideal.map_sup_mem_minimalPrimes_of_map_quotientMk_mem_minimalPrimes refine ⟨⟨inferInstance, sup_le_iff.mpr ?_⟩, fun q ⟨_, hleq⟩ hqle ↦ ?_⟩ · refine ⟨?_, hJP⟩ rw [Ideal.map_le_iff_le_comap, ← Ideal.under_def, ← Ideal.over_def P p] - exact hI.1.2 + exact Ideal.le_minimalPrimes hI · simp only [sup_le_iff] at hleq have h1 : p.map (algebraMap R S) ≤ q := by rw [Ideal.map_le_iff_le_comap] diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean index 9ecd208c7666f6..8758fea64c554d 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean @@ -48,7 +48,8 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] refine ⟨n, hn0, ((h.toFinset.erase I).inf id) ^ n, hn, ?_⟩ have (K : Ideal R) (hKI : K ≤ I) (hK : K ∈ ann.minimalPrimes) : K = I := le_antisymm hKI (hI.2 hK.1 hKI) - simpa [hI.1.1.pow_le_iff hn0, hI.1.1.inf_le', imp_not_comm, not_imp_not] + simpa [(Ideal.minimalPrimes_isPrime hI).pow_le_iff hn0, + (Ideal.minimalPrimes_isPrime hI).inf_le', imp_not_comm, not_imp_not] obtain ⟨hn0, J, hJ, hJI⟩ := Nat.find_spec key -- let `n` be minimal such that there exists an ideal `J` with `I ^ n * J ≤ ann` and `¬ J ≠ I` set n := Nat.find key @@ -74,9 +75,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] -- let `z` be the product of these finitely many `f y`'s let z := ∏ y ∈ s, f y -- then `z ∉ I` - have hz : z ∉ I := by - simp only [z, hI.1.1.prod_mem_iff, not_exists, not_and_or] - exact fun i ↦ Or.inr (h i) + have hz : z ∉ I := by simp [z, (Ideal.minimalPrimes_isPrime hI).prod_mem_iff, h] -- and `K ≤ colon N {z • x}` have hz' : K ≤ colon N {z • x} := by rw [← (map_injective_of_injective K.subtype_injective).eq_iff, map_subtype_top] at hs @@ -92,11 +91,12 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] simpa only [ann, mem_colon_singleton, mul_comm, mul_smul] using hz' hi -- but now `K = I ^ (n - 1) * J` contradicts the minimality of `n` have hK : I ^ (n - 1) * (J * Ideal.span {z}) ≤ ann ∧ ¬ J * Ideal.span {z} ≤ I := by - rw [← mul_assoc, hI.1.1.mul_le, not_or, Ideal.span_singleton_le_iff_mem] + rw [← mul_assoc, (Ideal.minimalPrimes_isPrime hI).mul_le, not_or, + Ideal.span_singleton_le_iff_mem] exact ⟨hz', hJI, hz⟩ by_cases hn' : n - 1 = 0 · simp [K, show n = 1 by grind] at hz' - exact (hK.2 (hz'.trans hI.1.2)).elim + exact (hK.2 (hz'.trans (Ideal.le_minimalPrimes hI))).elim · grind [Nat.find_min' key ⟨hn', J * Ideal.span {z}, hK⟩] end Submodule diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 7d76dbf783fb02..5b07cd7cc83ae0 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -65,8 +65,8 @@ theorem Ideal.iUnion_minimalPrimes : · rintro ⟨y, hy, hx⟩ obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy - refine ⟨p, hp, (hp.1.1.mem_or_mem ?_).resolve_right hyp⟩ - exact hp.1.1.radical_le_iff.mpr hp.1.2 hx + refine ⟨p, hp, ((Ideal.minimalPrimes_isPrime hp).mem_or_mem ?_).resolve_right hyp⟩ + exact (Ideal.minimalPrimes_isPrime hp).radical_le_iff.mpr (Ideal.le_minimalPrimes hp) hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -97,8 +97,8 @@ lemma Ideal.disjoint_nonZeroDivisors_of_mem_minimalPrimes {p : Ideal R} (hp : p theorem Ideal.exists_comap_eq_of_mem_minimalPrimes {I : Ideal S} (f : R →+* S) (p) (H : p ∈ (I.comap f).minimalPrimes) : ∃ p' : Ideal S, p'.IsPrime ∧ I ≤ p' ∧ p'.comap f = p := - have := H.1.1 - have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I H.1.2 + have := Ideal.minimalPrimes_isPrime H + have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_minimalPrimes H) ⟨p', hp', hIp', le.antisymm (H.2 ⟨inferInstance, comap_mono hIp'⟩ le)⟩ @[stacks 00FK] theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S} @@ -113,9 +113,9 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) obtain ⟨p', h₁, h₂, h₃⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f p H obtain ⟨q, hq, hq'⟩ := Ideal.exists_minimalPrimes_le h₂ refine ⟨q, hq, Eq.symm ?_⟩ - have := hq.1.1 + have := Ideal.minimalPrimes_isPrime hq have := (Ideal.comap_mono hq').trans_eq h₃ - exact (H.2 ⟨inferInstance, Ideal.comap_mono hq.1.2⟩ this).antisymm this + exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes hq)⟩ this).antisymm this theorem Ideal.minimalPrimes_comap_subset (f : R →+* S) (J : Ideal S) : (J.comap f).minimalPrimes ⊆ Ideal.comap f '' J.minimalPrimes := @@ -129,8 +129,8 @@ variable {R S : Type*} [CommRing R] [CommRing S] {I J : Ideal R} theorem Ideal.minimal_primes_comap_of_surjective {f : R →+* S} (hf : Function.Surjective f) {I J : Ideal S} (h : J ∈ I.minimalPrimes) : J.comap f ∈ (I.comap f).minimalPrimes := by - have := h.1.1 - refine ⟨⟨inferInstance, Ideal.comap_mono h.1.2⟩, ?_⟩ + have := Ideal.minimalPrimes_isPrime h + refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes h)⟩, ?_⟩ rintro K ⟨hK, e₁⟩ e₂ have : RingHom.ker f ≤ K := (Ideal.comap_mono bot_le).trans e₁ rw [← sup_eq_left.mpr this, RingHom.ker_eq_comap_bot, ← Ideal.comap_map_of_surjective f hf] @@ -156,7 +156,8 @@ lemma Ideal.minimalPrimes_map_of_surjective {S : Type*} [CommRing S] {f : R →+ rw [← Ideal.comap_minimalPrimes_eq_of_surjective hf, ← Set.image_comp, Ideal.comap_map_of_surjective f hf, Set.image_congr, Set.image_id, RingHom.ker] intro x hx - exact (Ideal.comap_map_of_surjective f hf _).trans (sup_eq_left.mpr <| le_sup_right.trans hx.1.2) + exact (Ideal.comap_map_of_surjective f hf _).trans + (sup_eq_left.mpr <| le_sup_right.trans (Ideal.le_minimalPrimes hx)) theorem Ideal.minimalPrimes_eq_comap : I.minimalPrimes = Ideal.comap (Ideal.Quotient.mk I) '' minimalPrimes (R ⧸ I) := by @@ -174,21 +175,21 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : ext p constructor · intro hp - haveI := hp.1.1 - refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp hp.1.2⟩, ?_⟩ + haveI := Ideal.minimalPrimes_isPrime hp + refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e - ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp hp.1.1).2 + ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.minimalPrimes_isPrime hp)).2 refine (Ideal.comap_mono <| hp.2 ⟨?_, Ideal.map_mono hI.2⟩ (Ideal.map_le_iff_le_comap.mpr e)).trans_eq ?_ · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' · exact IsLocalization.comap_map_of_isPrime_disjoint S A hI.1 hI' · intro hp - refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr hp.1.2⟩, ?_⟩ + refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_minimalPrimes hp)⟩, ?_⟩ · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] - refine ⟨hp.1.1, ?_⟩ + refine ⟨Ideal.minimalPrimes_isPrime hp, ?_⟩ rintro rfl - exact hp.1.1.ne_top rfl + exact (Ideal.minimalPrimes_isPrime hp).ne_top rfl · intro I hI e rw [← IsLocalization.map_comap S A I, ← IsLocalization.map_comap S A p] haveI := hI.1 @@ -212,7 +213,7 @@ theorem IsLocalization.AtPrime.radical_map_of_mem_minimalPrimes · rw [← IsLocalization.comap_le_comap_iff q.primeCompl A, AtPrime.map_eq_maximalIdeal q A, AtPrime.comap_maximalIdeal A q] apply hIq.2 hJ.1 - have := hJ.1.1.ne_top + have := (Ideal.minimalPrimes_isPrime hJ).ne_top rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_comap_iff q.primeCompl A J] at this exact Set.disjoint_compl_left_iff_subset.mp this From e7fd6eeb910a31c9d04f331bc3c57e462d141be8 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 11:09:54 +0800 Subject: [PATCH 06/69] add private and deprecation --- Mathlib/RingTheory/Ideal/Height.lean | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 5b458b468e9a25..ef2315e404be85 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -134,7 +134,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this -lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : +private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : I.primeHeight ≤ ringKrullDim R := Order.height_le_krullDim _ lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : @@ -185,7 +185,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ -lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : +private lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : primeHeight I = 0 ↔ I ∈ minimalPrimes R := by rw [Ideal.primeHeight, Order.height_eq_zero, minimalPrimes, Ideal.minimalPrimes] simp only [bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] @@ -211,7 +211,7 @@ lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by lemma Ideal.height_of_subsingleton [Subsingleton R] : I.height = ⊤ := by rw [Subsingleton.elim I ⊤, Ideal.height_top] -theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] +private theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := by have h : I ≠ ⊤ := Ideal.IsPrime.ne_top' obtain ⟨M, hM, hM'⟩ := Ideal.exists_le_maximal I h @@ -227,8 +227,7 @@ theorem Ideal.isMaximal_of_height_eq_ringKrullDim {I : Ideal R} [I.IsPrime] exact Ideal.isMaximal_of_primeHeight_eq_ringKrullDim e /-- The prime height of the maximal ideal equals the Krull dimension in a local ring -/ -@[simp] -theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : +private theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : (IsLocalRing.maximalIdeal R).primeHeight = ringKrullDim R := by rw [ringKrullDim, Ideal.primeHeight, ← Order.height_top_eq_krullDim] rfl @@ -249,6 +248,7 @@ theorem Ideal.height_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] · rintro rfl exact IsLocalRing.maximalIdeal_height_eq_ringKrullDim +@[deprecated "Use `Ideal.height_eq_ringKrullDim_iff` instead." (since := "2026-04-02")] theorem Ideal.primeHeight_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] {I : Ideal R} [I.IsPrime] : Ideal.primeHeight I = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by rw [← Ideal.height_eq_primeHeight, Ideal.height_eq_ringKrullDim_iff] @@ -319,8 +319,8 @@ lemma ringKrullDim_le_iff_isMaximal_height_le {R : Type*} [CommRing R] (n : With norm_cast exact Ideal.height_mono hle -theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [CommRing A] [Algebra R A] - [IsLocalization S A] (J : Ideal A) [J.IsPrime] : +private theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [CommRing A] + [Algebra R A] [IsLocalization S A] (J : Ideal A) [J.IsPrime] : (J.comap (algebraMap R A)).primeHeight = J.primeHeight := by rw [eq_comm, Ideal.primeHeight, Ideal.primeHeight, ← WithBot.coe_inj, Order.height_eq_krullDim_Iic, Order.height_eq_krullDim_Iic] @@ -346,10 +346,9 @@ theorem IsLocalization.AtPrime.ringKrullDim_eq_height (I : Ideal R) [I.IsPrime] [CommRing A] [Algebra R A] [IsLocalization.AtPrime A I] : ringKrullDim A = I.height := by have := IsLocalization.AtPrime.isLocalRing A I - rw [← IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim, - ← IsLocalization.primeHeight_comap I.primeCompl, - ← IsLocalization.AtPrime.comap_maximalIdeal A I, - Ideal.height_eq_primeHeight] + rw [← IsLocalRing.maximalIdeal_height_eq_ringKrullDim, + ← IsLocalization.height_comap I.primeCompl, + ← IsLocalization.AtPrime.comap_maximalIdeal A I] lemma IsLocalization.height_map_of_disjoint {S : Type*} [CommRing S] [Algebra R S] (M : Submonoid R) [IsLocalization M S] (p : Ideal R) [p.IsPrime] (h : Disjoint (M : Set R) (p : Set R)) : @@ -363,6 +362,7 @@ lemma IsLocalization.height_map_of_disjoint {S : Type*} [CommRing S] [Algebra R rw [AtPrime.ringKrullDim_eq_height P, AtPrime.ringKrullDim_eq_height p] at this exact WithBot.coe_eq_coe.mp this +@[deprecated "Use `mem_minimalPrimes_of_height_eq` instead." (since := "2026-04-02")] lemma mem_minimalPrimes_of_primeHeight_eq_height {I J : Ideal R} [J.IsPrime] (e : I ≤ J) (e' : J.primeHeight = I.height) [J.FiniteHeight] : J ∈ I.minimalPrimes := by rw [← J.height_eq_primeHeight] at e' From 43fc664d699b6a0e68fc59258bef8bb9a886b8f1 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 11:17:04 +0800 Subject: [PATCH 07/69] golf Ideal.sup_primeHeight_eq_ringKrullDim --- Mathlib/RingTheory/Ideal/Height.lean | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index ef2315e404be85..0c0c0c0f92533d 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -433,20 +433,25 @@ lemma Ideal.sup_height_eq_ringKrullDim [Nontrivial R] : · exact le_iSup_of_le p.last.isPrime.ne_top' le_rfl · exact le_iSup (fun I => ⨆ _, I.height) p.last.asIdeal -/-- In a nontrivial commutative ring `R`, the supremum of prime heights of all prime ideals is +/-- In a nontrivial commutative ring `R`, the supremum of heights of all prime ideals is equal to the Krull dimension of `R`. -/ -lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : - ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.primeHeight) = ringKrullDim R := by +lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : + ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.height) = ringKrullDim R := by rw [← sup_height_eq_ringKrullDim, WithBot.coe_inj] apply le_antisymm - · exact iSup_mono fun I => iSup_mono' fun hI => ⟨hI.ne_top, by rw [← height_eq_primeHeight]⟩ + · exact iSup_mono fun I => iSup_mono' fun hI => ⟨hI.ne_top, le_refl _⟩ · refine iSup_mono' fun I => ?_ by_cases I_top : I = ⊤ · exact ⟨⊥, by simp [I_top]⟩ - · obtain ⟨P, hP⟩ : I.minimalPrimes.Nonempty := - Set.nonempty_coe_sort.mp (nonempty_minimalPrimes I_top) + · obtain ⟨P, hP⟩ := Set.nonempty_coe_sort.mp (nonempty_minimalPrimes I_top) refine ⟨P, iSup_pos (α := ℕ∞) I_top ▸ le_iSup_of_le (hP.left.left) ?_⟩ - exact iInf_le_of_le P (iInf_le_of_le hP le_rfl) + have := Ideal.minimalPrimes_isPrime hP + exact iInf_le_of_le P (iInf_le_of_le hP (ge_of_eq (Ideal.height_eq_primeHeight P))) + +@[deprecated "Use `Ideal.sup_height_isPrime_eq_ringKrullDim` instead." (since := "2026-04-02")] +lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : + ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.primeHeight) = ringKrullDim R := by + simp [← Ideal.height_eq_primeHeight, Ideal.sup_height_isPrime_eq_ringKrullDim] /-- In a nontrivial commutative ring `R`, the supremum of prime heights of all maximal ideals is equal to the Krull dimension of `R`. -/ From a580c9ead4e4f4ee19329c12df1a6194402ed41d Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 2 Apr 2026 11:19:51 +0800 Subject: [PATCH 08/69] fix --- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index a8256e59729471..786dd1087da2e9 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -83,7 +83,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing ← (IsLocalization.orderEmbedding q.primeCompl (Localization.AtPrime q)).map_rel_iff] refine Submodule.le_of_le_smul_of_le_jacobson_bot (I := I) (IsNoetherian.noetherian _) ?_ ?_ · rw [IsLocalRing.jacobson_eq_maximalIdeal] - exacts [hp.1.2, bot_ne_top] + exacts [Ideal.le_minimalPrimes hp, bot_ne_top] · replace hn := congr(Ideal.comap (Ideal.Quotient.mk I) $(hn _ n.le_succ)) simp only [qs, OrderHom.coe_mk, ← RingHom.ker_eq_comap_bot, Ideal.mk_ker, Ideal.comap_map_of_surjective _ Ideal.Quotient.mk_surjective] at hn @@ -118,13 +118,14 @@ theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I have : p.IsPrime := Ideal.minimalPrimes_isPrime hp - have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans hp.1.2) + have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_minimalPrimes hp)) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) - ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, map_mono (le_sup_right.trans hp.1.2)⟩, - fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr - ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| - (comap_mono hrp).trans <| Eq.le <| - (p.comap_map_of_surjective _ Quotient.mk_surjective).trans <| sup_eq_left.mpr hfp⟩ + ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, + map_mono (le_sup_right.trans (Ideal.le_minimalPrimes hp))⟩, + fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr + ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| + (comap_mono hrp).trans <| Eq.le <| + (p.comap_map_of_surjective _ Quotient.mk_surjective).trans <| sup_eq_left.mpr hfp⟩ /-- If `q < p` are prime ideals such that `p` is minimal over `span (s ∪ {x})` and `t` is a set contained in `q` such that `s ⊆ √span (t ∪ {x})`, then `q` is minimal over `span t`. @@ -147,12 +148,13 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide have : (p.map f).FiniteHeight := ⟨Or.inr (h.trans_lt (WithTop.coe_lt_top 1)).ne⟩ rw [height_eq_primeHeight] at h have := (primeHeight_strict_mono h_lt).trans_le h - rw [ENat.lt_one_iff_eq_zero, primeHeight_eq_zero_iff] at this + rw [ENat.lt_one_iff_eq_zero, ← Ideal.height_eq_primeHeight, height_eq_zero_iff] at this have := minimal_primes_comap_of_surjective hf this rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, - map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| hp.1.2 <| subset_span <| .inl rfl⟩, + map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| (Ideal.le_minimalPrimes hp) <| + subset_span <| .inl rfl⟩, fun r ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr (hp.2 ⟨hr.comap f, ?_⟩ ?_)⟩ · rw [span_le, Set.insert_subset_iff] have := map_le_iff_le_comap.mp hxr (subset_span rfl) @@ -179,8 +181,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimal_primes have := Ideal.minimalPrimes_isPrime hp cases n with | zero => - rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_primeHeight p, - primeHeight_eq_zero_iff, minimalPrimes] + rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_zero_iff, minimalPrimes] simp_all | succ n => wlog hR : ∃ (_ : IsLocalRing R), p = maximalIdeal R @@ -204,7 +205,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimal_primes ⟨le_sup_left, x, mem_sup_right (mem_span_singleton_self _), hxq⟩).trans_le hJ) ((le_maximalIdeal hJ'.ne_top).lt_of_not_ge h) have h : (s' : Set R) ⊆ (q ⊔ span {x}).radical := by - have := hp.1.2.trans this + have := (Ideal.le_minimalPrimes hp).trans this rw [span_le, Finset.coe_insert, Set.insert_subset_iff] at this exact this.2 obtain ⟨t, ht, hspan⟩ := exists_subset_radical_span_sup_of_subset_radical_sup _ _ _ h @@ -318,7 +319,8 @@ lemma Ideal.height_le_height_add_spanFinrank_of_le {I p : Ideal R} [p.IsPrime] ( let p' := p.map (algebraMap R (R ⧸ I)) have : p'.IsPrime := isPrime_map_quotientMk_of_isPrime hrp obtain ⟨s, hps, hs⟩ := exists_finset_card_eq_height_of_isNoetherianRing p' - have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := fun _ hx ↦ hps.1.2 (subset_span hx) + have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := + fun _ hx ↦ (Ideal.le_minimalPrimes hps) (subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk I) p s := by refine Set.SurjOn.mono subset_rfl hsp' fun x hx ↦ ?_ obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x @@ -415,7 +417,7 @@ lemma Ideal.height_le_height_add_of_liesOver [IsNoetherianRing S] (p : Ideal R) let P' := P.map (Ideal.Quotient.mk <| p.map (algebraMap R S)) obtain ⟨s', hP', heq'⟩ := P'.exists_finset_card_eq_height_of_isNoetherianRing have hsP'sub : (s' : Set <| S ⧸ (Ideal.map (algebraMap R S) p)) ⊆ (P' : Set <| S ⧸ _) := - fun x hx ↦ hP'.1.2 (Ideal.subset_span hx) + fun x hx ↦ (Ideal.le_minimalPrimes hP') (Ideal.subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk (p.map (algebraMap R S))) P s' := by refine Set.SurjOn.mono subset_rfl hsP'sub fun x hx ↦ ?_ obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x From b5387efe52ac544b18593bb673925a58d3298d35 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 18:47:56 +0800 Subject: [PATCH 09/69] make strict mono private --- Mathlib/RingTheory/Ideal/Height.lean | 22 +++++++++++-------- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 5 ++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 0c0c0c0f92533d..f9b73a2cd944b9 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -92,26 +92,30 @@ lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ gcongr exact h -lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) : - I.primeHeight + 1 ≤ J.primeHeight := by - unfold primeHeight - exact Order.height_add_one_le h +private lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] + (h : I < J) : I.primeHeight + 1 ≤ J.primeHeight := + Order.height_add_one_le h + +lemma Ideal.height_add_one_le_of_lt_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) : + I.height + 1 ≤ J.height := by + simpa [Ideal.height_eq_primeHeight] using Ideal.primeHeight_add_one_le_of_lt h @[simp] theorem Ideal.height_top : (⊤ : Ideal R).height = ⊤ := by simp [height, minimalPrimes_top] -@[gcongr] -lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] - (h : I < J) [J.FiniteHeight] : - I.primeHeight < J.primeHeight := by - rw [primeHeight] +private lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) + [J.FiniteHeight] : I.primeHeight < J.primeHeight := by have : I.FiniteHeight := by rw [Ideal.finiteHeight_iff, ← lt_top_iff_ne_top, Ideal.height_eq_primeHeight] right exact lt_of_le_of_lt (Ideal.primeHeight_mono h.le) (Ideal.primeHeight_lt_top J) exact Order.height_strictMono h (Ideal.primeHeight_lt_top _) +lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) + [J.FiniteHeight] : I.height < J.height := by + simpa [Ideal.height_eq_primeHeight] using Ideal.primeHeight_strict_mono h + @[gcongr] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [height] diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 786dd1087da2e9..eff8c67f42326a 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -146,9 +146,8 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide sup_eq_left.mpr hI'q, sup_eq_left.mpr hI'p] using comap_mono (f := f) e have : (q.map f).IsPrime := map_isPrime_of_surjective hf (by rwa [mk_ker]) have : (p.map f).FiniteHeight := ⟨Or.inr (h.trans_lt (WithTop.coe_lt_top 1)).ne⟩ - rw [height_eq_primeHeight] at h - have := (primeHeight_strict_mono h_lt).trans_le h - rw [ENat.lt_one_iff_eq_zero, ← Ideal.height_eq_primeHeight, height_eq_zero_iff] at this + have := (height_strict_mono_of_isPrime h_lt).trans_le h + rw [ENat.lt_one_iff_eq_zero, height_eq_zero_iff] at this have := minimal_primes_comap_of_surjective hf this rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this From 732ccc0ff775da9e891bae1449b6fe36c9e1f73a Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 19:56:16 +0800 Subject: [PATCH 10/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 40 +++++++++------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index f9b73a2cd944b9..f161d0b916d261 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -108,14 +108,9 @@ private lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPri [J.FiniteHeight] : I.primeHeight < J.primeHeight := by have : I.FiniteHeight := by rw [Ideal.finiteHeight_iff, ← lt_top_iff_ne_top, Ideal.height_eq_primeHeight] - right - exact lt_of_le_of_lt (Ideal.primeHeight_mono h.le) (Ideal.primeHeight_lt_top J) + exact Or.inr (lt_of_le_of_lt (Ideal.primeHeight_mono h.le) (Ideal.primeHeight_lt_top J)) exact Order.height_strictMono h (Ideal.primeHeight_lt_top _) -lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) - [J.FiniteHeight] : I.height < J.height := by - simpa [Ideal.height_eq_primeHeight] using Ideal.primeHeight_strict_mono h - @[gcongr] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [height] @@ -126,15 +121,14 @@ theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @[gcongr] -lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] +lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] (h : I < J) [I.FiniteHeight] : I.height < J.height := by - rw [Ideal.height_eq_primeHeight I] by_cases hJ : J = ⊤ - · rw [hJ, height_top] - exact I.primeHeight_lt_top - · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] + · grw [hJ, height_top] + exact I.height_lt_top IsPrime.ne_top' + · rw [← ENat.add_one_le_iff (I.height_ne_top IsPrime.ne_top'), I.height_eq_primeHeight] refine le_iInf₂ (fun K hK ↦ ?_) - haveI := Ideal.minimalPrimes_isPrime hK + have := Ideal.minimalPrimes_isPrime hK have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this @@ -164,17 +158,13 @@ lemma Ideal.exists_isMaximal_height [FiniteRingKrullDim R] : instance (priority := 900) Ideal.finiteHeight_of_finiteRingKrullDim {I : Ideal R} [FiniteRingKrullDim R] : I.FiniteHeight := by rw [finiteHeight_iff, or_iff_not_imp_left, ← lt_top_iff_ne_top, ← WithBot.coe_lt_coe] - intro h - have h1 := ringKrullDim_lt_top (R := R) - have h2 := Ideal.height_le_ringKrullDim_of_ne_top h - exact lt_of_le_of_lt h2 h1 + exact fun h ↦ lt_of_le_of_lt (Ideal.height_le_ringKrullDim_of_ne_top h) ringKrullDim_lt_top /-- If J has finite height and I ≤ J, then I has finite height -/ lemma Ideal.finiteHeight_of_le {I J : Ideal R} (e : I ≤ J) (hJ : J ≠ ⊤) [FiniteHeight J] : FiniteHeight I where - eq_top_or_height_ne_top := Or.inr <| by - rw [← lt_top_iff_ne_top] - exact (height_mono e).trans_lt (height_lt_top hJ) + eq_top_or_height_ne_top := Or.inr <| + lt_top_iff_ne_top.mp ((height_mono e).trans_lt (height_lt_top hJ)) /-- If J is a prime ideal containing I, and its height is less than or equal to the height of I, then J is a minimal prime over I -/ @@ -185,7 +175,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le + exact lt_irrefl _ ((height_strict_mono_of_isPrime h₃).trans_le (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ @@ -193,13 +183,9 @@ private lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : primeHeight I = 0 ↔ I ∈ minimalPrimes R := by rw [Ideal.primeHeight, Order.height_eq_zero, minimalPrimes, Ideal.minimalPrimes] simp only [bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] - constructor - · intro h - refine ⟨inferInstance, ?_⟩ - by_contra! ⟨P, ⟨hP₁, ⟨hP₂, hP₃⟩⟩⟩ - exact hP₃ (h (b := ⟨P, hP₁⟩) hP₂) - · rintro ⟨hI, hI'⟩ b hb - exact hI' (y := b.asIdeal) b.isPrime hb + refine ⟨fun h ↦ ⟨‹_›, ?_⟩, fun ⟨hI, hI'⟩ b hb ↦ hI' b.isPrime hb⟩ + by_contra! ⟨P, ⟨hP₁, ⟨hP₂, hP₃⟩⟩⟩ + exact hP₃ (h (b := ⟨P, hP₁⟩) hP₂) lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by rw [Ideal.height_eq_primeHeight, Ideal.primeHeight_eq_zero_iff] From ae7cff95c92f5cf506a13a1d79ce83b33566ebde Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:21:44 +0800 Subject: [PATCH 11/69] deprecate strict mono --- Mathlib/RingTheory/Ideal/Height.lean | 36 ++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index f161d0b916d261..f0af50ba765314 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -104,13 +104,6 @@ lemma Ideal.height_add_one_le_of_lt_of_isPrime {I J : Ideal R} [I.IsPrime] [J.Is theorem Ideal.height_top : (⊤ : Ideal R).height = ⊤ := by simp [height, minimalPrimes_top] -private lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) - [J.FiniteHeight] : I.primeHeight < J.primeHeight := by - have : I.FiniteHeight := by - rw [Ideal.finiteHeight_iff, ← lt_top_iff_ne_top, Ideal.height_eq_primeHeight] - exact Or.inr (lt_of_le_of_lt (Ideal.primeHeight_mono h.le) (Ideal.primeHeight_lt_top J)) - exact Order.height_strictMono h (Ideal.primeHeight_lt_top _) - @[gcongr] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [height] @@ -132,6 +125,19 @@ lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this +lemma Ideal.height_strict_mono_of_isPrime_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] + (h : I < J) [J.FiniteHeight] : I.height < J.height := by + have : I.FiniteHeight := by + simpa [Ideal.finiteHeight_iff, ‹I.IsPrime›.ne_top] using + (lt_of_le_of_lt (Ideal.height_mono h.le) (J.height_lt_top IsPrime.ne_top')).ne + exact Ideal.height_strict_mono_of_isPrime h + +@[deprecated "Use `Ideal.height_strict_mono_of_isPrime_of_isPrime` instead." + (since := "2026-04-02")] +lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) + [J.FiniteHeight] : I.primeHeight < J.primeHeight := by + simpa [← Ideal.height_eq_primeHeight] using Ideal.height_strict_mono_of_isPrime_of_isPrime h + private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : I.primeHeight ≤ ringKrullDim R := Order.height_le_krullDim _ @@ -201,20 +207,20 @@ lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by lemma Ideal.height_of_subsingleton [Subsingleton R] : I.height = ⊤ := by rw [Subsingleton.elim I ⊤, Ideal.height_top] -private theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] - [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := by +theorem Ideal.isMaximal_of_height_eq_ringKrullDim {I : Ideal R} [I.IsPrime] + [FiniteRingKrullDim R] (e : I.height = ringKrullDim R) : I.IsMaximal := by have h : I ≠ ⊤ := Ideal.IsPrime.ne_top' obtain ⟨M, hM, hM'⟩ := Ideal.exists_le_maximal I h rcases lt_or_eq_of_le hM' with (hM' | hM') - · have h1 := Ideal.primeHeight_strict_mono hM' - have h2 := e ▸ M.primeHeight_le_ringKrullDim + · have h1 := Ideal.height_strict_mono_of_isPrime hM' + have h2 := e ▸ M.height_le_ringKrullDim_of_ne_top hM.ne_top simp [← not_lt, h1] at h2 · exact hM' ▸ hM -theorem Ideal.isMaximal_of_height_eq_ringKrullDim {I : Ideal R} [I.IsPrime] - [FiniteRingKrullDim R] (e : I.height = ringKrullDim R) : I.IsMaximal := by - rw [Ideal.height_eq_primeHeight] at e - exact Ideal.isMaximal_of_primeHeight_eq_ringKrullDim e +@[deprecated "Use `Ideal.isMaximal_of_height_eq_ringKrullDim` instead." (since := "2026-04-02")] +theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] + [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := + Ideal.isMaximal_of_height_eq_ringKrullDim (by simpa [Ideal.height_eq_primeHeight]) /-- The prime height of the maximal ideal equals the Krull dimension in a local ring -/ private theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : From facecaee3c25ee7101375e07fd8058e93fd92920 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:32:45 +0800 Subject: [PATCH 12/69] golf --- Mathlib/RingTheory/Ideal/Height.lean | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index f0af50ba765314..d3bcfb4374b962 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -127,9 +127,8 @@ lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] lemma Ideal.height_strict_mono_of_isPrime_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) [J.FiniteHeight] : I.height < J.height := by - have : I.FiniteHeight := by - simpa [Ideal.finiteHeight_iff, ‹I.IsPrime›.ne_top] using - (lt_of_le_of_lt (Ideal.height_mono h.le) (J.height_lt_top IsPrime.ne_top')).ne + have : I.FiniteHeight := I.finiteHeight_iff.mpr + (Or.inr (lt_of_le_of_lt (Ideal.height_mono h.le) (J.height_lt_top IsPrime.ne_top')).ne) exact Ideal.height_strict_mono_of_isPrime h @[deprecated "Use `Ideal.height_strict_mono_of_isPrime_of_isPrime` instead." @@ -143,11 +142,9 @@ private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : I.height ≤ ringKrullDim R := by - rw [Ideal.height] obtain ⟨P, hP⟩ : Nonempty (I.minimalPrimes) := Ideal.nonempty_minimalPrimes h have := Ideal.minimalPrimes_isPrime hP - refine le_trans ?_ (Ideal.primeHeight_le_ringKrullDim (I := P)) - simpa using iInf₂_le _ hP + exact (WithBot.coe_le_coe.mpr (iInf₂_le _ hP)).trans P.primeHeight_le_ringKrullDim /-- If `R` has finite Krull dimension, there exists a maximal ideal `m` with `ht m = dim R`. -/ lemma Ideal.exists_isMaximal_height [FiniteRingKrullDim R] : From bc6aba4914b853772e36973ae595c0455f02b20d Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:33:02 +0800 Subject: [PATCH 13/69] deprecate primeHeight_eq_zero --- Mathlib/RingTheory/Ideal/Height.lean | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index d3bcfb4374b962..d9b438d25a8514 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -182,22 +182,25 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ -private lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : - primeHeight I = 0 ↔ I ∈ minimalPrimes R := by - rw [Ideal.primeHeight, Order.height_eq_zero, minimalPrimes, Ideal.minimalPrimes] - simp only [bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] +lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by + rw [Ideal.height_eq_primeHeight, Ideal.primeHeight, Order.height_eq_zero, minimalPrimes] + simp only [Ideal.minimalPrimes, bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] refine ⟨fun h ↦ ⟨‹_›, ?_⟩, fun ⟨hI, hI'⟩ b hb ↦ hI' b.isPrime hb⟩ by_contra! ⟨P, ⟨hP₁, ⟨hP₂, hP₃⟩⟩⟩ exact hP₃ (h (b := ⟨P, hP₁⟩) hP₂) -lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by - rw [Ideal.height_eq_primeHeight, Ideal.primeHeight_eq_zero_iff] +@[deprecated "Use `Ideal.height_eq_zero_iff` instead." (since := "2026-04-02")] +private lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : + primeHeight I = 0 ↔ I ∈ minimalPrimes R := by + rw [← Ideal.height_eq_primeHeight, Ideal.height_eq_zero_iff] @[simp] lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] - exact ⟨p, hp, haveI := Ideal.minimalPrimes_isPrime hp; primeHeight_eq_zero_iff.mpr hp⟩ + refine ⟨p, hp, ?_⟩ + have := Ideal.minimalPrimes_isPrime hp + rw [← Ideal.height_eq_primeHeight, height_eq_zero_iff.mpr hp] /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @[simp, nontriviality] From c043789e59ad21d1edcd2a07f0a14e5e6b5dab67 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:37:45 +0800 Subject: [PATCH 14/69] fix --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index eff8c67f42326a..bf90d4a888ced7 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -146,7 +146,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide sup_eq_left.mpr hI'q, sup_eq_left.mpr hI'p] using comap_mono (f := f) e have : (q.map f).IsPrime := map_isPrime_of_surjective hf (by rwa [mk_ker]) have : (p.map f).FiniteHeight := ⟨Or.inr (h.trans_lt (WithTop.coe_lt_top 1)).ne⟩ - have := (height_strict_mono_of_isPrime h_lt).trans_le h + have := (height_strict_mono_of_isPrime_of_isPrime h_lt).trans_le h rw [ENat.lt_one_iff_eq_zero, height_eq_zero_iff] at this have := minimal_primes_comap_of_surjective hf this rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, From a35ed7f1f833053975aea424b7ed239e25155289 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:28:02 +0800 Subject: [PATCH 15/69] add height version of definition --- Mathlib/RingTheory/Ideal/Height.lean | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index d9b438d25a8514..ac3ee6fa917874 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -43,9 +43,16 @@ noncomputable def Ideal.height : ℕ∞ := /-- For a prime ideal, its height equals its prime height. -/ lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by - unfold height primeHeight - simp_rw [Ideal.minimalPrimes_eq_subsingleton_self] - simp + simp [height, primeHeight, Ideal.minimalPrimes_eq_subsingleton_self] + +lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = + Order.height (⟨I, ‹I.IsPrime›⟩ : PrimeSpectrum R) := + I.height_eq_primeHeight + +lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by + apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) + have := I.minimalPrimes_isPrime hp + exact (Ideal.height_eq_primeHeight _).symm /-- An ideal has finite height if it is either the unit ideal or its height is finite. We include the unit ideal in order to have the instance `IsNoetherianRing R → FiniteHeight I`. -/ From 2eef1814e73e3a2436575228a079a766ecdbd81a Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:32:21 +0800 Subject: [PATCH 16/69] deprecate more lemmas --- Mathlib/RingTheory/Ideal/Height.lean | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index ac3ee6fa917874..e72d0fddc1575c 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -72,11 +72,21 @@ lemma Ideal.height_lt_top {I : Ideal R} (hI : I ≠ ⊤) [I.FiniteHeight] : I.height < ⊤ := (Ideal.height_ne_top hI).lt_top +lemma Ideal.height_ne_top_of_isPrime {I : Ideal R} [I.FiniteHeight] [I.IsPrime] : + I.height ≠ ⊤ := + Ideal.height_ne_top ‹I.IsPrime›.ne_top + +@[deprecated "Use `Ideal.height_ne_top_of_isPrime` instead." (since := "2026-04-04")] lemma Ideal.primeHeight_ne_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : I.primeHeight ≠ ⊤ := by rw [← I.height_eq_primeHeight] exact Ideal.height_ne_top ‹I.IsPrime›.ne_top +lemma Ideal.height_lt_top_of_isPrime {I : Ideal R} [I.FiniteHeight] [I.IsPrime] : + I.height < ⊤ := + Ideal.height_lt_top ‹I.IsPrime›.ne_top + +@[deprecated "Use `Ideal.height_lt_top_of_isPrime` instead." (since := "2026-04-04")] lemma Ideal.primeHeight_lt_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : I.primeHeight < ⊤ := by rw [← I.height_eq_primeHeight] @@ -92,7 +102,6 @@ lemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.Finite rw [hn] exact ⟨l, last, by rw [len, WithTop.some_eq_coe, ENat.some_eq_coe]⟩ -@[gcongr] lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : I.primeHeight ≤ J.primeHeight := by unfold primeHeight From e09911d9a6e7ff1e3ea120e6a35011494d5333a1 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:40:54 +0800 Subject: [PATCH 17/69] deprecate more --- Mathlib/RingTheory/Ideal/Height.lean | 31 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index e72d0fddc1575c..2d6c8196ceea16 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -102,19 +102,26 @@ lemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.Finite rw [hn] exact ⟨l, last, by rw [len, WithTop.some_eq_coe, ENat.some_eq_coe]⟩ -lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : - I.primeHeight ≤ J.primeHeight := by - unfold primeHeight +private lemma Ideal.height_mono_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : + I.height ≤ J.height := by + simp only [Ideal.height_eq_order_height_of_isPrime] gcongr exact h -private lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] - (h : I < J) : I.primeHeight + 1 ≤ J.primeHeight := - Order.height_add_one_le h +@[deprecated "Use `Ideal.height_mono_of_isPrime` instead." (since := "2026-04-04")] +lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : + I.primeHeight ≤ J.primeHeight := by + simpa [Ideal.height_eq_primeHeight] using Ideal.height_mono_of_isPrime h lemma Ideal.height_add_one_le_of_lt_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) : I.height + 1 ≤ J.height := by - simpa [Ideal.height_eq_primeHeight] using Ideal.primeHeight_add_one_le_of_lt h + simp only [Ideal.height_eq_order_height_of_isPrime] + exact Order.height_add_one_le h + +@[deprecated "Use `Ideal.height_add_one_le_of_lt_of_isPrime` instead." (since := "2026-04-04")] +lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] + (h : I < J) : I.primeHeight + 1 ≤ J.primeHeight := by + simpa [Ideal.height_eq_primeHeight] using Ideal.height_add_one_le_of_lt_of_isPrime h @[simp] theorem Ideal.height_top : (⊤ : Ideal R).height = ⊤ := by @@ -122,12 +129,12 @@ theorem Ideal.height_top : (⊤ : Ideal R).height = ⊤ := by @[gcongr] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by - simp only [height] + simp only [I.height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] refine le_iInf₂ (fun p hp ↦ ?_) have := Ideal.minimalPrimes_isPrime hp obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_minimalPrimes hp)) - haveI := Ideal.minimalPrimes_isPrime hq - exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) + have := Ideal.minimalPrimes_isPrime hq + exact (iInf₂_le q hq).trans (Ideal.height_mono_of_isPrime e) @[gcongr] lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] @@ -135,11 +142,11 @@ lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] by_cases hJ : J = ⊤ · grw [hJ, height_top] exact I.height_lt_top IsPrime.ne_top' - · rw [← ENat.add_one_le_iff (I.height_ne_top IsPrime.ne_top'), I.height_eq_primeHeight] + · rw [← ENat.add_one_le_iff (I.height_ne_top IsPrime.ne_top'), J.height_eq_inf_minimalPrimes] refine le_iInf₂ (fun K hK ↦ ?_) have := Ideal.minimalPrimes_isPrime hK have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) - exact Ideal.primeHeight_add_one_le_of_lt this + exact Ideal.height_add_one_le_of_lt_of_isPrime this lemma Ideal.height_strict_mono_of_isPrime_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) [J.FiniteHeight] : I.height < J.height := by From 55ca9bfedb316516ccb8c89e6d762de800cb9cd8 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:48:04 +0800 Subject: [PATCH 18/69] deprecate even more --- Mathlib/RingTheory/Ideal/Height.lean | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 2d6c8196ceea16..65bb5520ff13cc 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -160,14 +160,21 @@ lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : [J.FiniteHeight] : I.primeHeight < J.primeHeight := by simpa [← Ideal.height_eq_primeHeight] using Ideal.height_strict_mono_of_isPrime_of_isPrime h -private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : +lemma Ideal.height_le_ringKrullDim_of_isPrime {I : Ideal R} [I.IsPrime] : + I.height ≤ ringKrullDim R := by + rw [I.height_eq_order_height_of_isPrime] + exact Order.height_le_krullDim _ + +@[deprecated "Use `Ideal.height_add_one_le_of_lt_of_isPrime` instead." (since := "2026-04-04")] +lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : I.primeHeight ≤ ringKrullDim R := Order.height_le_krullDim _ lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : I.height ≤ ringKrullDim R := by obtain ⟨P, hP⟩ : Nonempty (I.minimalPrimes) := Ideal.nonempty_minimalPrimes h + rw [I.height_eq_inf_minimalPrimes] have := Ideal.minimalPrimes_isPrime hP - exact (WithBot.coe_le_coe.mpr (iInf₂_le _ hP)).trans P.primeHeight_le_ringKrullDim + refine (WithBot.coe_le_coe.mpr (iInf₂_le _ hP)).trans P.height_le_ringKrullDim_of_isPrime /-- If `R` has finite Krull dimension, there exists a maximal ideal `m` with `ht m = dim R`. -/ lemma Ideal.exists_isMaximal_height [FiniteRingKrullDim R] : From 618cfa23224cb857db11cd124b0a4550667b5ff8 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:50:08 +0800 Subject: [PATCH 19/69] deprecate even more --- Mathlib/RingTheory/Ideal/Height.lean | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 65bb5520ff13cc..54a4f100209f74 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -252,17 +252,18 @@ theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := Ideal.isMaximal_of_height_eq_ringKrullDim (by simpa [Ideal.height_eq_primeHeight]) -/-- The prime height of the maximal ideal equals the Krull dimension in a local ring -/ -private theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : - (IsLocalRing.maximalIdeal R).primeHeight = ringKrullDim R := by - rw [ringKrullDim, Ideal.primeHeight, ← Order.height_top_eq_krullDim] - rfl - /-- The height of the maximal ideal equals the Krull dimension in a local ring. -/ @[simp] theorem IsLocalRing.maximalIdeal_height_eq_ringKrullDim [IsLocalRing R] : (IsLocalRing.maximalIdeal R).height = ringKrullDim R := by - rw [Ideal.height_eq_primeHeight, IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim] + rw [Ideal.height_eq_order_height_of_isPrime] + exact Order.height_top_eq_krullDim + +@[deprecated "Use `IsLocalRing.maximalIdeal_height_eq_ringKrullDim` instead." + (since := "2026-04-04")] +private theorem IsLocalRing.maximalIdeal_primeHeight_eq_ringKrullDim [IsLocalRing R] : + (IsLocalRing.maximalIdeal R).primeHeight = ringKrullDim R := by + simp [← Ideal.height_eq_primeHeight] /-- For a local ring with finite Krull dimension, a prime ideal has height equal to the Krull dimension if and only if it is the maximal ideal. -/ From ab901dba051e5bb622cec0732f71963243eb7cfb Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:00:48 +0800 Subject: [PATCH 20/69] deprecate a prime height usage --- Mathlib/RingTheory/Ideal/Height.lean | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index d9b438d25a8514..aa35455cd75b9e 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -449,7 +449,7 @@ lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.primeHeight) = ringKrullDim R := by simp [← Ideal.height_eq_primeHeight, Ideal.sup_height_isPrime_eq_ringKrullDim] -/-- In a nontrivial commutative ring `R`, the supremum of prime heights of all maximal ideals is +/-- In a nontrivial commutative ring `R`, the supremum of heights of all maximal ideals is equal to the Krull dimension of `R`. -/ lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.height) = ringKrullDim R := by @@ -462,8 +462,7 @@ lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : · obtain ⟨M, hM, hIM⟩ := exists_le_maximal I I_top exact ⟨M, iSup_mono' (fun hI ↦ ⟨hM, height_mono hIM⟩)⟩ -/-- In a nontrivial commutative ring `R`, the supremum of prime heights of all maximal ideals is -equal to the Krull dimension of `R`. -/ +@[deprecated "Use `Ideal.sup_height_of_maximal_eq_ringKrullDim` instead." (since := "2026-04-02")] lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.primeHeight) = ringKrullDim R := by simp_rw [← Ideal.height_eq_primeHeight, Ideal.sup_height_of_maximal_eq_ringKrullDim] @@ -481,10 +480,9 @@ lemma Ring.krullDimLE_of_isLocalization_maximal {n : ℕ} Ring.KrullDimLE n R := by simp_rw [Ring.krullDimLE_iff] at h ⊢ nontriviality R - rw [← Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim] + rw [← Ideal.sup_height_of_maximal_eq_ringKrullDim] refine (WithBot.coe_le_coe).mpr (iSup₂_le_iff.mpr fun P hP ↦ ?_) - rw [← Ideal.height_eq_primeHeight, ← WithBot.coe_le_coe] - rw [← IsLocalization.AtPrime.ringKrullDim_eq_height P (Rₚ P)] + rw [← WithBot.coe_le_coe, ← IsLocalization.AtPrime.ringKrullDim_eq_height P (Rₚ P)] exact h P end isLocalization From cd6b68c9b806c66b9320f92e8546b8c50ec520da Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:06:07 +0800 Subject: [PATCH 21/69] deprecate further more --- Mathlib/RingTheory/Ideal/Height.lean | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 9d619647c6c5a3..9232a3e5a3c758 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -346,11 +346,11 @@ lemma ringKrullDim_le_iff_isMaximal_height_le {R : Type*} [CommRing R] (n : With norm_cast exact Ideal.height_mono hle -private theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [CommRing A] +private theorem IsLocalization.height_comap_eq_of_isPrime (S : Submonoid R) {A : Type*} [CommRing A] [Algebra R A] [IsLocalization S A] (J : Ideal A) [J.IsPrime] : - (J.comap (algebraMap R A)).primeHeight = J.primeHeight := by - rw [eq_comm, Ideal.primeHeight, Ideal.primeHeight, ← WithBot.coe_inj, - Order.height_eq_krullDim_Iic, Order.height_eq_krullDim_Iic] + (J.comap (algebraMap R A)).height = J.height := by + rw [eq_comm, Ideal.height_eq_order_height_of_isPrime, Ideal.height_eq_order_height_of_isPrime, + ← WithBot.coe_inj, Order.height_eq_krullDim_Iic, Order.height_eq_krullDim_Iic] let e := IsLocalization.orderIsoOfPrime S A have H (p : Ideal R) (hp : p ≤ J.comap (algebraMap R A)) : Disjoint (S : Set R) p := Set.disjoint_of_subset_right hp (e ⟨_, ‹J.IsPrime›⟩).2.2 @@ -363,11 +363,19 @@ private theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [ congrArg (fun I ↦ I.1) (e.right_inv ⟨_, I.1.2, H _ I.2⟩) map_rel_iff' {I₁ I₂} := @RelIso.map_rel_iff _ _ _ _ e ⟨_, I₁.1.2⟩ ⟨_, I₂.1.2⟩ } +@[deprecated "Use `Ideal.height_ne_top_of_isPrime` instead." (since := "2026-04-04")] +private theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [CommRing A] + [Algebra R A] [IsLocalization S A] (J : Ideal A) [J.IsPrime] : + (J.comap (algebraMap R A)).primeHeight = J.primeHeight := by + simpa [Ideal.height_eq_primeHeight] using IsLocalization.height_comap_eq_of_isPrime S J + theorem IsLocalization.height_comap (S : Submonoid R) {A : Type*} [CommRing A] [Algebra R A] [IsLocalization S A] (J : Ideal A) : (J.comap (algebraMap R A)).height = J.height := by - rw [Ideal.height, Ideal.height] - simp_rw [← IsLocalization.primeHeight_comap S, IsLocalization.minimalPrimes_comap S A, - ← Ideal.height_eq_primeHeight, iInf_image] + rw [(J.comap _).height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] + simp only [IsLocalization.minimalPrimes_comap S A, iInf_image] + apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) + have := Ideal.minimalPrimes_isPrime hp + exact IsLocalization.height_comap_eq_of_isPrime S _ theorem IsLocalization.AtPrime.ringKrullDim_eq_height (I : Ideal R) [I.IsPrime] (A : Type*) [CommRing A] [Algebra R A] [IsLocalization.AtPrime A I] : From 375cdb828900d5dbaf9e6bdac5139f1a24aa6d42 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Sat, 4 Apr 2026 15:14:39 +0800 Subject: [PATCH 22/69] golf --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index bf90d4a888ced7..aed2a13495c071 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -237,9 +237,8 @@ than or equal to the minimum number of generators for this ideal. -/ lemma Ideal.height_le_spanRank_toENat (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanRank.toENat := by obtain ⟨J, hJ⟩ := nonempty_minimalPrimes hI - refine (iInf₂_le J hJ).trans ?_ - convert (I.height_le_spanRank_toENat_of_mem_minimal_primes J hJ) - exact Eq.symm (@height_eq_primeHeight _ _ J (Ideal.minimalPrimes_isPrime hJ)) + rw [I.height_eq_inf_minimalPrimes] + exact (iInf₂_le J hJ).trans (I.height_le_spanRank_toENat_of_mem_minimal_primes J hJ) lemma Ideal.height_le_spanFinrank (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanFinrank := by @@ -466,7 +465,7 @@ lemma Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown [IsNoetherianRing S simp [hlq, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)] obtain ⟨lp', hlp'len, hlp', _⟩ := exists_ltSeries_of_hasGoingDown lp l'.head.asIdeal have : (lp'.smash l' hlp').length = lp.length + lq.length := by simp [hlp'len, l'] - rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, height_eq_primeHeight] + rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, Ideal.height_eq_order_height_of_isPrime] apply Order.length_le_height simp [hlq, l', ← PrimeSpectrum.asIdeal_le_asIdeal, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)] From 9790c4fb12712acd3eb242c1b76827e0d9b5fc7e Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:08:27 +0800 Subject: [PATCH 23/69] add lemma to avoid def eq --- .../RingTheory/Ideal/MinimalPrime/Basic.lean | 23 ++++++++----- .../RingTheory/Ideal/MinimalPrime/Colon.lean | 12 +++---- .../Ideal/MinimalPrime/Localization.lean | 33 ++++++++++--------- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 6338b28d7d2623..689fddcfb9f092 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -54,6 +54,12 @@ variable {I J} theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := h.1.1 +theorem Ideal.le_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := + h.1.2 + +theorem minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := + h.1.1 + theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by set S := { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ OrderDual.ofDual p } suffices h : ∃ m, OrderDual.toDual J ≤ m ∧ Maximal (· ∈ S) m by @@ -117,17 +123,17 @@ theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes ext J constructor · exact fun H => - let e := H.1.1.radical_le_iff.mpr H.1.2 + let e := (Ideal.minimalPrimes_isPrime H).radical_le_iff.mpr (Ideal.le_minimalPrimes H) (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ theorem Ideal.minimalPrimes_eq_subsingleton_self [I.IsPrime] : I.minimalPrimes = {I} := by ext J - constructor - · exact fun H => (H.2 ⟨inferInstance, rfl.le⟩ H.1.2).antisymm H.1.2 - · rintro (rfl : J = I) - exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ + refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ (Ideal.le_minimalPrimes H)).antisymm + (Ideal.le_minimalPrimes H), ?_⟩ + rintro (rfl : J = I) + exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ variable (R) in theorem IsDomain.minimalPrimes_eq_singleton_bot [IsDomain R] : @@ -144,7 +150,7 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact h.1.1.ne_top (top_le_iff.mp h.1.2) + exact (Ideal.minimalPrimes_isPrime h).ne_top (top_le_iff.mp (Ideal.le_minimalPrimes h)) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by @@ -163,7 +169,8 @@ lemma Ideal.mem_minimalPrimes_sup {R : Type*} [CommRing R] {p I J : Ideal R} [p. p ∈ (I ⊔ J).minimalPrimes := by refine ⟨⟨‹_›, ?_⟩, fun q ⟨_, hq⟩ hqp ↦ ?_⟩ · rw [sup_le_iff] - exact ⟨hle, by simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) h.1.2⟩ + refine ⟨hle, ?_⟩ + simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) (Ideal.le_minimalPrimes h) · rw [sup_le_iff] at hq have h2 : p.map (Quotient.mk I) ≤ q.map (Quotient.mk I) := h.2 ⟨isPrime_map_quotientMk_of_isPrime hq.1, map_mono hq.2⟩ (map_mono hqp) @@ -183,7 +190,7 @@ lemma Ideal.map_sup_mem_minimalPrimes_of_map_quotientMk_mem_minimalPrimes refine ⟨⟨inferInstance, sup_le_iff.mpr ?_⟩, fun q ⟨_, hleq⟩ hqle ↦ ?_⟩ · refine ⟨?_, hJP⟩ rw [Ideal.map_le_iff_le_comap, ← Ideal.under_def, ← Ideal.over_def P p] - exact hI.1.2 + exact Ideal.le_minimalPrimes hI · simp only [sup_le_iff] at hleq have h1 : p.map (algebraMap R S) ≤ q := by rw [Ideal.map_le_iff_le_comap] diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean index 9ecd208c7666f6..8758fea64c554d 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean @@ -48,7 +48,8 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] refine ⟨n, hn0, ((h.toFinset.erase I).inf id) ^ n, hn, ?_⟩ have (K : Ideal R) (hKI : K ≤ I) (hK : K ∈ ann.minimalPrimes) : K = I := le_antisymm hKI (hI.2 hK.1 hKI) - simpa [hI.1.1.pow_le_iff hn0, hI.1.1.inf_le', imp_not_comm, not_imp_not] + simpa [(Ideal.minimalPrimes_isPrime hI).pow_le_iff hn0, + (Ideal.minimalPrimes_isPrime hI).inf_le', imp_not_comm, not_imp_not] obtain ⟨hn0, J, hJ, hJI⟩ := Nat.find_spec key -- let `n` be minimal such that there exists an ideal `J` with `I ^ n * J ≤ ann` and `¬ J ≠ I` set n := Nat.find key @@ -74,9 +75,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] -- let `z` be the product of these finitely many `f y`'s let z := ∏ y ∈ s, f y -- then `z ∉ I` - have hz : z ∉ I := by - simp only [z, hI.1.1.prod_mem_iff, not_exists, not_and_or] - exact fun i ↦ Or.inr (h i) + have hz : z ∉ I := by simp [z, (Ideal.minimalPrimes_isPrime hI).prod_mem_iff, h] -- and `K ≤ colon N {z • x}` have hz' : K ≤ colon N {z • x} := by rw [← (map_injective_of_injective K.subtype_injective).eq_iff, map_subtype_top] at hs @@ -92,11 +91,12 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] simpa only [ann, mem_colon_singleton, mul_comm, mul_smul] using hz' hi -- but now `K = I ^ (n - 1) * J` contradicts the minimality of `n` have hK : I ^ (n - 1) * (J * Ideal.span {z}) ≤ ann ∧ ¬ J * Ideal.span {z} ≤ I := by - rw [← mul_assoc, hI.1.1.mul_le, not_or, Ideal.span_singleton_le_iff_mem] + rw [← mul_assoc, (Ideal.minimalPrimes_isPrime hI).mul_le, not_or, + Ideal.span_singleton_le_iff_mem] exact ⟨hz', hJI, hz⟩ by_cases hn' : n - 1 = 0 · simp [K, show n = 1 by grind] at hz' - exact (hK.2 (hz'.trans hI.1.2)).elim + exact (hK.2 (hz'.trans (Ideal.le_minimalPrimes hI))).elim · grind [Nat.find_min' key ⟨hn', J * Ideal.span {z}, hK⟩] end Submodule diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 7d76dbf783fb02..5b07cd7cc83ae0 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -65,8 +65,8 @@ theorem Ideal.iUnion_minimalPrimes : · rintro ⟨y, hy, hx⟩ obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy - refine ⟨p, hp, (hp.1.1.mem_or_mem ?_).resolve_right hyp⟩ - exact hp.1.1.radical_le_iff.mpr hp.1.2 hx + refine ⟨p, hp, ((Ideal.minimalPrimes_isPrime hp).mem_or_mem ?_).resolve_right hyp⟩ + exact (Ideal.minimalPrimes_isPrime hp).radical_le_iff.mpr (Ideal.le_minimalPrimes hp) hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -97,8 +97,8 @@ lemma Ideal.disjoint_nonZeroDivisors_of_mem_minimalPrimes {p : Ideal R} (hp : p theorem Ideal.exists_comap_eq_of_mem_minimalPrimes {I : Ideal S} (f : R →+* S) (p) (H : p ∈ (I.comap f).minimalPrimes) : ∃ p' : Ideal S, p'.IsPrime ∧ I ≤ p' ∧ p'.comap f = p := - have := H.1.1 - have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I H.1.2 + have := Ideal.minimalPrimes_isPrime H + have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_minimalPrimes H) ⟨p', hp', hIp', le.antisymm (H.2 ⟨inferInstance, comap_mono hIp'⟩ le)⟩ @[stacks 00FK] theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S} @@ -113,9 +113,9 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) obtain ⟨p', h₁, h₂, h₃⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f p H obtain ⟨q, hq, hq'⟩ := Ideal.exists_minimalPrimes_le h₂ refine ⟨q, hq, Eq.symm ?_⟩ - have := hq.1.1 + have := Ideal.minimalPrimes_isPrime hq have := (Ideal.comap_mono hq').trans_eq h₃ - exact (H.2 ⟨inferInstance, Ideal.comap_mono hq.1.2⟩ this).antisymm this + exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes hq)⟩ this).antisymm this theorem Ideal.minimalPrimes_comap_subset (f : R →+* S) (J : Ideal S) : (J.comap f).minimalPrimes ⊆ Ideal.comap f '' J.minimalPrimes := @@ -129,8 +129,8 @@ variable {R S : Type*} [CommRing R] [CommRing S] {I J : Ideal R} theorem Ideal.minimal_primes_comap_of_surjective {f : R →+* S} (hf : Function.Surjective f) {I J : Ideal S} (h : J ∈ I.minimalPrimes) : J.comap f ∈ (I.comap f).minimalPrimes := by - have := h.1.1 - refine ⟨⟨inferInstance, Ideal.comap_mono h.1.2⟩, ?_⟩ + have := Ideal.minimalPrimes_isPrime h + refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes h)⟩, ?_⟩ rintro K ⟨hK, e₁⟩ e₂ have : RingHom.ker f ≤ K := (Ideal.comap_mono bot_le).trans e₁ rw [← sup_eq_left.mpr this, RingHom.ker_eq_comap_bot, ← Ideal.comap_map_of_surjective f hf] @@ -156,7 +156,8 @@ lemma Ideal.minimalPrimes_map_of_surjective {S : Type*} [CommRing S] {f : R →+ rw [← Ideal.comap_minimalPrimes_eq_of_surjective hf, ← Set.image_comp, Ideal.comap_map_of_surjective f hf, Set.image_congr, Set.image_id, RingHom.ker] intro x hx - exact (Ideal.comap_map_of_surjective f hf _).trans (sup_eq_left.mpr <| le_sup_right.trans hx.1.2) + exact (Ideal.comap_map_of_surjective f hf _).trans + (sup_eq_left.mpr <| le_sup_right.trans (Ideal.le_minimalPrimes hx)) theorem Ideal.minimalPrimes_eq_comap : I.minimalPrimes = Ideal.comap (Ideal.Quotient.mk I) '' minimalPrimes (R ⧸ I) := by @@ -174,21 +175,21 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : ext p constructor · intro hp - haveI := hp.1.1 - refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp hp.1.2⟩, ?_⟩ + haveI := Ideal.minimalPrimes_isPrime hp + refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e - ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp hp.1.1).2 + ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.minimalPrimes_isPrime hp)).2 refine (Ideal.comap_mono <| hp.2 ⟨?_, Ideal.map_mono hI.2⟩ (Ideal.map_le_iff_le_comap.mpr e)).trans_eq ?_ · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' · exact IsLocalization.comap_map_of_isPrime_disjoint S A hI.1 hI' · intro hp - refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr hp.1.2⟩, ?_⟩ + refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_minimalPrimes hp)⟩, ?_⟩ · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] - refine ⟨hp.1.1, ?_⟩ + refine ⟨Ideal.minimalPrimes_isPrime hp, ?_⟩ rintro rfl - exact hp.1.1.ne_top rfl + exact (Ideal.minimalPrimes_isPrime hp).ne_top rfl · intro I hI e rw [← IsLocalization.map_comap S A I, ← IsLocalization.map_comap S A p] haveI := hI.1 @@ -212,7 +213,7 @@ theorem IsLocalization.AtPrime.radical_map_of_mem_minimalPrimes · rw [← IsLocalization.comap_le_comap_iff q.primeCompl A, AtPrime.map_eq_maximalIdeal q A, AtPrime.comap_maximalIdeal A q] apply hIq.2 hJ.1 - have := hJ.1.1.ne_top + have := (Ideal.minimalPrimes_isPrime hJ).ne_top rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_comap_iff q.primeCompl A J] at this exact Set.disjoint_compl_left_iff_subset.mp this From 903a565b18e95a20baa90f755ce74d295a272d07 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:22:13 +0800 Subject: [PATCH 24/69] replace more .1.1 and .1.2 --- .../Ideal/AssociatedPrime/Localization.lean | 5 +-- Mathlib/RingTheory/Ideal/Height.lean | 25 +++++++------- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 33 ++++++++++--------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index 37909f3465e6de..2d07b507186198 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -131,10 +131,11 @@ variable (R M) in lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] : (Module.annihilator R M).minimalPrimes ⊆ associatedPrimes R M := by intro p hp - have prime := hp.1.1 + have prime := Ideal.minimalPrimes_isPrime hp let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by - simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using hp.1.2 + simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using + Ideal.le_minimalPrimes hp rcases associatedPrimes.nonempty Rₚ (LocalizedModule p.primeCompl M) with ⟨q, hq⟩ have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq simp only [← preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 28ae520c1cff57..4e84e280aea7c9 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -117,7 +117,7 @@ theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height simp only [height] refine le_iInf₂ (fun p hp ↦ ?_) have := Ideal.minimalPrimes_isPrime hp - obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans hp.1.2) + obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_minimalPrimes hp)) haveI := Ideal.minimalPrimes_isPrime hq exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @@ -131,7 +131,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) haveI := Ideal.minimalPrimes_isPrime hK - have : I < K := lt_of_lt_of_le h hK.1.2 + have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : @@ -179,10 +179,10 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr obtain ⟨p, h₁, h₂⟩ := Ideal.exists_minimalPrimes_le e convert h₁ refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm - have := h₁.1.1 + have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ - ((height_strict_mono_of_is_prime h₃).trans_le (e'.trans <| height_mono h₁.1.2)) + exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le + (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : @@ -201,7 +201,9 @@ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] - exact ⟨p, hp, haveI := hp.1.1; primeHeight_eq_zero_iff.mpr hp⟩ + refine ⟨p, hp, ?_⟩ + have := Ideal.minimalPrimes_isPrime hp + rw [primeHeight_eq_zero_iff.mpr hp] /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @[simp, nontriviality] @@ -281,7 +283,7 @@ lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal rw [← Ideal.comap_coe, Ideal.comap_minimalPrimes_eq_of_surjective (f := (↑e : R →+* S)) e.surjective] exact e.idealComapOrderIso.injective.mem_set_image.symm - · have : J.IsPrime := h.1.1 + · have : J.IsPrime := Ideal.minimalPrimes_isPrime h simp only [EquivLike.coe_coe, RingEquiv.idealComapOrderIso_apply, ← Ideal.height_eq_primeHeight, RingEquiv.height_comap_of_isPrime] @@ -375,7 +377,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id refine (Ideal.subset_union_prime ⊥ ⊥ ?_).not.mpr ?_ · rintro K hK - - rw [Set.Finite.mem_toFinset] at hK - exact hK.1.1.1 + exact Ideal.minimalPrimes_isPrime hK.1 · push Not intro K hK e have := hr.trans (Ideal.height_mono e) @@ -391,7 +393,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id push_cast exact add_le_add h₂ ((Submodule.spanRank_span_le_card _).trans (by simp)) · refine le_iInf₂ (fun p hp ↦ ?_) - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp by_cases h : p.height = ⊤ · rw [← p.height_eq_primeHeight, h] exact le_top @@ -408,9 +410,10 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id apply le_antisymm · rwa [← p.height_eq_primeHeight] · rwa [← e] - refine ⟨mem_minimalPrimes_of_primeHeight_eq_height (le_sup_left.trans hp.1.2) this.symm, ?_⟩ + refine ⟨mem_minimalPrimes_of_primeHeight_eq_height + (le_sup_left.trans (Ideal.le_minimalPrimes hp)) this.symm, ?_⟩ rwa [p.height_eq_primeHeight, eq_comm] - · exact hp.1.2 <| Ideal.mem_sup_right <| Ideal.subset_span <| Set.mem_singleton x + · exact (Ideal.le_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 0d273c352d3b7b..f34d9276bde91f 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -83,7 +83,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing ← (IsLocalization.orderEmbedding q.primeCompl (Localization.AtPrime q)).map_rel_iff] refine Submodule.le_of_le_smul_of_le_jacobson_bot (I := I) (IsNoetherian.noetherian _) ?_ ?_ · rw [IsLocalRing.jacobson_eq_maximalIdeal] - exacts [hp.1.2, bot_ne_top] + exacts [Ideal.le_minimalPrimes hp, bot_ne_top] · replace hn := congr(Ideal.comap (Ideal.Quotient.mk I) $(hn _ n.le_succ)) simp only [qs, OrderHom.coe_mk, ← RingHom.ker_eq_comap_bot, Ideal.mk_ker, Ideal.comap_map_of_surjective _ Ideal.Quotient.mk_surjective] at hn @@ -106,7 +106,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing has height at most 1. -/ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes (I : Ideal R) [I.IsPrincipal] (p : Ideal R) (hp : p ∈ I.minimalPrimes) : p.height ≤ 1 := by - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ · rwa [← IsLocalization.height_comap p.primeCompl, @@ -117,14 +117,15 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I - have : p.IsPrime := hp.1.1 - have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans hp.1.2) + have : p.IsPrime := Ideal.minimalPrimes_isPrime hp + have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_minimalPrimes hp)) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) - ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, map_mono (le_sup_right.trans hp.1.2)⟩, - fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr - ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| - (comap_mono hrp).trans <| Eq.le <| - (p.comap_map_of_surjective _ Quotient.mk_surjective).trans <| sup_eq_left.mpr hfp⟩ + ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, + map_mono (le_sup_right.trans (Ideal.le_minimalPrimes hp))⟩, + fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr + ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| + (comap_mono hrp).trans <| Eq.le <| + (p.comap_map_of_surjective _ Quotient.mk_surjective).trans <| sup_eq_left.mpr hfp⟩ /-- If `q < p` are prime ideals such that `p` is minimal over `span (s ∪ {x})` and `t` is a set contained in `q` such that `s ⊆ √span (t ∪ {x})`, then `q` is minimal over `span t`. @@ -152,7 +153,8 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, - map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| hp.1.2 <| subset_span <| .inl rfl⟩, + map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| (Ideal.le_minimalPrimes hp) <| + subset_span <| .inl rfl⟩, fun r ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr (hp.2 ⟨hr.comap f, ?_⟩ ?_)⟩ · rw [span_le, Set.insert_subset_iff] have := map_le_iff_le_comap.mp hxr (subset_span rfl) @@ -176,7 +178,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimal_primes induction hn : s.card using Nat.strong_induction_on generalizing R with | h n H => replace hn : s.card ≤ n := hn.le - have := hp.1.1 + have := Ideal.minimalPrimes_isPrime hp cases n with | zero => rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_primeHeight p, @@ -204,7 +206,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimal_primes ⟨le_sup_left, x, mem_sup_right (mem_span_singleton_self _), hxq⟩).trans_le hJ) ((le_maximalIdeal hJ'.ne_top).lt_of_not_ge h) have h : (s' : Set R) ⊆ (q ⊔ span {x}).radical := by - have := hp.1.2.trans this + have := (Ideal.le_minimalPrimes hp).trans this rw [span_le, Finset.coe_insert, Set.insert_subset_iff] at this exact this.2 obtain ⟨t, ht, hspan⟩ := exists_subset_radical_span_sup_of_subset_radical_sup _ _ _ h @@ -239,7 +241,7 @@ lemma Ideal.height_le_spanRank_toENat (I : Ideal R) (hI : I ≠ ⊤) : obtain ⟨J, hJ⟩ := nonempty_minimalPrimes hI refine (iInf₂_le J hJ).trans ?_ convert (I.height_le_spanRank_toENat_of_mem_minimal_primes J hJ) - exact Eq.symm (@height_eq_primeHeight _ _ J hJ.1.1) + exact (@height_eq_primeHeight _ _ J (Ideal.minimalPrimes_isPrime hJ)).symm lemma Ideal.height_le_spanFinrank (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanFinrank := by @@ -318,7 +320,8 @@ lemma Ideal.height_le_height_add_spanFinrank_of_le {I p : Ideal R} [p.IsPrime] ( let p' := p.map (algebraMap R (R ⧸ I)) have : p'.IsPrime := isPrime_map_quotientMk_of_isPrime hrp obtain ⟨s, hps, hs⟩ := exists_finset_card_eq_height_of_isNoetherianRing p' - have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := fun _ hx ↦ hps.1.2 (subset_span hx) + have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := + fun _ hx ↦ (Ideal.le_minimalPrimes hps) (subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk I) p s := by refine Set.SurjOn.mono subset_rfl hsp' fun x hx ↦ ?_ obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x @@ -415,7 +418,7 @@ lemma Ideal.height_le_height_add_of_liesOver [IsNoetherianRing S] (p : Ideal R) let P' := P.map (Ideal.Quotient.mk <| p.map (algebraMap R S)) obtain ⟨s', hP', heq'⟩ := P'.exists_finset_card_eq_height_of_isNoetherianRing have hsP'sub : (s' : Set <| S ⧸ (Ideal.map (algebraMap R S) p)) ⊆ (P' : Set <| S ⧸ _) := - fun x hx ↦ hP'.1.2 (Ideal.subset_span hx) + fun x hx ↦ (Ideal.le_minimalPrimes hP') (Ideal.subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk (p.map (algebraMap R S))) P s' := by refine Set.SurjOn.mono subset_rfl hsP'sub fun x hx ↦ ?_ obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x From 663dafa3d5db14b6119a56fb99fda4e93f91d80d Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:23:18 +0800 Subject: [PATCH 25/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 4e84e280aea7c9..c63c53f6d27026 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -130,7 +130,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] exact I.primeHeight_lt_top · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) - haveI := Ideal.minimalPrimes_isPrime hK + have := Ideal.minimalPrimes_isPrime hK have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this From 99d74db08b6dfd61ef6fa6cf6024066849014b06 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:16:01 +0800 Subject: [PATCH 26/69] fix doc --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 90b2ea119c741a..075d158ba45537 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -170,7 +170,7 @@ lemma Ideal.eq_of_le_of_height_le [I.IsPrime] [I.FiniteHeight] {J : Ideal R} (h : I ≤ J) (h_height : J.height ≤ I.height) : I = J := eq_of_le_of_not_lt h fun hlt => not_le.mpr (Ideal.height_strict_mono_of_is_prime hlt) h_height -@[deprecated "Use `Ideal.height_add_one_le_of_lt_of_isPrime` instead." (since := "2026-04-04")] +@[deprecated "Use `Ideal.height_le_ringKrullDim_of_isPrime` instead." (since := "2026-04-04")] private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : I.primeHeight ≤ ringKrullDim R := Order.height_le_krullDim _ From 6d956b634f6e2e730d36863cd6acf3f39c832673 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:30:05 +0800 Subject: [PATCH 27/69] fix and add deprecation --- Mathlib/RingTheory/Ideal/Height.lean | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 2c9fb5c2d44815..b2681c76294800 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -131,6 +131,10 @@ lemma Ideal.height_strict_mono_of_isPrime_of_isPrime {I J : Ideal R} [I.IsPrime] (Or.inr (lt_of_le_of_lt (Ideal.height_mono h.le) (J.height_lt_top IsPrime.ne_top')).ne) exact Ideal.height_strict_mono_of_isPrime h +@[deprecated (since := "2026-04-02")] +alias Ideal.height_strict_mono_of_isPrime_of_is_prime := + Ideal.height_strict_mono_of_isPrime_of_isPrime + @[deprecated "Use `Ideal.height_strict_mono_of_isPrime_of_isPrime` instead." (since := "2026-04-02")] lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) @@ -140,7 +144,7 @@ lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : /-- A prime ideal of finite height is equal to any ideal that contains it with no greater height. -/ lemma Ideal.eq_of_le_of_height_le [I.IsPrime] [I.FiniteHeight] {J : Ideal R} (h : I ≤ J) (h_height : J.height ≤ I.height) : I = J := - eq_of_le_of_not_lt h fun hlt => not_le.mpr (Ideal.height_strict_mono_of_is_prime hlt) h_height + eq_of_le_of_not_lt h fun hlt => not_le.mpr (Ideal.height_strict_mono_of_isPrime hlt) h_height private lemma Ideal.primeHeight_le_ringKrullDim {I : Ideal R} [I.IsPrime] : I.primeHeight ≤ ringKrullDim R := Order.height_le_krullDim _ From 5b55fdc247193c18c5318309029d33a919320620 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 15 Apr 2026 22:16:16 +0800 Subject: [PATCH 28/69] Update KrullsHeightTheorem.lean --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index f10627b26cf219..c08bb61cff9381 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -148,7 +148,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide have : (p.map f).FiniteHeight := ⟨Or.inr (h.trans_lt (WithTop.coe_lt_top 1)).ne⟩ have := (height_strict_mono_of_isPrime_of_isPrime h_lt).trans_le h rw [ENat.lt_one_iff_eq_zero, height_eq_zero_iff] at this - have := minimal_primes_comap_of_surjective hf this + have := minimalPrimes_comap_of_surjective hf this rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, From c03a1f7948a55fb2cebdf1fbc6bb547260f3743c Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 15 Apr 2026 22:34:53 +0800 Subject: [PATCH 29/69] fix --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 0e412542aaedb1..9a9adf388f6ff5 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -241,7 +241,7 @@ lemma Ideal.height_le_spanRank_toENat (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanRank.toENat := by obtain ⟨J, hJ⟩ := nonempty_minimalPrimes hI rw [I.height_eq_inf_minimalPrimes] - exact (iInf₂_le J hJ).trans (I.height_le_spanRank_toENat_of_mem_minimal_primes J hJ) + exact (iInf₂_le J hJ).trans (I.height_le_spanRank_toENat_of_mem_minimalPrimes J hJ) lemma Ideal.height_le_spanFinrank (I : Ideal R) (hI : I ≠ ⊤) : I.height ≤ I.spanFinrank := by From 4ffe3c92d1ebf035c56390c202d78b9881a8b9cf Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 24 Apr 2026 22:39:30 +0800 Subject: [PATCH 30/69] fix naming --- .../Ideal/AssociatedPrime/Localization.lean | 2 +- Mathlib/RingTheory/Ideal/Height.lean | 10 +++++----- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 14 +++++++------- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 16 ++++++++-------- Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean | 2 +- .../Ideal/MinimalPrime/Localization.lean | 14 +++++++------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index 2d07b507186198..e3dc5170f20330 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -135,7 +135,7 @@ lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Mo let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using - Ideal.le_minimalPrimes hp + Ideal.le_of_mem_minimalPrimes hp rcases associatedPrimes.nonempty Rₚ (LocalizedModule p.primeCompl M) with ⟨q, hq⟩ have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq simp only [← preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index dd5ca9b542be75..ff558449ad202e 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -117,7 +117,7 @@ theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height simp only [height] refine le_iInf₂ (fun p hp ↦ ?_) have := Ideal.minimalPrimes_isPrime hp - obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_minimalPrimes hp)) + obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_of_mem_minimalPrimes hp)) haveI := Ideal.minimalPrimes_isPrime hq exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @@ -131,7 +131,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) have := Ideal.minimalPrimes_isPrime hK - have : I < K := lt_of_lt_of_le h (Ideal.le_minimalPrimes hK) + have : I < K := lt_of_lt_of_le h (Ideal.le_of_mem_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this /-- A prime ideal of finite height is equal to any ideal that contains it with no greater height. -/ @@ -187,7 +187,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le - (e'.trans <| height_mono (Ideal.le_minimalPrimes h₁))) + (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : @@ -416,9 +416,9 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id · rwa [← p.height_eq_primeHeight] · rwa [← e] refine ⟨mem_minimalPrimes_of_primeHeight_eq_height - (le_sup_left.trans (Ideal.le_minimalPrimes hp)) this.symm, ?_⟩ + (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) this.symm, ?_⟩ rwa [p.height_eq_primeHeight, eq_comm] - · exact (Ideal.le_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x + · exact (Ideal.le_of_mem_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index d5a4597fe3c9b6..91de20c5386a1b 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -83,7 +83,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing ← (IsLocalization.orderEmbedding q.primeCompl (Localization.AtPrime q)).map_rel_iff] refine Submodule.le_of_le_smul_of_le_jacobson_bot (I := I) (IsNoetherian.noetherian _) ?_ ?_ · rw [IsLocalRing.jacobson_eq_maximalIdeal] - exacts [Ideal.le_minimalPrimes hp, bot_ne_top] + exacts [Ideal.le_of_mem_minimalPrimes hp, bot_ne_top] · replace hn := congr(Ideal.comap (Ideal.Quotient.mk I) $(hn _ n.le_succ)) simp only [qs, OrderHom.coe_mk, ← RingHom.ker_eq_comap_bot, Ideal.mk_ker, Ideal.comap_map_of_surjective _ Ideal.Quotient.mk_surjective] at hn @@ -118,10 +118,10 @@ theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I have : p.IsPrime := Ideal.minimalPrimes_isPrime hp - have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_minimalPrimes hp)) + have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, - map_mono (le_sup_right.trans (Ideal.le_minimalPrimes hp))⟩, + map_mono (le_sup_right.trans (Ideal.le_of_mem_minimalPrimes hp))⟩, fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| (comap_mono hrp).trans <| Eq.le <| @@ -153,7 +153,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, - map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| (Ideal.le_minimalPrimes hp) <| + map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| (Ideal.le_of_mem_minimalPrimes hp) <| subset_span <| .inl rfl⟩, fun r ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr (hp.2 ⟨hr.comap f, ?_⟩ ?_)⟩ · rw [span_le, Set.insert_subset_iff] @@ -206,7 +206,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimalPrimes ⟨le_sup_left, x, mem_sup_right (mem_span_singleton_self _), hxq⟩).trans_le hJ) ((le_maximalIdeal hJ'.ne_top).lt_of_not_ge h) have h : (s' : Set R) ⊆ (q ⊔ span {x}).radical := by - have := (Ideal.le_minimalPrimes hp).trans this + have := (Ideal.le_of_mem_minimalPrimes hp).trans this rw [span_le, Finset.coe_insert, Set.insert_subset_iff] at this exact this.2 obtain ⟨t, ht, hspan⟩ := exists_subset_radical_span_sup_of_subset_radical_sup _ _ _ h @@ -324,7 +324,7 @@ lemma Ideal.height_le_height_add_spanFinrank_of_le {I p : Ideal R} [p.IsPrime] ( have : p'.IsPrime := isPrime_map_quotientMk_of_isPrime hrp obtain ⟨s, hps, hs⟩ := exists_finset_card_eq_height_of_isNoetherianRing p' have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := - fun _ hx ↦ (Ideal.le_minimalPrimes hps) (subset_span hx) + fun _ hx ↦ (Ideal.le_of_mem_minimalPrimes hps) (subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk I) p s := by refine Set.SurjOn.mono subset_rfl hsp' fun x hx ↦ ?_ obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x @@ -421,7 +421,7 @@ lemma Ideal.height_le_height_add_of_liesOver [IsNoetherianRing S] (p : Ideal R) let P' := P.map (Ideal.Quotient.mk <| p.map (algebraMap R S)) obtain ⟨s', hP', heq'⟩ := P'.exists_finset_card_eq_height_of_isNoetherianRing have hsP'sub : (s' : Set <| S ⧸ (Ideal.map (algebraMap R S) p)) ⊆ (P' : Set <| S ⧸ _) := - fun x hx ↦ (Ideal.le_minimalPrimes hP') (Ideal.subset_span hx) + fun x hx ↦ (Ideal.le_of_mem_minimalPrimes hP') (Ideal.subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk (p.map (algebraMap R S))) P s' := by refine Set.SurjOn.mono subset_rfl hsP'sub fun x hx ↦ ?_ obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 689fddcfb9f092..17483edc6cccfd 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -54,10 +54,10 @@ variable {I J} theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := h.1.1 -theorem Ideal.le_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := +theorem Ideal.le_of_mem_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := h.1.2 -theorem minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := +theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by @@ -123,15 +123,15 @@ theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes ext J constructor · exact fun H => - let e := (Ideal.minimalPrimes_isPrime H).radical_le_iff.mpr (Ideal.le_minimalPrimes H) + let e := (Ideal.minimalPrimes_isPrime H).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes H) (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ theorem Ideal.minimalPrimes_eq_subsingleton_self [I.IsPrime] : I.minimalPrimes = {I} := by ext J - refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ (Ideal.le_minimalPrimes H)).antisymm - (Ideal.le_minimalPrimes H), ?_⟩ + refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ (Ideal.le_of_mem_minimalPrimes H)).antisymm + (Ideal.le_of_mem_minimalPrimes H), ?_⟩ rintro (rfl : J = I) exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ @@ -150,7 +150,7 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact (Ideal.minimalPrimes_isPrime h).ne_top (top_le_iff.mp (Ideal.le_minimalPrimes h)) + exact (Ideal.minimalPrimes_isPrime h).ne_top (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by @@ -170,7 +170,7 @@ lemma Ideal.mem_minimalPrimes_sup {R : Type*} [CommRing R] {p I J : Ideal R} [p. refine ⟨⟨‹_›, ?_⟩, fun q ⟨_, hq⟩ hqp ↦ ?_⟩ · rw [sup_le_iff] refine ⟨hle, ?_⟩ - simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) (Ideal.le_minimalPrimes h) + simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) (Ideal.le_of_mem_minimalPrimes h) · rw [sup_le_iff] at hq have h2 : p.map (Quotient.mk I) ≤ q.map (Quotient.mk I) := h.2 ⟨isPrime_map_quotientMk_of_isPrime hq.1, map_mono hq.2⟩ (map_mono hqp) @@ -190,7 +190,7 @@ lemma Ideal.map_sup_mem_minimalPrimes_of_map_quotientMk_mem_minimalPrimes refine ⟨⟨inferInstance, sup_le_iff.mpr ?_⟩, fun q ⟨_, hleq⟩ hqle ↦ ?_⟩ · refine ⟨?_, hJP⟩ rw [Ideal.map_le_iff_le_comap, ← Ideal.under_def, ← Ideal.over_def P p] - exact Ideal.le_minimalPrimes hI + exact Ideal.le_of_mem_minimalPrimes hI · simp only [sup_le_iff] at hleq have h1 : p.map (algebraMap R S) ≤ q := by rw [Ideal.map_le_iff_le_comap] diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean index 4b76a27a9235e3..27693479951ca1 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean @@ -96,7 +96,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] exact ⟨hz', hJI, hz⟩ by_cases hn' : n - 1 = 0 · simp [K, show n = 1 by grind] at hz' - exact (hK.2 (hz'.trans (Ideal.le_minimalPrimes hI))).elim + exact (hK.2 (hz'.trans (Ideal.le_of_mem_minimalPrimes hI))).elim · grind [Nat.find_min' key ⟨hn', J * Ideal.span {z}, hK⟩] end Submodule diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 0afbe2e5f9e851..cdb9c17bc7a400 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -66,7 +66,7 @@ theorem Ideal.iUnion_minimalPrimes : obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy refine ⟨p, hp, ((Ideal.minimalPrimes_isPrime hp).mem_or_mem ?_).resolve_right hyp⟩ - exact (Ideal.minimalPrimes_isPrime hp).radical_le_iff.mpr (Ideal.le_minimalPrimes hp) hx + exact (Ideal.minimalPrimes_isPrime hp).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes hp) hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -98,7 +98,7 @@ lemma Ideal.disjoint_nonZeroDivisors_of_mem_minimalPrimes {p : Ideal R} (hp : p theorem Ideal.exists_comap_eq_of_mem_minimalPrimes {I : Ideal S} (f : R →+* S) (p) (H : p ∈ (I.comap f).minimalPrimes) : ∃ p' : Ideal S, p'.IsPrime ∧ I ≤ p' ∧ p'.comap f = p := have := Ideal.minimalPrimes_isPrime H - have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_minimalPrimes H) + have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_of_mem_minimalPrimes H) ⟨p', hp', hIp', le.antisymm (H.2 ⟨inferInstance, comap_mono hIp'⟩ le)⟩ @[stacks 00FK] theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S} @@ -115,7 +115,7 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) refine ⟨q, hq, Eq.symm ?_⟩ have := Ideal.minimalPrimes_isPrime hq have := (Ideal.comap_mono hq').trans_eq h₃ - exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes hq)⟩ this).antisymm this + exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes hq)⟩ this).antisymm this theorem Ideal.minimalPrimes_comap_subset (f : R →+* S) (J : Ideal S) : (J.comap f).minimalPrimes ⊆ Ideal.comap f '' J.minimalPrimes := @@ -130,7 +130,7 @@ variable {R S : Type*} [CommRing R] [CommRing S] {I J : Ideal R} theorem Ideal.minimalPrimes_comap_of_surjective {f : R →+* S} (hf : Function.Surjective f) {I J : Ideal S} (h : J ∈ I.minimalPrimes) : J.comap f ∈ (I.comap f).minimalPrimes := by have := Ideal.minimalPrimes_isPrime h - refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_minimalPrimes h)⟩, ?_⟩ + refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes h)⟩, ?_⟩ rintro K ⟨hK, e₁⟩ e₂ have : RingHom.ker f ≤ K := (Ideal.comap_mono bot_le).trans e₁ rw [← sup_eq_left.mpr this, RingHom.ker_eq_comap_bot, ← Ideal.comap_map_of_surjective f hf] @@ -160,7 +160,7 @@ lemma Ideal.minimalPrimes_map_of_surjective {S : Type*} [CommRing S] {f : R →+ Ideal.comap_map_of_surjective f hf, Set.image_congr, Set.image_id, RingHom.ker] intro x hx exact (Ideal.comap_map_of_surjective f hf _).trans - (sup_eq_left.mpr <| le_sup_right.trans (Ideal.le_minimalPrimes hx)) + (sup_eq_left.mpr <| le_sup_right.trans (Ideal.le_of_mem_minimalPrimes hx)) theorem Ideal.minimalPrimes_eq_comap : I.minimalPrimes = Ideal.comap (Ideal.Quotient.mk I) '' minimalPrimes (R ⧸ I) := by @@ -179,7 +179,7 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : constructor · intro hp haveI := Ideal.minimalPrimes_isPrime hp - refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_minimalPrimes hp)⟩, ?_⟩ + refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.minimalPrimes_isPrime hp)).2 @@ -188,7 +188,7 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' · exact IsLocalization.comap_map_of_isPrime_disjoint S A hI.1 hI' · intro hp - refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_minimalPrimes hp)⟩, ?_⟩ + refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] refine ⟨Ideal.minimalPrimes_isPrime hp, ?_⟩ rintro rfl From 90805b47929166aee9aa9aff2d032f16f544d051 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:28:28 +0800 Subject: [PATCH 31/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 3 ++- Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index ff558449ad202e..2e2e034fe0d23d 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -186,7 +186,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le + exact lt_irrefl _ ((height_strict_mono_of_isPrime h₃).trans_le (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 91de20c5386a1b..dd0087b6d0add1 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -118,7 +118,8 @@ theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I have : p.IsPrime := Ideal.minimalPrimes_isPrime hp - have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) + have hfp : RingHom.ker f ≤ p := + I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, map_mono (le_sup_right.trans (Ideal.le_of_mem_minimalPrimes hp))⟩, diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index cdb9c17bc7a400..a5c4cfb5f300f5 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -115,7 +115,8 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) refine ⟨q, hq, Eq.symm ?_⟩ have := Ideal.minimalPrimes_isPrime hq have := (Ideal.comap_mono hq').trans_eq h₃ - exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes hq)⟩ this).antisymm this + exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes hq)⟩ this).antisymm + this theorem Ideal.minimalPrimes_comap_subset (f : R →+* S) (J : Ideal S) : (J.comap f).minimalPrimes ⊆ Ideal.comap f '' J.minimalPrimes := @@ -179,7 +180,8 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : constructor · intro hp haveI := Ideal.minimalPrimes_isPrime hp - refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ + refine ⟨⟨Ideal.IsPrime.comap _, + Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.minimalPrimes_isPrime hp)).2 From 10af9921cde5469f493b9be7a7c02f363f1b74a8 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:37:07 +0800 Subject: [PATCH 32/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 2e2e034fe0d23d..ff558449ad202e 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -186,7 +186,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ ((height_strict_mono_of_isPrime h₃).trans_le + exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ From 08f157e20c4d617ff613cd968fe028532d3a01f2 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:37:31 +0800 Subject: [PATCH 33/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 494e24046c9de3..7d1693f6ebf1a4 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -187,7 +187,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm have := Ideal.minimalPrimes_isPrime h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le + exact lt_irrefl _ ((height_strict_mono_of_isPrime h₃).trans_le (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) /-- A prime ideal has height zero if and only if it is minimal -/ From 7648ee642c39f7a70133d1e67ffb495522f9f0c5 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 5 May 2026 20:44:31 +0800 Subject: [PATCH 34/69] fix naming --- .../Ideal/AssociatedPrime/Localization.lean | 2 +- Mathlib/RingTheory/Ideal/Height.lean | 20 +++++++++---------- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 8 ++++---- .../RingTheory/Ideal/MinimalPrime/Basic.lean | 8 ++++---- .../RingTheory/Ideal/MinimalPrime/Colon.lean | 8 ++++---- .../Ideal/MinimalPrime/Localization.lean | 20 +++++++++---------- .../RingTheory/KrullDimension/Regular.lean | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index e3dc5170f20330..6ce2cc209d03c4 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -131,7 +131,7 @@ variable (R M) in lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] : (Module.annihilator R M).minimalPrimes ⊆ associatedPrimes R M := by intro p hp - have prime := Ideal.minimalPrimes_isPrime hp + have prime := Ideal.IsPrime.of_mem_minimalPrimes hp let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 1c01846ee0b6e2..8e275fc8481417 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -39,7 +39,7 @@ noncomputable def Ideal.primeHeight [hI : I.IsPrime] : ℕ∞ := /-- The height of an ideal is defined as the infimum of the heights of its minimal prime ideals. -/ noncomputable def Ideal.height : ℕ∞ := - ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J (minimalPrimes_isPrime (I := I) ‹_›) + ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J (IsPrime.of_mem_minimalPrimes (I := I) ‹_›) /-- For a prime ideal, its height equals its prime height. -/ lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by @@ -116,9 +116,9 @@ lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [height] refine le_iInf₂ (fun p hp ↦ ?_) - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_of_mem_minimalPrimes hp)) - haveI := Ideal.minimalPrimes_isPrime hq + haveI := Ideal.IsPrime.of_mem_minimalPrimes hq exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @[gcongr] @@ -130,7 +130,7 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] exact I.primeHeight_lt_top · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) - have := Ideal.minimalPrimes_isPrime hK + have := Ideal.IsPrime.of_mem_minimalPrimes hK have : I < K := lt_of_lt_of_le h (Ideal.le_of_mem_minimalPrimes hK) exact Ideal.primeHeight_add_one_le_of_lt this @@ -146,7 +146,7 @@ lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : I.height ≤ ringKrullDim R := by rw [Ideal.height] obtain ⟨P, hP⟩ : Nonempty (I.minimalPrimes) := Ideal.nonempty_minimalPrimes h - have := Ideal.minimalPrimes_isPrime hP + have := Ideal.IsPrime.of_mem_minimalPrimes hP refine le_trans ?_ (Ideal.primeHeight_le_ringKrullDim (I := P)) simpa using iInf₂_le _ hP @@ -184,7 +184,7 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr obtain ⟨p, h₁, h₂⟩ := Ideal.exists_minimalPrimes_le e convert h₁ refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm - have := Ideal.minimalPrimes_isPrime h₁ + have := Ideal.IsPrime.of_mem_minimalPrimes h₁ have := finiteHeight_of_le h₂ IsPrime.ne_top' exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) @@ -207,7 +207,7 @@ lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] refine ⟨p, hp, ?_⟩ - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp rw [primeHeight_eq_zero_iff.mpr hp] /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @@ -288,7 +288,7 @@ lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal rw [← Ideal.comap_coe, Ideal.comap_minimalPrimes_eq_of_surjective (f := (↑e : R →+* S)) e.surjective] exact e.idealComapOrderIso.injective.mem_set_image.symm - · have : J.IsPrime := Ideal.minimalPrimes_isPrime h + · have : J.IsPrime := Ideal.IsPrime.of_mem_minimalPrimes h simp only [EquivLike.coe_coe, RingEquiv.idealComapOrderIso_apply, ← Ideal.height_eq_primeHeight, RingEquiv.height_comap_of_isPrime] @@ -379,7 +379,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id refine (Ideal.subset_union_prime ⊥ ⊥ ?_).not.mpr ?_ · rintro K hK - - rw [Set.Finite.mem_toFinset] at hK - exact Ideal.minimalPrimes_isPrime hK.1 + exact Ideal.IsPrime.of_mem_minimalPrimes hK.1 · push Not intro K hK e have := hr.trans (Ideal.height_mono e) @@ -395,7 +395,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id push_cast exact add_le_add h₂ ((Submodule.spanRank_span_le_card _).trans (by simp)) · refine le_iInf₂ (fun p hp ↦ ?_) - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp by_cases h : p.height = ⊤ · rw [← p.height_eq_primeHeight, h] exact le_top diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 897b813b7b05c4..216697afa6012c 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -106,7 +106,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing has height at most 1. -/ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes (I : Ideal R) [I.IsPrincipal] (p : Ideal R) (hp : p ∈ I.minimalPrimes) : p.height ≤ 1 := by - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ · rwa [← IsLocalization.height_comap p.primeCompl, @@ -117,7 +117,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I - have : p.IsPrime := Ideal.minimalPrimes_isPrime hp + have : p.IsPrime := Ideal.IsPrime.of_mem_minimalPrimes hp have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) @@ -139,7 +139,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide have hf : Function.Surjective f := Quotient.mk_surjective have hI'q : span t ≤ q := span_le.mpr htq have hI'p : span t ≤ p := hI'q.trans hqp.le - have := minimalPrimes_isPrime hp + have := IsPrime.of_mem_minimalPrimes hp have : (p.map f).IsPrime := map_isPrime_of_surjective hf (by rwa [mk_ker]) suffices h : (p.map f).height ≤ 1 by have h_lt : q.map f < p.map f := (map_mono hqp.le).lt_of_not_ge fun e ↦ hqp.not_ge <| by @@ -179,7 +179,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimalPrimes induction hn : s.card using Nat.strong_induction_on generalizing R with | h n H => replace hn : s.card ≤ n := hn.le - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp cases n with | zero => rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_primeHeight p, diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 17483edc6cccfd..66e3e15a4b6f1a 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -51,13 +51,13 @@ lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x variable {I J} -theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := +theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := h.1.1 theorem Ideal.le_of_mem_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := h.1.2 -theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := +theorem Ideal.IsPrime.of_mem_minimalPrimes' {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by @@ -123,7 +123,7 @@ theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes ext J constructor · exact fun H => - let e := (Ideal.minimalPrimes_isPrime H).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes H) + let e := (Ideal.IsPrime.of_mem_minimalPrimes H).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes H) (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ @@ -150,7 +150,7 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact (Ideal.minimalPrimes_isPrime h).ne_top (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) + exact (Ideal.IsPrime.of_mem_minimalPrimes h).ne_top (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean index a9654ed4513af0..547575d16c3f12 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean @@ -48,8 +48,8 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] refine ⟨n, hn0, ((h.toFinset.erase I).inf id) ^ n, hn, ?_⟩ have (K : Ideal R) (hKI : K ≤ I) (hK : K ∈ ann.minimalPrimes) : K = I := le_antisymm hKI (hI.2 hK.1 hKI) - simpa [(Ideal.minimalPrimes_isPrime hI).pow_le_iff hn0, - (Ideal.minimalPrimes_isPrime hI).inf_le', imp_not_comm, not_imp_not] + simpa [(Ideal.IsPrime.of_mem_minimalPrimes hI).pow_le_iff hn0, + (Ideal.IsPrime.of_mem_minimalPrimes hI).inf_le', imp_not_comm, not_imp_not] obtain ⟨hn0, J, hJ, hJI⟩ := Nat.find_spec key -- let `n` be minimal such that there exists an ideal `J` with `I ^ n * J ≤ ann` and `¬ J ≠ I` set n := Nat.find key @@ -75,7 +75,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] -- let `z` be the product of these finitely many `f y`'s let z := ∏ y ∈ s, f y -- then `z ∉ I` - have hz : z ∉ I := by simp [z, (Ideal.minimalPrimes_isPrime hI).prod_mem_iff, h] + have hz : z ∉ I := by simp [z, (Ideal.IsPrime.of_mem_minimalPrimes hI).prod_mem_iff, h] -- and `K ≤ colon N {z • x}` have hz' : K ≤ colon N {z • x} := by rw [← (map_injective_of_injective K.subtype_injective).eq_iff, map_subtype_top] at hs @@ -91,7 +91,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] simpa only [ann, mem_colon_singleton, mul_comm, mul_smul] using hz' hi -- but now `K = I ^ (n - 1) * J` contradicts the minimality of `n` have hK : I ^ (n - 1) * (J * Ideal.span {z}) ≤ ann ∧ ¬ J * Ideal.span {z} ≤ I := by - rw [← mul_assoc, (Ideal.minimalPrimes_isPrime hI).mul_le, not_or, + rw [← mul_assoc, (Ideal.IsPrime.of_mem_minimalPrimes hI).mul_le, not_or, Ideal.span_singleton_le_iff_mem] exact ⟨hz', hJI, hz⟩ by_cases hn' : n - 1 = 0 diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index a5c4cfb5f300f5..ce937323a986c5 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -65,8 +65,8 @@ theorem Ideal.iUnion_minimalPrimes : · rintro ⟨y, hy, hx⟩ obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy - refine ⟨p, hp, ((Ideal.minimalPrimes_isPrime hp).mem_or_mem ?_).resolve_right hyp⟩ - exact (Ideal.minimalPrimes_isPrime hp).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes hp) hx + refine ⟨p, hp, ((Ideal.IsPrime.of_mem_minimalPrimes hp).mem_or_mem ?_).resolve_right hyp⟩ + exact (Ideal.IsPrime.of_mem_minimalPrimes hp).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes hp) hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -97,7 +97,7 @@ lemma Ideal.disjoint_nonZeroDivisors_of_mem_minimalPrimes {p : Ideal R} (hp : p theorem Ideal.exists_comap_eq_of_mem_minimalPrimes {I : Ideal S} (f : R →+* S) (p) (H : p ∈ (I.comap f).minimalPrimes) : ∃ p' : Ideal S, p'.IsPrime ∧ I ≤ p' ∧ p'.comap f = p := - have := Ideal.minimalPrimes_isPrime H + have := Ideal.IsPrime.of_mem_minimalPrimes H have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_of_mem_minimalPrimes H) ⟨p', hp', hIp', le.antisymm (H.2 ⟨inferInstance, comap_mono hIp'⟩ le)⟩ @@ -113,7 +113,7 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) obtain ⟨p', h₁, h₂, h₃⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f p H obtain ⟨q, hq, hq'⟩ := Ideal.exists_minimalPrimes_le h₂ refine ⟨q, hq, Eq.symm ?_⟩ - have := Ideal.minimalPrimes_isPrime hq + have := Ideal.IsPrime.of_mem_minimalPrimes hq have := (Ideal.comap_mono hq').trans_eq h₃ exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes hq)⟩ this).antisymm this @@ -130,7 +130,7 @@ variable {R S : Type*} [CommRing R] [CommRing S] {I J : Ideal R} theorem Ideal.minimalPrimes_comap_of_surjective {f : R →+* S} (hf : Function.Surjective f) {I J : Ideal S} (h : J ∈ I.minimalPrimes) : J.comap f ∈ (I.comap f).minimalPrimes := by - have := Ideal.minimalPrimes_isPrime h + have := Ideal.IsPrime.of_mem_minimalPrimes h refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes h)⟩, ?_⟩ rintro K ⟨hK, e₁⟩ e₂ have : RingHom.ker f ≤ K := (Ideal.comap_mono bot_le).trans e₁ @@ -179,12 +179,12 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : ext p constructor · intro hp - haveI := Ideal.minimalPrimes_isPrime hp + haveI := Ideal.IsPrime.of_mem_minimalPrimes hp refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e - ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.minimalPrimes_isPrime hp)).2 + ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.IsPrime.of_mem_minimalPrimes hp)).2 refine (Ideal.comap_mono <| hp.2 ⟨?_, Ideal.map_mono hI.2⟩ (Ideal.map_le_iff_le_comap.mpr e)).trans_eq ?_ · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' @@ -192,9 +192,9 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : · intro hp refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] - refine ⟨Ideal.minimalPrimes_isPrime hp, ?_⟩ + refine ⟨Ideal.IsPrime.of_mem_minimalPrimes hp, ?_⟩ rintro rfl - exact (Ideal.minimalPrimes_isPrime hp).ne_top rfl + exact (Ideal.IsPrime.of_mem_minimalPrimes hp).ne_top rfl · intro I hI e rw [← IsLocalization.map_comap S A I, ← IsLocalization.map_comap S A p] haveI := hI.1 @@ -218,7 +218,7 @@ theorem IsLocalization.AtPrime.radical_map_of_mem_minimalPrimes · rw [← IsLocalization.comap_le_comap_iff q.primeCompl A, AtPrime.map_eq_maximalIdeal q A, AtPrime.comap_maximalIdeal A q] apply hIq.2 hJ.1 - have := (Ideal.minimalPrimes_isPrime hJ).ne_top + have := (Ideal.IsPrime.of_mem_minimalPrimes hJ).ne_top rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_comap_iff q.primeCompl A J] at this exact Set.disjoint_compl_left_iff_subset.mp this diff --git a/Mathlib/RingTheory/KrullDimension/Regular.lean b/Mathlib/RingTheory/KrullDimension/Regular.lean index fddb6d4876b442..89bcb36e104007 100644 --- a/Mathlib/RingTheory/KrullDimension/Regular.lean +++ b/Mathlib/RingTheory/KrullDimension/Regular.lean @@ -95,7 +95,7 @@ theorem supportDim_quotSMulTop_succ_le_of_notMem_minimalPrimes {x : R} let q : LTSeries (support R M) := p.map (Set.MapsTo.restrict id (support R (QuotSMulTop x M)) (support R M) le) (fun _ _ h ↦ h) obtain ⟨r, hrm, hr⟩ := exists_minimalPrimes_le (mem_support_iff_of_finite.mp q.head.2) - let r : support R M := ⟨⟨r, minimalPrimes_isPrime hrm⟩, mem_support_iff_of_finite.mpr hrm.1.2⟩ + let r : support R M := ⟨⟨r, IsPrime.of_mem_minimalPrimes hrm⟩, mem_support_iff_of_finite.mpr hrm.1.2⟩ have hr : r < q.head := lt_of_le_of_ne hr (fun h ↦ hn q.head.1.1 (by rwa [← h]) hp.2) exact le_of_eq_of_le (by simp [q]) (le_iSup _ (q.cons r hr)) From d6d581af8ce47486c0d00ec17b7db16e7b112917 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 5 May 2026 20:59:36 +0800 Subject: [PATCH 35/69] fix long line --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 6 ++++-- Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean | 6 ++++-- Mathlib/RingTheory/KrullDimension/Regular.lean | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 66e3e15a4b6f1a..c2092dba194aba 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -123,7 +123,8 @@ theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes ext J constructor · exact fun H => - let e := (Ideal.IsPrime.of_mem_minimalPrimes H).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes H) + let e := (Ideal.IsPrime.of_mem_minimalPrimes H).radical_le_iff.mpr + (Ideal.le_of_mem_minimalPrimes H) (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ @@ -150,7 +151,8 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact (Ideal.IsPrime.of_mem_minimalPrimes h).ne_top (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) + exact (Ideal.IsPrime.of_mem_minimalPrimes h).ne_top + (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index ce937323a986c5..17c15f1cd8f1ca 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -66,7 +66,8 @@ theorem Ideal.iUnion_minimalPrimes : obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy refine ⟨p, hp, ((Ideal.IsPrime.of_mem_minimalPrimes hp).mem_or_mem ?_).resolve_right hyp⟩ - exact (Ideal.IsPrime.of_mem_minimalPrimes hp).radical_le_iff.mpr (Ideal.le_of_mem_minimalPrimes hp) hx + exact (Ideal.IsPrime.of_mem_minimalPrimes hp).radical_le_iff.mpr + (Ideal.le_of_mem_minimalPrimes hp) hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -184,7 +185,8 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e - ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp (Ideal.IsPrime.of_mem_minimalPrimes hp)).2 + ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp + (Ideal.IsPrime.of_mem_minimalPrimes hp)).2 refine (Ideal.comap_mono <| hp.2 ⟨?_, Ideal.map_mono hI.2⟩ (Ideal.map_le_iff_le_comap.mpr e)).trans_eq ?_ · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' diff --git a/Mathlib/RingTheory/KrullDimension/Regular.lean b/Mathlib/RingTheory/KrullDimension/Regular.lean index 89bcb36e104007..d57c56ed221acd 100644 --- a/Mathlib/RingTheory/KrullDimension/Regular.lean +++ b/Mathlib/RingTheory/KrullDimension/Regular.lean @@ -95,7 +95,8 @@ theorem supportDim_quotSMulTop_succ_le_of_notMem_minimalPrimes {x : R} let q : LTSeries (support R M) := p.map (Set.MapsTo.restrict id (support R (QuotSMulTop x M)) (support R M) le) (fun _ _ h ↦ h) obtain ⟨r, hrm, hr⟩ := exists_minimalPrimes_le (mem_support_iff_of_finite.mp q.head.2) - let r : support R M := ⟨⟨r, IsPrime.of_mem_minimalPrimes hrm⟩, mem_support_iff_of_finite.mpr hrm.1.2⟩ + let r : support R M := ⟨⟨r, IsPrime.of_mem_minimalPrimes hrm⟩, + mem_support_iff_of_finite.mpr hrm.1.2⟩ have hr : r < q.head := lt_of_le_of_ne hr (fun h ↦ hn q.head.1.1 (by rwa [← h]) hp.2) exact le_of_eq_of_le (by simp [q]) (le_iSup _ (q.cons r hr)) From acc4f74109dde1e49b253c32cb915d819448757f Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 5 May 2026 21:01:23 +0800 Subject: [PATCH 36/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 36c505bf3fb0c3..6f2dd53e83c68f 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -447,7 +447,7 @@ lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : · exact ⟨⊥, by simp [I_top]⟩ · obtain ⟨P, hP⟩ := Set.nonempty_coe_sort.mp (nonempty_minimalPrimes I_top) refine ⟨P, iSup_pos (α := ℕ∞) I_top ▸ le_iSup_of_le (hP.left.left) ?_⟩ - have := Ideal.minimalPrimes_isPrime hP + have := Ideal.IsPrime.of_mem_minimalPrimes hP exact iInf_le_of_le P (iInf_le_of_le hP (ge_of_eq (Ideal.height_eq_primeHeight P))) @[deprecated "Use `Ideal.sup_height_isPrime_eq_ringKrullDim` instead." (since := "2026-04-02")] From b31ee5880f2fd280a82b31c23ca513fd6fab9652 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 5 May 2026 21:03:34 +0800 Subject: [PATCH 37/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index f2f1e2b7fb8f18..c9e74f4b73c5d4 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -51,7 +51,7 @@ lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) - have := I.minimalPrimes_isPrime hp + have := I.IsPrime.of_mem_minimalPrimes hp exact (Ideal.height_eq_primeHeight _).symm /-- An ideal has finite height if it is either the unit ideal or its height is finite. @@ -383,7 +383,7 @@ theorem IsLocalization.height_comap (S : Submonoid R) {A : Type*} [CommRing A] [ rw [(J.comap _).height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] simp only [IsLocalization.minimalPrimes_comap S A, iInf_image] apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) - have := Ideal.minimalPrimes_isPrime hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp exact IsLocalization.height_comap_eq_of_isPrime S _ theorem IsLocalization.AtPrime.ringKrullDim_eq_height (I : Ideal R) [I.IsPrime] (A : Type*) From d6f76edc2953f113321ab2ed061c593c3849e4ad Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 5 May 2026 22:54:29 +0800 Subject: [PATCH 38/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index c9e74f4b73c5d4..c181a39af13470 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -51,7 +51,7 @@ lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) - have := I.IsPrime.of_mem_minimalPrimes hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp exact (Ideal.height_eq_primeHeight _).symm /-- An ideal has finite height if it is either the unit ideal or its height is finite. From a2c2b50a638c5e585e8591c7b46abd29980009d5 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 7 May 2026 20:58:51 +0800 Subject: [PATCH 39/69] private primeHeight --- Mathlib/RingTheory/Ideal/Height.lean | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index c181a39af13470..4a6a1837757911 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -34,15 +34,16 @@ open Ideal /-- The height of a prime ideal is defined as the supremum of the lengths of strictly decreasing chains of prime ideals below it. -/ -noncomputable def Ideal.primeHeight [hI : I.IsPrime] : ℕ∞ := +private noncomputable def Ideal.primeHeight [hI : I.IsPrime] : ℕ∞ := Order.height (⟨I, hI⟩ : PrimeSpectrum R) /-- The height of an ideal is defined as the infimum of the heights of its minimal prime ideals. -/ +@[no_expose] noncomputable def Ideal.height : ℕ∞ := ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J (IsPrime.of_mem_minimalPrimes (I := I) ‹_›) /-- For a prime ideal, its height equals its prime height. -/ -lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by +private lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by simp [height, primeHeight, Ideal.minimalPrimes_eq_subsingleton_self] lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = @@ -77,7 +78,7 @@ lemma Ideal.height_ne_top_of_isPrime {I : Ideal R} [I.FiniteHeight] [I.IsPrime] Ideal.height_ne_top ‹I.IsPrime›.ne_top @[deprecated "Use `Ideal.height_ne_top_of_isPrime` instead." (since := "2026-04-04")] -lemma Ideal.primeHeight_ne_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : +private lemma Ideal.primeHeight_ne_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : I.primeHeight ≠ ⊤ := by rw [← I.height_eq_primeHeight] exact Ideal.height_ne_top ‹I.IsPrime›.ne_top @@ -87,7 +88,7 @@ lemma Ideal.height_lt_top_of_isPrime {I : Ideal R} [I.FiniteHeight] [I.IsPrime] Ideal.height_lt_top ‹I.IsPrime›.ne_top @[deprecated "Use `Ideal.height_lt_top_of_isPrime` instead." (since := "2026-04-04")] -lemma Ideal.primeHeight_lt_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : +private lemma Ideal.primeHeight_lt_top (I : Ideal R) [I.FiniteHeight] [I.IsPrime] : I.primeHeight < ⊤ := by rw [← I.height_eq_primeHeight] exact Ideal.height_lt_top ‹I.IsPrime›.ne_top @@ -109,7 +110,7 @@ private lemma Ideal.height_mono_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrim exact h @[deprecated "Use `Ideal.height_mono_of_isPrime` instead." (since := "2026-04-04")] -lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : +private lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : I.primeHeight ≤ J.primeHeight := by simpa [Ideal.height_eq_primeHeight] using Ideal.height_mono_of_isPrime h @@ -119,7 +120,7 @@ lemma Ideal.height_add_one_le_of_lt_of_isPrime {I J : Ideal R} [I.IsPrime] [J.Is exact Order.height_add_one_le h @[deprecated "Use `Ideal.height_add_one_le_of_lt_of_isPrime` instead." (since := "2026-04-04")] -lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] +private lemma Ideal.primeHeight_add_one_le_of_lt {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) : I.primeHeight + 1 ≤ J.primeHeight := by simpa [Ideal.height_eq_primeHeight] using Ideal.height_add_one_le_of_lt_of_isPrime h @@ -160,7 +161,7 @@ alias Ideal.height_strict_mono_of_isPrime_of_is_prime := @[deprecated "Use `Ideal.height_strict_mono_of_isPrime_of_isPrime` instead." (since := "2026-04-02")] -lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) +private lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) [J.FiniteHeight] : I.primeHeight < J.primeHeight := by simpa [← Ideal.height_eq_primeHeight] using Ideal.height_strict_mono_of_isPrime_of_isPrime h @@ -257,7 +258,7 @@ theorem Ideal.isMaximal_of_height_eq_ringKrullDim {I : Ideal R} [I.IsPrime] · exact hM' ▸ hM @[deprecated "Use `Ideal.isMaximal_of_height_eq_ringKrullDim` instead." (since := "2026-04-02")] -theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] +private theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I.IsPrime] [FiniteRingKrullDim R] (e : I.primeHeight = ringKrullDim R) : I.IsMaximal := Ideal.isMaximal_of_height_eq_ringKrullDim (by simpa [Ideal.height_eq_primeHeight]) @@ -285,8 +286,9 @@ theorem Ideal.height_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] exact IsLocalRing.maximalIdeal_height_eq_ringKrullDim @[deprecated "Use `Ideal.height_eq_ringKrullDim_iff` instead." (since := "2026-04-02")] -theorem Ideal.primeHeight_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] {I : Ideal R} - [I.IsPrime] : Ideal.primeHeight I = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by +private theorem Ideal.primeHeight_eq_ringKrullDim_iff [FiniteRingKrullDim R] [IsLocalRing R] + {I : Ideal R} [I.IsPrime] : + Ideal.primeHeight I = ringKrullDim R ↔ I = IsLocalRing.maximalIdeal R := by rw [← Ideal.height_eq_primeHeight, Ideal.height_eq_ringKrullDim_iff] lemma Ideal.height_le_iff {p : Ideal R} {n : ℕ} [p.IsPrime] : @@ -407,7 +409,7 @@ lemma IsLocalization.height_map_of_disjoint {S : Type*} [CommRing S] [Algebra R exact WithBot.coe_eq_coe.mp this @[deprecated "Use `mem_minimalPrimes_of_height_eq` instead." (since := "2026-04-02")] -lemma mem_minimalPrimes_of_primeHeight_eq_height {I J : Ideal R} [J.IsPrime] (e : I ≤ J) +private lemma mem_minimalPrimes_of_primeHeight_eq_height {I J : Ideal R} [J.IsPrime] (e : I ≤ J) (e' : J.primeHeight = I.height) [J.FiniteHeight] : J ∈ I.minimalPrimes := by rw [← J.height_eq_primeHeight] at e' exact mem_minimalPrimes_of_height_eq e (e' ▸ le_refl _) @@ -490,7 +492,7 @@ lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : exact iInf_le_of_le P (iInf_le_of_le hP (ge_of_eq (Ideal.height_eq_primeHeight P))) @[deprecated "Use `Ideal.sup_height_isPrime_eq_ringKrullDim` instead." (since := "2026-04-02")] -lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : +private lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.primeHeight) = ringKrullDim R := by simp [← Ideal.height_eq_primeHeight, Ideal.sup_height_isPrime_eq_ringKrullDim] @@ -508,7 +510,7 @@ lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : exact ⟨M, iSup_mono' (fun hI ↦ ⟨hM, height_mono hIM⟩)⟩ @[deprecated "Use `Ideal.sup_height_of_maximal_eq_ringKrullDim` instead." (since := "2026-04-02")] -lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : +private lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.primeHeight) = ringKrullDim R := by simp_rw [← Ideal.height_eq_primeHeight, Ideal.sup_height_of_maximal_eq_ringKrullDim] From 7f19e330f1e0564925a618ef935fc47572548e2c Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 7 May 2026 21:20:03 +0800 Subject: [PATCH 40/69] fix --- Mathlib/AlgebraicGeometry/Properties.lean | 2 +- Mathlib/RingTheory/KrullDimension/PID.lean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/AlgebraicGeometry/Properties.lean b/Mathlib/AlgebraicGeometry/Properties.lean index 764b571ba938f5..0344da531bd33b 100644 --- a/Mathlib/AlgebraicGeometry/Properties.lean +++ b/Mathlib/AlgebraicGeometry/Properties.lean @@ -354,7 +354,7 @@ lemma coheight_eq_of_isOpenImmersion {U X : Scheme} {x : U} (f : U ⟶ X) [IsOpe open Order in lemma idealHeight_eq_coheight (R : CommRingCat) (x : Spec R) : x.asIdeal.height = coheight x := by - rw [Ideal.height_eq_primeHeight x.asIdeal, Ideal.primeHeight, + rw [Ideal.height_eq_order_height_of_isPrime, ← Order.coheight_orderIso (specOrderIsoPrimeSpectrum R), ← height_ofDual, specOrderIsoPrimeSpectrum_apply, OrderDual.ofDual_toDual] rfl diff --git a/Mathlib/RingTheory/KrullDimension/PID.lean b/Mathlib/RingTheory/KrullDimension/PID.lean index 74c56d4b0bde82..c87e2986505260 100644 --- a/Mathlib/RingTheory/KrullDimension/PID.lean +++ b/Mathlib/RingTheory/KrullDimension/PID.lean @@ -51,5 +51,5 @@ lemma IsPrincipalIdealRing.height_eq_one_of_isMaximal {R : Type*} [CommRing R] [ · suffices h : (m.height : WithBot ℕ∞) ≤ 1 by norm_cast at h rw [← IsPrincipalIdealRing.ringKrullDim_eq_one _ h] exact Ideal.height_le_ringKrullDim_of_ne_top Ideal.IsPrime.ne_top' - · rw [Order.one_le_iff_pos, Ideal.height_eq_primeHeight, Ideal.primeHeight, Order.height_pos] + · rw [Order.one_le_iff_pos, Ideal.height_eq_order_height_of_isPrime, Order.height_pos] exact not_isMin_of_lt (b := ⊥) (Ideal.bot_lt_of_maximal m h) From c6df49a131394480eb54518017eb19428e9a6f93 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 11:47:32 +0800 Subject: [PATCH 41/69] add predicate IsMinimalPrime --- Mathlib/RingTheory/Ideal/Height.lean | 35 ++++++++-------- .../RingTheory/Ideal/KrullsHeightTheorem.lean | 27 +++++++------ .../RingTheory/Ideal/MinimalPrime/Basic.lean | 38 +++++++++--------- .../RingTheory/Ideal/MinimalPrime/Colon.lean | 10 ++--- .../Ideal/MinimalPrime/Localization.lean | 40 ++++++++----------- Mathlib/RingTheory/KrullDimension/Zero.lean | 4 +- .../RingTheory/Spectrum/Prime/Topology.lean | 2 +- 7 files changed, 73 insertions(+), 83 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 8e275fc8481417..74ea36cc589984 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -39,7 +39,7 @@ noncomputable def Ideal.primeHeight [hI : I.IsPrime] : ℕ∞ := /-- The height of an ideal is defined as the infimum of the heights of its minimal prime ideals. -/ noncomputable def Ideal.height : ℕ∞ := - ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J (IsPrime.of_mem_minimalPrimes (I := I) ‹_›) + ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J ‹J ∈ I.minimalPrimes›.isPrime /-- For a prime ideal, its height equals its prime height. -/ lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by @@ -116,9 +116,9 @@ lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [height] refine le_iInf₂ (fun p hp ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hp - obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_of_mem_minimalPrimes hp)) - haveI := Ideal.IsPrime.of_mem_minimalPrimes hq + have := hp.isPrime + obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans hp.le) + haveI := hq.isPrime exact (iInf₂_le q hq).trans (Ideal.primeHeight_mono e) @[gcongr] @@ -130,9 +130,8 @@ lemma Ideal.height_strict_mono_of_is_prime {I J : Ideal R} [I.IsPrime] exact I.primeHeight_lt_top · rw [← ENat.add_one_le_iff I.primeHeight_ne_top, Ideal.height] refine le_iInf₂ (fun K hK ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hK - have : I < K := lt_of_lt_of_le h (Ideal.le_of_mem_minimalPrimes hK) - exact Ideal.primeHeight_add_one_le_of_lt this + have := hK.isPrime + exact Ideal.primeHeight_add_one_le_of_lt (lt_of_lt_of_le h hK.le) /-- A prime ideal of finite height is equal to any ideal that contains it with no greater height. -/ lemma Ideal.eq_of_le_of_height_le [I.IsPrime] [I.FiniteHeight] @@ -146,7 +145,7 @@ lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : I.height ≤ ringKrullDim R := by rw [Ideal.height] obtain ⟨P, hP⟩ : Nonempty (I.minimalPrimes) := Ideal.nonempty_minimalPrimes h - have := Ideal.IsPrime.of_mem_minimalPrimes hP + have := hP.isPrime refine le_trans ?_ (Ideal.primeHeight_le_ringKrullDim (I := P)) simpa using iInf₂_le _ hP @@ -184,16 +183,14 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr obtain ⟨p, h₁, h₂⟩ := Ideal.exists_minimalPrimes_le e convert h₁ refine (eq_of_le_of_not_lt h₂ fun h₃ ↦ ?_).symm - have := Ideal.IsPrime.of_mem_minimalPrimes h₁ + have := h₁.isPrime have := finiteHeight_of_le h₂ IsPrime.ne_top' - exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le - (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) + exact lt_irrefl _ ((height_strict_mono_of_is_prime h₃).trans_le (e'.trans <| height_mono h₁.le)) /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : primeHeight I = 0 ↔ I ∈ minimalPrimes R := by - rw [Ideal.primeHeight, Order.height_eq_zero, minimalPrimes, Ideal.minimalPrimes] - simp only [bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] + rw [Ideal.primeHeight, Order.height_eq_zero, minimalPrimes_eq_minimals] constructor · intro h refine ⟨inferInstance, ?_⟩ @@ -288,7 +285,7 @@ lemma RingEquiv.height_comap {S : Type*} [CommRing S] (e : R ≃+* S) (I : Ideal rw [← Ideal.comap_coe, Ideal.comap_minimalPrimes_eq_of_surjective (f := (↑e : R →+* S)) e.surjective] exact e.idealComapOrderIso.injective.mem_set_image.symm - · have : J.IsPrime := Ideal.IsPrime.of_mem_minimalPrimes h + · have : J.IsPrime := h.isPrime simp only [EquivLike.coe_coe, RingEquiv.idealComapOrderIso_apply, ← Ideal.height_eq_primeHeight, RingEquiv.height_comap_of_isPrime] @@ -379,7 +376,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id refine (Ideal.subset_union_prime ⊥ ⊥ ?_).not.mpr ?_ · rintro K hK - - rw [Set.Finite.mem_toFinset] at hK - exact Ideal.IsPrime.of_mem_minimalPrimes hK.1 + exact hK.1.isPrime · push Not intro K hK e have := hr.trans (Ideal.height_mono e) @@ -395,7 +392,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id push_cast exact add_le_add h₂ ((Submodule.spanRank_span_le_card _).trans (by simp)) · refine le_iInf₂ (fun p hp ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime by_cases h : p.height = ⊤ · rw [← p.height_eq_primeHeight, h] exact le_top @@ -412,10 +409,10 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id apply le_antisymm · rwa [← p.height_eq_primeHeight] · rwa [← e] - refine ⟨mem_minimalPrimes_of_primeHeight_eq_height - (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) this.symm, ?_⟩ + refine ⟨mem_minimalPrimes_of_primeHeight_eq_height (le_sup_left.trans hp.le) this.symm, ?_⟩ rwa [p.height_eq_primeHeight, eq_comm] - · exact (Ideal.le_of_mem_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x + · apply hp.le + exact Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 216697afa6012c..4727a66d44e03c 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -83,7 +83,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing ← (IsLocalization.orderEmbedding q.primeCompl (Localization.AtPrime q)).map_rel_iff] refine Submodule.le_of_le_smul_of_le_jacobson_bot (I := I) (IsNoetherian.noetherian _) ?_ ?_ · rw [IsLocalRing.jacobson_eq_maximalIdeal] - exacts [Ideal.le_of_mem_minimalPrimes hp, bot_ne_top] + exacts [hp.le, bot_ne_top] · replace hn := congr(Ideal.comap (Ideal.Quotient.mk I) $(hn _ n.le_succ)) simp only [qs, OrderHom.coe_mk, ← RingHom.ker_eq_comap_bot, Ideal.mk_ker, Ideal.comap_map_of_surjective _ Ideal.Quotient.mk_surjective] at hn @@ -106,7 +106,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing has height at most 1. -/ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes (I : Ideal R) [I.IsPrincipal] (p : Ideal R) (hp : p ∈ I.minimalPrimes) : p.height ≤ 1 := by - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ · rwa [← IsLocalization.height_comap p.primeCompl, @@ -117,12 +117,12 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I - have : p.IsPrime := Ideal.IsPrime.of_mem_minimalPrimes hp + have : p.IsPrime := hp.isPrime have hfp : RingHom.ker f ≤ p := - I.mk_ker.trans_le (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) + I.mk_ker.trans_le (le_sup_left.trans hp.le) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, - map_mono (le_sup_right.trans (Ideal.le_of_mem_minimalPrimes hp))⟩, + map_mono (le_sup_right.trans hp.le)⟩, fun _ ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr <| hp.2 ⟨hr.comap f, sup_le_iff.mpr ⟨I.mk_ker.symm.trans_le <| ker_le_comap (Ideal.Quotient.mk I), le_comap_of_map_le hxr⟩⟩ <| (comap_mono hrp).trans <| Eq.le <| @@ -139,7 +139,8 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide have hf : Function.Surjective f := Quotient.mk_surjective have hI'q : span t ≤ q := span_le.mpr htq have hI'p : span t ≤ p := hI'q.trans hqp.le - have := IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime + have lep := hp.le have : (p.map f).IsPrime := map_isPrime_of_surjective hf (by rwa [mk_ker]) suffices h : (p.map f).height ≤ 1 by have h_lt : q.map f < p.map f := (map_mono hqp.le).lt_of_not_ge fun e ↦ hqp.not_ge <| by @@ -154,8 +155,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, - map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| (Ideal.le_of_mem_minimalPrimes hp) <| - subset_span <| .inl rfl⟩, + map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| lep <| subset_span <| .inl rfl⟩, fun r ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr (hp.2 ⟨hr.comap f, ?_⟩ ?_)⟩ · rw [span_le, Set.insert_subset_iff] have := map_le_iff_le_comap.mp hxr (subset_span rfl) @@ -179,7 +179,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimalPrimes induction hn : s.card using Nat.strong_induction_on generalizing R with | h n H => replace hn : s.card ≤ n := hn.le - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime cases n with | zero => rw [ENat.coe_zero, nonpos_iff_eq_zero, height_eq_primeHeight p, @@ -207,7 +207,7 @@ nonrec lemma Ideal.height_le_spanRank_toENat_of_mem_minimalPrimes ⟨le_sup_left, x, mem_sup_right (mem_span_singleton_self _), hxq⟩).trans_le hJ) ((le_maximalIdeal hJ'.ne_top).lt_of_not_ge h) have h : (s' : Set R) ⊆ (q ⊔ span {x}).radical := by - have := (Ideal.le_of_mem_minimalPrimes hp).trans this + have := hp.le.trans this rw [span_le, Finset.coe_insert, Set.insert_subset_iff] at this exact this.2 obtain ⟨t, ht, hspan⟩ := exists_subset_radical_span_sup_of_subset_radical_sup _ _ _ h @@ -324,8 +324,8 @@ lemma Ideal.height_le_height_add_spanFinrank_of_le {I p : Ideal R} [p.IsPrime] ( let p' := p.map (algebraMap R (R ⧸ I)) have : p'.IsPrime := isPrime_map_quotientMk_of_isPrime hrp obtain ⟨s, hps, hs⟩ := exists_finset_card_eq_height_of_isNoetherianRing p' - have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := - fun _ hx ↦ (Ideal.le_of_mem_minimalPrimes hps) (subset_span hx) + have lep' := hps.le + have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := fun _ hx ↦ lep' (subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk I) p s := by refine Set.SurjOn.mono subset_rfl hsp' fun x hx ↦ ?_ obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x @@ -421,8 +421,9 @@ lemma Ideal.height_le_height_add_of_liesOver [IsNoetherianRing S] (p : Ideal R) obtain ⟨s, hp, heq⟩ := p.exists_finset_card_eq_height_of_isNoetherianRing let P' := P.map (Ideal.Quotient.mk <| p.map (algebraMap R S)) obtain ⟨s', hP', heq'⟩ := P'.exists_finset_card_eq_height_of_isNoetherianRing + have leP' := hP'.le have hsP'sub : (s' : Set <| S ⧸ (Ideal.map (algebraMap R S) p)) ⊆ (P' : Set <| S ⧸ _) := - fun x hx ↦ (Ideal.le_of_mem_minimalPrimes hP') (Ideal.subset_span hx) + fun x hx ↦ leP' (Ideal.subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk (p.map (algebraMap R S))) P s' := by refine Set.SurjOn.mono subset_rfl hsP'sub fun x hx ↦ ?_ obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index c2092dba194aba..71da00fef48909 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -36,14 +36,20 @@ section variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R) +protected def Ideal.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p + +lemma Ideal.IsMinimalPrime.isPrime {p : Ideal R} (h : I.IsMinimalPrime p) : p.IsPrime := h.1.1 + +lemma Ideal.IsMinimalPrime.le {p : Ideal R} (h : I.IsMinimalPrime p) : I ≤ p := h.1.2 + /-- `I.minimalPrimes` is the set of ideals that are minimal primes over `I`. -/ -protected def Ideal.minimalPrimes : Set (Ideal R) := - {p | Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p} +protected abbrev Ideal.minimalPrimes : Set (Ideal R) := + {p | I.IsMinimalPrime p} variable (R) in /-- `minimalPrimes R` is the set of minimal primes of `R`. This is defined as `Ideal.minimalPrimes ⊥`. -/ -def minimalPrimes : Set (Ideal R) := +abbrev minimalPrimes : Set (Ideal R) := Ideal.minimalPrimes ⊥ lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x} := @@ -51,13 +57,8 @@ lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x variable {I J} -theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : p.IsPrime := - h.1.1 - -theorem Ideal.le_of_mem_minimalPrimes {p : Ideal R} (h : p ∈ I.minimalPrimes) : I ≤ p := - h.1.2 - -theorem Ideal.IsPrime.of_mem_minimalPrimes' {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := +theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : + p.IsPrime := h.1.1 theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by @@ -122,17 +123,15 @@ variable {R S : Type*} [CommSemiring R] [CommSemiring S] {I J : Ideal R} theorem Ideal.minimalPrimes_eq_subsingleton (hI : I.IsPrimary) : I.minimalPrimes = {I.radical} := by ext J constructor - · exact fun H => - let e := (Ideal.IsPrime.of_mem_minimalPrimes H).radical_le_iff.mpr - (Ideal.le_of_mem_minimalPrimes H) - (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ e).antisymm e + · intro H + have le := H.out.isPrime.radical_le_iff.mpr H.le + exact (H.2 ⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩ le).antisymm le · rintro (rfl : J = I.radical) exact ⟨⟨Ideal.isPrime_radical hI, Ideal.le_radical⟩, fun _ H _ => H.1.radical_le_iff.mpr H.2⟩ theorem Ideal.minimalPrimes_eq_subsingleton_self [I.IsPrime] : I.minimalPrimes = {I} := by ext J - refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ (Ideal.le_of_mem_minimalPrimes H)).antisymm - (Ideal.le_of_mem_minimalPrimes H), ?_⟩ + refine ⟨fun H => (H.2 ⟨inferInstance, rfl.le⟩ H.le).antisymm H.le, ?_⟩ rintro (rfl : J = I) exact ⟨⟨inferInstance, rfl.le⟩, fun _ h _ => h.2⟩ @@ -151,8 +150,7 @@ theorem Ideal.minimalPrimes_top : (⊤ : Ideal R).minimalPrimes = ∅ := by ext p simp only [Set.notMem_empty, iff_false] intro h - exact (Ideal.IsPrime.of_mem_minimalPrimes h).ne_top - (top_le_iff.mp (Ideal.le_of_mem_minimalPrimes h)) + exact h.isPrime.ne_top (top_le_iff.mp h.le) theorem Ideal.minimalPrimes_eq_empty_iff (I : Ideal R) : I.minimalPrimes = ∅ ↔ I = ⊤ := by @@ -172,7 +170,7 @@ lemma Ideal.mem_minimalPrimes_sup {R : Type*} [CommRing R] {p I J : Ideal R} [p. refine ⟨⟨‹_›, ?_⟩, fun q ⟨_, hq⟩ hqp ↦ ?_⟩ · rw [sup_le_iff] refine ⟨hle, ?_⟩ - simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) (Ideal.le_of_mem_minimalPrimes h) + simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) h.le · rw [sup_le_iff] at hq have h2 : p.map (Quotient.mk I) ≤ q.map (Quotient.mk I) := h.2 ⟨isPrime_map_quotientMk_of_isPrime hq.1, map_mono hq.2⟩ (map_mono hqp) @@ -192,7 +190,7 @@ lemma Ideal.map_sup_mem_minimalPrimes_of_map_quotientMk_mem_minimalPrimes refine ⟨⟨inferInstance, sup_le_iff.mpr ?_⟩, fun q ⟨_, hleq⟩ hqle ↦ ?_⟩ · refine ⟨?_, hJP⟩ rw [Ideal.map_le_iff_le_comap, ← Ideal.under_def, ← Ideal.over_def P p] - exact Ideal.le_of_mem_minimalPrimes hI + exact hI.le · simp only [sup_le_iff] at hleq have h1 : p.map (algebraMap R S) ≤ q := by rw [Ideal.map_le_iff_le_comap] diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean index 547575d16c3f12..d7db15b1f87253 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Colon.lean @@ -48,8 +48,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] refine ⟨n, hn0, ((h.toFinset.erase I).inf id) ^ n, hn, ?_⟩ have (K : Ideal R) (hKI : K ≤ I) (hK : K ∈ ann.minimalPrimes) : K = I := le_antisymm hKI (hI.2 hK.1 hKI) - simpa [(Ideal.IsPrime.of_mem_minimalPrimes hI).pow_le_iff hn0, - (Ideal.IsPrime.of_mem_minimalPrimes hI).inf_le', imp_not_comm, not_imp_not] + simpa [hI.isPrime.pow_le_iff hn0, hI.isPrime.inf_le', imp_not_comm, not_imp_not] obtain ⟨hn0, J, hJ, hJI⟩ := Nat.find_spec key -- let `n` be minimal such that there exists an ideal `J` with `I ^ n * J ≤ ann` and `¬ J ≠ I` set n := Nat.find key @@ -75,7 +74,7 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] -- let `z` be the product of these finitely many `f y`'s let z := ∏ y ∈ s, f y -- then `z ∉ I` - have hz : z ∉ I := by simp [z, (Ideal.IsPrime.of_mem_minimalPrimes hI).prod_mem_iff, h] + have hz : z ∉ I := by simp [z, hI.isPrime.prod_mem_iff, h] -- and `K ≤ colon N {z • x}` have hz' : K ≤ colon N {z • x} := by rw [← (map_injective_of_injective K.subtype_injective).eq_iff, map_subtype_top] at hs @@ -91,12 +90,11 @@ theorem exists_eq_colon_of_mem_minimalPrimes [IsNoetherianRing R] simpa only [ann, mem_colon_singleton, mul_comm, mul_smul] using hz' hi -- but now `K = I ^ (n - 1) * J` contradicts the minimality of `n` have hK : I ^ (n - 1) * (J * Ideal.span {z}) ≤ ann ∧ ¬ J * Ideal.span {z} ≤ I := by - rw [← mul_assoc, (Ideal.IsPrime.of_mem_minimalPrimes hI).mul_le, not_or, - Ideal.span_singleton_le_iff_mem] + rw [← mul_assoc, hI.isPrime.mul_le, not_or, Ideal.span_singleton_le_iff_mem] exact ⟨hz', hJI, hz⟩ by_cases hn' : n - 1 = 0 · simp [K, show n = 1 by grind] at hz' - exact (hK.2 (hz'.trans (Ideal.le_of_mem_minimalPrimes hI))).elim + exact (hK.2 (hz'.trans hI.le)).elim · grind [Nat.find_min' key ⟨hn', J * Ideal.span {z}, hK⟩] end Submodule diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 17c15f1cd8f1ca..0e24ee5ad176e0 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -65,9 +65,8 @@ theorem Ideal.iUnion_minimalPrimes : · rintro ⟨y, hy, hx⟩ obtain ⟨p, hp, hyp⟩ : ∃ p ∈ I.minimalPrimes, y ∉ p := by simpa [← Ideal.sInf_minimalPrimes] using hy - refine ⟨p, hp, ((Ideal.IsPrime.of_mem_minimalPrimes hp).mem_or_mem ?_).resolve_right hyp⟩ - exact (Ideal.IsPrime.of_mem_minimalPrimes hp).radical_le_iff.mpr - (Ideal.le_of_mem_minimalPrimes hp) hx + refine ⟨p, hp, (hp.isPrime.mem_or_mem ?_).resolve_right hyp⟩ + exact hp.isPrime.radical_le_iff.mpr hp.le hx theorem Ideal.exists_mul_mem_of_mem_minimalPrimes {p : Ideal R} (hp : p ∈ I.minimalPrimes) {x : R} (hx : x ∈ p) : @@ -98,8 +97,8 @@ lemma Ideal.disjoint_nonZeroDivisors_of_mem_minimalPrimes {p : Ideal R} (hp : p theorem Ideal.exists_comap_eq_of_mem_minimalPrimes {I : Ideal S} (f : R →+* S) (p) (H : p ∈ (I.comap f).minimalPrimes) : ∃ p' : Ideal S, p'.IsPrime ∧ I ≤ p' ∧ p'.comap f = p := - have := Ideal.IsPrime.of_mem_minimalPrimes H - have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I (Ideal.le_of_mem_minimalPrimes H) + have := H.isPrime + have ⟨p', hIp', hp', le⟩ := exists_ideal_comap_le_prime p I H.le ⟨p', hp', hIp', le.antisymm (H.2 ⟨inferInstance, comap_mono hIp'⟩ le)⟩ @[stacks 00FK] theorem Ideal.exists_comap_eq_of_mem_minimalPrimes_of_injective {f : R →+* S} @@ -114,10 +113,9 @@ theorem Ideal.exists_minimalPrimes_comap_eq {I : Ideal S} (f : R →+* S) (p) obtain ⟨p', h₁, h₂, h₃⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f p H obtain ⟨q, hq, hq'⟩ := Ideal.exists_minimalPrimes_le h₂ refine ⟨q, hq, Eq.symm ?_⟩ - have := Ideal.IsPrime.of_mem_minimalPrimes hq + have := hq.isPrime have := (Ideal.comap_mono hq').trans_eq h₃ - exact (H.2 ⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes hq)⟩ this).antisymm - this + exact (H.2 ⟨inferInstance, Ideal.comap_mono hq.le⟩ this).antisymm this theorem Ideal.minimalPrimes_comap_subset (f : R →+* S) (J : Ideal S) : (J.comap f).minimalPrimes ⊆ Ideal.comap f '' J.minimalPrimes := @@ -131,8 +129,8 @@ variable {R S : Type*} [CommRing R] [CommRing S] {I J : Ideal R} theorem Ideal.minimalPrimes_comap_of_surjective {f : R →+* S} (hf : Function.Surjective f) {I J : Ideal S} (h : J ∈ I.minimalPrimes) : J.comap f ∈ (I.comap f).minimalPrimes := by - have := Ideal.IsPrime.of_mem_minimalPrimes h - refine ⟨⟨inferInstance, Ideal.comap_mono (Ideal.le_of_mem_minimalPrimes h)⟩, ?_⟩ + have := h.isPrime + refine ⟨⟨inferInstance, Ideal.comap_mono h.le⟩, ?_⟩ rintro K ⟨hK, e₁⟩ e₂ have : RingHom.ker f ≤ K := (Ideal.comap_mono bot_le).trans e₁ rw [← sup_eq_left.mpr this, RingHom.ker_eq_comap_bot, ← Ideal.comap_map_of_surjective f hf] @@ -161,8 +159,7 @@ lemma Ideal.minimalPrimes_map_of_surjective {S : Type*} [CommRing S] {f : R →+ rw [← Ideal.comap_minimalPrimes_eq_of_surjective hf, ← Set.image_comp, Ideal.comap_map_of_surjective f hf, Set.image_congr, Set.image_id, RingHom.ker] intro x hx - exact (Ideal.comap_map_of_surjective f hf _).trans - (sup_eq_left.mpr <| le_sup_right.trans (Ideal.le_of_mem_minimalPrimes hx)) + exact (Ideal.comap_map_of_surjective f hf _).trans (sup_eq_left.mpr <| le_sup_right.trans hx.le) theorem Ideal.minimalPrimes_eq_comap : I.minimalPrimes = Ideal.comap (Ideal.Quotient.mk I) '' minimalPrimes (R ⧸ I) := by @@ -180,27 +177,24 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : ext p constructor · intro hp - haveI := Ideal.IsPrime.of_mem_minimalPrimes hp - refine ⟨⟨Ideal.IsPrime.comap _, - Ideal.map_le_iff_le_comap.mp (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ + have := hp.isPrime + refine ⟨⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp hp.le⟩, ?_⟩ rintro I hI e have hI' : Disjoint (S : Set R) I := Set.disjoint_of_subset_right e - ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp - (Ideal.IsPrime.of_mem_minimalPrimes hp)).2 + ((IsLocalization.isPrime_iff_isPrime_disjoint S A _).mp hp.isPrime).2 refine (Ideal.comap_mono <| hp.2 ⟨?_, Ideal.map_mono hI.2⟩ (Ideal.map_le_iff_le_comap.mpr e)).trans_eq ?_ · exact IsLocalization.isPrime_of_isPrime_disjoint S A I hI.1 hI' · exact IsLocalization.comap_map_of_isPrime_disjoint S A hI.1 hI' · intro hp - refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr (Ideal.le_of_mem_minimalPrimes hp)⟩, ?_⟩ + refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr hp.le⟩, ?_⟩ · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] - refine ⟨Ideal.IsPrime.of_mem_minimalPrimes hp, ?_⟩ + refine ⟨hp.isPrime, ?_⟩ rintro rfl - exact (Ideal.IsPrime.of_mem_minimalPrimes hp).ne_top rfl + exact hp.isPrime.ne_top rfl · intro I hI e rw [← IsLocalization.map_comap S A I, ← IsLocalization.map_comap S A p] - haveI := hI.1 - exact Ideal.map_mono (hp.2 ⟨Ideal.IsPrime.comap _, Ideal.map_le_iff_le_comap.mp hI.2⟩ + exact Ideal.map_mono (hp.2 ⟨hI.1.comap _, Ideal.map_le_iff_le_comap.mp hI.2⟩ (Ideal.comap_mono e)) theorem IsLocalization.minimalPrimes_comap [IsLocalization S A] (J : Ideal A) : @@ -220,7 +214,7 @@ theorem IsLocalization.AtPrime.radical_map_of_mem_minimalPrimes · rw [← IsLocalization.comap_le_comap_iff q.primeCompl A, AtPrime.map_eq_maximalIdeal q A, AtPrime.comap_maximalIdeal A q] apply hIq.2 hJ.1 - have := (Ideal.IsPrime.of_mem_minimalPrimes hJ).ne_top + have := hJ.isPrime.ne_top rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_comap_iff q.primeCompl A J] at this exact Set.disjoint_compl_left_iff_subset.mp this diff --git a/Mathlib/RingTheory/KrullDimension/Zero.lean b/Mathlib/RingTheory/KrullDimension/Zero.lean index dd5e85a37710ff..09dac318663204 100644 --- a/Mathlib/RingTheory/KrullDimension/Zero.lean +++ b/Mathlib/RingTheory/KrullDimension/Zero.lean @@ -34,7 +34,9 @@ lemma Ring.KrullDimLE.mem_minimalPrimes_iff_le_of_isPrime {I J : Ideal R} [I.IsP variable (R) in lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isPrime : minimalPrimes R = { I | I.IsPrime } := by - ext; simp [minimalPrimes, mem_minimalPrimes_iff] + ext + rw [mem_minimalPrimes_iff] + simp variable (R) in lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isMaximal : diff --git a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean index 3b956aa9811add..b8b39eaaea65e2 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean @@ -958,7 +958,7 @@ lemma denseRange_comap_iff_minimalPrimes : · intro H I hI have : I ∈ (RingHom.ker f).minimalPrimes := by rw [denseRange_comap_iff_ker_le_nilRadical] at H - simp only [minimalPrimes, Ideal.minimalPrimes, Set.mem_setOf] at hI ⊢ + simp only [Set.mem_setOf, Ideal.IsMinimalPrime] at hI ⊢ convert hI using 2 with p exact ⟨fun h ↦ ⟨h.1, bot_le⟩, fun h ↦ ⟨h.1, H.trans (h.1.radical_le_iff.mpr bot_le)⟩⟩ obtain ⟨p, hp, _, rfl⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f (I := ⊥) I this From b7ad058bedcfb99078b5cb38333ac8c0569c9888 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 11:53:08 +0800 Subject: [PATCH 42/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index b6fa067a4f0448..3884bc3955c77d 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -52,7 +52,7 @@ lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime exact (Ideal.height_eq_primeHeight _).symm /-- An ideal has finite height if it is either the unit ideal or its height is finite. @@ -132,9 +132,9 @@ theorem Ideal.height_top : (⊤ : Ideal R).height = ⊤ := by theorem Ideal.height_mono {I J : Ideal R} (h : I ≤ J) : I.height ≤ J.height := by simp only [I.height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] refine le_iInf₂ (fun p hp ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hp - obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans (Ideal.le_of_mem_minimalPrimes hp)) - have := Ideal.IsPrime.of_mem_minimalPrimes hq + have := hp.isPrime + obtain ⟨q, hq, e⟩ := Ideal.exists_minimalPrimes_le (h.trans hp.le) + have := hq.isPrime exact (iInf₂_le q hq).trans (Ideal.height_mono_of_isPrime e) @[gcongr] @@ -145,8 +145,8 @@ lemma Ideal.height_strict_mono_of_isPrime {I J : Ideal R} [I.IsPrime] exact I.height_lt_top IsPrime.ne_top' · rw [← ENat.add_one_le_iff (I.height_ne_top IsPrime.ne_top'), J.height_eq_inf_minimalPrimes] refine le_iInf₂ (fun K hK ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hK - have : I < K := lt_of_lt_of_le h (Ideal.le_of_mem_minimalPrimes hK) + have := hK.isPrime + have : I < K := lt_of_lt_of_le h hK.le exact Ideal.height_add_one_le_of_lt_of_isPrime this lemma Ideal.height_strict_mono_of_isPrime_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] @@ -183,7 +183,7 @@ lemma Ideal.height_le_ringKrullDim_of_ne_top {I : Ideal R} (h : I ≠ ⊤) : I.height ≤ ringKrullDim R := by obtain ⟨P, hP⟩ : Nonempty (I.minimalPrimes) := Ideal.nonempty_minimalPrimes h rw [I.height_eq_inf_minimalPrimes] - have := Ideal.IsPrime.of_mem_minimalPrimes hP + have := hP.isPrime refine (WithBot.coe_le_coe.mpr (iInf₂_le _ hP)).trans P.height_le_ringKrullDim_of_isPrime /-- If `R` has finite Krull dimension, there exists a maximal ideal `m` with `ht m = dim R`. -/ @@ -219,12 +219,11 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr have := h₁.isPrime have := finiteHeight_of_le h₂ IsPrime.ne_top' exact lt_irrefl _ ((height_strict_mono_of_isPrime h₃).trans_le - (e'.trans <| height_mono (Ideal.le_of_mem_minimalPrimes h₁))) + (e'.trans <| height_mono h₁.le)) /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by - rw [Ideal.height_eq_primeHeight, Ideal.primeHeight, Order.height_eq_zero, minimalPrimes] - simp only [Ideal.minimalPrimes, bot_le, and_true, Set.mem_setOf_eq, Minimal, IsMin] + rw [Ideal.height_eq_order_height_of_isPrime, Order.height_eq_zero, minimalPrimes_eq_minimals] refine ⟨fun h ↦ ⟨‹_›, ?_⟩, fun ⟨hI, hI'⟩ b hb ↦ hI' b.isPrime hb⟩ by_contra! ⟨P, ⟨hP₁, ⟨hP₂, hP₃⟩⟩⟩ exact hP₃ (h (b := ⟨P, hP₁⟩) hP₂) @@ -385,7 +384,7 @@ theorem IsLocalization.height_comap (S : Submonoid R) {A : Type*} [CommRing A] [ rw [(J.comap _).height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] simp only [IsLocalization.minimalPrimes_comap S A, iInf_image] apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := hp.isPrime exact IsLocalization.height_comap_eq_of_isPrime S _ theorem IsLocalization.AtPrime.ringKrullDim_eq_height (I : Ideal R) [I.IsPrime] (A : Type*) @@ -448,14 +447,15 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id by_cases h : p.height = ⊤ · exact le_of_le_of_eq le_top h.symm have : p.FiniteHeight := ⟨Or.inr h⟩ - have := Ideal.height_mono (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) + have := Ideal.height_mono (le_sup_left.trans hp.le) suffices h : (r : ℕ∞) ≠ p.height by exact Order.add_one_le_of_lt (lt_of_le_of_ne (h₃.trans this) h) intro e apply hx₂ p - · refine ⟨mem_minimalPrimes_of_height_eq - (le_sup_left.trans (Ideal.le_of_mem_minimalPrimes hp)) (le_of_eq_of_le e.symm h₃), e.symm⟩ - · exact (Ideal.le_of_mem_minimalPrimes hp) <| Ideal.mem_sup_right <| mem_span_singleton_self x + · refine ⟨mem_minimalPrimes_of_height_eq (le_sup_left.trans hp.le) (e.symm.trans_le h₃), + e.symm⟩ + · apply hp.le + exact Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ @@ -488,7 +488,7 @@ lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : · exact ⟨⊥, by simp [I_top]⟩ · obtain ⟨P, hP⟩ := Set.nonempty_coe_sort.mp (nonempty_minimalPrimes I_top) refine ⟨P, iSup_pos (α := ℕ∞) I_top ▸ le_iSup_of_le (hP.left.left) ?_⟩ - have := Ideal.IsPrime.of_mem_minimalPrimes hP + have := hP.isPrime exact iInf_le_of_le P (iInf_le_of_le hP (ge_of_eq (Ideal.height_eq_primeHeight P))) @[deprecated "Use `Ideal.sup_height_isPrime_eq_ringKrullDim` instead." (since := "2026-04-02")] From b2163caa9f91fe5818f54473b76c500bf9c22bb1 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 11:54:58 +0800 Subject: [PATCH 43/69] fix --- Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean | 5 ++--- Mathlib/RingTheory/KrullDimension/Regular.lean | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean index 6ce2cc209d03c4..a5cc113e02ede6 100644 --- a/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/AssociatedPrime/Localization.lean @@ -131,11 +131,10 @@ variable (R M) in lemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] : (Module.annihilator R M).minimalPrimes ⊆ associatedPrimes R M := by intro p hp - have prime := Ideal.IsPrime.of_mem_minimalPrimes hp + have prime := hp.isPrime let Rₚ := Localization.AtPrime p have : Nontrivial (LocalizedModule p.primeCompl M) := by - simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using - Ideal.le_of_mem_minimalPrimes hp + simpa [← Module.mem_support_iff (p := ⟨p, prime⟩), Module.support_eq_zeroLocus] using hp.le rcases associatedPrimes.nonempty Rₚ (LocalizedModule p.primeCompl M) with ⟨q, hq⟩ have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq simp only [← preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl diff --git a/Mathlib/RingTheory/KrullDimension/Regular.lean b/Mathlib/RingTheory/KrullDimension/Regular.lean index d57c56ed221acd..389bb3119f3f4a 100644 --- a/Mathlib/RingTheory/KrullDimension/Regular.lean +++ b/Mathlib/RingTheory/KrullDimension/Regular.lean @@ -95,8 +95,7 @@ theorem supportDim_quotSMulTop_succ_le_of_notMem_minimalPrimes {x : R} let q : LTSeries (support R M) := p.map (Set.MapsTo.restrict id (support R (QuotSMulTop x M)) (support R M) le) (fun _ _ h ↦ h) obtain ⟨r, hrm, hr⟩ := exists_minimalPrimes_le (mem_support_iff_of_finite.mp q.head.2) - let r : support R M := ⟨⟨r, IsPrime.of_mem_minimalPrimes hrm⟩, - mem_support_iff_of_finite.mpr hrm.1.2⟩ + let r : support R M := ⟨⟨r, hrm.isPrime⟩, mem_support_iff_of_finite.mpr hrm.1.2⟩ have hr : r < q.head := lt_of_le_of_ne hr (fun h ↦ hn q.head.1.1 (by rwa [← h]) hp.2) exact le_of_eq_of_le (by simp [q]) (le_iSup _ (q.cons r hr)) From 8535ebb694ebed8cca9be7e2f468a990c81f56e0 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 12:31:40 +0800 Subject: [PATCH 44/69] add doc --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 71da00fef48909..38dc8a47448940 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -36,6 +36,7 @@ section variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R) +/-- The predicate for describing an ideal is minimal prime over certain ideal `I`. -/ protected def Ideal.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p lemma Ideal.IsMinimalPrime.isPrime {p : Ideal R} (h : I.IsMinimalPrime p) : p.IsPrime := h.1.1 From a594879c62a28b75e05d654a5bfb0b851c6dc49f Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 12:34:34 +0800 Subject: [PATCH 45/69] add deprecation --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 74ea36cc589984..b4df06a82cc35c 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -204,7 +204,7 @@ lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] refine ⟨p, hp, ?_⟩ - have := Ideal.IsPrime.of_mem_minimalPrimes hp + have := Ideal.IsPrime.of_mem_minimalPrimes' hp rw [primeHeight_eq_zero_iff.mpr hp] /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 38dc8a47448940..b2513268de7475 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -58,8 +58,11 @@ lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x variable {I J} -theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : - p.IsPrime := +@[deprecated "Use `Ideal.IsMinimalPrime.isPrime` instead." (since := "2026-05-08")] +theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := + h.1.1 + +theorem Ideal.IsPrime.of_mem_minimalPrimes' {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by From 3300967b327394d52e0a5ab55bff5f5e5dbff2d0 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Fri, 8 May 2026 12:36:42 +0800 Subject: [PATCH 46/69] add doc --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index b2513268de7475..01fda98a1c78a5 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -62,6 +62,7 @@ variable {I J} theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 +/-- Variant of `Ideal.IsMinimalPrime.isPrime` for the set of all minimal primes of `R`. -/ theorem Ideal.IsPrime.of_mem_minimalPrimes' {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 From 8babb5d47ce4b5c5d7b614a1ceafb7bf7e2700e3 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 19:17:58 +0800 Subject: [PATCH 47/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 0c8eba31adff54..c7927db78b7fc0 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -204,7 +204,7 @@ lemma Ideal.one_le_height_span_singleton_of_mem_nonZeroDivisors {x : R} (hx : x ∈ nonZeroDivisors R) : 1 ≤ (span {x}).height := by dsimp [Ideal.height] refine le_iInf₂ fun q hq => ?_ - have : q.IsPrime := minimalPrimes_isPrime hq + have : q.IsPrime := hq.isPrime rw [ENat.one_le_iff_ne_zero, Ne, primeHeight_eq_zero_iff] intro hmin exact absurd hx <| notMem_nonZeroDivisors_of_mem_mem_minimalPrimes From 421559a2f4d1a574bbd9e3edbe427df1cc63cb22 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 20:25:05 +0800 Subject: [PATCH 48/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index fbb4dcc5f32a9a..ae7af5328b7489 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -236,10 +236,10 @@ private lemma Ideal.primeHeight_eq_zero_iff {I : Ideal R} [I.IsPrime] : /-- If `x` is a non-zero-divisor, then `span {x}` has height at least 1. -/ lemma Ideal.one_le_height_span_singleton_of_mem_nonZeroDivisors {x : R} (hx : x ∈ nonZeroDivisors R) : 1 ≤ (span {x}).height := by - dsimp [Ideal.height] + rw [Ideal.height_eq_inf_minimalPrimes] refine le_iInf₂ fun q hq => ?_ have : q.IsPrime := hq.isPrime - rw [ENat.one_le_iff_ne_zero, Ne, primeHeight_eq_zero_iff] + rw [ENat.one_le_iff_ne_zero, Ne, height_eq_zero_iff] intro hmin exact absurd hx <| notMem_nonZeroDivisors_of_mem_mem_minimalPrimes (hq.1.2 <| Ideal.mem_span_singleton.mpr <| dvd_refl x) hmin From 0d7c0df9ed5af5a9634a645903b5265a4f06b322 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 22:33:28 +0800 Subject: [PATCH 49/69] fix deprecation --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 01fda98a1c78a5..3b43ccc3fbd9af 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -59,11 +59,11 @@ lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x variable {I J} @[deprecated "Use `Ideal.IsMinimalPrime.isPrime` instead." (since := "2026-05-08")] -theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := +theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 /-- Variant of `Ideal.IsMinimalPrime.isPrime` for the set of all minimal primes of `R`. -/ -theorem Ideal.IsPrime.of_mem_minimalPrimes' {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := +theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by From cb6481677045f0350919c42f643e3ee20ef87a4b Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 22:50:49 +0800 Subject: [PATCH 50/69] adapt to changes in under --- Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean index 39dff232b8beb1..0815cca79f45dc 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Localization.lean @@ -194,12 +194,12 @@ theorem IsLocalization.minimalPrimes_map [IsLocalization S A] (J : Ideal R) : · exact IsLocalization.under_map_of_isPrime_disjoint S A hI.1 hI' · intro hp refine ⟨⟨?_, Ideal.map_le_iff_le_comap.mpr hp.le⟩, ?_⟩ - · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_comap_iff S] + · rw [IsLocalization.isPrime_iff_isPrime_disjoint S A, IsLocalization.disjoint_under_iff S] refine ⟨hp.isPrime, ?_⟩ rintro rfl exact hp.isPrime.ne_top rfl · intro I hI e - rw [← IsLocalization.map_comap S A I, ← IsLocalization.map_comap S A p] + rw [← IsLocalization.map_under S A I, ← IsLocalization.map_under S A p] exact Ideal.map_mono (hp.2 ⟨hI.1.comap _, Ideal.map_le_iff_le_comap.mp hI.2⟩ (Ideal.comap_mono e)) @@ -221,7 +221,7 @@ theorem IsLocalization.AtPrime.radical_map_of_mem_minimalPrimes AtPrime.map_eq_maximalIdeal q A, AtPrime.under_maximalIdeal A q] apply hIq.2 hJ.1 have := hJ.isPrime.ne_top - rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_comap_iff q.primeCompl A J] at this + rw [ne_eq, Ideal.comap_eq_top_iff, ← ne_eq, ← disjoint_under_iff q.primeCompl A J] at this exact Set.disjoint_compl_left_iff_subset.mp this end From e2c53ab4f6c106d071b6484987880f158c668cbf Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 22:55:19 +0800 Subject: [PATCH 51/69] fix naming --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 3b43ccc3fbd9af..35f8173fffb045 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -36,16 +36,16 @@ section variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R) -/-- The predicate for describing an ideal is minimal prime over certain ideal `I`. -/ -protected def Ideal.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p +/-- `IsMinimalPrime I p` says that `p` is a minimal prime over `I`. -/ +def _root_.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p -lemma Ideal.IsMinimalPrime.isPrime {p : Ideal R} (h : I.IsMinimalPrime p) : p.IsPrime := h.1.1 +lemma IsMinimalPrime.isPrime {p : Ideal R} (h : IsMinimalPrime I p) : p.IsPrime := h.1.1 -lemma Ideal.IsMinimalPrime.le {p : Ideal R} (h : I.IsMinimalPrime p) : I ≤ p := h.1.2 +lemma IsMinimalPrime.le {p : Ideal R} (h : IsMinimalPrime I p) : I ≤ p := h.1.2 /-- `I.minimalPrimes` is the set of ideals that are minimal primes over `I`. -/ protected abbrev Ideal.minimalPrimes : Set (Ideal R) := - {p | I.IsMinimalPrime p} + {p | IsMinimalPrime I p} variable (R) in /-- `minimalPrimes R` is the set of minimal primes of `R`. From 6ac19f6121dc655ce060a7b9ec0812eca886d625 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 23:11:18 +0800 Subject: [PATCH 52/69] fix --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- Mathlib/RingTheory/Spectrum/Prime/Topology.lean | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 8936db344d4d88..295d7761f4a4cb 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -215,7 +215,7 @@ lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] refine ⟨p, hp, ?_⟩ - have := Ideal.IsPrime.of_mem_minimalPrimes' hp + have := Ideal.IsPrime.of_mem_minimalPrimes hp rw [primeHeight_eq_zero_iff.mpr hp] /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ diff --git a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean index 49a274abcc0296..3028bf73db9325 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean @@ -958,7 +958,7 @@ lemma denseRange_comap_iff_minimalPrimes : · intro H I hI have : I ∈ (RingHom.ker f).minimalPrimes := by rw [denseRange_comap_iff_ker_le_nilRadical] at H - simp only [Set.mem_setOf, Ideal.IsMinimalPrime] at hI ⊢ + simp only [Set.mem_setOf, IsMinimalPrime] at hI ⊢ convert hI using 2 with p exact ⟨fun h ↦ ⟨h.1, bot_le⟩, fun h ↦ ⟨h.1, H.trans (h.1.radical_le_iff.mpr bot_le)⟩⟩ obtain ⟨p, hp, _, rfl⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f (I := ⊥) I this From 5354bc478ae2e5bf7b9d1d459aab24a1bcb8084f Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Tue, 12 May 2026 23:35:50 +0800 Subject: [PATCH 53/69] fix --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index a5d97348bcdd98..a240f420f3323a 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -109,7 +109,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes have := hp.isPrime let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ - · rwa [← IsLocalization.height_under p.primeCompl, + · rwa [← IsLocalization.height_under p.primeCompl, ← Ideal.under_def, Localization.AtPrime.under_maximalIdeal] at this · rwa [IsLocalization.minimalPrimes_map p.primeCompl (Localization.AtPrime p) I, Set.mem_preimage, Localization.AtPrime.under_maximalIdeal] From 4dcf91f03ee441eeab3ebfb7cde82f4334853f02 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 00:07:10 +0800 Subject: [PATCH 54/69] refactor name --- .../RingTheory/Ideal/MinimalPrime/Basic.lean | 19 ++++++++++++++----- .../RingTheory/Spectrum/Prime/Topology.lean | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 35f8173fffb045..0393b187d7d7f9 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -37,21 +37,30 @@ section variable {R S : Type*} [CommSemiring R] [CommSemiring S] (I J : Ideal R) /-- `IsMinimalPrime I p` says that `p` is a minimal prime over `I`. -/ -def _root_.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p +protected def Ideal.IsMinimalPrime (p : Ideal R) : Prop := Minimal (fun q ↦ q.IsPrime ∧ I ≤ q) p -lemma IsMinimalPrime.isPrime {p : Ideal R} (h : IsMinimalPrime I p) : p.IsPrime := h.1.1 +variable {I} in +lemma Ideal.IsMinimalPrime.isPrime {p : Ideal R} (h : I.IsMinimalPrime p) : p.IsPrime := h.1.1 -lemma IsMinimalPrime.le {p : Ideal R} (h : IsMinimalPrime I p) : I ≤ p := h.1.2 +variable {I} in +lemma Ideal.IsMinimalPrime.le {p : Ideal R} (h : I.IsMinimalPrime p) : I ≤ p := h.1.2 + +abbrev IsMinimalPrime (p : Ideal R) : Prop := (⊥ : Ideal R).IsMinimalPrime p + +lemma IsMinimalPrime.isPrime {p : Ideal R} (h : IsMinimalPrime p) : p.IsPrime := h.1.1 + +lemma IsMinimalPrime.iff_minimal (p : Ideal R) : IsMinimalPrime p ↔ Minimal Ideal.IsPrime p := by + simp [Ideal.IsMinimalPrime] /-- `I.minimalPrimes` is the set of ideals that are minimal primes over `I`. -/ protected abbrev Ideal.minimalPrimes : Set (Ideal R) := - {p | IsMinimalPrime I p} + {p | I.IsMinimalPrime p} variable (R) in /-- `minimalPrimes R` is the set of minimal primes of `R`. This is defined as `Ideal.minimalPrimes ⊥`. -/ abbrev minimalPrimes : Set (Ideal R) := - Ideal.minimalPrimes ⊥ + {p | IsMinimalPrime p} lemma minimalPrimes_eq_minimals : minimalPrimes R = {x | Minimal Ideal.IsPrime x} := congr_arg Minimal (by simp) diff --git a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean index 3028bf73db9325..49a274abcc0296 100644 --- a/Mathlib/RingTheory/Spectrum/Prime/Topology.lean +++ b/Mathlib/RingTheory/Spectrum/Prime/Topology.lean @@ -958,7 +958,7 @@ lemma denseRange_comap_iff_minimalPrimes : · intro H I hI have : I ∈ (RingHom.ker f).minimalPrimes := by rw [denseRange_comap_iff_ker_le_nilRadical] at H - simp only [Set.mem_setOf, IsMinimalPrime] at hI ⊢ + simp only [Set.mem_setOf, Ideal.IsMinimalPrime] at hI ⊢ convert hI using 2 with p exact ⟨fun h ↦ ⟨h.1, bot_le⟩, fun h ↦ ⟨h.1, H.trans (h.1.radical_le_iff.mpr bot_le)⟩⟩ obtain ⟨p, hp, _, rfl⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f (I := ⊥) I this From 32775b4e69dcec47c814214230ddaafc3234b26e Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 00:07:21 +0800 Subject: [PATCH 55/69] golf --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index dc12af9d5751eb..30a166eceeb779 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -338,8 +338,7 @@ lemma Ideal.height_le_height_add_spanFinrank_of_le {I p : Ideal R} [p.IsPrime] ( let p' := p.map (algebraMap R (R ⧸ I)) have : p'.IsPrime := isPrime_map_quotientMk_of_isPrime hrp obtain ⟨s, hps, hs⟩ := exists_finset_card_eq_height_of_isNoetherianRing p' - have lep' := hps.le - have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := fun _ hx ↦ lep' (subset_span hx) + have hsp' : (s : Set (R ⧸ I)) ⊆ (p' : Set _) := fun _ hx ↦ hps.le (subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk I) p s := by refine Set.SurjOn.mono subset_rfl hsp' fun x hx ↦ ?_ obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective x @@ -435,9 +434,8 @@ lemma Ideal.height_le_height_add_of_liesOver [IsNoetherianRing S] (p : Ideal R) obtain ⟨s, hp, heq⟩ := p.exists_finset_card_eq_height_of_isNoetherianRing let P' := P.map (Ideal.Quotient.mk <| p.map (algebraMap R S)) obtain ⟨s', hP', heq'⟩ := P'.exists_finset_card_eq_height_of_isNoetherianRing - have leP' := hP'.le have hsP'sub : (s' : Set <| S ⧸ (Ideal.map (algebraMap R S) p)) ⊆ (P' : Set <| S ⧸ _) := - fun x hx ↦ leP' (Ideal.subset_span hx) + fun x hx ↦ hP'.le (Ideal.subset_span hx) have : Set.SurjOn (Ideal.Quotient.mk (p.map (algebraMap R S))) P s' := by refine Set.SurjOn.mono subset_rfl hsP'sub fun x hx ↦ ?_ obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x From 9b9ebbcf4e7e4857df034dca1d69c85096fa1deb Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 00:26:35 +0800 Subject: [PATCH 56/69] add doc --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 0393b187d7d7f9..4086b4f40074d3 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -45,6 +45,7 @@ lemma Ideal.IsMinimalPrime.isPrime {p : Ideal R} (h : I.IsMinimalPrime p) : p.Is variable {I} in lemma Ideal.IsMinimalPrime.le {p : Ideal R} (h : I.IsMinimalPrime p) : I ≤ p := h.1.2 +/-- `IsMinimalPrime p` says that `p` is a minimal prime of the ring. -/ abbrev IsMinimalPrime (p : Ideal R) : Prop := (⊥ : Ideal R).IsMinimalPrime p lemma IsMinimalPrime.isPrime {p : Ideal R} (h : IsMinimalPrime p) : p.IsPrime := h.1.1 From 126d2d9e2bd216b1b685a5589869d8fe7d00c2f8 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 10:23:57 +0800 Subject: [PATCH 57/69] golf --- Mathlib/RingTheory/Ideal/Height.lean | 7 ++----- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 6 ++---- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 295d7761f4a4cb..15d71475c438d0 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -214,9 +214,7 @@ lemma Ideal.one_le_height_span_singleton_of_mem_nonZeroDivisors lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm simp only [Ideal.height, ENat.iInf_eq_zero] - refine ⟨p, hp, ?_⟩ - have := Ideal.IsPrime.of_mem_minimalPrimes hp - rw [primeHeight_eq_zero_iff.mpr hp] + exact ⟨p, hp, haveI := hp.isPrime; primeHeight_eq_zero_iff.mpr hp⟩ /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @[simp, nontriviality] @@ -428,8 +426,7 @@ lemma exists_spanRank_le_and_le_height_of_le_height [IsNoetherianRing R] (I : Id · rwa [← e] refine ⟨mem_minimalPrimes_of_primeHeight_eq_height (le_sup_left.trans hp.le) this.symm, ?_⟩ rwa [p.height_eq_primeHeight, eq_comm] - · apply hp.le - exact Ideal.mem_sup_right <| mem_span_singleton_self x + · exact hp.le <| Ideal.mem_sup_right <| mem_span_singleton_self x /-- In a nontrivial commutative ring `R`, the supremum of heights of all ideals is equal to the Krull dimension of `R`. -/ diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 30a166eceeb779..4371f9bdc6a4f3 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -118,8 +118,7 @@ theorem Ideal.map_height_le_one_of_mem_minimalPrimes {I p : Ideal R} {x : R} (hp : p ∈ (I ⊔ span {x}).minimalPrimes) : (p.map (Ideal.Quotient.mk I)).height ≤ 1 := let f := Ideal.Quotient.mk I have : p.IsPrime := hp.isPrime - have hfp : RingHom.ker f ≤ p := - I.mk_ker.trans_le (le_sup_left.trans hp.le) + have hfp : RingHom.ker f ≤ p := I.mk_ker.trans_le (le_sup_left.trans hp.le) height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨map_isPrime_of_surjective Quotient.mk_surjective hfp, map_mono (le_sup_right.trans hp.le)⟩, @@ -154,7 +153,6 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide have hI'q : span t ≤ q := span_le.mpr htq have hI'p : span t ≤ p := hI'q.trans hqp.le have := hp.isPrime - have lep := hp.le have : (p.map f).IsPrime := map_isPrime_of_surjective hf (by rwa [mk_ker]) suffices h : (p.map f).height ≤ 1 by have h_lt : q.map f < p.map f := (map_mono hqp.le).lt_of_not_ge fun e ↦ hqp.not_ge <| by @@ -169,7 +167,7 @@ theorem Ideal.mem_minimalPrimes_span_of_mem_minimalPrimes_span_insert {q p : Ide rwa [comap_map_of_surjective f hf, ← RingHom.ker_eq_comap_bot, mk_ker, sup_eq_left.mpr hI'q] at this refine height_le_one_of_isPrincipal_of_mem_minimalPrimes ((span {x}).map f) (p.map f) ⟨⟨this, - map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| lep <| subset_span <| .inl rfl⟩, + map_mono <| span_le.mpr <| Set.singleton_subset_iff.mpr <| hp.le <| subset_span <| .inl rfl⟩, fun r ⟨hr, hxr⟩ hrp ↦ map_le_iff_le_comap.mpr (hp.2 ⟨hr.comap f, ?_⟩ ?_)⟩ · rw [span_le, Set.insert_subset_iff] have := map_le_iff_le_comap.mp hxr (subset_span rfl) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 4086b4f40074d3..5ed12cb4e7f562 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -184,8 +184,7 @@ lemma Ideal.mem_minimalPrimes_sup {R : Type*} [CommRing R] {p I J : Ideal R} [p. p ∈ (I ⊔ J).minimalPrimes := by refine ⟨⟨‹_›, ?_⟩, fun q ⟨_, hq⟩ hqp ↦ ?_⟩ · rw [sup_le_iff] - refine ⟨hle, ?_⟩ - simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) h.le + refine ⟨hle, by simpa [hle] using Ideal.comap_mono (f := Ideal.Quotient.mk I) h.le⟩ · rw [sup_le_iff] at hq have h2 : p.map (Quotient.mk I) ≤ q.map (Quotient.mk I) := h.2 ⟨isPrime_map_quotientMk_of_isPrime hq.1, map_mono hq.2⟩ (map_mono hqp) From 4d9a85d4b5d4a5d570eb86ceabc46db49a520b63 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 12:01:55 +0800 Subject: [PATCH 58/69] remove unused lemma --- Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean index 5ed12cb4e7f562..1d4dea8b6ad45e 100644 --- a/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean +++ b/Mathlib/RingTheory/Ideal/MinimalPrime/Basic.lean @@ -72,10 +72,6 @@ variable {I J} theorem Ideal.minimalPrimes_isPrime {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := h.1.1 -/-- Variant of `Ideal.IsMinimalPrime.isPrime` for the set of all minimal primes of `R`. -/ -theorem Ideal.IsPrime.of_mem_minimalPrimes {p : Ideal R} (h : p ∈ minimalPrimes R) : p.IsPrime := - h.1.1 - theorem Ideal.exists_minimalPrimes_le [J.IsPrime] (e : I ≤ J) : ∃ p ∈ I.minimalPrimes, p ≤ J := by set S := { p : (Ideal R)ᵒᵈ | Ideal.IsPrime p ∧ I ≤ OrderDual.ofDual p } suffices h : ∃ m, OrderDual.toDual J ≤ m ∧ Maximal (· ∈ S) m by From 6d6d52cb765aa9b98688c0f0d6c1bf6c53b6ac49 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 13:57:25 +0800 Subject: [PATCH 59/69] alternative fix --- Mathlib/RingTheory/KrullDimension/Zero.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/KrullDimension/Zero.lean b/Mathlib/RingTheory/KrullDimension/Zero.lean index 09dac318663204..0e8c6265d81628 100644 --- a/Mathlib/RingTheory/KrullDimension/Zero.lean +++ b/Mathlib/RingTheory/KrullDimension/Zero.lean @@ -35,8 +35,7 @@ variable (R) in lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isPrime : minimalPrimes R = { I | I.IsPrime } := by ext - rw [mem_minimalPrimes_iff] - simp + exact Ideal.mem_minimalPrimes_iff_isPrime variable (R) in lemma Ring.KrullDimLE.minimalPrimes_eq_setOf_isMaximal : From 2784124e2b43f71d634e0c69df8e7162156067d5 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Wed, 13 May 2026 14:05:28 +0800 Subject: [PATCH 60/69] golf --- Mathlib/RingTheory/Ideal/Height.lean | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 691e673b121164..01eaed34275dd8 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -247,10 +247,9 @@ lemma Ideal.one_le_height_span_singleton_of_mem_nonZeroDivisors @[simp] lemma Ideal.height_bot [Nontrivial R] : (⊥ : Ideal R).height = 0 := by obtain ⟨p, hp⟩ := Ideal.nonempty_minimalPrimes (R := R) (I := ⊥) top_ne_bot.symm - simp only [Ideal.height, ENat.iInf_eq_zero] - refine ⟨p, hp, ?_⟩ - have := hp.isPrime - rw [← Ideal.height_eq_primeHeight, height_eq_zero_iff.mpr hp] + rw [Ideal.height_eq_inf_minimalPrimes] + simp only [ENat.iInf_eq_zero] + refine ⟨p, hp, haveI := hp.isPrime; height_eq_zero_iff.mpr hp⟩ /-- In a trivial commutative ring, the height of any ideal is `∞`. -/ @[simp, nontriviality] From 81e88ddf4fdaafe9d7587e796b66ba4e1ac48075 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Mon, 18 May 2026 10:20:12 +0800 Subject: [PATCH 61/69] use under --- Mathlib/RingTheory/Ideal/Height.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 01eaed34275dd8..4f176d3abfa20f 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -390,7 +390,7 @@ private theorem IsLocalization.primeHeight_comap (S : Submonoid R) {A : Type*} [ simpa [Ideal.height_eq_primeHeight] using IsLocalization.height_under_eq_of_isPrime S J theorem IsLocalization.height_under (S : Submonoid R) {A : Type*} [CommRing A] [Algebra R A] - [IsLocalization S A] (J : Ideal A) : (J.comap (algebraMap R A)).height = J.height := by + [IsLocalization S A] (J : Ideal A) : (J.under R).height = J.height := by rw [(J.comap _).height_eq_inf_minimalPrimes, J.height_eq_inf_minimalPrimes] simp only [IsLocalization.minimalPrimes_comap S A, iInf_image] apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) From ff9fc4cd7bf0dba3251c1c64ea2cc3515fc7f39f Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Mon, 18 May 2026 10:53:47 +0800 Subject: [PATCH 62/69] fix --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 3cfc6d99f0a15d..801771d7d490fb 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -109,7 +109,7 @@ lemma Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes have := hp.isPrime let f := algebraMap R (Localization.AtPrime p) have := Ideal.height_le_one_of_isPrincipal_of_mem_minimalPrimes_of_isLocalRing (I.map f) ?_ - · rwa [← IsLocalization.height_under p.primeCompl, ← Ideal.under_def, + · rwa [← IsLocalization.height_under p.primeCompl, Localization.AtPrime.under_maximalIdeal] at this · rwa [IsLocalization.minimalPrimes_map p.primeCompl (Localization.AtPrime p) I, Set.mem_preimage, Localization.AtPrime.under_maximalIdeal] From 2506602e98567bc76f5169638f8c00591204d6f6 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:29:21 +0800 Subject: [PATCH 63/69] remove expose --- Mathlib/RingTheory/Ideal/Height.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 4f176d3abfa20f..1f094d5c801f6b 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -26,7 +26,7 @@ In this file, we define the height of a prime ideal and the height of an ideal. -/ -@[expose] public section +public section variable {R : Type*} [CommRing R] (I : Ideal R) @@ -38,7 +38,6 @@ private noncomputable def Ideal.primeHeight [hI : I.IsPrime] : ℕ∞ := Order.height (⟨I, hI⟩ : PrimeSpectrum R) /-- The height of an ideal is defined as the infimum of the heights of its minimal prime ideals. -/ -@[no_expose] noncomputable def Ideal.height : ℕ∞ := ⨅ J ∈ I.minimalPrimes, @Ideal.primeHeight _ _ J ‹J ∈ I.minimalPrimes›.isPrime From 34942ddfbd32b9458db2ce24adc0cce0dc4154b7 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:33:35 +0800 Subject: [PATCH 64/69] refactor PID proof --- Mathlib/RingTheory/KrullDimension/PID.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/RingTheory/KrullDimension/PID.lean b/Mathlib/RingTheory/KrullDimension/PID.lean index c87e2986505260..370302852f63ef 100644 --- a/Mathlib/RingTheory/KrullDimension/PID.lean +++ b/Mathlib/RingTheory/KrullDimension/PID.lean @@ -51,5 +51,5 @@ lemma IsPrincipalIdealRing.height_eq_one_of_isMaximal {R : Type*} [CommRing R] [ · suffices h : (m.height : WithBot ℕ∞) ≤ 1 by norm_cast at h rw [← IsPrincipalIdealRing.ringKrullDim_eq_one _ h] exact Ideal.height_le_ringKrullDim_of_ne_top Ideal.IsPrime.ne_top' - · rw [Order.one_le_iff_pos, Ideal.height_eq_order_height_of_isPrime, Order.height_pos] - exact not_isMin_of_lt (b := ⊥) (Ideal.bot_lt_of_maximal m h) + · apply le_of_eq_of_le _ (Ideal.height_add_one_le_of_lt_of_isPrime (Ideal.bot_lt_of_maximal m h)) + simp From 1937f84e11fef50ce3c17d6a159024a03a9a8488 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:43:29 +0800 Subject: [PATCH 65/69] refactor order height lemma --- Mathlib/AlgebraicGeometry/Properties.lean | 3 +-- Mathlib/RingTheory/Ideal/Height.lean | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Mathlib/AlgebraicGeometry/Properties.lean b/Mathlib/AlgebraicGeometry/Properties.lean index 0344da531bd33b..e84461e05f0eac 100644 --- a/Mathlib/AlgebraicGeometry/Properties.lean +++ b/Mathlib/AlgebraicGeometry/Properties.lean @@ -354,10 +354,9 @@ lemma coheight_eq_of_isOpenImmersion {U X : Scheme} {x : U} (f : U ⟶ X) [IsOpe open Order in lemma idealHeight_eq_coheight (R : CommRingCat) (x : Spec R) : x.asIdeal.height = coheight x := by - rw [Ideal.height_eq_order_height_of_isPrime, + rw [PrimeSpectrum.height_eq_order_height_of_isPrime, ← Order.coheight_orderIso (specOrderIsoPrimeSpectrum R), ← height_ofDual, specOrderIsoPrimeSpectrum_apply, OrderDual.ofDual_toDual] - rfl open Order in @[stacks 02IZ] diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 1f094d5c801f6b..77aa9044de4621 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -45,9 +45,9 @@ noncomputable def Ideal.height : ℕ∞ := private lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by simp [height, primeHeight, Ideal.minimalPrimes_eq_subsingleton_self] -lemma Ideal.height_eq_order_height_of_isPrime [I.IsPrime] : I.height = - Order.height (⟨I, ‹I.IsPrime›⟩ : PrimeSpectrum R) := - I.height_eq_primeHeight +lemma PrimeSpectrum.height_eq_order_height_of_isPrime (p : PrimeSpectrum R) : + p.1.height = Order.height p := + p.1.height_eq_primeHeight lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) @@ -104,7 +104,7 @@ lemma Ideal.exists_ltSeries_length_eq_height (p : Ideal R) [p.IsPrime] [p.Finite private lemma Ideal.height_mono_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I ≤ J) : I.height ≤ J.height := by - simp only [Ideal.height_eq_order_height_of_isPrime] + simp only [Ideal.height_eq_primeHeight, Ideal.primeHeight] gcongr exact h @@ -115,7 +115,7 @@ private lemma Ideal.primeHeight_mono {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h lemma Ideal.height_add_one_le_of_lt_of_isPrime {I J : Ideal R} [I.IsPrime] [J.IsPrime] (h : I < J) : I.height + 1 ≤ J.height := by - simp only [Ideal.height_eq_order_height_of_isPrime] + simp only [Ideal.height_eq_primeHeight, Ideal.primeHeight] exact Order.height_add_one_le h @[deprecated "Use `Ideal.height_add_one_le_of_lt_of_isPrime` instead." (since := "2026-04-04")] @@ -166,7 +166,7 @@ private lemma Ideal.primeHeight_strict_mono {I J : Ideal R} [I.IsPrime] [J.IsPri lemma Ideal.height_le_ringKrullDim_of_isPrime {I : Ideal R} [I.IsPrime] : I.height ≤ ringKrullDim R := by - rw [I.height_eq_order_height_of_isPrime] + rw [Ideal.height_eq_primeHeight, Ideal.primeHeight] exact Order.height_le_krullDim _ /-- A prime ideal of finite height is equal to any ideal that contains it with no greater height. -/ @@ -222,7 +222,8 @@ lemma Ideal.mem_minimalPrimes_of_height_eq {I J : Ideal R} (e : I ≤ J) [J.IsPr /-- A prime ideal has height zero if and only if it is minimal -/ lemma Ideal.height_eq_zero_iff {I : Ideal R} [I.IsPrime] : height I = 0 ↔ I ∈ minimalPrimes R := by - rw [Ideal.height_eq_order_height_of_isPrime, Order.height_eq_zero, minimalPrimes_eq_minimals] + rw [Ideal.height_eq_primeHeight, Ideal.primeHeight, Order.height_eq_zero, + minimalPrimes_eq_minimals] refine ⟨fun h ↦ ⟨‹_›, ?_⟩, fun ⟨hI, hI'⟩ b hb ↦ hI' b.isPrime hb⟩ by_contra! ⟨P, ⟨hP₁, ⟨hP₂, hP₃⟩⟩⟩ exact hP₃ (h (b := ⟨P, hP₁⟩) hP₂) @@ -274,7 +275,7 @@ private theorem Ideal.isMaximal_of_primeHeight_eq_ringKrullDim {I : Ideal R} [I. @[simp] theorem IsLocalRing.maximalIdeal_height_eq_ringKrullDim [IsLocalRing R] : (IsLocalRing.maximalIdeal R).height = ringKrullDim R := by - rw [Ideal.height_eq_order_height_of_isPrime] + rw [Ideal.height_eq_primeHeight, Ideal.primeHeight] exact Order.height_top_eq_krullDim @[deprecated "Use `IsLocalRing.maximalIdeal_height_eq_ringKrullDim` instead." @@ -368,8 +369,9 @@ lemma ringKrullDim_le_iff_isMaximal_height_le {R : Type*} [CommRing R] (n : With private theorem IsLocalization.height_under_eq_of_isPrime (S : Submonoid R) {A : Type*} [CommRing A] [Algebra R A] [IsLocalization S A] (J : Ideal A) [J.IsPrime] : (J.comap (algebraMap R A)).height = J.height := by - rw [eq_comm, Ideal.height_eq_order_height_of_isPrime, Ideal.height_eq_order_height_of_isPrime, - ← WithBot.coe_inj, Order.height_eq_krullDim_Iic, Order.height_eq_krullDim_Iic] + rw [eq_comm, Ideal.height_eq_primeHeight, Ideal.height_eq_primeHeight, Ideal.primeHeight, + Ideal.primeHeight, ← WithBot.coe_inj, Order.height_eq_krullDim_Iic, + Order.height_eq_krullDim_Iic] let e := IsLocalization.orderIsoOfPrime S A have H (p : Ideal R) (hp : p ≤ J.comap (algebraMap R A)) : Disjoint (S : Set R) p := Set.disjoint_of_subset_right hp (e ⟨_, ‹J.IsPrime›⟩).2.2 From 825663aadcc93ff798f5bc9c1d9f0b5af84144ff Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:45:00 +0800 Subject: [PATCH 66/69] fix doc for primeHeight --- Mathlib/RingTheory/Ideal/Height.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 77aa9044de4621..0cd51f3d9e2e96 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -17,10 +17,6 @@ In this file, we define the height of a prime ideal and the height of an ideal. ## Main definitions -* `Ideal.primeHeight` : The height of a prime ideal $\mathfrak{p}$. We define it as the supremum of - the lengths of strictly decreasing chains of prime ideals below it. This definition is implemented - via `Order.height`. - * `Ideal.height` : The height of an ideal. We defined it as the infimum of the `primeHeight` of the minimal prime ideals of I. From 8cae9271f2ccf43a296910ceaaef085a7452a8cb Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:51:44 +0800 Subject: [PATCH 67/69] fix naming --- Mathlib/RingTheory/Ideal/Height.lean | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 0cd51f3d9e2e96..8e5fde64376212 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -487,7 +487,7 @@ lemma Ideal.sup_height_eq_ringKrullDim [Nontrivial R] : /-- In a nontrivial commutative ring `R`, the supremum of heights of all prime ideals is equal to the Krull dimension of `R`. -/ -lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : +lemma Ideal.sup_isPrime_height_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.height) = ringKrullDim R := by rw [← sup_height_eq_ringKrullDim, WithBot.coe_inj] apply le_antisymm @@ -503,11 +503,11 @@ lemma Ideal.sup_height_isPrime_eq_ringKrullDim [Nontrivial R] : @[deprecated "Use `Ideal.sup_height_isPrime_eq_ringKrullDim` instead." (since := "2026-04-02")] private lemma Ideal.sup_primeHeight_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsPrime), I.primeHeight) = ringKrullDim R := by - simp [← Ideal.height_eq_primeHeight, Ideal.sup_height_isPrime_eq_ringKrullDim] + simp [← Ideal.height_eq_primeHeight, Ideal.sup_isPrime_height_eq_ringKrullDim] /-- In a nontrivial commutative ring `R`, the supremum of heights of all maximal ideals is equal to the Krull dimension of `R`. -/ -lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : +lemma Ideal.sup_isMaximal_height_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.height) = ringKrullDim R := by rw [← Ideal.sup_height_eq_ringKrullDim, WithBot.coe_inj] apply le_antisymm @@ -521,7 +521,7 @@ lemma Ideal.sup_height_of_maximal_eq_ringKrullDim [Nontrivial R] : @[deprecated "Use `Ideal.sup_height_of_maximal_eq_ringKrullDim` instead." (since := "2026-04-02")] private lemma Ideal.sup_primeHeight_of_maximal_eq_ringKrullDim [Nontrivial R] : ↑(⨆ (I : Ideal R) (_ : I.IsMaximal), I.primeHeight) = ringKrullDim R := by - simp_rw [← Ideal.height_eq_primeHeight, Ideal.sup_height_of_maximal_eq_ringKrullDim] + simp_rw [← Ideal.height_eq_primeHeight, Ideal.sup_isMaximal_height_eq_ringKrullDim] section isLocalization @@ -536,7 +536,7 @@ lemma Ring.krullDimLE_of_isLocalization_maximal {n : ℕ} Ring.KrullDimLE n R := by simp_rw [Ring.krullDimLE_iff] at h ⊢ nontriviality R - rw [← Ideal.sup_height_of_maximal_eq_ringKrullDim] + rw [← Ideal.sup_isMaximal_height_eq_ringKrullDim] refine (WithBot.coe_le_coe).mpr (iSup₂_le_iff.mpr fun P hP ↦ ?_) rw [← WithBot.coe_le_coe, ← IsLocalization.AtPrime.ringKrullDim_eq_height P (Rₚ P)] exact h P From a4420aadfb2136d7730a656e21d91119ea7ea869 Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 21:59:36 +0800 Subject: [PATCH 68/69] temp fix --- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 801771d7d490fb..537bb2b4f995f2 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -480,7 +480,8 @@ lemma Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown [IsNoetherianRing S simp [hlq, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)] obtain ⟨lp', hlp'len, hlp', _⟩ := exists_ltSeries_of_hasGoingDown lp l'.head.asIdeal have : (lp'.smash l' hlp').length = lp.length + lq.length := by simp [hlp'len, l'] - rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, Ideal.height_eq_order_height_of_isPrime] + rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, + (⟨P, ‹_›⟩ : PrimeSpectrum S).height_eq_order_height_of_isPrime] apply Order.length_le_height simp [hlq, l', ← PrimeSpectrum.asIdeal_le_asIdeal, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)] From 45b8864a30cc386c4e0b9a7a11a0272e119f306a Mon Sep 17 00:00:00 2001 From: Thmoas-Guan <150537269+Thmoas-Guan@users.noreply.github.com> Date: Thu, 21 May 2026 22:03:04 +0800 Subject: [PATCH 69/69] fix naming --- Mathlib/AlgebraicGeometry/Properties.lean | 2 +- Mathlib/RingTheory/Ideal/Height.lean | 6 +++--- Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Mathlib/AlgebraicGeometry/Properties.lean b/Mathlib/AlgebraicGeometry/Properties.lean index e84461e05f0eac..c37783d7f1fde8 100644 --- a/Mathlib/AlgebraicGeometry/Properties.lean +++ b/Mathlib/AlgebraicGeometry/Properties.lean @@ -354,7 +354,7 @@ lemma coheight_eq_of_isOpenImmersion {U X : Scheme} {x : U} (f : U ⟶ X) [IsOpe open Order in lemma idealHeight_eq_coheight (R : CommRingCat) (x : Spec R) : x.asIdeal.height = coheight x := by - rw [PrimeSpectrum.height_eq_order_height_of_isPrime, + rw [PrimeSpectrum.height_eq_orderHeight, ← Order.coheight_orderIso (specOrderIsoPrimeSpectrum R), ← height_ofDual, specOrderIsoPrimeSpectrum_apply, OrderDual.ofDual_toDual] diff --git a/Mathlib/RingTheory/Ideal/Height.lean b/Mathlib/RingTheory/Ideal/Height.lean index 8e5fde64376212..52d06e6ec73e24 100644 --- a/Mathlib/RingTheory/Ideal/Height.lean +++ b/Mathlib/RingTheory/Ideal/Height.lean @@ -41,9 +41,9 @@ noncomputable def Ideal.height : ℕ∞ := private lemma Ideal.height_eq_primeHeight [I.IsPrime] : I.height = I.primeHeight := by simp [height, primeHeight, Ideal.minimalPrimes_eq_subsingleton_self] -lemma PrimeSpectrum.height_eq_order_height_of_isPrime (p : PrimeSpectrum R) : - p.1.height = Order.height p := - p.1.height_eq_primeHeight +lemma PrimeSpectrum.height_eq_orderHeight (p : PrimeSpectrum R) : + p.asIdeal.height = Order.height p := + p.asIdeal.height_eq_primeHeight lemma Ideal.height_eq_inf_minimalPrimes : I.height = ⨅ J ∈ I.minimalPrimes, J.height := by apply iInf_congr (fun p ↦ iInf_congr fun hp ↦ ?_) diff --git a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean index 537bb2b4f995f2..5aa2e8787d83d3 100644 --- a/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean +++ b/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean @@ -480,8 +480,7 @@ lemma Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown [IsNoetherianRing S simp [hlq, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)] obtain ⟨lp', hlp'len, hlp', _⟩ := exists_ltSeries_of_hasGoingDown lp l'.head.asIdeal have : (lp'.smash l' hlp').length = lp.length + lq.length := by simp [hlp'len, l'] - rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, - (⟨P, ‹_›⟩ : PrimeSpectrum S).height_eq_order_height_of_isPrime] + rw [← hlenp, ← hlenq, ← Nat.cast_add, ← this, (⟨P, ‹_›⟩ : PrimeSpectrum S).height_eq_orderHeight] apply Order.length_le_height simp [hlq, l', ← PrimeSpectrum.asIdeal_le_asIdeal, map_le_iff_le_comap, LiesOver.over (p := p) (P := P)]