Stafford38/Geometry/ActualCommonOpenCompletionDerivation.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.EtaleGenericOpenExtraAwayB
3 public import Stafford38.Geometry.EtaleCotangentBasis
4 public import Stafford38.Geometry.PrescribedCompletionDerivationCommutation
5 public import Stafford38.Geometry.PrescribedGroundPointUnitPowerChart
6 public import Stafford38.Geometry.SmoothLocalTiltedArcAxisLift
7 public import Mathlib.RingTheory.LaurentSeries
8 
9 @[expose] public section
10 
11 set_option autoImplicit false
12 set_option maxHeartbeats 4000000
13 
14 /-!
15 # Actual common-open and completed-chart derivations
16 
17 The map from the selected point-local ring into the common open is the one
18 induced by `localPointToGenericOpen`, followed by its actual chart-denominator
19 localization.  Its compatibility with the parameter algebra is proved from
20 the localization maps.  Consequently the coordinate derivations on the
21 common open restrict to the prescribed local derivations, and those commute
22 with the canonical multivariate completion and tilted arc on every element.
23 -/
24 
25 namespace Stafford38.Geometry.ActualCommonOpenCompletionDerivation
26 
27 open Stafford38.Geometry.EtaleGenericOpenTransport
28 open Stafford38.Geometry.EtaleCotangentBasis
29 open Stafford38.Geometry.PrescribedCompletionDerivationCommutation
30 open Stafford38.Geometry.PrescribedGroundPointUnitPowerChart
31 open Stafford38.Geometry.PrescribedGroundPointPowerSeriesMap
32 open Stafford38.Geometry.SmoothLocalTiltedArcAxisLift
33 
34 noncomputable section
35 
36 universe u v w
37 
38 variable {k : Type u} [Field k] {d : ℕ}
39 local notation "R" => MvPolynomial (Option (Fin d)) k
40 variable {A : Type v} [CommRing A] [Algebra k A]
41   [Algebra (MvPolynomial (Option (Fin d)) k) A]
42   [IsScalarTower k (MvPolynomial (Option (Fin d)) k) A]
43   [Algebra.EssFiniteType (MvPolynomial (Option (Fin d)) k) A]
44 variable {Q : Type w} [CommRing Q] [Algebra Q A]
45 
46 theorem scalarTower_k_R_pointLocal
47     (M : Ideal A) [M.IsPrime]
48     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
49     IsScalarTower k R (Localization.AtPrime M) := by
50   infer_instance
51 
52 /-- The actual map from the point-local ring into the generic common open,
53 including the selected chart denominator localization. -/
54 noncomputable def pointLocalToCommonOpen
55     (M : Ideal A) [M.IsPrime] (f : Q)
56     (e : Localization.Away f ≃ₐ[Q]
57       Localization.Away (algebraMap Q A f)) (g : Q) :
58     Localization.AtPrime M →+* genericOpenExtraAwayB M f e g :=
59   (algebraMap (genericOpenRing M f e)
60     (genericOpenExtraAwayB M f e g)).comp
61       (localPointToGenericOpen M f e)
62 
63 /-- Restriction to the original finite-type ring recovers the sole common-open
64 map from that ring.  This is the comparison that induces parameter
65 compatibility; it is not supplied as an additional hypothesis. -/
66 theorem pointLocalToCommonOpen_comp_algebraMap
67     (M : Ideal A) [M.IsPrime] (f : Q)
68     (e : Localization.Away f ≃ₐ[Q]
69       Localization.Away (algebraMap Q A f)) (g : Q) :
70     (pointLocalToCommonOpen (A := A) M f e g).comp
71       (algebraMap A (Localization.AtPrime M)) =
72     genericOpenExtraAwayBMap M f e g := by
73   ext a
74   simp [pointLocalToCommonOpen, genericOpenExtraAwayBMap, genericOpenBMap,
75     localPointToGenericOpen_apply]
76 
77 /-- A chosen field-valued arc on the original chart extends to the actual
78 common open, and its restriction along the point-local map is the canonical
79 localization of that same arc. -/
80 theorem genericArcToExtraAway_comp_pointLocalToCommonOpen
81     {L : Type*} [Field L]
82     (M : Ideal A) [M.IsPrime] (f : Q)
83     (e : Localization.Away f ≃ₐ[Q]
84       Localization.Away (algebraMap Q A f)) (g : Q)
85     (ρ : A →+* L)
86     (hf : IsUnit (ρ (algebraMap Q A f)))
87     (hunitM : ∀ b, b ∉ M → IsUnit (ρ b))
88     (hg : IsUnit (ρ (algebraMap Q A g))) :
89     (genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg).comp
90       (pointLocalToCommonOpen (A := A) M f e g) =
91         localPointToField (B := A) M ρ hunitM := by
92   apply IsLocalization.ringHom_ext M.primeCompl
93   ext b
94   simp [pointLocalToCommonOpen, genericArcToGenericOpenExtraAwayB,
95     genericOpenExtraAwayBMap, genericArcToGenericOpen_apply,
96     localPointToGenericOpen_apply, localPointToField_apply]
97 
98 /-- If the local point map and the generic-open algebra map come from the
99 same polynomial parameters on `A`, then their induced maps agree on every
100 parameter.  The equality follows from the preceding actual localization-map
101 identity and the scalar tower `k → R → A`. -/
102 theorem pointLocalToCommonOpen_parameter_map
103     (M : Ideal A) [M.IsPrime] (f : Q)
104     (e : Localization.Away f ≃ₐ[Q]
105       Localization.Away (algebraMap Q A f)) (g : Q) :
106     let T := Localization.AtPrime M
107     let U := genericOpenExtraAwayB M f e g
108     let Cq := genericOpenRing M f e
109     letI : Algebra R T := Algebra.compHom T (algebraMap R A)
110     letI : Algebra R Cq :=
111       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
112     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
113     ∀ j : Option (Fin d),
114       pointLocalToCommonOpen (A := A) M f e g
115         (algebraMap R T (MvPolynomial.X j)) =
116       algebraMap R U (MvPolynomial.X j) := by
117   dsimp
118   let T := Localization.AtPrime M
119   let Cq := genericOpenRing M f e
120   let U := genericOpenExtraAwayB M f e g
121   letI : Algebra R T := Algebra.compHom T (algebraMap R A)
122   letI : SMul R T := (inferInstance : Algebra R T).toSMul
123   letI : SMul A T := (inferInstance : Algebra A T).toSMul
124   letI : IsScalarTower R A T :=
125     IsScalarTower.of_algebraMap_eq'
126       (show algebraMap R T = (algebraMap A T).comp (algebraMap R A) from rfl)
127   letI : Algebra R Cq :=
128     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
129   letI : IsScalarTower R A Cq :=
130     IsScalarTower.of_algebraMap_eq'
131       (show algebraMap R Cq = (algebraMap A Cq).comp (algebraMap R A) from rfl)
132   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
133   intro j
134   have hloc := pointLocalToCommonOpen_comp_algebraMap (A := A) M f e g
135   have hRU : (genericOpenExtraAwayBMap M f e g).comp
136       (algebraMap R A) = algebraMap R U := by
137     apply RingHom.ext
138     intro r
139     change algebraMap Cq U
140       (genericOpenBMap M f e (algebraMap R A r)) =
141         algebraMap Cq U (algebraMap A Cq (algebraMap R A r))
142     rfl
143   have hloc' (x : A) :
144       pointLocalToCommonOpen (A := A) M f e g
145         (algebraMap A T x) = genericOpenExtraAwayBMap M f e g x := by
146     have hx := congrArg (fun φ : A →+* U => φ x) hloc
147     simpa only [RingHom.comp_apply] using hx
148   calc
149     pointLocalToCommonOpen (A := A) M f e g
150         (algebraMap R T (MvPolynomial.X j)) =
151       pointLocalToCommonOpen (A := A) M f e g
152         (algebraMap A T (algebraMap R A (MvPolynomial.X j))) := by
153           rw [IsScalarTower.algebraMap_apply R A T]
154     _ = genericOpenExtraAwayBMap M f e g
155         (algebraMap R A (MvPolynomial.X j)) := by
156           exact hloc' _
157     _ = algebraMap R U (MvPolynomial.X j) := by
158       have hX := congrArg (fun φ : R →+* U => φ (MvPolynomial.X j)) hRU
159       change genericOpenExtraAwayBMap M f e g
160         (algebraMap R A (MvPolynomial.X j)) = algebraMap R U (MvPolynomial.X j)
161       simpa only [RingHom.comp_apply] using hX
162 
163 theorem pointLocalToCommonOpen_comp_polynomialMap
164     (M : Ideal A) [M.IsPrime] (f : Q)
165     (e : Localization.Away f ≃ₐ[Q]
166       Localization.Away (algebraMap Q A f)) (g : Q) :
167     let T := Localization.AtPrime M
168     let Cq := genericOpenRing M f e
169     let U := genericOpenExtraAwayB M f e g
170     letI : Algebra A T := inferInstance
171     letI : Algebra R T := inferInstance
172     letI : Algebra R Cq :=
173       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
174     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
175     (pointLocalToCommonOpen (A := A) M f e g).comp (algebraMap R T) =
176       algebraMap R U := by
177   dsimp
178   let T := Localization.AtPrime M
179   let Cq := genericOpenRing M f e
180   let U := genericOpenExtraAwayB M f e g
181   letI : Algebra A T := inferInstance
182   letI : Algebra R T := inferInstance
183   letI : Algebra R Cq :=
184     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
185   letI : IsScalarTower R A Cq :=
186     IsScalarTower.of_algebraMap_eq'
187       (show algebraMap R Cq = (algebraMap A Cq).comp (algebraMap R A) from rfl)
188   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
189   have hRT : algebraMap R T = (algebraMap A T).comp (algebraMap R A) := by
190     exact IsScalarTower.algebraMap_eq R A T
191   apply MvPolynomial.ringHom_ext
192   · intro c
193     have hc : algebraMap R T (MvPolynomial.C c) =
194         algebraMap A T (algebraMap k A c) := by
195       have hcomp := congrArg (fun φ : R →+* T => φ (MvPolynomial.C c)) hRT
196       calc
197         algebraMap R T (MvPolynomial.C c) =
198             algebraMap A T (algebraMap R A (MvPolynomial.C c)) := by
199               simpa only [RingHom.comp_apply] using hcomp
200         _ = algebraMap A T (algebraMap k A c) := by
201               congr 1
202               exact (IsScalarTower.algebraMap_apply k R A c).symm
203     calc
204       pointLocalToCommonOpen (A := A) M f e g
205           (algebraMap R T (MvPolynomial.C c)) =
206         pointLocalToCommonOpen (A := A) M f e g
207           (algebraMap A T (algebraMap k A c)) := congrArg _ hc
208       _ = genericOpenExtraAwayBMap M f e g (algebraMap k A c) := by
209         have hl := congrArg
210           (fun φ : A →+* U => φ (algebraMap k A c))
211           (pointLocalToCommonOpen_comp_algebraMap (A := A) M f e g)
212         simpa only [RingHom.comp_apply] using hl
213       _ = algebraMap R U (MvPolynomial.C c) := by
214         have hRU : (genericOpenExtraAwayBMap M f e g).comp
215             (algebraMap R A) = algebraMap R U := by
216           apply RingHom.ext
217           intro r
218           change algebraMap Cq U
219               (genericOpenBMap M f e (algebraMap R A r)) =
220             algebraMap Cq U (algebraMap A Cq (algebraMap R A r))
221           rfl
222         have hr := congrArg
223           (fun φ : R →+* U => φ (MvPolynomial.C c)) hRU
224         have hkc : algebraMap R A (MvPolynomial.C c) = algebraMap k A c :=
225           (IsScalarTower.algebraMap_apply k R A c).symm
226         rw [← hkc]
227         exact hr
228   · intro i
229     exact pointLocalToCommonOpen_parameter_map (A := A) M f e g i
230 
231 noncomputable def pointLocalToCommonOpenAlg
232     (M : Ideal A) [M.IsPrime] (f : Q)
233     (e : Localization.Away f ≃ₐ[Q]
234       Localization.Away (algebraMap Q A f)) (g : Q)
235     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
236     let T := Localization.AtPrime M
237     let Cq := genericOpenRing M f e
238     let U := genericOpenExtraAwayB M f e g
239     letI : Algebra A T := inferInstance
240     letI : Algebra R T := inferInstance
241     letI : Algebra R Cq :=
242       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
243     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
244     letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
245     letI : Algebra k U := Algebra.compHom U (algebraMap k R)
246     letI : SMul R U := (inferInstance : Algebra R U).toSMul
247     letI : SMul k U := (inferInstance : Algebra k U).toSMul
248     letI : IsScalarTower k R U := by
249       apply IsScalarTower.of_algebraMap_eq'
250       apply RingHom.ext
251       intro c
252       rfl
253     T →ₐ[k] U := by
254   dsimp
255   let T := Localization.AtPrime M
256   let Cq := genericOpenRing M f e
257   let U := genericOpenExtraAwayB M f e g
258   letI : Algebra A T := inferInstance
259   letI : Algebra R T := inferInstance
260   letI : Algebra R Cq :=
261     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
262   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
263   letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
264   letI : Algebra k U := Algebra.compHom U (algebraMap k R)
265   letI : SMul R U := (inferInstance : Algebra R U).toSMul
266   letI : SMul k U := (inferInstance : Algebra k U).toSMul
267   letI : IsScalarTower k R U := by
268     apply IsScalarTower.of_algebraMap_eq'
269     apply RingHom.ext
270     intro c
271     rfl
272   let hR := pointLocalToCommonOpen_comp_polynomialMap (k := k) (d := d) (A := A) M f e g
273   refine ⟨pointLocalToCommonOpen (A := A) M f e g, ?_⟩
274   intro c
275   change pointLocalToCommonOpen (A := A) M f e g (algebraMap k T c) =
276     algebraMap k U c
277   rw [IsScalarTower.algebraMap_apply k R T c]
278   have hc := congrArg (fun φ : R →+* U => φ (algebraMap k R c)) hR
279   calc
280     pointLocalToCommonOpen (A := A) M f e g
281         (algebraMap R T (algebraMap k R c)) =
282       algebraMap R U (algebraMap k R c) := by
283         simpa only [RingHom.comp_apply] using hc
284     _ = algebraMap k U c := (IsScalarTower.algebraMap_apply k R U c).symm
285 
286 /-- The actual coordinate derivations on the common open restrict to the
287 coordinate derivations of the selected point-local chart.  The parameter
288 compatibility is the localization identity above, while formal étaleness of
289 the common open is transported from the point-local chart. -/
290 theorem coordinateDerivation_restrict_to_pointLocal
291     (M : Ideal A) [M.IsPrime] (f : Q)
292     (e : Localization.Away f ≃ₐ[Q]
293       Localization.Away (algebraMap Q A f)) (g : Q)
294     [Algebra.FormallyEtale R (Localization.AtPrime M)] (j : Option (Fin d)) :
295     let T := Localization.AtPrime M
296     let Cq := genericOpenRing M f e
297     let U := genericOpenExtraAwayB M f e g
298     letI : Algebra A T := inferInstance
299     letI : Algebra R T := inferInstance
300     letI : Algebra R Cq :=
301       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
302     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
303     letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
304     letI : Algebra k U := Algebra.compHom U (algebraMap k R)
305     letI : SMul R U := (inferInstance : Algebra R U).toSMul
306     letI : SMul k U := (inferInstance : Algebra k U).toSMul
307     letI : IsScalarTower k R U := by
308       apply IsScalarTower.of_algebraMap_eq'
309       apply RingHom.ext
310       intro c
311       rfl
312     let θ := pointLocalToCommonOpenAlg (k := k) (d := d) (A := A) M f e g
313     letI : Algebra T U := θ.toRingHom.toAlgebra' (fun x y => mul_comm (θ x) y)
314     letI : SMul T U := (inferInstance : Algebra T U).toSMul
315     letI : SMul U U := (inferInstance : Algebra U U).toSMul
316     letI : IsScalarTower k T U := by
317       apply IsScalarTower.of_algebraMap_eq'
318       apply RingHom.ext
319       intro c
320       change algebraMap k U c = algebraMap T U (algebraMap k T c)
321       rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
322       exact (θ.commutes c).symm
323     letI : IsScalarTower T U U := ⟨fun t u₁ u₂ => by
324       change (algebraMap T U t * u₁) * u₂ =
325         algebraMap T U t * (u₁ * u₂)
326       exact mul_assoc _ _ _⟩
327     letI : Algebra.FormallyEtale R U := by
328       simpa [U, Cq] using formallyEtale_genericOpenExtraAway_of_pointLocal M f e g
329     (Algebra.linearMap T U).compDer
330         (coordinateDerivation (k := k) (σ := Option (Fin d)) (B := T) j) =
331       ((coordinateDerivation (k := k) (σ := Option (Fin d))
332         (B := U) (L := U) j).compAlgebraMap T) := by
333   dsimp
334   let T := Localization.AtPrime M
335   let Cq := genericOpenRing M f e
336   let U := genericOpenExtraAwayB M f e g
337   letI : Algebra A T := inferInstance
338   letI : Algebra R T := inferInstance
339   letI : Algebra R Cq :=
340     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
341   letI : IsScalarTower R A T := by infer_instance
342   letI : IsScalarTower R A Cq :=
343     IsScalarTower.of_algebraMap_eq'
344       (show algebraMap R Cq = (algebraMap A Cq).comp (algebraMap R A) from rfl)
345   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
346   letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
347   letI : Algebra k U := Algebra.compHom U (algebraMap k R)
348   letI : SMul R U := (inferInstance : Algebra R U).toSMul
349   letI : SMul k U := (inferInstance : Algebra k U).toSMul
350   letI : IsScalarTower k R U := by
351     apply IsScalarTower.of_algebraMap_eq'
352     apply RingHom.ext
353     intro c
354     rfl
355   let θ := pointLocalToCommonOpenAlg (k := k) (d := d) (A := A) M f e g
356   letI : Algebra T U := θ.toRingHom.toAlgebra' (fun x y => mul_comm (θ x) y)
357   letI : Algebra.FormallyEtale R U := by
358     simpa [U, Cq] using formallyEtale_genericOpenExtraAway_of_pointLocal M f e g
359   letI : SMul T U := (inferInstance : Algebra T U).toSMul
360   letI : SMul U U := (inferInstance : Algebra U U).toSMul
361   letI : IsScalarTower k T U := by
362     apply IsScalarTower.of_algebraMap_eq'
363     apply RingHom.ext
364     intro c
365     change algebraMap k U c = algebraMap T U (algebraMap k T c)
366     rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
367     exact (θ.commutes c).symm
368   letI : IsScalarTower T U U := ⟨fun t u₁ u₂ => by
369     change (algebraMap T U t * u₁) * u₂ =
370       algebraMap T U t * (u₁ * u₂)
371     exact mul_assoc _ _ _⟩
372   have hparam : ∀ i : Option (Fin d),
373       algebraMap T U (algebraMap R T (MvPolynomial.X i)) =
374         algebraMap R U (MvPolynomial.X i) := by
375     intro i
376     calc
377       algebraMap T U (algebraMap R T (MvPolynomial.X i)) =
378           pointLocalToCommonOpen (A := A) M f e g
379             (algebraMap R T (MvPolynomial.X i)) := by
380               rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
381               change pointLocalToCommonOpen (A := A) M f e g
382                 (algebraMap R T (MvPolynomial.X i)) = _
383               rfl
384       _ = algebraMap R U (MvPolynomial.X i) :=
385         pointLocalToCommonOpen_parameter_map (A := A) M f e g i
386   exact coordinateDerivation_compAlgebraMap (k := k)
387     (σ := Option (Fin d)) (B := T) (C := U) hparam j
388 
389 /-- The canonical tilted arc on the `Option (Fin d)` chart, reindexed through
390 the existing `Fin (d+1)` completion and then included into its fraction field. -/
391 noncomputable def pointLocalFinSuccArcFractionField
392     (M : Ideal A) [M.IsMaximal] (eM : (A ⧸ M) ≃ₐ[k] k)
393     (α : Fin d → k)
394     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
395     Localization.AtPrime M →ₐ[k] FractionRing (PowerSeries k) :=
396   (IsScalarTower.toAlgHom k (PowerSeries k) (FractionRing (PowerSeries k))).comp
397     ((SmoothLocalTiltedArcAxisLift.punitToPowerSeries (k := k)).toAlgHom.comp
398       ((MvPowerSeries.substAlgHom
399         (SmoothLocalTiltedArcAxisLift.tiltedArcHasSubstPUnit (k := k) α)).comp
400         (PrescribedGroundPointUnitPowerChart.localToFinSuccPowerSeries
401           (k := k) (B := A) (d := d) M eM)))
402 
403 /-- The canonical point-local tilted arc viewed as a field-valued map on the
404 original chart algebra. -/
405 noncomputable def originalToPointLocalFinSuccArcFractionField
406     (M : Ideal A) [M.IsMaximal] (eM : (A ⧸ M) ≃ₐ[k] k)
407     (α : Fin d → k)
408     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
409     A →+* FractionRing (PowerSeries k) :=
410   (pointLocalFinSuccArcFractionField (k := k) (d := d) (A := A) M eM α).toRingHom.comp
411     (algebraMap A (Localization.AtPrime M))
412 
413 /-- The canonical point-local tilted arc with values in the Laurent-series
414 field used by the projective-conormal comparison. -/
415 private theorem groundMap_powerSeries_to_laurent (c : k) :
416     algebraMap k (LaurentSeries k) c =
417       algebraMap (PowerSeries k) (LaurentSeries k)
418         (algebraMap k (PowerSeries k) c) := by rfl
419 
420 theorem groundTower_powerSeries_to_laurent :
421     letI : Module k (LaurentSeries k) := Algebra.toModule
422     letI : SMul k (LaurentSeries k) :=
423       (Algebra.toModule : Module k (LaurentSeries k)).toSMul
424     IsScalarTower k (PowerSeries k) (LaurentSeries k) := by
425   letI : Module k (LaurentSeries k) := Algebra.toModule
426   letI : SMul k (LaurentSeries k) :=
427     (Algebra.toModule : Module k (LaurentSeries k)).toSMul
428   exact IsScalarTower.of_algebraMap_eq groundMap_powerSeries_to_laurent
429 
430 noncomputable def pointLocalFinSuccArcLaurentSeries
431     (M : Ideal A) [M.IsMaximal] (eM : (A ⧸ M) ≃ₐ[k] k)
432     (α : Fin d → k)
433     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
434     Localization.AtPrime M →ₐ[k] LaurentSeries k := by
435   letI : Module k (LaurentSeries k) := Algebra.toModule
436   letI : SMul k (LaurentSeries k) :=
437     (Algebra.toModule : Module k (LaurentSeries k)).toSMul
438   letI : IsScalarTower k (PowerSeries k) (LaurentSeries k) :=
439     groundTower_powerSeries_to_laurent
440   exact (IsScalarTower.toAlgHom k (PowerSeries k) (LaurentSeries k)).comp
441     ((SmoothLocalTiltedArcAxisLift.punitToPowerSeries (k := k)).toAlgHom.comp
442       ((MvPowerSeries.substAlgHom
443         (SmoothLocalTiltedArcAxisLift.tiltedArcHasSubstPUnit (k := k) α)).comp
444         (PrescribedGroundPointUnitPowerChart.localToFinSuccPowerSeries
445           (k := k) (B := A) (d := d) M eM)))
446 
447 /-- The original chart algebra map into Laurent series for this same
448 point-local tilted arc. -/
449 noncomputable def originalToPointLocalFinSuccArcLaurentSeries
450     (M : Ideal A) [M.IsMaximal] (eM : (A ⧸ M) ≃ₐ[k] k)
451     (α : Fin d → k)
452     [Algebra.FormallyEtale R (Localization.AtPrime M)] :
453     A →+* LaurentSeries k :=
454   (pointLocalFinSuccArcLaurentSeries (k := k) (d := d) (A := A) M eM α).toRingHom.comp
455     (algebraMap A (Localization.AtPrime M))
456 
457 /-- The canonical point-local arc preserves the ground field map. -/
458 theorem originalToPointLocalFinSuccArcLaurentSeries_base
459     (M : Ideal A) [M.IsMaximal] (eM : (A ⧸ M) ≃ₐ[k] k)
460     (α : Fin d → k)
461     [Algebra.FormallyEtale R (Localization.AtPrime M)] (c : k) :
462     originalToPointLocalFinSuccArcLaurentSeries
463         (k := k) (d := d) (A := A) M eM α (algebraMap k A c) =
464       algebraMap k (LaurentSeries k) c := by
465   letI : Module k (LaurentSeries k) := Algebra.toModule
466   letI : SMul k (LaurentSeries k) :=
467     (Algebra.toModule : Module k (LaurentSeries k)).toSMul
468   letI : IsScalarTower k (PowerSeries k) (LaurentSeries k) :=
469     groundTower_powerSeries_to_laurent
470   change pointLocalFinSuccArcLaurentSeries
471       (k := k) (d := d) (A := A) M eM α
472       (algebraMap A (Localization.AtPrime M) (algebraMap k A c)) = _
473   rw [← IsScalarTower.algebraMap_apply k A (Localization.AtPrime M) c]
474   exact (pointLocalFinSuccArcLaurentSeries
475     (k := k) (d := d) (A := A) M eM α).commutes c
476 
477 /-- Applying an actual field-valued arc to the common-open coordinate
478 derivation agrees, on every element of the selected local ring, with the
479 same coordinate derivation followed by the localized arc. -/
480 theorem genericArc_coordinateDerivation_on_pointLocal
481     {L : Type*} [Field L]
482     (M : Ideal A) [M.IsPrime] (f : Q)
483     (e : Localization.Away f ≃ₐ[Q]
484       Localization.Away (algebraMap Q A f)) (g : Q)
485     (ρ : A →+* L)
486     (hf : IsUnit (ρ (algebraMap Q A f)))
487     (hunitM : ∀ b, b ∉ M → IsUnit (ρ b))
488     (hg : IsUnit (ρ (algebraMap Q A g)))
489     [Algebra.FormallyEtale R (Localization.AtPrime M)]
490     (j : Option (Fin d)) (b : Localization.AtPrime M) :
491     let T := Localization.AtPrime M
492     let Cq := genericOpenRing M f e
493     let U := genericOpenExtraAwayB M f e g
494     letI : Algebra A T := inferInstance
495     letI : Algebra R T := inferInstance
496     letI : Algebra R Cq :=
497       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
498     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
499     letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
500     letI : Algebra k U := Algebra.compHom U (algebraMap k R)
501     letI : SMul R U := (inferInstance : Algebra R U).toSMul
502     letI : SMul k U := (inferInstance : Algebra k U).toSMul
503     letI : IsScalarTower k R U := by
504       apply IsScalarTower.of_algebraMap_eq'
505       apply RingHom.ext
506       intro c
507       rfl
508     let θ := pointLocalToCommonOpenAlg (k := k) (d := d) (A := A) M f e g
509     letI : Algebra T U := θ.toRingHom.toAlgebra' (fun x y => mul_comm (θ x) y)
510     letI : SMul T U := (inferInstance : Algebra T U).toSMul
511     letI : SMul U U := (inferInstance : Algebra U U).toSMul
512     letI : IsScalarTower k T U := by
513       apply IsScalarTower.of_algebraMap_eq'
514       apply RingHom.ext
515       intro c
516       change algebraMap k U c = algebraMap T U (algebraMap k T c)
517       rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
518       exact (θ.commutes c).symm
519     letI : IsScalarTower T U U := ⟨fun t u₁ u₂ => by
520       change (algebraMap T U t * u₁) * u₂ =
521         algebraMap T U t * (u₁ * u₂)
522       exact mul_assoc _ _ _⟩
523     letI : Algebra.FormallyEtale R U :=
524       formallyEtale_genericOpenExtraAway_of_pointLocal M f e g
525     genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
526       (EtaleCotangentBasis.coordinateDerivation
527         (k := k) (σ := Option (Fin d)) (B := genericOpenExtraAwayB M f e g)
528         (L := genericOpenExtraAwayB M f e g) j
529         (pointLocalToCommonOpen (A := A) M f e g b)) =
530       localPointToField (B := A) M ρ hunitM
531         (EtaleCotangentBasis.coordinateDerivation
532           (k := k) (σ := Option (Fin d)) (B := Localization.AtPrime M)
533           (L := Localization.AtPrime M) j b) := by
534   let T := Localization.AtPrime M
535   let Cq := genericOpenRing M f e
536   let U := genericOpenExtraAwayB M f e g
537   letI : Algebra A T := inferInstance
538   letI : Algebra R T := inferInstance
539   letI : Algebra R Cq :=
540     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
541   letI : IsScalarTower R A T := inferInstance
542   letI : IsScalarTower R A Cq :=
543     IsScalarTower.of_algebraMap_eq'
544       (show algebraMap R Cq = (algebraMap A Cq).comp (algebraMap R A) from rfl)
545   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
546   letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
547   letI : Algebra k U := Algebra.compHom U (algebraMap k R)
548   letI : SMul R U := (inferInstance : Algebra R U).toSMul
549   letI : SMul k U := (inferInstance : Algebra k U).toSMul
550   letI : IsScalarTower k R U := by
551     apply IsScalarTower.of_algebraMap_eq'
552     apply RingHom.ext
553     intro c
554     rfl
555   let θ := pointLocalToCommonOpenAlg (k := k) (d := d) (A := A) M f e g
556   letI : Algebra T U := θ.toRingHom.toAlgebra' (fun x y => mul_comm (θ x) y)
557   letI : SMul T U := (inferInstance : Algebra T U).toSMul
558   letI : SMul U U := (inferInstance : Algebra U U).toSMul
559   letI : IsScalarTower k T U := by
560     apply IsScalarTower.of_algebraMap_eq'
561     apply RingHom.ext
562     intro c
563     change algebraMap k U c = algebraMap T U (algebraMap k T c)
564     rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
565     exact (θ.commutes c).symm
566   letI : IsScalarTower T U U := ⟨fun t u₁ u₂ => by
567     change (algebraMap T U t * u₁) * u₂ =
568       algebraMap T U t * (u₁ * u₂)
569     exact mul_assoc _ _ _⟩
570   letI : Algebra.FormallyEtale R U :=
571     formallyEtale_genericOpenExtraAway_of_pointLocal M f e g
572   have htheta : θ.toRingHom = pointLocalToCommonOpen (A := A) M f e g := by
573     ext x
574     rfl
575   have hmap : algebraMap T U = pointLocalToCommonOpen (A := A) M f e g := by
576     rw [RingHom.algebraMap_toAlgebra' _ (fun x y => mul_comm (θ x) y)]
577     exact htheta
578   have hcomp := genericArcToExtraAway_comp_pointLocalToCommonOpen
579     (A := A) M f e g ρ hf hunitM hg
580   have hder := congrArg
581     (fun D : Derivation k T U => D b)
582     (coordinateDerivation_restrict_to_pointLocal
583       (k := k) (d := d) (A := A) M f e g j)
584   change algebraMap T U
585       (EtaleCotangentBasis.coordinateDerivation
586         (k := k) (σ := Option (Fin d)) (B := T) (L := T) j b) =
587     EtaleCotangentBasis.coordinateDerivation
588       (k := k) (σ := Option (Fin d)) (B := U) (L := U) j
589         (algebraMap T U b) at hder
590   rw [hmap] at hder
591   calc
592     genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
593         (EtaleCotangentBasis.coordinateDerivation
594           (k := k) (σ := Option (Fin d)) (B := U) (L := U) j
595           (pointLocalToCommonOpen (A := A) M f e g b)) =
596       genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
597         (pointLocalToCommonOpen (A := A) M f e g
598           (EtaleCotangentBasis.coordinateDerivation
599             (k := k) (σ := Option (Fin d)) (B := T) (L := T) j b)) :=
600           congrArg _ hder.symm
601     _ = localPointToField (B := A) M ρ hunitM
602         (EtaleCotangentBasis.coordinateDerivation
603           (k := k) (σ := Option (Fin d)) (B := T) (L := T) j b) := by
604       have h := congrArg
605         (fun φ : T →+* L => φ
606           (EtaleCotangentBasis.coordinateDerivation
607             (k := k) (σ := Option (Fin d)) (B := T) (L := T) j b)) hcomp
608       simpa only [RingHom.comp_apply] using h
609 
610 /-- The actual common-open arc has the canonical ground-field restriction
611 when it is built from the same point-local tilted arc. -/
612 theorem genericArcToPointLocalLaurentSeries_base
613     (M : Ideal A) [M.IsMaximal] (f : Q)
614     (e : Localization.Away f ≃ₐ[Q]
615       Localization.Away (algebraMap Q A f)) (g : Q)
616     [Algebra.FormallyEtale R (Localization.AtPrime M)]
617     (eM : (A ⧸ M) ≃ₐ[k] k) (α : Fin d → k)
618     (hf : IsUnit (originalToPointLocalFinSuccArcLaurentSeries
619       (k := k) (d := d) (A := A) M eM α (algebraMap Q A f)))
620     (hunitM : ∀ b, b ∉ M → IsUnit
621       (originalToPointLocalFinSuccArcLaurentSeries
622         (k := k) (d := d) (A := A) M eM α b))
623     (hg : IsUnit (originalToPointLocalFinSuccArcLaurentSeries
624       (k := k) (d := d) (A := A) M eM α (algebraMap Q A g)))
625     (c : k) :
626     let T := Localization.AtPrime M
627     let Cq := genericOpenRing M f e
628     let U := genericOpenExtraAwayB M f e g
629     letI : Algebra A T := inferInstance
630     letI : Algebra R T := inferInstance
631     letI : Algebra R Cq :=
632       ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
633     letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
634     letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
635     letI : Algebra k U := Algebra.compHom U (algebraMap k R)
636     letI : SMul R U := (inferInstance : Algebra R U).toSMul
637     letI : SMul k U := (inferInstance : Algebra k U).toSMul
638     letI : IsScalarTower k R U := by
639       apply IsScalarTower.of_algebraMap_eq'
640       apply RingHom.ext
641       intro c
642       rfl
643     (genericArcToGenericOpenExtraAwayB M f e
644       (originalToPointLocalFinSuccArcLaurentSeries
645         (k := k) (d := d) (A := A) M eM α) hf hunitM g hg)
646         (algebraMap k U c) = algebraMap k (LaurentSeries k) c := by
647   dsimp
648   let T := Localization.AtPrime M
649   let Cq := genericOpenRing M f e
650   let U := genericOpenExtraAwayB M f e g
651   let ρ := originalToPointLocalFinSuccArcLaurentSeries
652     (k := k) (d := d) (A := A) M eM α
653   letI : Algebra A T := inferInstance
654   letI : Algebra R T := inferInstance
655   letI : Algebra R Cq :=
656     ((algebraMap A Cq).comp (algebraMap R A)).toAlgebra
657   letI : IsScalarTower R A T := inferInstance
658   letI : IsScalarTower R A Cq :=
659     IsScalarTower.of_algebraMap_eq'
660       (show algebraMap R Cq = (algebraMap A Cq).comp (algebraMap R A) from rfl)
661   letI : Algebra R U := Algebra.compHom U (algebraMap R Cq)
662   letI : IsScalarTower k R T := scalarTower_k_R_pointLocal (A := A) M
663   letI : Algebra k U := Algebra.compHom U (algebraMap k R)
664   letI : SMul R U := (inferInstance : Algebra R U).toSMul
665   letI : SMul k U := (inferInstance : Algebra k U).toSMul
666   letI : IsScalarTower k R U := by
667     apply IsScalarTower.of_algebraMap_eq'
668     apply RingHom.ext
669     intro c
670     rfl
671   let θ := pointLocalToCommonOpenAlg (k := k) (d := d) (A := A) M f e g
672   letI : Algebra T U := θ.toRingHom.toAlgebra' (fun x y => mul_comm (θ x) y)
673   have hθ : θ.toRingHom = pointLocalToCommonOpen (A := A) M f e g := by
674     ext x
675     rfl
676   have hcomm (c : k) :
677       pointLocalToCommonOpen (A := A) M f e g (algebraMap k T c) =
678         algebraMap k U c := by
679     have h := θ.commutes c
680     change pointLocalToCommonOpen (A := A) M f e g
681       (algebraMap k T c) = algebraMap k U c at h
682     exact h
683   have hcomp := genericArcToExtraAway_comp_pointLocalToCommonOpen
684     (A := A) M f e g ρ hf hunitM hg
685   have heval := congrArg
686     (fun φ : T →+* LaurentSeries k => φ (algebraMap k T c)) hcomp
687   change genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
688       (pointLocalToCommonOpen (A := A) M f e g (algebraMap k T c)) =
689     localPointToField (B := A) M ρ hunitM (algebraMap k T c) at heval
690   calc
691     genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
692         (algebraMap k U c) =
693       genericArcToGenericOpenExtraAwayB M f e ρ hf hunitM g hg
694         (pointLocalToCommonOpen (A := A) M f e g (algebraMap k T c)) :=
695           congrArg _ (hcomm c).symm
696     _ = localPointToField (B := A) M ρ hunitM (algebraMap k T c) := heval
697     _ = ρ (algebraMap k A c) := by
698           rw [IsScalarTower.algebraMap_apply k A T c]
699           exact localPointToField_apply M ρ hunitM (algebraMap k A c)
700     _ = algebraMap k (LaurentSeries k) c := by
701           exact originalToPointLocalFinSuccArcLaurentSeries_base
702             (k := k) (d := d) (A := A) M eM α c
703 
704 
705 end
706 end Stafford38.Geometry.ActualCommonOpenCompletionDerivation
707