|
| 1 | +/- |
| 2 | +Copyright (c) 2026 Vlad Tsyrklevich. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Vlad Tsyrklevich |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.RingTheory.Ideal.KrullsHeightTheorem |
| 9 | +public import Mathlib.RingTheory.MvPolynomial.Ideal |
| 10 | + |
| 11 | +/-! |
| 12 | +# Height of polynomial ideals |
| 13 | +
|
| 14 | +This file computes the height of the ideal generated by an arbitrary set of variables `(Xₛ, ...)` |
| 15 | +in the polynomial ring `R[X₁, ..., Xₙ]`. |
| 16 | +-/ |
| 17 | + |
| 18 | +public section |
| 19 | + |
| 20 | +namespace MvPolynomial |
| 21 | + |
| 22 | +variable {σ R : Type*} [CommRing R] |
| 23 | + |
| 24 | +private theorem le_height_span_X_image_of_isDomain [IsDomain R] (s : Set σ) : |
| 25 | + s.encard ≤ (Ideal.span (X (R := R) '' s)).height := by |
| 26 | + refine ENat.forall_natCast_le_iff_le.mp fun n hn ↦ ?_ |
| 27 | + induction n generalizing s with |
| 28 | + | zero => simp |
| 29 | + | succ n ih => |
| 30 | + by_cases! he : IsEmpty s |
| 31 | + · simp_all |
| 32 | + obtain ⟨x, hx⟩ := he |
| 33 | + have := ih (s \ {x}) (by grw [← Set.encard_tsub_one_le_encard_sdiff_singleton, ← hn]; norm_cast) |
| 34 | + push_cast |
| 35 | + grw [this] |
| 36 | + have := span_X_image_isPrime (R := R) (σ := σ) |
| 37 | + refine Ideal.height_add_one_le_of_lt_of_isPrime <| lt_iff_le_and_ne'.mpr ⟨?_, ?_⟩ |
| 38 | + · exact Ideal.span_mono (by grind) |
| 39 | + · exact ne_of_mem_of_not_mem' (a := X x) (by simp [hx]) (by simp) |
| 40 | + |
| 41 | +theorem le_height_span_X_image (s : Set σ) : |
| 42 | + s.encard ≤ (Ideal.span (X (R := R) '' s)).height := by |
| 43 | + rw [Ideal.height_eq_inf_minimalPrimes] |
| 44 | + refine le_iInf₂ fun I hI ↦ ?_ |
| 45 | + let π := MvPolynomial.map (σ := σ) (Ideal.Quotient.mk (Ideal.comap C I)) |
| 46 | + have h₁ : (Ideal.map π I).height ≤ I.height := by |
| 47 | + have : Function.Surjective π := MvPolynomial.map_surjective _ Ideal.Quotient.mk_surjective |
| 48 | + grw [RingHom.height_le_height_comap_of_surjective this, Ideal.comap_map_of_surjective _ this] |
| 49 | + simp [π, ← RingHom.ker_eq_comap_bot, ker_map, Ideal.map_comap_le] |
| 50 | + have h₂ : Ideal.span (X '' s) ≤ Ideal.map π I := by |
| 51 | + grw [← Ideal.map_mono hI.1.2, Ideal.map_span, Ideal.span_mono] |
| 52 | + rintro x ⟨y, hy₁, hy₂⟩ |
| 53 | + simpa using ⟨y, hy₁, hy₂ ▸ map_X _ y⟩ |
| 54 | + have := hI.1.1 |
| 55 | + grw [← h₁, ← Ideal.height_mono h₂, ← le_height_span_X_image_of_isDomain] |
| 56 | + |
| 57 | +theorem height_span_X_image_eq [Nontrivial R] [IsNoetherianRing R] [Finite σ] (s : Set σ) : |
| 58 | + (Ideal.span (X (R := R) '' s)).height = s.encard := by |
| 59 | + refine le_antisymm ?_ (le_height_span_X_image ..) |
| 60 | + grw [Ideal.height_span_le_encard_of_span_ne_top, Set.encard_image_le] |
| 61 | + exact (Ideal.ne_top_iff_one _).mpr (by simp [mem_ideal_span_X_image]) |
| 62 | + |
| 63 | +end MvPolynomial |
0 commit comments