Stafford38/Geometry/A0ChartFormalEtale.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.ProjectiveChartSameFieldOverlap
3 public import Stafford38.Geometry.ChartGenericPointFractionRing
4 public import Stafford38.Geometry.EtaleGenericOpenExtraAwayB
5 public import Mathlib.RingTheory.Etale.Basic
6 public import Mathlib.RingTheory.Localization.Away.Basic
7 
8 @[expose] public section
9 
10 set_option autoImplicit false
11 set_option maxHeartbeats 2400000
12 
13 noncomputable section
14 namespace Stafford38.Geometry.A0ChartFormalEtale
15 
16 open Stafford38.Geometry.ProjectiveChartSameFieldOverlap
17 open Stafford38.Geometry.ChartGenericPointFractionRing
18 open Stafford38.Geometry.EtaleGenericOpenTransport
19 open Stafford38.Geometry.AffineComponentCoordinateSplit
20 open Stafford38.Geometry.ComponentFunctionFieldBoundary
21 open Stafford38.Geometry.ComponentProjectiveChartFactorization
22 open Stafford38.Geometry.ProjectiveChartCoordinates
23 
24 universe u v w
25 
26 /-- If a formally etale algebra already inverts `r`, it is formally etale
27 as an algebra over the localization that inverts `r`. -/
28 theorem formallyEtale_away_of_formallyEtale_base
29     {R S : Type u} [CommRing R] [CommRing S] [Algebra R S]
30     [Algebra.FormallyEtale R S] (r : R)
31     (hr : IsUnit (algebraMap R S r)) :
32     let T := Localization.Away r
33     letI : Algebra T S :=
34       (IsLocalization.Away.lift (g := algebraMap R S) r hr).toAlgebra
35     Algebra.FormallyEtale T S := by
36   let T := Localization.Away r
37   let φ : T →+* S := IsLocalization.Away.lift (g := algebraMap R S) r hr
38   letI : Algebra T S := φ.toAlgebra
39   have hcomp : (algebraMap T S).comp (algebraMap R T) = algebraMap R S := by
40     exact IsLocalization.Away.lift_comp (g := algebraMap R S) r hr
41   letI : IsScalarTower R T S := IsScalarTower.of_algebraMap_eq (fun x => (DFunLike.congr_fun hcomp x).symm)
42   letI : IsLocalization
43       (Submonoid.map (algebraMap R S) (Submonoid.powers r)) S := by
44     apply IsLocalization.of_le_isUnit
45     rintro z ⟨x, hx, rfl⟩
46     rcases (Submonoid.mem_powers_iff _ _).mp hx with ⟨n, hn⟩
47     rw [← hn, map_pow]
48     exact hr.pow n
49   exact Algebra.FormallyEtale.localization_map
50     (R := R) (S := S) (Rₘ := T) (Sₘ := S) (Submonoid.powers r)
51 
52 
53 /-- A quotient-chart equivalence carries its chart-denominator localization
54 with it. -/
55 noncomputable def selectedChartAwayEquivOfQuotientEquiv
56     {k : Type u} [Field k] {m : ℕ}
57     {Q : Type v} [CommRing Q] [Algebra k Q]
58     (P : PrimeSpectrum (MvPolynomial (Fin m) k)) (j : Fin m)
59     (hsel : SelectedAffineChartQuotient (k := k) P j ≃ₐ[k] Q) :
60     SelectedAffineChartLocalization (k := k) P j ≃ₐ[k]
61       Localization.Away (hsel (selectedAffineChartDenominator P j)) := by
62   let R := SelectedAffineChartQuotient (k := k) P j
63   let S := SelectedAffineChartLocalization (k := k) P j
64   let T := Localization.Away (hsel (selectedAffineChartDenominator P j))
65   let M := Submonoid.powers (selectedAffineChartDenominator P j)
66   let N := Submonoid.powers (hsel (selectedAffineChartDenominator P j))
67   letI : IsLocalization M S := inferInstance
68   letI : IsLocalization N T := inferInstance
69   have hmap : Submonoid.map hsel.toRingHom M = N := by
70     simp [M, N, Submonoid.map_powers]
71   exact IsLocalization.algEquivOfAlgEquiv
72     (A := k) (R := R) (M := M) (S := S) (P := Q) (T := N) (Q := T)
73     hsel hmap
74 
75 /-- The precise Q-algebra structure on the common open is the one induced by
76 its canonical localization over Q. -/
77 theorem formallyEtale_genericOpenExtraAway_overQ
78     {Q : Type u} [CommRing Q] {B : Type v} [CommRing B] [Algebra Q B]
79     (M : Ideal B) [M.IsPrime] (f : Q)
80     (e : Localization.Away f ≃ₐ[Q]
81       Localization.Away (algebraMap Q B f)) (g : Q) :
82     let Cq := genericOpenRing M f e
83     let C := genericOpenExtraAwayB M f e g
84     letI : Algebra Q Cq :=
85       Algebra.compHom Cq (algebraMap Q (Localization.Away f))
86     letI : Algebra Q C := Algebra.compHom C (algebraMap Q Cq)
87     Algebra.FormallyEtale Q C := by
88   dsimp
89   let Cq := genericOpenRing M f e
90   let C := genericOpenExtraAwayB M f e g
91   letI : Semiring C := (inferInstance : CommSemiring C).toSemiring
92   letI : Algebra (Localization.Away f) Cq := inferInstance
93   letI : Algebra Q Cq := inferInstance
94   letI : Algebra Cq C := inferInstance
95   letI : Algebra Q C := Algebra.compHom C (algebraMap Q Cq)
96   letI : SMul Q Cq := (inferInstance : Algebra Q Cq).toSMul
97   letI : SMul Cq C := (inferInstance : Algebra Cq C).toSMul
98   letI : SMul Q C := (Algebra.compHom C (algebraMap Q Cq)).toSMul
99   letI : IsScalarTower Q Cq C :=
100     IsScalarTower.of_algebraMap_eq (fun _ => rfl)
101   letI : Algebra.FormallyEtale Q Cq := formallyEtale_genericOpenRing M f e
102   letI : Algebra.FormallyEtale Cq C :=
103     Algebra.FormallyEtale.of_isLocalization
104       (Submonoid.powers (genericOpenBMap M f e (algebraMap Q B g)))
105   exact Algebra.FormallyEtale.comp Q Cq C
106 
107 
108 /-- The finite-birational map on B restricts to the canonical Q map on its
109 localized generic chart. -/
110 theorem genericOpenBMap_base_eq
111     {Q : Type u} [CommRing Q] {B : Type v} [CommRing B] [Algebra Q B]
112     (M : Ideal B) [M.IsPrime] (f : Q)
113     (e : Localization.Away f ≃ₐ[Q]
114       Localization.Away (algebraMap Q B f)) (q : Q) :
115     genericOpenBMap M f e (algebraMap Q B q) =
116       algebraMap Q (genericOpenRing M f e) q := by
117   let Cq := genericOpenRing M f e
118   let Bf := Localization.Away (algebraMap Q B f)
119   letI : Algebra Q Cq := inferInstance
120   change algebraMap (Localization.Away f) Cq
121       (e.symm (algebraMap B Bf (algebraMap Q B q))) = _
122   rw [← IsScalarTower.algebraMap_apply Q B Bf]
123   rw [e.symm.commutes]
124   rfl
125 
126 /-- The canonical Q-algebra map into the common generic open agrees with the
127 map induced from the integral chart algebra. -/
128 theorem genericOpenExtraAway_base_map_agrees
129     {Q : Type u} [CommRing Q] {B : Type v} [CommRing B] [Algebra Q B]
130     (M : Ideal B) [M.IsPrime] (f : Q)
131     (e : Localization.Away f ≃ₐ[Q]
132       Localization.Away (algebraMap Q B f)) (g : Q) :
133     let Cq := genericOpenRing M f e
134     let C := genericOpenExtraAwayB M f e g
135     letI : Algebra Q Cq := inferInstance
136     letI : Algebra Q C := Algebra.compHom C (algebraMap Q Cq)
137     (genericOpenExtraAwayBMap M f e g).comp (algebraMap Q B) =
138       algebraMap Q C := by
139   dsimp
140   let Cq := genericOpenRing M f e
141   let C := genericOpenExtraAwayB M f e g
142   letI : Algebra Q Cq := inferInstance
143   letI : Algebra Q C := Algebra.compHom C (algebraMap Q Cq)
144   ext q
145   change algebraMap Cq C (genericOpenBMap M f e (algebraMap Q B q)) = _
146   rw [genericOpenBMap_base_eq M f e q]
147   rfl
148 
149 /-- The original affine chart localization maps into the selected projective
150 chart localization and then into the actual common open. -/
151 noncomputable def originalAffineChartLocalizationToCommonOpen
152     {k : Type u} [Field k] {m : ℕ}
153     {Q : Type v} [CommRing Q] [Algebra k Q]
154     {B : Type w} [CommRing B] [Algebra Q B]
155     (P : PrimeSpectrum (MvPolynomial (Fin m) k)) (j : Fin m)
156     (hxj : componentCoordinate P j ≠ 0)
157     (hsel : SelectedAffineChartQuotient (k := k) P j ≃ₐ[k] Q)
158     (M : Ideal B) [M.IsPrime] (f : Q)
159     (e : Localization.Away f ≃ₐ[Q]
160       Localization.Away (algebraMap Q B f)) :
161     let C := genericOpenExtraAwayB M f e (hsel (selectedAffineChartDenominator P j))
162     letI : Semiring C := (inferInstance : CommSemiring C).toSemiring
163     OriginalAffineChartLocalization (k := k) P j →+* C := by
164   let g := hsel (selectedAffineChartDenominator P j)
165   let Cq := genericOpenRing M f e
166   let C := genericOpenExtraAwayB M f e g
167   letI : Algebra (Localization.Away f) Cq := inferInstance
168   letI : Algebra Q Cq := inferInstance
169   letI : Algebra Cq C := inferInstance
170   letI : Algebra Q C := Algebra.compHom C (algebraMap Q Cq)
171   let z := genericOpenBMap M f e (algebraMap Q B g)
172   have hz : z = algebraMap Q Cq g := genericOpenBMap_base_eq M f e g
173   letI : IsLocalization.Away (algebraMap Q Cq g) C := by
174     rw [← hz]
175     infer_instance
176   let h : OriginalAffineChartLocalization (k := k) P j ≃ₐ[k]
177       Localization.Away g :=
178     (originalAffineChartOverlapEquiv P j hxj).trans
179       (selectedChartAwayEquivOfQuotientEquiv P j hsel)
180   let ψraw : Localization.Away g →+* C :=
181     IsLocalization.Away.map (S := Localization.Away g) (Q := C)
182       (algebraMap Q Cq) g
183   let ψ : Localization.Away g →+* C :=
184     RingHom.copy ψraw (fun x => ψraw x) rfl
185   exact ψ.comp h.toAlgHom.toRingHom
186 
187 /-- The original affine quotient maps to the same common open through its
188 selected chart localization. -/
189 noncomputable def originalAffineChartToCommonOpen
190     {k : Type u} [Field k] {m : ℕ}
191     {Q : Type v} [CommRing Q] [Algebra k Q]
192     {B : Type w} [CommRing B] [Algebra Q B]
193     (P : PrimeSpectrum (MvPolynomial (Fin m) k)) (j : Fin m)
194     (hxj : componentCoordinate P j ≠ 0)
195     (hsel : SelectedAffineChartQuotient (k := k) P j ≃ₐ[k] Q)
196     (M : Ideal B) [M.IsPrime] (f : Q)
197     (e : Localization.Away f ≃ₐ[Q]
198       Localization.Away (algebraMap Q B f)) :
199     let C := genericOpenExtraAwayB M f e (hsel (selectedAffineChartDenominator P j))
200     letI : Semiring C := (inferInstance : CommSemiring C).toSemiring
201     OriginalAffineChartQuotient (k := k) P →+* C :=
202   (originalAffineChartLocalizationToCommonOpen P j hxj hsel M f e).comp
203     (algebraMap (OriginalAffineChartQuotient (k := k) P)
204       (OriginalAffineChartLocalization P j))
205 
206 /-- The chart map above is formally etale: first localize the original chart,
207 then use the checked affine-overlap equivalence, and finally localize the
208 common generic open at the image of the selected denominator. -/
209 theorem formallyEtale_originalAffineChartToCommonOpen
210     {k : Type u} [Field k] {m : ℕ}
211     {Q : Type v} [CommRing Q] [Algebra k Q]
212     {B : Type w} [CommRing B] [Algebra Q B]
213     (P : PrimeSpectrum (MvPolynomial (Fin m) k)) (j : Fin m)
214     (hxj : componentCoordinate P j ≠ 0)
215     (hsel : SelectedAffineChartQuotient (k := k) P j ≃ₐ[k] Q)
216     (M : Ideal B) [M.IsPrime] (f : Q)
217     (e : Localization.Away f ≃ₐ[Q]
218       Localization.Away (algebraMap Q B f)) :
219     let g := hsel (selectedAffineChartDenominator P j)
220     let C := genericOpenExtraAwayB M f e g
221     letI : Semiring C := (inferInstance : CommSemiring C).toSemiring
222     let A₀ := OriginalAffineChartQuotient (k := k) P
223     let S := OriginalAffineChartLocalization (k := k) P j
224     letI : Algebra A₀ C :=
225       (originalAffineChartToCommonOpen P j hxj hsel M f e).toAlgebra
226     Algebra.FormallyEtale A₀ C := by
227   dsimp
228   let g := hsel (selectedAffineChartDenominator P j)
229   let C := genericOpenExtraAwayB M f e g
230   letI : Semiring C := (inferInstance : CommSemiring C).toSemiring
231   let A₀ := OriginalAffineChartQuotient (k := k) P
232   let S := OriginalAffineChartLocalization (k := k) P j
233   let T := Localization.Away g
234   let Cq := genericOpenRing M f e
235   letI : Algebra Q Cq := inferInstance
236   letI : Algebra Cq C := inferInstance
237   letI : Algebra Q C :=
238     Algebra.compHom C (algebraMap Q Cq)
239   have hg : IsUnit (algebraMap Q C g) := by
240     change IsUnit (algebraMap Cq C (algebraMap Q Cq g))
241     rw [← genericOpenBMap_base_eq M f e g]
242     exact IsLocalization.Away.algebraMap_isUnit
243       (genericOpenBMap M f e (algebraMap Q B g))
244   letI : Algebra.FormallyEtale Q C :=
245     formallyEtale_genericOpenExtraAway_overQ M f e g
246   let φ : T →+* C := IsLocalization.Away.lift
247     (g := algebraMap Q C) g hg
248   letI : Algebra T C := φ.toAlgebra
249   letI : SMul Q T := (inferInstance : Algebra Q T).toSMul
250   letI : SMul T C := (inferInstance : Algebra T C).toSMul
251   letI : SMul Q C := (Algebra.compHom C (algebraMap Q Cq)).toSMul
252   have hcomp : (algebraMap T C).comp (algebraMap Q T) = algebraMap Q C := by
253     exact IsLocalization.Away.lift_comp (g := algebraMap Q C) g hg
254   letI : IsScalarTower Q T C :=
255     IsScalarTower.of_algebraMap_eq (fun q => (DFunLike.congr_fun hcomp q).symm)
256   letI : Algebra.FormallyEtale T C :=
257     formallyEtale_away_of_formallyEtale_base (R := Q) (S := C) g hg
258   let h : S ≃ₐ[k] T :=
259     (originalAffineChartOverlapEquiv P j hxj).trans
260       (selectedChartAwayEquivOfQuotientEquiv P j hsel)
261   letI : Algebra S T := h.toAlgHom.toAlgebra
262   let hS : S ≃ₐ[S] T := { h with commutes' := fun _ => rfl }
263   letI : Algebra.FormallyEtale S T := Algebra.FormallyEtale.of_equiv hS
264   letI : Algebra S C := Algebra.compHom C (algebraMap S T)
265   letI : SMul T C := (inferInstance : Algebra T C).toSMul
266   letI : SMul S C := (Algebra.compHom C (algebraMap S T)).toSMul
267   letI : IsScalarTower S T C := IsScalarTower.of_algebraMap_eq (fun _ => rfl)
268   have hSC : Algebra.FormallyEtale S C :=
269     Algebra.FormallyEtale.comp S T C
270   letI : Algebra A₀ S := inferInstance
271   letI : Algebra A₀ C :=
272     (originalAffineChartToCommonOpen P j hxj hsel M f e).toAlgebra
273   letI : SMul A₀ S := (inferInstance : Algebra A₀ S).toSMul
274   letI : SMul S C := (inferInstance : Algebra S C).toSMul
275   letI : SMul A₀ C := (inferInstance : Algebra A₀ C).toSMul
276   letI : IsScalarTower A₀ S C := IsScalarTower.of_algebraMap_eq (fun _ => rfl)
277   letI : Algebra.FormallyEtale A₀ S :=
278     Algebra.FormallyEtale.of_isLocalization
279       (Submonoid.powers (originalAffineChartDenominator P j))
280   exact Algebra.FormallyEtale.comp A₀ S C
281 
282 end Stafford38.Geometry.A0ChartFormalEtale
283 end
284