/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file has been modified. -/ import OAI.AlgebraicGeometry.Cycle.ComponentLocalGenerator import OAI.AlgebraicGeometry.Cycle.ComponentDimension import OAI.AlgebraicGeometry.Smooth.DimensionFormula import OAI.AlgebraicGeometry.Smooth.PointwiseDimension import OAI.Algebra.Foundations.PolynomialCatenaryT import OAI.AlgebraicGeometry.Cycle.ComponentNormal import OAI.AlgebraicGeometry.Smooth.CatenaryDimension import Mathlib.RingTheory.IntegralClosure.GoingDown import Mathlib.RingTheory.KrullDimension.Field import Mathlib.RingTheory.KrullDimension.Polynomial import Mathlib.RingTheory.NoetherNormalization import Mathlib.RingTheory.Polynomial.RationalRoot import Mathlib.RingTheory.Polynomial.UniqueFactorization /-! # Component Closed Point Dimension -/ namespace OAI.AlgebraicGeometry.Cycle.ComponentClosedPointDimension noncomputable section open _root_.Algebra open _root_.AlgebraicGeometry open _root_.RingHom /-! # Dimensions at closed points of cycle components This file proves that every closed point of the reduced closure of a codimension-`p` point in a smooth complex `d`-fold has coheight `d - p`. The commutative-algebra input is the equidimensionality of a finite-type domain over a field: every maximal ideal has height equal to the ring's Krull dimension. It is proved directly from Noether normalization, incomparability, and going down. The closed-point formula removes the small-dimensional restriction from the separate component and ambient coordinate package and from the resulting component-local fundamental-class generator. The two coordinate systems remain independent of one another; a simultaneous normal form for the closed immersion is a separate statement. -/ open _root_.CategoryTheory _root_.Ideal _root_.MvPolynomial _root_.Topology _root_.TopologicalSpace namespace Algebra variable {k A : Type*} [Field k] [CommRing A] [IsDomain A] [Algebra k A] [Algebra.FiniteType k A] include k /-- Every maximal ideal of a finite-type domain over a field has height equal to the Krull dimension of the domain. -/ lemma FiniteType.height_eq_ringKrullDim_of_isMaximal (P : Ideal A) [P.IsMaximal] : (↑P.height : WithBot ℕ∞) = ringKrullDim A := by obtain ⟨n, g, hg, hfinite⟩ := exists_finite_inj_algHom_of_fg k A let : Algebra (MvPolynomial (Fin n) k) A := g.toAlgebra let : FaithfulSMul (MvPolynomial (Fin n) k) A := (faithfulSMul_iff_algebraMap_injective _ _).mpr hg let : Algebra.IsIntegral (MvPolynomial (Fin n) k) A := ⟨hfinite.to_isIntegral⟩ have hheight : P.height = (P.under (MvPolynomial (Fin n) k)).height := by calc P.height = Order.height (⟨P, inferInstance⟩ : PrimeSpectrum A) := by change (⟨P, inferInstance⟩ : PrimeSpectrum A).asIdeal.height = Order.height (⟨P, inferInstance⟩ : PrimeSpectrum A) exact PrimeSpectrum.height_eq_orderHeight _ _ = Order.height (PrimeSpectrum.comap (algebraMap (MvPolynomial (Fin n) k) A) (⟨P, inferInstance⟩ : PrimeSpectrum A)) := by apply Order.height_eq_of_strictMono (PrimeSpectrum.comap (algebraMap (MvPolynomial (Fin n) k) A)) (fun _ _ hQQ' ↦ Ideal.IsIntegral.under_lt_under hQQ') intro Q q hq have hq' : q.asIdeal < Q.asIdeal.under (MvPolynomial (Fin n) k) := by change q.asIdeal < (PrimeSpectrum.comap (algebraMap (MvPolynomial (Fin n) k) A) Q).asIdeal at hq simpa only [PrimeSpectrum.comap_asIdeal] using hq obtain ⟨Q', hQ'Q, hQ'prime, hQ'over⟩ := Q.asIdeal.exists_ideal_lt_liesOver_of_lt (R := MvPolynomial (Fin n) k) (p := q.asIdeal) (q := Q.asIdeal.under (MvPolynomial (Fin n) k)) hq' refine ⟨⟨Q', hQ'prime⟩, hQ'Q, ?_⟩ apply PrimeSpectrum.ext simpa [Ideal.under] using hQ'over.over.symm _ = (P.under (MvPolynomial (Fin n) k)).height := by rw [show P.under (MvPolynomial (Fin n) k) = (PrimeSpectrum.comap (algebraMap (MvPolynomial (Fin n) k) A) (⟨P, inferInstance⟩ : PrimeSpectrum A)).asIdeal from rfl] exact (PrimeSpectrum.height_eq_orderHeight _).symm rw [OAI.Algebra.Foundations.PolynomialCatenaryT.PolynomialCatenary.ringKrullDim_eq_of_isIntegral_of_injective hg, MvPolynomial.ringKrullDim_of_isNoetherianRing, ringKrullDim_eq_zero_of_field, ENat.card_eq_coe_fintype_card, Fintype.card_fin, hheight, OAI.Algebra.RingTheory.SmoothKrullDimension.MvPolynomial.height_eq_fin_of_isMaximal k n (P.under (MvPolynomial (Fin n) k))] norm_num end Algebra namespace RingHom /-- The quotient by a prime of height `p` in a standard-smooth complex algebra of relative dimension `d` has Krull dimension `d - p`. -/ lemma IsStandardSmoothOfRelativeDimension.ringKrullDim_quotient_eq_sub_complex {A : Type} [CommRing A] {f : ℂ →+* A} {d p : ℕ} (hf : f.IsStandardSmoothOfRelativeDimension d) (P : Ideal A) [P.IsPrime] (hP : P.height = p) : ringKrullDim (A ⧸ P) = d - p := by have hsum := (AlgebraicGeometry.Smooth.CatenaryDimension.RingHom.IsStandardSmoothOfRelativeDimension.height_add_ringKrullDim_quotient_eq_complex hf) P rw [hP] at hsum obtain ⟨a, b, ha, hb, hab⟩ := WithBot.add_eq_coe.mp hsum have ha' : a = (p : ℕ∞) := WithBot.coe_injective ha subst a have hbtop : b ≠ ⊤ := by intro htop rw [htop, add_top] at hab exact ENat.top_ne_natCast d hab lift b to ℕ using hbtop with n have hpn : p + n = d := by exact_mod_cast hab rw [← hb, WithBot.coe_natCast] congr lia end RingHom attribute [local instance] AlgebraicGeometry.Over.Basic.overSpecAlgebra variable (X : Over (Spec ↧ℂ)) {d p : ℕ} /-- Every closed point of the reduced closure of a codimension-`p` point in a smooth complex `d`-fold has coheight `d - p` inside that reduced closure. -/ lemma cycleComponent_closedPoint_coheight_eq_sub [IsIntegral X.left] [Smooth X.hom] [Foundations.ProjectiveSpaceIs.IsProjective X.hom] (x : X.left) (z : Support.cycleComponent X.left x) [SmoothOfRelativeDimension d X.hom] (hx : Order.coheight x = p) (hz : IsClosed {z}) : Order.coheight z = d - p := by let c : Support.cycleComponent X.left x ⟶ X.left := Support.cycleComponentι X.left x let y : X.left := c z have hyx : y ≤ x := (ComponentDimension.cycleComponentOrderIsoIic X.left x z).2 obtain ⟨U, hU, hyU, hstandard⟩ := ComplexPoint.SmoothCoordinates.SmoothOfRelativeDimension.exists_affine_isStandardSmoothOfRelativeDimension (d := d) X.hom y have hxU : x ∈ U := by rw [Scheme.le_iff_specializes] at hyx exact hyx.mem_open U.isOpen hyU let W : (Support.cycleComponent X.left x).Opens := c ⁻¹ᵁ U have hW : IsAffineOpen W := hU.preimage c have hzW : z ∈ W := hyU let : Nonempty W := ⟨⟨z, hzW⟩⟩ let xu : U.toScheme := ⟨x, hxU⟩ let zw : W.toScheme := ⟨z, hzW⟩ let q : Γ(X.left, U) →+* Γ(Support.cycleComponent X.left x, W) := (c.app U).hom have hqsurj : Function.Surjective q := c.app_surjective U hU let P : Ideal Γ(X.left, U) := (hU.primeIdealOf xu).asIdeal let I := Scheme.IdealSheafData.vanishingIdeal (X := X.left) ⟨closure {x}, isClosed_closure⟩ have hsingleton : hU.fromSpec ⁻¹' ({x} : Set X.left) = ({hU.primeIdealOf xu} : Set (Spec Γ(X.left, U))) := by ext Q simp only [Set.mem_preimage, Set.mem_singleton_iff] refine ⟨fun hQ ↦ hU.fromSpec.isOpenEmbedding.injective (hQ.trans (hU.fromSpec_primeIdealOf xu).symm), ?_⟩ rintro rfl exact hU.fromSpec_primeIdealOf xu have hpreimage : hU.fromSpec ⁻¹' closure {x} = closure {hU.primeIdealOf xu} := by have hclosure := congrArg (fun T : Set (Spec Γ(X.left, U)) ↦ closure T) hsingleton exact (hU.fromSpec.isOpenEmbedding.isOpenMap.preimage_closure_eq_closure_preimage hU.fromSpec.continuous ({x} : Set X.left)).trans hclosure have hideal : I.ideal ⟨U, hU⟩ = P := by change PrimeSpectrum.vanishingIdeal (hU.fromSpec ⁻¹' closure {x}) = P erw [hpreimage, PrimeSpectrum.vanishingIdeal_closure, PrimeSpectrum.vanishingIdeal_singleton] have hqker : RingHom.ker q = P := by change RingHom.ker (c.app U).hom = P rw [← Scheme.Hom.ker_apply c ⟨U, hU⟩] calc c.ker.ideal ⟨U, hU⟩ = I.ideal ⟨U, hU⟩ := by rw [show c = I.subschemeι from rfl] exact congrArg (fun J : X.left.IdealSheafData ↦ J.ideal ⟨U, hU⟩) I.ker_subschemeι _ = P := hideal have hPheight : P.height = p := by calc P.height = Order.coheight xu := by change (hU.primeIdealOf xu).asIdeal.height = Order.coheight xu exact (AlgebraicGeometry.Smooth.PointwiseDimension.IsAffineOpen.primeIdealOf_height_eq_coheight hU) _ _ = Order.coheight x := by have h := coheight_eq_of_isOpenImmersion (x := xu) U.ι simpa [xu] using h.symm _ = p := hx have hquotient : ringKrullDim (Γ(X.left, U) ⧸ P) = d - p := (ComponentClosedPointDimension.RingHom.IsStandardSmoothOfRelativeDimension.ringKrullDim_quotient_eq_sub_complex (ComplexPoint.SmoothCoordinates.algebraMap_isStandardSmoothOfRelativeDimension (d := d) X hstandard)) P hPheight have hringW : ringKrullDim Γ(Support.cycleComponent X.left x, W) = d - p := by calc ringKrullDim Γ(Support.cycleComponent X.left x, W) = ringKrullDim (Γ(X.left, U) ⧸ RingHom.ker q) := (ringKrullDim_eq_of_ringEquiv (RingHom.quotientKerEquivOfSurjective hqsurj)).symm _ = ringKrullDim (Γ(X.left, U) ⧸ P) := by rw [hqker] _ = d - p := hquotient let s : Support.cycleComponent X.left x ⟶ Spec ↧ℂ := c ≫ X.hom let : Algebra ℂ Γ(Support.cycleComponent X.left x, W) := AlgebraicGeometry.Over.Basic.overSpecAlgebra (Over.mk s) W let : Algebra.FiniteType ℂ Γ(Support.cycleComponent X.left x, W) := by rw [← RingHom.finiteType_algebraMap] change (algebraMap ℂ Γ(Support.cycleComponent X.left x, W)).FiniteType apply (s.finiteType_appLE (isAffineOpen_top (Spec ↧ℂ)) hW (by simp)).comp exact RingHom.FiniteType.of_surjective _ (Scheme.ΓSpecIso ↧ℂ).symm.commRingCatIsoToRingEquiv.surjective let Q : Ideal Γ(Support.cycleComponent X.left x, W) := (hW.primeIdealOf zw).asIdeal have hQmax : Q.IsMaximal := hW.primeIdealOf_isMaximal_of_isClosed zw hz have hQheight : (↑Q.height : WithBot ℕ∞) = d - p := by rw [ComponentClosedPointDimension.Algebra.FiniteType.height_eq_ringKrullDim_of_isMaximal (k := ℂ) Q, hringW] have hQcoheight : Q.height = Order.coheight z := by calc Q.height = Order.coheight zw := by change (hW.primeIdealOf zw).asIdeal.height = Order.coheight zw exact (AlgebraicGeometry.Smooth.PointwiseDimension.IsAffineOpen.primeIdealOf_height_eq_coheight hW) _ _ = Order.coheight z := by have h := coheight_eq_of_isOpenImmersion (x := zw) W.ι simpa [zw] using h.symm apply WithBot.coe_injective rw [← hQcoheight] exact hQheight end end OAI.AlgebraicGeometry.Cycle.ComponentClosedPointDimension