Stafford38/Paper/Support/DimensionTheory.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 
3 public import Mathlib.RingTheory.NoetherNormalization
4 public import Mathlib.RingTheory.Ideal.HasGoingUp
5 public import Mathlib.RingTheory.Ideal.KrullsHeightTheorem
6 public import Mathlib.RingTheory.AlgebraicIndependent.Transcendental
7 public import Mathlib.RingTheory.AlgebraicIndependent.TranscendenceBasis
8 public import Mathlib.RingTheory.Ideal.Cotangent
9 public import Mathlib.RingTheory.Ideal.MinimalPrime.Noetherian
10 public import Mathlib.Algebra.Module.SpanRankOperations
11 
12 @[expose] public section
13 
14 /-!
15 # Dimension theory of finitely generated algebras over a field
16 
17 * `trdeg_quotient_lt`: in a finitely generated domain `D` over a field `K`, a nonzero
18   prime `𝔭` lowers the transcendence degree, `trdeg_K (D/𝔭) < trdeg_K D`.
19 * `ringKrullDim_eq_trdeg`: a finitely generated domain `A` over `K` has Krull
20   dimension `trdeg_K A` (Noether normalization and going up for the lower bound,
21   `trdeg_quotient_lt` along a chain of primes for the upper bound).
22 * `partialEvalChain`, `le_height_ker_aeval`: the maximal ideal of a point of `K^n`
23   has height at least `n` in `K[x_1, …, x_n]`.
24 * `isDomain_of_spanFinrank_maximalIdeal_le`: a regular local ring is a domain.
25 -/
26 
27 namespace Stafford38.Paper.Support
28 
29 open MvPolynomial
30 
31 noncomputable section
32 
33 universe u
34 
35 section Trdeg
36 
37 variable {K : Type u} [Field K]
38 
39 /-- **A nonzero prime lowers the transcendence degree.** Lift a transcendence basis of
40 `D/𝔭` to `D`; if `trdeg D ≤ trdeg D/𝔭`, the lift is a transcendence basis of `D`, so a
41 nonzero `a ∈ 𝔭` is algebraic over `K[z]` and `𝔭 ∩ K[z] ≠ 0`; but `K[z] → D/𝔭` is
42 injective. -/
43 theorem trdeg_quotient_lt {D : Type u} [CommRing D] [IsDomain D] [Algebra K D]
44     [Algebra.FiniteType K D] (p : Ideal D) [p.IsPrime] (hp : p ≠ ⊥) :
45     Algebra.trdeg K (D ⧸ p) < Algebra.trdeg K D := by
46   classical
47   have hfin : Algebra.trdeg K D < Cardinal.aleph0 := trdeg_lt_aleph0_of_finiteType
48   have : FaithfulSMul K (D ⧸ p) :=
49     (faithfulSMul_iff_algebraMap_injective K (D ⧸ p)).2 (algebraMap K (D ⧸ p)).injective
50   obtain ⟨s, hs⟩ := exists_isTranscendenceBasis K (D ⧸ p)
51   by_contra hlt
52   have hle : Algebra.trdeg K D ≤ Cardinal.mk s := by
53     rw [hs.cardinalMk_eq_trdeg]
54     exact not_lt.1 hlt
55   let z : s → D := fun i ↦ (Ideal.Quotient.mk_surjective (i : D ⧸ p)).choose
56   have hz : ∀ i, Ideal.Quotient.mk p (z i) = i := fun i ↦
57     (Ideal.Quotient.mk_surjective (i : D ⧸ p)).choose_spec
58   have hcomp : (Ideal.Quotient.mkₐ K p : D →ₐ[K] D ⧸ p) ∘ z = ((↑) : s → D ⧸ p) := by
59     funext i
60     exact hz i
61   have hzi : AlgebraicIndependent K z :=
62     AlgebraicIndependent.of_comp (Ideal.Quotient.mkₐ K p) (hcomp ▸ hs.1)
63   have hzb : IsTranscendenceBasis K z := AlgebraicIndependent.isTranscendenceBasis_of_trdeg_le hzi hfin hle
64   have := hzb.isAlgebraic
65   obtain ⟨a, hap, ha0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot hp
66   have hunder := Ideal.under_ne_bot_of_algebraic_mem
67     (R := Algebra.adjoin K (Set.range z)) ha0 hap (Algebra.IsAlgebraic.isAlgebraic a)
68   obtain ⟨r, hr, hr0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot hunder
69   obtain ⟨g, hg⟩ : (r : D) ∈ (MvPolynomial.aeval (R := K) z).range := by
70     rw [← Algebra.adjoin_range_eq_range_aeval]
71     exact r.2
72   have hg0 : MvPolynomial.aeval ((↑) : s → D ⧸ p) g = 0 := by
73     rw [← hcomp, show (⇑(Ideal.Quotient.mkₐ K p) ∘ z) = fun i ↦ Ideal.Quotient.mkₐ K p (z i)
74       from rfl, ← MvPolynomial.comp_aeval_apply]
75     change Ideal.Quotient.mk p ((MvPolynomial.aeval (R := K) z).toRingHom g) = 0
76     rw [hg]
77     exact (Ideal.Quotient.eq_zero_iff_mem).2 hr
78   have hg' : g = 0 := (algebraicIndependent_iff.1 hs.1) g hg0
79   apply hr0
80   apply Subtype.ext
81   rw [← hg, hg', map_zero]
82   rfl
83 
84 /-- The transcendence degree of a quotient is at most that of the ring. -/
85 theorem trdeg_quotient_le {A : Type u} [CommRing A] [Algebra K A] (p : Ideal A) :
86     Algebra.trdeg K (A ⧸ p) ≤ Algebra.trdeg K A :=
87   trdeg_le_of_surjective (Ideal.Quotient.mkₐ K p) Ideal.Quotient.mk_surjective
88 
89 /-- A domain and its fraction field have the same transcendence degree. -/
90 theorem trdeg_fractionRing (D : Type u) [CommRing D] [IsDomain D] [Algebra K D] :
91     Algebra.trdeg K (FractionRing D) = Algebra.trdeg K D := by
92   have : FaithfulSMul K D :=
93     (faithfulSMul_iff_algebraMap_injective K D).2 (algebraMap K D).injective
94   have : FaithfulSMul D (FractionRing D) :=
95     (faithfulSMul_iff_algebraMap_injective _ _).2 (IsFractionRing.injective D (FractionRing D))
96   have : Algebra.IsAlgebraic D (FractionRing D) :=
97     IsLocalization.isAlgebraic (R := D) (S := FractionRing D) (nonZeroDivisors D)
98   rw [← trdeg_add_eq (R := K) (S := D) (A := FractionRing D),
99     trdeg_eq_zero (R := D) (A := FractionRing D), add_zero]
100 
101 /-- For primes `𝔭 < 𝔮` of a finitely generated `K`-algebra,
102 `trdeg_K (A/𝔮) < trdeg_K (A/𝔭)`, as natural numbers. -/
103 theorem trdeg_quotient_toNat_lt {A : Type u} [CommRing A] [Algebra K A]
104     [Algebra.FiniteType K A] {p q : Ideal A} [p.IsPrime] [q.IsPrime] (hpq : p < q) :
105     (Algebra.trdeg K (A ⧸ q)).toNat < (Algebra.trdeg K (A ⧸ p)).toNat := by
106   classical
107   let q' : Ideal (A ⧸ p) := q.map (Ideal.Quotient.mk p)
108   have hker : RingHom.ker (Ideal.Quotient.mk p) ≤ q := by
109     rw [Ideal.mk_ker]
110     exact hpq.le
111   have : q'.IsPrime := Ideal.map_isPrime_of_surjective Ideal.Quotient.mk_surjective hker
112   have hq' : q' ≠ ⊥ := by
113     obtain ⟨a, haq, hap⟩ := IsConcreteLE.exists_of_lt hpq
114     intro h
115     apply hap
116     have : Ideal.Quotient.mk p a ∈ q' := Ideal.mem_map_of_mem _ haq
117     rw [h, Ideal.mem_bot, Ideal.Quotient.eq_zero_iff_mem] at this
118     exact this
119   have hlt := trdeg_quotient_lt (K := K) q' hq'
120   have he : Algebra.trdeg K ((A ⧸ p) ⧸ q') = Algebra.trdeg K (A ⧸ q) :=
121     (DoubleQuot.quotQuotEquivQuotOfLEₐ K hpq.le).trdeg_eq
122   rw [he] at hlt
123   have hfin : Algebra.trdeg K (A ⧸ p) < Cardinal.aleph0 := trdeg_lt_aleph0_of_finiteType
124   exact Cardinal.toNat_strictMonoOn (hlt.trans hfin) hfin hlt
125 
126 end Trdeg
127 
128 section Chain
129 
130 variable {K : Type u} [Field K] {n : ℕ}
131 
132 /-- Substitute `x_i = y_i` for `i < j`. -/
133 def partialEval (y : Fin n → K) (j : ℕ) :
134     MvPolynomial (Fin n) K →ₐ[K] MvPolynomial (Fin n) K :=
135   MvPolynomial.aeval fun i ↦ if (i : ℕ) < j then C (y i) else X i
136 
137 theorem partialEval_comp (y : Fin n → K) {j k : ℕ} (hjk : j ≤ k) :
138     (partialEval y k).comp (partialEval y j) = partialEval y k := by
139   apply MvPolynomial.algHom_ext
140   intro i
141   simp only [partialEval, AlgHom.comp_apply, aeval_X]
142   by_cases hij : (i : ℕ) < j
143   · have hik : (i : ℕ) < k := lt_of_lt_of_le hij hjk
144     simp [hij, hik]
145   · simp [hij]
146 
147 theorem ker_partialEval_mono (y : Fin n → K) {j k : ℕ} (hjk : j ≤ k) :
148     RingHom.ker (partialEval y j) ≤ RingHom.ker (partialEval y k) := by
149   intro g hg
150   rw [RingHom.mem_ker] at hg ⊢
151   rw [← partialEval_comp y hjk, AlgHom.comp_apply, hg, map_zero]
152 
153 theorem ker_partialEval_lt (y : Fin n → K) {j : ℕ} (hj : j < n) :
154     RingHom.ker (partialEval y j) < RingHom.ker (partialEval y (j + 1)) := by
155   refine lt_of_le_of_ne (ker_partialEval_mono y (Nat.le_succ j)) fun h ↦ ?_
156   have hmem : X (⟨j, hj⟩ : Fin n) - C (y ⟨j, hj⟩) ∈ RingHom.ker (partialEval y (j + 1)) := by
157     rw [RingHom.mem_ker]
158     simp [partialEval]
159   rw [← h, RingHom.mem_ker] at hmem
160   simp only [partialEval, map_sub, aeval_X, lt_irrefl, ite_false, aeval_C,
161     MvPolynomial.algebraMap_eq] at hmem
162   have := congrArg (MvPolynomial.eval fun _ ↦ y ⟨j, hj⟩ + 1) hmem
163   simp at this
164 
165 theorem ker_partialEval_zero (y : Fin n → K) : RingHom.ker (partialEval y 0) = ⊥ := by
166   have : partialEval y 0 = AlgHom.id K _ := by
167     apply MvPolynomial.algHom_ext
168     intro i
169     simp [partialEval]
170   rw [this]
171   exact (RingHom.injective_iff_ker_eq_bot _).1 Function.injective_id
172 
173 theorem ker_partialEval_self (y : Fin n → K) :
174     RingHom.ker (partialEval y n) = RingHom.ker (MvPolynomial.aeval (R := K) y) := by
175   have : partialEval y n = (Algebra.ofId K (MvPolynomial (Fin n) K)).comp (aeval y) := by
176     apply MvPolynomial.algHom_ext
177     intro i
178     simp [partialEval, MvPolynomial.algebraMap_eq]
179   ext g
180   rw [RingHom.mem_ker, RingHom.mem_ker, this, AlgHom.comp_apply]
181   simp only [Algebra.ofId_apply, MvPolynomial.algebraMap_eq]
182   exact MvPolynomial.C_eq_zero
183 
184 theorem isPrime_ker_partialEval (y : Fin n → K) (j : ℕ) :
185     (RingHom.ker (partialEval y j)).IsPrime :=
186   RingHom.ker_isPrime _
187 
188 /-- The chain `0 = 𝔭_0 < 𝔭_1 < ⋯ < 𝔭_n = 𝔪_y`, `𝔭_j = (x_1 - y_1, …, x_j - y_j)`. -/
189 def partialEvalChain (y : Fin n → K) : LTSeries (PrimeSpectrum (MvPolynomial (Fin n) K)) where
190   length := n
191   toFun j := ⟨RingHom.ker (partialEval y j), isPrime_ker_partialEval y j⟩
192   step j := ker_partialEval_lt y j.2
193 
194 theorem partialEvalChain_head (y : Fin n → K) :
195     ((partialEvalChain y).head).asIdeal = ⊥ :=
196   ker_partialEval_zero y
197 
198 theorem partialEvalChain_last (y : Fin n → K) :
199     ((partialEvalChain y).last).asIdeal = RingHom.ker (MvPolynomial.aeval (R := K) y) :=
200   ker_partialEval_self y
201 
202 /-- The maximal ideal of a point of `K^n` has height at least `n`. -/
203 theorem le_height_ker_aeval (y : Fin n → K) :
204     (n : ℕ∞) ≤ (RingHom.ker (MvPolynomial.aeval (R := K) y)).height := by
205   have : (RingHom.ker (MvPolynomial.aeval (R := K) y)).IsPrime := RingHom.ker_isPrime _
206   rw [show RingHom.ker (MvPolynomial.aeval (R := K) y) =
207     ((partialEvalChain y).last).asIdeal from (partialEvalChain_last y).symm,
208     PrimeSpectrum.height_eq_orderHeight]
209   exact Order.length_le_height_last (p := partialEvalChain y)
210 
211 end Chain
212 
213 section KrullTrdeg
214 
215 variable {K : Type u} [Field K]
216 
217 /-- `dim A ≤ trdeg_K A` for a finitely generated `K`-algebra: along a chain of primes
218 the transcendence degree of the quotients drops strictly. -/
219 theorem ringKrullDim_le_trdeg (A : Type u) [CommRing A] [Algebra K A]
220     [Algebra.FiniteType K A] :
221     ringKrullDim A ≤ ((Algebra.trdeg K A).toNat : WithBot ℕ∞) := by
222   have hfinA : Algebra.trdeg K A < Cardinal.aleph0 := trdeg_lt_aleph0_of_finiteType
223   unfold ringKrullDim Order.krullDim
224   refine iSup_le fun l ↦ ?_
225   let tr : PrimeSpectrum A → ℕ := fun p ↦ (Algebra.trdeg K (A ⧸ p.asIdeal)).toNat
226   have hstep : ∀ k (hk : k ≤ l.length),
227       tr (l ⟨k, Nat.lt_succ_of_le hk⟩) + k ≤ tr (l 0) := by
228     intro k
229     induction k with
230     | zero => intro _; simp
231     | succ k ih =>
232       intro hk
233       have h1 := ih (Nat.le_of_succ_le hk)
234       have hlt : l ⟨k, by omega⟩ < l ⟨k + 1, by omega⟩ := l.strictMono (by simp)
235       have h2 := trdeg_quotient_toNat_lt (K := K) (A := A) (p := (l ⟨k, by omega⟩).asIdeal)
236         (q := (l ⟨k + 1, by omega⟩).asIdeal) hlt
237       simp only [tr] at h1 ⊢
238       omega
239   have hlen := hstep l.length le_rfl
240   have h0 : tr (l 0) ≤ (Algebra.trdeg K A).toNat :=
241     Cardinal.toNat_le_toNat (trdeg_quotient_le _) hfinA
242   have : l.length ≤ (Algebra.trdeg K A).toNat := by omega
243   exact_mod_cast this
244 
245 /-- `trdeg_K A ≤ dim A` for a finitely generated domain: Noether normalization
246 `K[z_1, …, z_s] ⊆ A` with `s = trdeg_K A`, and the chain of `partialEvalChain` lifts to `A`
247 by going up. -/
248 theorem trdeg_le_ringKrullDim (A : Type u) [CommRing A] [IsDomain A] [Algebra K A]
249     [Algebra.FiniteType K A] :
250     ((Algebra.trdeg K A).toNat : WithBot ℕ∞) ≤ ringKrullDim A := by
251   obtain ⟨s, g, hinj, hint⟩ := exists_integral_inj_algHom_of_fg K A
252   let : Algebra (MvPolynomial (Fin s) K) A := g.toRingHom.toAlgebra
253   have : IsScalarTower K (MvPolynomial (Fin s) K) A :=
254     IsScalarTower.of_algebraMap_eq fun c ↦ (g.commutes c).symm
255   have : Algebra.IsIntegral (MvPolynomial (Fin s) K) A := ⟨hint⟩
256   have : FaithfulSMul (MvPolynomial (Fin s) K) A :=
257     (faithfulSMul_iff_algebraMap_injective _ _).2 hinj
258   have : FaithfulSMul K (MvPolynomial (Fin s) K) :=
259     (faithfulSMul_iff_algebraMap_injective _ _).2 (algebraMap K _).injective
260   have htr : Algebra.trdeg K A = s := by
261     rw [← trdeg_add_eq (R := K) (S := MvPolynomial (Fin s) K) (A := A), MvPolynomial.trdeg_of_isDomain,
262       trdeg_eq_zero (R := MvPolynomial (Fin s) K) (A := A)]
263     simp
264   rw [htr, Cardinal.toNat_natCast]
265   let l := partialEvalChain (K := K) (fun _ : Fin s ↦ (0 : K))
266   have : (⊥ : Ideal A).LiesOver (RelSeries.head l).asIdeal := by
267     refine ⟨?_⟩
268     rw [partialEvalChain_head, Ideal.under]
269     exact (Ideal.comap_bot_of_injective (algebraMap (MvPolynomial (Fin s) K) A) hinj).symm
270   obtain ⟨L, hL, -, -⟩ := Ideal.exists_ltSeries_of_hasGoingUp l (⊥ : Ideal A)
271   have := Order.LTSeries.length_le_krullDim L
272   rw [hL] at this
273   exact this
274 
275 /-- **Krull dimension equals transcendence degree** for a finitely generated domain over a
276 field. -/
277 theorem ringKrullDim_eq_trdeg (A : Type u) [CommRing A] [IsDomain A] [Algebra K A]
278     [Algebra.FiniteType K A] :
279     ringKrullDim A = ((Algebra.trdeg K A).toNat : WithBot ℕ∞) :=
280   le_antisymm (ringKrullDim_le_trdeg A) (trdeg_le_ringKrullDim A)
281 
282 end KrullTrdeg
283 
284 section Regular
285 
286 open IsLocalRing
287 
288 theorem withBot_natCast_le_of_add_one_le {a : ℕ} {D : WithBot ℕ∞}
289     (h : (a : WithBot ℕ∞) + 1 ≤ D + 1) : (a : WithBot ℕ∞) ≤ D := by
290   induction D using WithBot.recBotCoe with
291   | bot => simp at h
292   | coe d =>
293     induction d using ENat.recTopCoe with
294     | top => exact_mod_cast le_top
295     | coe d =>
296       have : a + 1 ≤ d + 1 := by exact_mod_cast h
297       exact_mod_cast (by omega : a ≤ d)
298 
299 /-- If `x ∈ 𝔪 ∖ 𝔪²`, then `𝔪_{R/(x)}` needs one generator fewer than `𝔪`: extend the class
300 of `x` to a basis of `𝔪/𝔪²` and lift it to generators of `𝔪` containing `x`. -/
301 theorem spanFinrank_maximalIdeal_quotient_add_one_le {R : Type u} [CommRing R] [IsLocalRing R]
302     [IsNoetherianRing R] {x : R} (hx : x ∈ maximalIdeal R) (hx2 : x ∉ maximalIdeal R ^ 2)
303     [IsLocalRing (R ⧸ Ideal.span {x})] :
304     (maximalIdeal (R ⧸ Ideal.span {x})).spanFinrank + 1 ≤ (maximalIdeal R).spanFinrank := by
305   classical
306   set 𝔪 := maximalIdeal R
307   let v : CotangentSpace R := 𝔪.toCotangent ⟨x, hx⟩
308   have hv : v ≠ 0 := fun h ↦ hx2 ((Ideal.toCotangent_eq_zero 𝔪 ⟨x, hx⟩).1 h)
309   have hli : LinearIndepOn (ResidueField R) id ({v} : Set (CotangentSpace R)) :=
310     (linearIndepOn_singleton_iff (ResidueField R)).2 hv
311   let S : Set (CotangentSpace R) := hli.extend (Set.subset_univ _)
312   let b := Module.Basis.extend hli
313   have hvS : v ∈ S := hli.subset_extend _ rfl
314   have hSfin : S.Finite := Set.toFinite S
315   have hrank : 𝔪.spanFinrank = S.ncard := by
316     rw [spanFinrank_maximalIdeal_eq_finrank_cotangentSpace, Module.finrank_eq_nat_card_basis b,
317       Nat.card_coe_set_eq]
318   let σ : CotangentSpace R → 𝔪 := fun w ↦
319     if w = v then ⟨x, hx⟩ else (Ideal.toCotangent_surjective 𝔪 w).choose
320   have hσ : ∀ w, 𝔪.toCotangent (σ w) = w := by
321     intro w
322     by_cases h : w = v
323     · simp only [σ, h, ite_true]; rfl
324     · simp only [σ, h, ite_false]; exact (Ideal.toCotangent_surjective 𝔪 w).choose_spec
325   let T : Set 𝔪 := σ '' S
326   have hTspan : Submodule.span R T = ⊤ := by
327     rw [← CotangentSpace.span_image_eq_top_iff]
328     have : 𝔪.toCotangent '' T = S := by
329       rw [Set.image_image]
330       simp [hσ]
331     rw [this]
332     have := b.span_eq
333     rwa [Module.Basis.range_extend] at this
334   have h𝔪 : 𝔪 = Ideal.span (Subtype.val '' T) := by
335     have h := congrArg (Submodule.map 𝔪.subtype) hTspan
336     rw [Submodule.map_span, Submodule.map_top, Submodule.range_subtype] at h
337     exact h.symm
338   have hmax : maximalIdeal (R ⧸ Ideal.span {x}) =
339       Ideal.span ((Ideal.Quotient.mk _) '' (Subtype.val '' (T \ {σ v}))) := by
340     rw [← map_maximalIdeal_of_surjective _ Ideal.Quotient.mk_surjective]
341     change 𝔪.map _ = _
342     conv_lhs => rw [h𝔪]
343     rw [Ideal.map_span]
344     apply le_antisymm
345     · rw [Ideal.span_le]
346       rintro _ ⟨_, ⟨t, ht, rfl⟩, rfl⟩
347       by_cases htv : t = σ v
348       · have : Ideal.Quotient.mk (Ideal.span {x}) (t : R) = 0 := by
349           rw [htv, Ideal.Quotient.eq_zero_iff_mem]
350           simp only [σ, ite_true]
351           exact Ideal.mem_span_singleton_self x
352         rw [this]
353         exact Ideal.zero_mem _
354       · exact Ideal.subset_span ⟨t, ⟨t, ⟨ht, htv⟩, rfl⟩, rfl⟩
355     · apply Ideal.span_mono
356       rintro _ ⟨_, ⟨t, ht, rfl⟩, rfl⟩
357       exact ⟨t, ⟨t, ht.1, rfl⟩, rfl⟩
358   have hTfin : T.Finite := hSfin.image σ
359   have hσvT : σ v ∈ T := ⟨v, hvS, rfl⟩
360   have h1 : (maximalIdeal (R ⧸ Ideal.span {x})).spanFinrank ≤
361       ((Ideal.Quotient.mk (Ideal.span {x})) '' (Subtype.val '' (T \ {σ v}))).ncard := by
362     rw [hmax]
363     exact Submodule.spanFinrank_span_le_ncard_of_finite
364       (((hTfin.sdiff).image _).image _)
365   have h2 : ((Ideal.Quotient.mk (Ideal.span {x})) '' (Subtype.val '' (T \ {σ v}))).ncard ≤
366       (T \ {σ v}).ncard :=
367     (Set.ncard_image_le ((hTfin.sdiff).image _)).trans (Set.ncard_image_le hTfin.sdiff)
368   have h3 : (T \ {σ v}).ncard + 1 = T.ncard := Set.ncard_sdiff_singleton_add_one hσvT hTfin
369   have h4 : T.ncard ≤ S.ncard := Set.ncard_image_le hSfin
370   omega
371 
372 /-- **A regular local ring is a domain.** If `𝔪` is generated by at most `dim R` elements,
373 then `R` is a domain.  Induction on the number of generators: choose `x ∈ 𝔪` outside `𝔪²`
374 and outside the minimal primes; `R/(x)` is again regular, hence a domain, so `(x)` is prime;
375 a minimal prime `𝔮 ⊆ (x)` satisfies `𝔮 = x𝔮`, so `𝔮 = 0` by Nakayama. -/
376 theorem isDomain_of_spanFinrank_maximalIdeal_le :
377     ∀ (μ : ℕ) (R : Type u) [CommRing R] [IsLocalRing R] [IsNoetherianRing R],
378       (maximalIdeal R).spanFinrank = μ → (μ : WithBot ℕ∞) ≤ ringKrullDim R → IsDomain R := by
379   intro μ
380   induction μ using Nat.strong_induction_on with
381   | _ μ ih =>
382   intro R _ _ _ hμ hdim
383   set 𝔪 := maximalIdeal R
384   have hfg : 𝔪.FG := IsNoetherian.noetherian 𝔪
385   have hjac : 𝔪 ≤ (⊥ : Ideal R).jacobson := (IsLocalRing.jacobson_eq_maximalIdeal ⊥ bot_ne_top).ge
386   rcases Nat.eq_zero_or_pos μ with h0 | hpos
387   · have hbot : 𝔪 = ⊥ := (Submodule.spanFinrank_eq_zero_iff_eq_bot hfg).1 (hμ.trans h0)
388     exact (IsLocalRing.isField_iff_maximalIdeal_eq.2 hbot).isDomain
389   -- `𝔪 ⊄ 𝔪²`
390   have hm2 : ¬ 𝔪 ≤ 𝔪 ^ 2 := by
391     intro h
392     have : 𝔪 = ⊥ := Submodule.eq_bot_of_le_smul_of_le_jacobson_bot 𝔪 𝔪 hfg
393       (by rw [smul_eq_mul, ← pow_two]; exact h) hjac
394     rw [this, Submodule.spanFinrank_bot] at hμ
395     omega
396   -- `𝔪` is not a minimal prime
397   have hdimpos : (0 : WithBot ℕ∞) < ringKrullDim R :=
398     lt_of_lt_of_le (by exact_mod_cast hpos) hdim
399   have hmin : ∀ q ∈ minimalPrimes R, ¬ 𝔪 ≤ q := by
400     intro q hq hle
401     have hqp : q.IsPrime := hq.1.1
402     have heq : q = 𝔪 := (IsLocalRing.le_maximalIdeal hqp.ne_top).antisymm hle
403     have h0 : 𝔪.height = 0 := Ideal.height_eq_zero_iff.2 (heq ▸ hq)
404     rw [← IsLocalRing.maximalIdeal_height_eq_ringKrullDim, h0] at hdimpos
405     exact lt_irrefl _ hdimpos
406   -- prime avoidance
407   have hfin : (minimalPrimes R).Finite := minimalPrimes.finite_of_isNoetherianRing R
408   let s : Finset (Ideal R) := insert (𝔪 ^ 2) hfin.toFinset
409   have hp : ∀ i ∈ s, i ≠ 𝔪 ^ 2 → i ≠ 𝔪 ^ 2 → (id i).IsPrime := by
410     intro i hi hia _
411     rcases Finset.mem_insert.1 hi with rfl | hi
412     · exact absurd rfl hia
413     · exact (hfin.mem_toFinset.1 hi).1.1
414   have hnot := (Ideal.subset_union_prime (s := s) (f := id) (𝔪 ^ 2) (𝔪 ^ 2) hp (I := 𝔪)).not.2
415     (by
416       rintro ⟨i, hi, hle⟩
417       rcases Finset.mem_insert.1 hi with rfl | hi
418       · exact hm2 hle
419       · exact hmin i (hfin.mem_toFinset.1 hi) hle)
420   obtain ⟨x, hx𝔪, hxU⟩ := Set.not_subset.1 hnot
421   have hx2 : x ∉ 𝔪 ^ 2 := fun h ↦ hxU (Set.mem_biUnion (Finset.mem_coe.2
422     (Finset.mem_insert_self _ _)) h)
423   have hxq : ∀ q ∈ minimalPrimes R, x ∉ q := fun q hq h ↦ hxU (Set.mem_biUnion
424     (Finset.mem_coe.2 (Finset.mem_insert_of_mem (hfin.mem_toFinset.2 hq))) h)
425   -- `R/(x)` is regular of smaller embedding dimension
426   have hne : Ideal.span {x} ≠ ⊤ := by
427     rw [Ne, Ideal.span_singleton_eq_top]
428     exact (IsLocalRing.mem_maximalIdeal x).1 hx𝔪
429   have : Nontrivial (R ⧸ Ideal.span {x}) := Ideal.Quotient.nontrivial_iff.2 hne
430   have : IsLocalRing (R ⧸ Ideal.span {x}) :=
431     IsLocalRing.of_surjective' (Ideal.Quotient.mk _) Ideal.Quotient.mk_surjective
432   have hμ' := spanFinrank_maximalIdeal_quotient_add_one_le hx𝔪 hx2
433   have hdim' : ringKrullDim R ≤ ringKrullDim (R ⧸ Ideal.span {x}) + 1 := by
434     rw [← IsLocalRing.maximalIdeal_height_eq_ringKrullDim]
435     exact Ideal.height_le_ringKrullDim_quotient_add_one hx𝔪
436   set μ' := (maximalIdeal (R ⧸ Ideal.span {x})).spanFinrank
437   have hle : (μ' : WithBot ℕ∞) ≤ ringKrullDim (R ⧸ Ideal.span {x}) := by
438     have h1 : ((μ' + 1 : ℕ) : WithBot ℕ∞) ≤ ringKrullDim (R ⧸ Ideal.span {x}) + 1 :=
439       le_trans (by exact_mod_cast hμ ▸ hμ') (hdim.trans hdim')
440     push_cast at h1
441     exact withBot_natCast_le_of_add_one_le h1
442   have hμlt : μ' < μ := by
443     have h := hμ'
444     rw [show maximalIdeal R = 𝔪 from rfl, hμ] at h
445     omega
446   have hdom := ih μ' hμlt (R ⧸ Ideal.span {x}) rfl hle
447   have hprime : (Ideal.span {x}).IsPrime := (Ideal.Quotient.isDomain_iff_prime _).1 hdom
448   -- a minimal prime inside `(x)` is zero
449   obtain ⟨q, hq, hqx⟩ := Ideal.exists_minimalPrimes_le (bot_le : (⊥ : Ideal R) ≤ Ideal.span {x})
450   have hqp : q.IsPrime := hq.1.1
451   have hxq' : x ∉ q := hxq q hq
452   have hqle : q ≤ Ideal.span {x} • q := by
453     intro a ha
454     obtain ⟨c, rfl⟩ := Ideal.mem_span_singleton'.1 (hqx ha)
455     have hc : c ∈ q := (hqp.mem_or_mem ha).resolve_right hxq'
456     rw [mul_comm]
457     exact Submodule.smul_mem_smul (Ideal.mem_span_singleton_self x) hc
458   have hq0 : q = ⊥ := Submodule.eq_bot_of_le_smul_of_le_jacobson_bot _ q
459     (IsNoetherian.noetherian q) hqle
460     (le_trans (Ideal.span_le.2 (Set.singleton_subset_iff.2 hx𝔪)) hjac)
461   have hbot : (⊥ : Ideal R).IsPrime := hq0 ▸ hqp
462   have : IsDomain (R ⧸ (⊥ : Ideal R)) := (Ideal.Quotient.isDomain_iff_prime _).2 hbot
463   exact (RingEquiv.quotientBot R).toMulEquiv.isDomain_iff.1 this
464 
465 end Regular
466 
467 end
468 
469 #print axioms trdeg_quotient_lt
470 #print axioms trdeg_quotient_le
471 #print axioms trdeg_fractionRing
472 #print axioms trdeg_quotient_toNat_lt
473 #print axioms partialEval_comp
474 #print axioms ker_partialEval_mono
475 #print axioms ker_partialEval_lt
476 #print axioms ker_partialEval_zero
477 #print axioms ker_partialEval_self
478 #print axioms isPrime_ker_partialEval
479 #print axioms partialEvalChain_head
480 #print axioms partialEvalChain_last
481 #print axioms le_height_ker_aeval
482 #print axioms ringKrullDim_le_trdeg
483 #print axioms trdeg_le_ringKrullDim
484 #print axioms ringKrullDim_eq_trdeg
485 #print axioms withBot_natCast_le_of_add_one_le
486 #print axioms spanFinrank_maximalIdeal_quotient_add_one_le
487 #print axioms isDomain_of_spanFinrank_maximalIdeal_le
488 
489 end Stafford38.Paper.Support
490