Stafford38/Geometry/ActualSameWitnessDivisorNumerator.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.CenterNumeratorFromHeight
3 public import Stafford38.Geometry.ActualOptionColumnBinding
4 public import Stafford38.Geometry.ActualChartNormalizationCenter
5 public import Stafford38.Geometry.LocalNormalizationCenterEquivalence
6 public import Stafford38.Geometry.IntegralClosureCenterDVR
7 public import Stafford38.Geometry.ProjectiveChartNormalizationFinite
8 public import Stafford38.Geometry.ActualSelectedResidueBasis
9 public import Mathlib.RingTheory.IntegralClosure.IntegrallyClosed
10 
11 @[expose] public section
12 
13 set_option autoImplicit false
14 set_option maxHeartbeats 4000000
15 set_option synthInstance.maxHeartbeats 600000
16 set_option linter.style.haveILetI false
17 
18 noncomputable section
19 
20 namespace Stafford38.Geometry.ActualSameWitnessDivisorNumerator
21 
22 open IsLocalRing
23 open Stafford38.Geometry.AsymptoticDivisorExistence
24 open Stafford38.Geometry.AsymptoticChartArcAdapter
25 open Stafford38.Geometry.ComponentProjectiveClosure
26 open Stafford38.Geometry.ComponentProjectiveChartKernel
27 open Stafford38.Geometry.ComponentFunctionFieldBoundary
28 open Stafford38.Geometry.ChartGenericPointFractionRing
29 open Stafford38.Geometry.GeneralDivisorialVisibleFrame
30 open Stafford38.Geometry.ProjectiveChartNormalizationCenter
31 open Stafford38.Geometry.RelativeCoefficientDVR
32 open Stafford38.Geometry.RelativeRetainedBoundaryPlace
33 open Stafford38.Geometry.RetainedGroundMapIdentification
34 
35 universe u
36 
37 /-- The output data for the actual same-witness construction. The nested lets
38 are retained here so the proposition names exactly the canonical chart,
39 normalization, and center used by the existing owners. -/
40 noncomputable def actualParameterOutput
41     {k : Type u} [Field k] [CharZero k]
42     {m : ℕ} (hm : 0 < m)
43     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
44     (w : GeneralDivisorialVisibleFrameWitness hm P) : Prop := by
45   let C := w.column
46   let W := C.W
47   let F := ComponentFractionField P
48   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
49   let U := W.place.valuation
50   let V := U.toSubring
51   letI : IsDiscreteValuationRing V := W.place.isDiscrete
52   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
53   letI : Algebra W.coefficientField V :=
54     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
55   letI : Algebra k V := C.groundCoeff.toAlgebra
56   letI : Algebra V F := V.subtype.toAlgebra
57   letI : IsScalarTower k V F := C.groundTower
58   let κ := ResidueField V
59   let retained := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
60   letI : Algebra k κ := retained
61   have hretainedMap : @algebraMap k κ _ _ retained =
62       (residue V).comp C.groundCoeff := by
63     simpa [C, W, V, κ, C.groundCoeff_eq_retained] using w.retainedGroundMap
64   letI : IsScalarTower k V κ := by
65     exact IsScalarTower.of_algebraMap_eq fun c => by
66       have h := RingHom.congr_fun hretainedMap c
67       change algebraMap k κ c = residue V (C.groundCoeff c)
68       exact h
69   let eChart := chartAffineCoordinateEquiv C.chart
70   let Q : Subalgebra k F := Algebra.adjoin k (Set.range (chartGenericPoint P C.chart eChart))
71   let hQV : Q.toSubring ≤ V := by
72     intro z hz
73     exact Stafford38.Geometry.ActualChartValuationImage.chartGenericPointSubalgebra_le_valuationSubring
74       hm P w z hz
75   let B := integralClosure Q.toSubring F
76   let S := B.toSubring
77   let center := integralClosureCenter Q.toSubring U hQV
78   let eB := ActualChartNormalizationCenter.subalgebraToSubringRingEquiv B
79   let centerB := center.comap (eB : B →+* S)
80   letI : center.IsPrime := integralClosureCenter_isPrime Q.toSubring U hQV
81   letI : centerB.IsPrime := Ideal.IsPrime.comap (eB : B →+* S)
82   exact ∀ (t : Set κ), t.Finite →
83       IsTranscendenceBasis k ((↑) : t → κ) →
84       ∀ (index : t → Fin m), Function.Injective index →
85         (∀ z : t, IsLocalRing.residue V (C.q (eChart (index z)).1) = (z : κ)) →
86           ∃ (e : Localization.AtPrime centerB ≃+* V) (s : B)
87             (den : centerB.primeCompl) (u₀ u₁ : Localization.AtPrime centerB),
88             (∀ b : B, ((e (algebraMap B _ b) : V) : F) = (b : F)) ∧
89             s ≠ 0 ∧ s ∈ centerB ∧
90             IsLocalization.mk' _ s den = e.symm
91               (Stafford38.Geometry.CompletedDVRPowerSeries.chosenUniformizer V) ∧
92             Ideal.span {algebraMap B (Localization.AtPrime centerB) s} =
93               maximalIdeal (Localization.AtPrime centerB) ∧
94             IsUnit u₀ ∧ IsUnit u₁ ∧
95             algebraMap B (Localization.AtPrime centerB)
96                 (ActualOptionColumnBinding.actualNormalizedProjectiveColumnInIntegralClosure hm P w 0) =
97               (algebraMap B _ s) ^ w.differential.core.D.a * u₀ ∧
98             algebraMap B (Localization.AtPrime centerB)
99                 (ActualOptionColumnBinding.actualNormalizedProjectiveColumnInIntegralClosure hm P w
100                   (Fin.succ ⟨0, hm⟩)) =
101               (algebraMap B _ s) ^ (w.differential.core.D.a + w.differential.core.D.e) * u₁
102 
103 /-- The actual selected residue basis determines one normalization-center
104 localization, one numerator, and both retained coordinate order
105 factorizations. -/
106 theorem exists_actual_parameter_with_retained_orders
107     {k : Type u} [Field k] [CharZero k]
108     {m : ℕ} (hm : 0 < m)
109     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
110     (w : GeneralDivisorialVisibleFrameWitness hm P) :
111   actualParameterOutput hm P w := by
112   classical
113   unfold actualParameterOutput
114   intro _Cpre _Wpre _Fpre _valuationPre _Vpre _κpre _retainedAlgebraPre
115     _retainedMapPre _eChartPre _Qpre _hQVpre _Bpre _Spre _centerPre _eBPre
116     _centerBPre t htFinite htBasis index hindex hres
117   let C := w.column
118   let W := C.W
119   let F := ComponentFractionField P
120   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
121   let U := W.place.valuation
122   let V := U.toSubring
123   letI : IsDiscreteValuationRing V := W.place.isDiscrete
124   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
125   letI : Algebra W.coefficientField V :=
126     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
127   letI : Algebra k V := C.groundCoeff.toAlgebra
128   letI : Algebra V F := V.subtype.toAlgebra
129   letI : IsScalarTower k V F := C.groundTower
130   let κ := ResidueField V
131   let retained := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
132   letI : Algebra k κ := retained
133   let eChart := chartAffineCoordinateEquiv C.chart
134   let Q : Subalgebra k F := Algebra.adjoin k (Set.range (chartGenericPoint P C.chart eChart))
135   have hQV : Q.toSubring ≤ V := by
136     intro z hz
137     exact Stafford38.Geometry.ActualChartValuationImage.chartGenericPointSubalgebra_le_valuationSubring
138       hm P w z hz
139   let B := integralClosure Q.toSubring F
140   let S := B.toSubring
141   let center := integralClosureCenter Q.toSubring U hQV
142   let eB := ActualChartNormalizationCenter.subalgebraToSubringRingEquiv B
143   let centerB := center.comap (eB : B →+* S)
144   letI : center.IsPrime := integralClosureCenter_isPrime Q.toSubring U hQV
145   letI : centerB.IsPrime := Ideal.IsPrime.comap (eB : B →+* S)
146   have hchartPoint : componentProjectivePoint P C.chart ≠ 0 := by
147     intro hz
148     have hq := C.q_commonScale C.chart
149     change (C.q C.chart : F) = C.scale * componentProjectivePoint P C.chart at hq
150     have hq1 : (C.q C.chart : F) = 1 := congrArg Subtype.val C.chart_one
151     rw [hz, mul_zero, hq1] at hq
152     exact one_ne_zero hq
153   letI : Algebra Q.toSubring F := Q.toSubring.subtype.toAlgebra
154   have hQfrac : IsFractionRing Q.toSubring F := by
155     let hQ : IsFractionRing Q F :=
156       chartGenericPointSubalgebra_isFractionRing P C.chart eChart hchartPoint
157     letI : IsFractionRing Q F := hQ
158     letI : FaithfulSMul Q.toSubring F :=
159       (faithfulSMul_iff_algebraMap_injective Q.toSubring F).mpr Subtype.val_injective
160     apply IsFractionRing.of_field Q.toSubring F
161     intro z
162     obtain ⟨a, b, hb, hz⟩ := IsFractionRing.div_surjective Q z
163     let eqv := ActualChartNormalizationCenter.subalgebraToSubringRingEquiv Q
164     refine ⟨eqv a, eqv b, ?_⟩
165     change z = (eqv a : F) / (eqv b : F)
166     calc
167       z = (a : F) / (b : F) := hz.symm
168       _ = (eqv a : F) / (eqv b : F) := by rfl
169   letI : IsFractionRing Q.toSubring F := hQfrac
170   letI : Algebra k Q.toSubring := Q.algebra
171   letI : IsScalarTower k Q.toSubring F := IsScalarTower.of_algebraMap_eq fun _ => rfl
172   have hQfinite : Algebra.FiniteType k Q.toSubring := by
173     change Algebra.FiniteType k Q
174     exact chartGenericPointSubalgebra_finiteType P C.chart eChart
175   letI : Algebra k B := Algebra.compHom B (algebraMap k Q.toSubring)
176   letI : IsScalarTower k Q.toSubring B := IsScalarTower.of_algebraMap_eq fun _ => rfl
177   have hBfinite : Algebra.FiniteType k B :=
178     Stafford38.Geometry.ProjectiveChartNormalizationFinite.integralClosure_finiteType_over_base
179       k Q.toSubring F
180   letI : Algebra k S := ((eB : B →+* S).comp (algebraMap k B)).toAlgebra
181   let eBAlg : B ≃ₐ[k] S := AlgEquiv.ofRingEquiv (f := eB) (by intro c; rfl)
182   letI : Algebra.FiniteType k B := hBfinite
183   letI : Algebra.FiniteType k S :=
184     Algebra.FiniteType.of_surjective eBAlg.toAlgHom eBAlg.surjective
185   letI : IsNoetherianRing S := Algebra.FiniteType.isNoetherianRing k S
186   letI : Algebra S F := S.subtype.toAlgebra
187   letI : FaithfulSMul S F :=
188     (faithfulSMul_iff_algebraMap_injective S F).mpr Subtype.val_injective
189   letI : IsIntegrallyClosedIn S F := by
190     change IsIntegrallyClosedIn (integralClosure Q.toSubring F).toSubring F
191     infer_instance
192   letI : IsIntegrallyClosed S := IsIntegrallyClosed.of_isIntegrallyClosedIn S F
193   letI : IsFractionRing S F :=
194     Stafford38.Geometry.IntegralClosureCenterDVR.integralClosure_isFractionRing Q.toSubring
195   letI : IsFractionRing (integralClosure Q.toSubring F).toSubring F :=
196     Stafford38.Geometry.IntegralClosureCenterDVR.integralClosure_isFractionRing Q.toSubring
197   have hcenterPrime : center.IsPrime := integralClosureCenter_isPrime Q.toSubring U hQV
198   have hheight := ActualChartNormalizationCenter.actual_chart_normalization_center_height_one_of_selected_basis
199     hm P w t htFinite htBasis index hindex hres
200   have hNoethCanonical : IsNoetherianRing (integralClosure Q.toSubring F).toSubring := by
201     change IsNoetherianRing S
202     infer_instance
203   have hIntegrallyClosedCanonical :
204       IsIntegrallyClosed (integralClosure Q.toSubring F).toSubring := by
205     change IsIntegrallyClosed S
206     infer_instance
207   have hFractionRingCanonical :
208       IsFractionRing (integralClosure Q.toSubring F).toSubring F :=
209     Stafford38.Geometry.IntegralClosureCenterDVR.integralClosure_isFractionRing Q.toSubring
210   obtain ⟨eC, heC⟩ :=
211     @Stafford38.Geometry.LocalNormalizationCenterEquivalence.exists_localization_equiv_of_height_one
212       F inferInstance Q.toSubring U hQV hNoethCanonical hIntegrallyClosedCanonical
213       hFractionRingCanonical hcenterPrime hheight
214   let qB : Fin (m + 1) → B :=
215     ActualOptionColumnBinding.actualNormalizedProjectiveColumnInIntegralClosure hm P w
216   obtain ⟨_hchart, hqB, _hrows⟩ :=
217     ActualOptionColumnBinding.actualNormalizedProjectiveColumnInIntegralClosure_spec hm P w
218   have hq0 : eC (algebraMap S (Localization.AtPrime center) (eB (qB 0))) = C.q 0 := by
219     apply Subtype.ext
220     change ((eC (algebraMap S (Localization.AtPrime center) (eB (qB 0))) : V) : F) =
221       ((C.q 0 : V) : F)
222     calc
223       _ = (eB (qB 0) : F) := heC (eB (qB 0))
224       _ = (qB 0 : F) := by rfl
225       _ = (C.q 0 : F) := hqB 0
226   have hq1 : eC (algebraMap S (Localization.AtPrime center)
227       (eB (qB (Fin.succ ⟨0, hm⟩)))) = C.q (Fin.succ ⟨0, hm⟩) := by
228     apply Subtype.ext
229     change ((eC (algebraMap S (Localization.AtPrime center)
230       (eB (qB (Fin.succ ⟨0, hm⟩)))) : V) : F) =
231       ((C.q (Fin.succ ⟨0, hm⟩) : V) : F)
232     calc
233       _ = (eB (qB (Fin.succ ⟨0, hm⟩)) : F) := heC (eB (qB (Fin.succ ⟨0, hm⟩)))
234       _ = (qB (Fin.succ ⟨0, hm⟩) : F) := by rfl
235       _ = (C.q (Fin.succ ⟨0, hm⟩) : F) := hqB (Fin.succ ⟨0, hm⟩)
236   obtain ⟨hQ0, hQ1⟩ := ActualOptionColumnBinding.retained_frame_coordinate_orders hm P w
237   let D := w.differential.core.D
238   let π := Stafford38.Geometry.CompletedDVRPowerSeries.chosenUniformizer V
239   have hπ : Irreducible π :=
240     Stafford38.Geometry.CompletedDVRPowerSeries.chosenUniformizer_irreducible V
241   have h0 : eC (algebraMap S (Localization.AtPrime center) (eB (qB 0))) =
242       π ^ D.a * D.u := by rw [hq0]; exact hQ0
243   have h1 : eC (algebraMap S (Localization.AtPrime center)
244       (eB (qB (Fin.succ ⟨0, hm⟩)))) =
245       π ^ (D.a + D.e) * D.w := by rw [hq1]; exact hQ1
246   have hu₀ : IsUnit D.u := D.u_unit
247   have hu₁ : IsUnit D.w := w.differential.core.D_w_unit
248   have hcore := exists_numerator_across_carrier_equiv
249     (coB := algebraMap B F) (coS := S.subtype) (coV := V.subtype)
250     eB center centerB rfl eC heC (by intro b; rfl)
251     π hπ (qB 0) (qB (Fin.succ ⟨0, hm⟩)) D.a (D.a + D.e) D.u D.w
252     h0 h1 hu₀ hu₁
253   exact hcore
254 
255 /-- The canonical selected residue basis and the actual retained-order
256 producer coexist over one witness. The latter is universal in the selected
257 basis inputs, so it can be instantiated at precisely the `t/index/hres` from
258 the former without making a second selection. -/
259 theorem selected_basis_and_parameter_output
260     {k : Type u} [Field k] [CharZero k]
261     {m : ℕ} (hm : 0 < m)
262     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
263     (w : GeneralDivisorialVisibleFrameWitness hm P) :
264     let C := w.column
265     let W := C.W
266     let F := ComponentFractionField P
267     letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
268     let V := W.place.valuation.toSubring
269     letI : IsDiscreteValuationRing V := W.place.isDiscrete
270     letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
271     letI : Algebra W.coefficientField V :=
272       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
273     let κ := ResidueField V
274     letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
275     (∃ (t : Set κ), t.Finite ∧
276       IsTranscendenceBasis k ((↑) : t → κ) ∧
277       ∃ (index : t → Fin m), Function.Injective index ∧
278         ∀ z : t, residue V
279           (C.q ((chartAffineCoordinateEquiv C.chart) (index z)).1) = (z : κ)) ∧
280     actualParameterOutput hm P w := by
281   constructor
282   · exact ActualSelectedResidueBasis.exists_actual_selected_residue_basis hm P w
283   · exact exists_actual_parameter_with_retained_orders hm P w
284 
285 end Stafford38.Geometry.ActualSameWitnessDivisorNumerator
286