Stafford38/Geometry/ActualSameWitnessGroundPointCompletion.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.ActualSameWitnessDivisorNumerator
3 public import Stafford38.Geometry.ActualSelectedNormalizationDivisorEtale
4 public import Stafford38.Geometry.GroundPointETCompatibility
5 public import Stafford38.Geometry.ActualOptionGroundPointCompletion
6 public import Stafford38.Geometry.ChartGenericPointFractionRing
7 public import Stafford38.Geometry.ProjectiveChartNormalizationFinite
8 public import Stafford38.Geometry.IntegralClosureCenterDVR
9 public import Stafford38.Geometry.ActualChartValuationImage
10 public import Stafford38.Geometry.RetainedGroundMapIdentification
11 public import Stafford38.Geometry.ComponentFunctionFieldBoundary
12 public import Stafford38.Geometry.UnitPowerCenterTransport
13 
14 @[expose] public section
15 
16 set_option autoImplicit false
17 set_option maxHeartbeats 4000000
18 set_option synthInstance.maxHeartbeats 600000
19 set_option linter.style.haveILetI false
20 set_option pp.explicit false
21 
22 noncomputable section
23 
24 namespace Stafford38.Geometry.ActualSameWitnessGroundPointCompletion
25 
26 open IsLocalRing
27 open Stafford38.Geometry.AsymptoticDivisorExistence
28 open Stafford38.Geometry.AsymptoticChartArcAdapter
29 open Stafford38.Geometry.ComponentProjectiveClosure
30 open Stafford38.Geometry.ComponentProjectiveChartKernel
31 open Stafford38.Geometry.ComponentFunctionFieldBoundary
32 open Stafford38.Geometry.GeneralDivisorialVisibleFrame
33 open Stafford38.Geometry.RelativeCoefficientDVR
34 open Stafford38.Geometry.RelativeRetainedBoundaryPlace
35 open Stafford38.Geometry.ChartGenericPointFractionRing
36 open Stafford38.Geometry.ProjectiveChartNormalizationCenter
37 open Stafford38.Geometry.ActualSelectedNormalizationDivisorEtale
38 open Stafford38.Geometry.ActualOptionColumnBinding
39 open Stafford38.Geometry.ActualSameWitnessDivisorNumerator
40 open Stafford38.Geometry.RetainedGroundMapIdentification
41 
42 universe u v w
43 
44 def actualOptionMap {k : Type u} [CommSemiring k]
45     {σ : Type v} {B : Type w} [CommSemiring B] [Algebra k B]
46     (s : B) (rows : σ → B) : MvPolynomial (Option σ) k →ₐ[k] B :=
47   MvPolynomial.aeval (fun j => Option.elim j s rows)
48 
49 theorem actualOptionMap_none {k : Type u} [CommSemiring k]
50     {σ : Type v} {B : Type w} [CommSemiring B] [Algebra k B]
51     (s : B) (rows : σ → B) :
52     actualOptionMap (k := k) s rows
53       (MvPolynomial.X (none : Option σ) : MvPolynomial (Option σ) k) = s := by
54   classical
55   simp [actualOptionMap]
56 
57 theorem actualOptionMap_some {k : Type u} [CommSemiring k]
58     {σ : Type v} {B : Type w} [CommSemiring B] [Algebra k B]
59     (s : B) (rows : σ → B) (z : σ) :
60     actualOptionMap (k := k) s rows
61       (MvPolynomial.X (some z : Option σ) : MvPolynomial (Option σ) k) = rows z := by
62   classical
63   simp [actualOptionMap]
64 
65 /-- Exact output of the actual same-witness selected chart construction. This is a named
66 proposition so the dependent telescope is elaborated once and downstream callers can
67 refer to the canonical package without re-expanding its instance-heavy lets. -/
68 @[irreducible] def actualSameWitnessGroundPointOutput
69     {k : Type u} [Field k] [CharZero k] [IsAlgClosed k]
70     {m : ℕ} (hm : 0 < m)
71     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
72     (w : GeneralDivisorialVisibleFrameWitness hm P) : Prop :=
73   let C := w.column
74   let W := C.W
75   let F := ComponentFractionField P
76   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
77   let U := W.place.valuation
78   let V := U.toSubring
79   letI : IsDiscreteValuationRing V := W.place.isDiscrete
80   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
81   letI : Algebra W.coefficientField V :=
82     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
83   let κ := ResidueField V
84   letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
85   let hQV :=
86     ActualChartValuationImage.chartGenericPointSubalgebra_le_valuationSubring hm P w
87   let B := actualSelectedNormalization P w
88   let coeff := actualSelectedNormalizationCoefficients P w
89   letI : Algebra k B := coeff.toAlgebra
90   let PB := actualSelectedNormalizationCenterPrime P w hQV
91   ∃ (hBfinite : Algebra.FiniteType k B),
92     letI : Algebra.FiniteType k B := hBfinite
93     ∃ (t : Set κ) (htFinite : t.Finite),
94     letI : Fintype t := htFinite.fintype
95     ∃ (htBasis : IsTranscendenceBasis k ((↑) : t → κ))
96       (index : t → Fin m), Function.Injective index ∧
97       (∀ z : t, residue V
98         (C.q ((chartAffineCoordinateEquiv C.chart) (index z)).1) = (z : κ)) ∧
99       ∃ (hPB : PB.IsPrime),
100         letI : PB.IsPrime := hPB
101         ∃ (s : B) (hs0 : s ≠ 0) (hsPB : s ∈ PB)
102           (u₀ u₁ : Localization.AtPrime PB)
103           (hu₀ : IsUnit u₀) (hu₁ : IsUnit u₁)
104           (hspan : Ideal.span {algebraMap B (Localization.AtPrime PB) s} =
105             maximalIdeal (Localization.AtPrime PB))
106           (hfactor₀ :
107             algebraMap B (Localization.AtPrime PB)
108                 (actualNormalizedProjectiveColumnInIntegralClosure hm P w 0) =
109               (algebraMap B (Localization.AtPrime PB) s) ^
110                 w.differential.core.D.a * u₀)
111           (hfactor₁ :
112             algebraMap B (Localization.AtPrime PB)
113                 (actualNormalizedProjectiveColumnInIntegralClosure hm P w
114                   (Fin.succ ⟨0, hm⟩)) =
115               (algebraMap B (Localization.AtPrime PB) s) ^
116                 (w.differential.core.D.a + w.differential.core.D.e) * u₁),
117           let rows := actualSelectedNormalizationRows P w index
118           let fOption : MvPolynomial (Option t) k →ₐ[k] B :=
119             actualOptionMap s rows
120           ∃ (cert : ActualOptionEtaleCertificate k t B PB s rows fOption),
121             ActualOptionGroundPointCompletion.GroundPointChartOutput
122               PB fOption s
123               (actualNormalizedProjectiveColumnInIntegralClosure hm P w 0)
124               (actualNormalizedProjectiveColumnInIntegralClosure hm P w
125                 (Fin.succ ⟨0, hm⟩))
126               (actualSelectedNormalizationRows P w index)
127               ((Fintype.equivFin t).symm)
128               w.differential.core.D.a
129               (w.differential.core.D.a + w.differential.core.D.e)
130 
131 /-- One selected residue basis, one retained numerator, and the canonical
132 closed-ground-point completion chart built from that same option-coordinate
133 map. The output keeps the selected tuple and the numerator's order data, then
134 returns the existing ground-point theorem's full chart package. -/
135 theorem exists_actual_same_witness_groundpoint_chart
136     {k : Type u} [Field k] [CharZero k] [IsAlgClosed k]
137     {m : ℕ} (hm : 0 < m)
138     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
139     (w : GeneralDivisorialVisibleFrameWitness hm P) :
140       actualSameWitnessGroundPointOutput hm P w := by
141   classical
142   unfold actualSameWitnessGroundPointOutput
143   let C := w.column
144   let W := C.W
145   let F := ComponentFractionField P
146   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
147   let U := W.place.valuation
148   let V := U.toSubring
149   letI : IsDiscreteValuationRing V := W.place.isDiscrete
150   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
151   letI : Algebra W.coefficientField V :=
152     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
153   let κ := ResidueField V
154   letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
155   let eChart := chartAffineCoordinateEquiv C.chart
156   let Q : Subalgebra k F := actualSelectedChartAlgebra P w
157   let hQV :=
158     ActualChartValuationImage.chartGenericPointSubalgebra_le_valuationSubring hm P w
159   let B := actualSelectedNormalization P w
160   let coeff : k →+* B := actualSelectedNormalizationCoefficients P w
161   letI : Algebra k B := coeff.toAlgebra
162   letI : Algebra Q.toSubring F := Q.toSubring.subtype.toAlgebra
163   have hchartPoint : componentProjectivePoint P C.chart ≠ 0 := by
164     intro hz
165     have hq := C.q_commonScale C.chart
166     change (C.q C.chart : F) = C.scale * componentProjectivePoint P C.chart at hq
167     have hq1 : (C.q C.chart : F) = 1 := congrArg Subtype.val C.chart_one
168     rw [hz, mul_zero, hq1] at hq
169     exact one_ne_zero hq
170   have hQfrac : IsFractionRing Q.toSubring F := by
171     let hQ : IsFractionRing Q F :=
172       chartGenericPointSubalgebra_isFractionRing P C.chart eChart hchartPoint
173     letI : IsFractionRing Q F := hQ
174     letI : FaithfulSMul Q.toSubring F :=
175       (faithfulSMul_iff_algebraMap_injective Q.toSubring F).mpr Subtype.val_injective
176     apply IsFractionRing.of_field Q.toSubring F
177     intro z
178     obtain ⟨a, b, hb, hz⟩ := IsFractionRing.div_surjective Q z
179     let eqv := ActualChartNormalizationCenter.subalgebraToSubringRingEquiv Q
180     refine ⟨eqv a, eqv b, ?_⟩
181     change z = (eqv a : F) / (eqv b : F)
182     calc
183       z = (a : F) / (b : F) := hz.symm
184       _ = (eqv a : F) / (eqv b : F) := by rfl
185   letI : IsFractionRing Q.toSubring F := hQfrac
186   letI : Algebra k Q.toSubring := Q.algebra
187   letI : IsScalarTower k Q.toSubring F :=
188     IsScalarTower.of_algebraMap_eq fun _ => rfl
189   have hQfinite : Algebra.FiniteType k Q.toSubring := by
190     change Algebra.FiniteType k Q
191     exact chartGenericPointSubalgebra_finiteType P C.chart eChart
192   letI : Algebra.FiniteType k Q.toSubring := hQfinite
193   have hAlg :
194       Algebra.compHom B (algebraMap k Q.toSubring) = coeff.toAlgebra := by
195     apply Algebra.algebra_ext
196     intro c
197     rfl
198   have hBfiniteComp :
199       @Algebra.FiniteType k B _ _ (Algebra.compHom B (algebraMap k Q.toSubring)) := by
200     letI : Algebra k B := Algebra.compHom B (algebraMap k Q.toSubring)
201     letI : IsScalarTower k Q.toSubring B :=
202       IsScalarTower.of_algebraMap_eq fun _ => rfl
203     exact ProjectiveChartNormalizationFinite.integralClosure_finiteType_over_base
204       k Q.toSubring F
205   have hfiniteEq := congrArg
206     (fun A : Algebra k B => @Algebra.FiniteType k B _ _ A) hAlg
207   have hBfinite : Algebra.FiniteType k B := hfiniteEq.mp hBfiniteComp
208   refine ⟨hBfinite, ?_⟩
209   letI : Algebra.FiniteType k B := hBfinite
210   have hselected :=
211     ActualSelectedResidueBasis.exists_actual_selected_residue_basis hm P w
212   rcases hselected with ⟨t, htFinite, htBasis, index, hindex, hres⟩
213   letI : Fintype t := htFinite.fintype
214   have hparameterAt :=
215     exists_actual_parameter_with_retained_orders hm P w t htFinite htBasis index hindex hres
216   rcases hparameterAt with
217     ⟨eCenter, s, den, u₀, u₁, hfield, hs0, hsPB, hmk, hspan,
218       hu₀, hu₁, hfactor₀, hfactor₁⟩
219   change actualSelectedNormalization P w at s
220   let center := actualSelectedNormalizationCenter P w hQV
221   let eB := ActualChartNormalizationCenter.subalgebraToSubringRingEquiv B
222   let centerB := center.comap eB.toRingHom
223   let PB := actualSelectedNormalizationCenterPrime P w hQV
224   have hPB : PB.IsPrime := by
225     have hc : center.IsPrime := integralClosureCenter_isPrime Q.toSubring U hQV
226     letI : center.IsPrime := hc
227     change (center.comap eB.toRingHom).IsPrime
228     exact Ideal.IsPrime.comap eB.toRingHom
229   letI : PB.IsPrime := hPB
230   have hPB_eq : PB = centerB := rfl
231   letI : centerB.IsPrime := hPB_eq ▸ hPB
232   have hsPB' : s ∈ PB := by
233     change s ∈ centerB
234     exact hsPB
235   have hspan' :
236       Ideal.span {algebraMap B (Localization.AtPrime PB) s} =
237         maximalIdeal (Localization.AtPrime PB) := by
238     exact prime_span_eq_maximalIdeal_transport PB centerB hPB_eq s hspan
239   let q₀ := actualNormalizedProjectiveColumnInIntegralClosure hm P w 0
240   let q₁ := actualNormalizedProjectiveColumnInIntegralClosure hm P w
241     (Fin.succ ⟨0, hm⟩)
242   have hFactorTransport :
243       ∃ u₀PB u₁PB : Localization.AtPrime PB,
244         IsUnit u₀PB ∧ IsUnit u₁PB ∧
245         algebraMap B (Localization.AtPrime PB) q₀ =
246           (algebraMap B (Localization.AtPrime PB) s) ^ w.differential.core.D.a * u₀PB ∧
247         algebraMap B (Localization.AtPrime PB) q₁ =
248           (algebraMap B (Localization.AtPrime PB) s) ^
249             (w.differential.core.D.a + w.differential.core.D.e) * u₁PB :=
250     selected_center_retained_factors_at_canonical_prime PB centerB hPB_eq
251       q₀ q₁ s w.differential.core.D.a w.differential.core.D.e
252       u₀ u₁ hu₀ hu₁ hfactor₀ hfactor₁
253   rcases hFactorTransport with
254     ⟨u₀PB, u₁PB, hu₀PB, hu₁PB, hfactor₀', hfactor₁'⟩
255   let rows : t → actualSelectedNormalization P w :=
256     actualSelectedNormalizationRows P w index
257   let fOption : MvPolynomial (Option t) k →ₐ[k] actualSelectedNormalization P w :=
258     actualOptionMap s rows
259   have hnone : fOption (MvPolynomial.X none) = s := by
260     exact actualOptionMap_none s rows
261   have hsome : ∀ z : t, fOption (MvPolynomial.X (some z)) = rows z := by
262     intro z
263     exact actualOptionMap_some s rows z
264   have hPBDirect : (actualSelectedNormalizationCenterPrime P w hQV).IsPrime := by
265     change PB.IsPrime
266     exact hPB
267   have certDirect :
268       ActualOptionEtaleCertificate k t (actualSelectedNormalization P w)
269         (actualSelectedNormalizationCenterPrime P w hQV) s rows fOption :=
270     formallyEtale_at_selected_actual_normalization_center_core hm P w
271       hQV t htFinite htBasis index hindex hres s hPBDirect hs0 hsPB' hspan'
272       fOption hnone hsome
273   have hEt := actualCertificate_formallyEtale_for_groundPointAdapter
274     (actualSelectedNormalizationCenterPrime P w hQV) s rows fOption certDirect
275   have hOrders : 0 < w.differential.core.D.a ∧
276     w.differential.core.D.a <
277       w.differential.core.D.a + w.differential.core.D.e := by
278     have ha := w.differential.core.D.one_le_a
279     have he := w.differential.core.D.one_le_e
280     omega
281   exact ⟨t, htFinite, htBasis, index, hindex, hres, hPB, s, hs0, hsPB',
282     u₀PB, u₁PB, hu₀PB, hu₁PB, hspan', hfactor₀', hfactor₁',
283     certDirect,
284     ActualOptionGroundPointCompletion.exists_groundPoint_chart_from_option_map
285       (actualSelectedNormalizationCenterPrime P w hQV) fOption s
286       (actualNormalizedProjectiveColumnInIntegralClosure hm P w 0)
287       (actualNormalizedProjectiveColumnInIntegralClosure hm P w (Fin.succ ⟨0, hm⟩))
288       rows hnone hsPB' hsome ((Fintype.equivFin t).symm) hEt
289       w.differential.core.D.a
290       (w.differential.core.D.a + w.differential.core.D.e)
291       hOrders u₀PB u₁PB hu₀PB hu₁PB hfactor₀' hfactor₁'⟩
292 
293 end Stafford38.Geometry.ActualSameWitnessGroundPointCompletion
294