Stafford38/Geometry/ActualOptionGroundPointCompletion.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.PrescribedGroundPointUnitPowerChart
3 public import Mathlib.RingTheory.Etale.Basic
4 public import Mathlib.Algebra.MvPolynomial.Rename
5 
6 @[expose] public section
7 
8 set_option autoImplicit false
9 set_option maxHeartbeats 2000000
10 set_option linter.style.haveILetI false
11 
12 noncomputable section
13 
14 namespace Stafford38.Geometry.ActualOptionGroundPointCompletion
15 
16 /-- Formal étaleness is invariant under an algebra equivalence of source
17 rings, followed by composition through the equivalent source. -/
18 theorem formallyEtale_after_source_equiv
19     {k R S T : Type*} [CommRing k] [CommRing R] [CommRing S] [CommRing T]
20     [Algebra k R] [Algebra k S] [Algebra S T] [Algebra R S] [Algebra R T]
21     [IsScalarTower R S T]
22     (e : R ≃ₐ[k] S) (he : e.toRingEquiv.toFun = algebraMap R S)
23     (hEt : Algebra.FormallyEtale S T) :
24     Algebra.FormallyEtale R T := by
25   letI : Algebra R R := Algebra.id R
26   have eR : R ≃ₐ[R] S :=
27     { toRingEquiv := e.toRingEquiv
28       commutes' := by intro x; exact congrFun he x }
29   have hBase : Algebra.FormallyEtale R S :=
30     Algebra.FormallyEtale.of_equiv (R := R) (A := R) eR
31   letI : Algebra.FormallyEtale R S := hBase
32   exact Algebra.FormallyEtale.comp R S T
33 
34 /-- Transfer formal etaleness across two algebra structures on the same
35 underlying target ring when their algebra maps agree. The identity ring
36 isomorphism is the induced algebra equivalence. -/
37 theorem formallyEtale_of_same_target_algebraMap
38     {R T : Type*} [CommRing R] [CommRing T]
39     (a₁ a₂ : Algebra R T)
40     (hmap : @algebraMap R T _ _ a₁ = @algebraMap R T _ _ a₂)
41     (hEt : @Algebra.FormallyEtale R T _ _ a₁) :
42     @Algebra.FormallyEtale R T _ _ a₂ := by
43   let e : @AlgEquiv R T T _ _ _ a₁ a₂ :=
44     @AlgEquiv.ofRingEquiv R T T _ _ _ a₁ a₂ (RingEquiv.refl T) (by
45       intro x
46       exact congrArg (fun g : R →+* T => g x) hmap)
47   exact @Algebra.FormallyEtale.of_equiv R T T _ _ a₁ _ a₂ hEt e
48 
49 /-- The complete output of the prescribed closed-ground-point chart
50 construction for the given option-coordinate map and divisor parameter. -/
51 abbrev GroundPointChartOutput
52     {k B σ : Type*} [Field k] [IsAlgClosed k] [CommRing B] [Algebra k B]
53     [IsDomain B] [Algebra.FiniteType k B] [Fintype σ]
54     (P : Ideal B) [P.IsPrime]
55     (fOption : MvPolynomial (Option σ) k →ₐ[k] B)
56     (s q₀ q₁ : B) (qRow : σ → B)
57     (τ : Fin (Fintype.card σ) ≃ σ)
58     (e₀ e₁ : ℕ) : Prop :=
59   let Rfin := MvPolynomial (Option (Fin (Fintype.card σ))) k
60   let e : Rfin ≃ₐ[k] MvPolynomial (Option σ) k :=
61     MvPolynomial.renameEquiv k τ.optionCongr
62   let fFin : Rfin →ₐ[k] B := fOption.comp e.toAlgHom
63   letI : Algebra Rfin B := fFin.toRingHom.toAlgebra
64   letI : IsScalarTower k Rfin B := IsScalarTower.of_algebraMap_eq' (by
65     ext c
66     exact (fFin.commutes c).symm)
67   ∃ (fUnit fEtale : B) (M : Ideal B) (hM : M.IsMaximal),
68     letI : M.IsMaximal := hM
69     letI : Algebra Rfin (Localization.AtPrime M) := inferInstance
70     ∃ (eM : (B ⧸ M) ≃ₐ[k] k)
71       (v₀ v₁ : Localization.Away fUnit)
72       (chart : Localization.AtPrime M →ₐ[k]
73         MvPowerSeries (Fin (Fintype.card σ + 1)) k)
74       (U₀ U₁ : MvPowerSeries (Fin (Fintype.card σ + 1)) k),
75       fUnit ∉ P ∧ fUnit ∉ M ∧ P ≤ M ∧
76       fEtale ∉ P ∧ fEtale ∉ M ∧
77       Algebra.IsStandardEtale Rfin (Localization.Away fEtale) ∧
78       IsUnit v₀ ∧ IsUnit v₁ ∧
79       algebraMap B (Localization.Away fUnit) q₀ =
80         (algebraMap B (Localization.Away fUnit) s) ^ e₀ * v₀ ∧
81       algebraMap B (Localization.Away fUnit) q₁ =
82         (algebraMap B (Localization.Away fUnit) s) ^ e₁ * v₁ ∧
83       (0 < e₀ ∧ e₀ < e₁) ∧
84       IsUnit U₀ ∧ IsUnit U₁ ∧
85       MvPowerSeries.constantCoeff U₀ ≠ 0 ∧
86       MvPowerSeries.constantCoeff U₁ ≠ 0 ∧
87       chart (algebraMap B (Localization.AtPrime M) s) =
88         MvPowerSeries.X (0 : Fin (Fintype.card σ + 1)) ∧
89       (∀ z : σ, chart (algebraMap B (Localization.AtPrime M) (qRow z)) =
90         MvPowerSeries.C
91           (@Stafford38.Geometry.PrescribedAffineResidueCompletion.residueCoordinates
92             k (Option (Fin (Fintype.card σ))) B inferInstance inferInstance inferInstance
93             fFin.toRingHom.toAlgebra M eM (some (τ.symm z))) +
94         MvPowerSeries.X (τ.symm z).succ) ∧
95       chart (algebraMap B (Localization.AtPrime M) q₀) =
96         MvPowerSeries.X (0 : Fin (Fintype.card σ + 1)) ^ e₀ * U₀ ∧
97       chart (algebraMap B (Localization.AtPrime M) q₁) =
98         MvPowerSeries.X (0 : Fin (Fintype.card σ + 1)) ^ e₁ * U₁ ∧
99       ∃ (hEtM : Algebra.FormallyEtale Rfin (Localization.AtPrime M)),
100         chart = @Stafford38.Geometry.PrescribedGroundPointUnitPowerChart.localToFinSuccPowerSeries
101           k B (Fintype.card σ) inferInstance inferInstance inferInstance
102           (inferInstance : Algebra Rfin B) (inferInstance : IsScalarTower k Rfin B)
103           (Algebra.EssFiniteType.of_comp k Rfin B) M hM eM hEtM
104 
105 /-- Starting from the actual Option-coordinate map and its specified divisor
106 parameter, obtain the existing closed-ground-point completion chart. Every
107 selected row identity is transported through the same polynomial rename. -/
108 theorem exists_groundPoint_chart_from_option_map
109     {k B σ : Type*} [Field k] [IsAlgClosed k] [CommRing B] [Algebra k B]
110     [IsDomain B] [Algebra.FiniteType k B] [Fintype σ]
111     (P : Ideal B) [P.IsPrime]
112     (fOption : MvPolynomial (Option σ) k →ₐ[k] B)
113     (s q₀ q₁ : B) (qRow : σ → B)
114     (hnone : fOption (MvPolynomial.X none) = s)
115     (hsP : s ∈ P)
116     (hsome : ∀ z, fOption (MvPolynomial.X (some z)) = qRow z)
117     (τ : Fin (Fintype.card σ) ≃ σ)
118     (hEt :
119       let Rσ := MvPolynomial (Option σ) k
120       letI : Algebra Rσ B := fOption.toRingHom.toAlgebra
121       letI : IsScalarTower k Rσ B := IsScalarTower.of_algebraMap_eq' (by
122         ext c
123         exact (fOption.commutes c).symm)
124       letI : Algebra Rσ (Localization.AtPrime P) := inferInstance
125       Algebra.FormallyEtale Rσ (Localization.AtPrime P))
126     (e₀ e₁ : ℕ) (hOrders : 0 < e₀ ∧ e₀ < e₁)
127     (u₀ u₁ : Localization.AtPrime P) (hu₀ : IsUnit u₀) (hu₁ : IsUnit u₁)
128     (h₀ : algebraMap B (Localization.AtPrime P) q₀ =
129       (algebraMap B (Localization.AtPrime P) s) ^ e₀ * u₀)
130     (h₁ : algebraMap B (Localization.AtPrime P) q₁ =
131       (algebraMap B (Localization.AtPrime P) s) ^ e₁ * u₁) :
132     GroundPointChartOutput P fOption s q₀ q₁ qRow τ e₀ e₁ := by
133   classical
134   let Rσ := MvPolynomial (Option σ) k
135   let Rfin := MvPolynomial (Option (Fin (Fintype.card σ))) k
136   let e : Rfin ≃ₐ[k] Rσ := MvPolynomial.renameEquiv k τ.optionCongr
137   letI : Algebra Rfin Rσ := e.toRingEquiv.toRingHom.toAlgebra
138   letI : Algebra Rσ B := fOption.toRingHom.toAlgebra
139   letI : IsScalarTower k Rσ B := IsScalarTower.of_algebraMap_eq' (by
140     ext c
141     exact (fOption.commutes c).symm)
142   let fFin : Rfin →ₐ[k] B := fOption.comp e.toAlgHom
143   letI : Algebra Rfin B := fFin.toRingHom.toAlgebra
144   letI : IsScalarTower k Rfin B := IsScalarTower.of_algebraMap_eq' (by
145     ext c
146     exact (fFin.commutes c).symm)
147   let algDefault : Algebra Rσ (Localization.AtPrime P) := inferInstance
148   have hmapFin : algebraMap Rfin B =
149       (algebraMap Rσ B).comp (algebraMap Rfin Rσ) := by
150     change fFin.toRingHom = fOption.toRingHom.comp e.toRingHom
151     rfl
152   letI : IsScalarTower Rfin Rσ B := IsScalarTower.of_algebraMap_eq' hmapFin
153   letI : Algebra Rσ (Localization.AtPrime P) := algDefault
154   letI : Algebra.FormallyEtale Rσ (Localization.AtPrime P) := hEt
155   have hmapFinT : algebraMap Rfin (Localization.AtPrime P) =
156       (algebraMap Rσ (Localization.AtPrime P)).comp (algebraMap Rfin Rσ) := by
157     calc
158       algebraMap Rfin (Localization.AtPrime P) =
159           (algebraMap B (Localization.AtPrime P)).comp (algebraMap Rfin B) :=
160         IsScalarTower.algebraMap_eq Rfin B (Localization.AtPrime P)
161       _ = (algebraMap B (Localization.AtPrime P)).comp
162           ((algebraMap Rσ B).comp (algebraMap Rfin Rσ)) := by rw [hmapFin]
163       _ = ((algebraMap B (Localization.AtPrime P)).comp (algebraMap Rσ B)).comp
164           (algebraMap Rfin Rσ) := by rw [RingHom.comp_assoc]
165       _ = (algebraMap Rσ (Localization.AtPrime P)).comp (algebraMap Rfin Rσ) :=
166         congrArg (fun g => g.comp (algebraMap Rfin Rσ))
167           (IsScalarTower.algebraMap_eq Rσ B (Localization.AtPrime P))
168   letI : IsScalarTower Rfin Rσ (Localization.AtPrime P) :=
169     IsScalarTower.of_algebraMap_eq' hmapFinT
170   have hEtFin : Algebra.FormallyEtale Rfin (Localization.AtPrime P) :=
171     formallyEtale_after_source_equiv e (by ext p; rfl) hEt
172   letI : Algebra.EssFiniteType Rfin B := Algebra.EssFiniteType.of_comp k Rfin B
173   have hnoneFin : s = algebraMap Rfin B (MvPolynomial.X none) := by
174     change s = fFin (MvPolynomial.X none)
175     simp [fFin, e, MvPolynomial.renameEquiv, MvPolynomial.rename_X, hnone]
176   have hrowsFin (i : Fin (Fintype.card σ)) :
177       algebraMap Rfin B (MvPolynomial.X (some i)) = qRow (τ i) := by
178     change fFin (MvPolynomial.X (some i)) = qRow (τ i)
179     simp [fFin, e, MvPolynomial.renameEquiv, MvPolynomial.rename_X, hsome]
180   obtain ⟨fUnit, fEtale, M, hM, eM, hEtM, v₀, v₁,
181       hfUnitP, hfUnitM, hPM, hfEtaleP, hfEtaleM, hStandard,
182       hv₀, hv₁, hAway₀, hAway₁, hOrders', hChart⟩ :=
183     Stafford38.Geometry.PrescribedGroundPointUnitPowerChart.exists_prescribed_ground_point_chart_with_unit_powers
184       (k := k) (B := B) (d := Fintype.card σ) P s q₀ q₁ hnoneFin hsP hEtFin
185       e₀ e₁ hOrders u₀ u₁ hu₀ hu₁ h₀ h₁
186   letI : M.IsMaximal := hM
187   letI : Algebra.FormallyEtale Rfin (Localization.AtPrime M) := hEtM
188   let chart := Stafford38.Geometry.PrescribedGroundPointUnitPowerChart.localToFinSuccPowerSeries
189     (k := k) (B := B) (d := Fintype.card σ) M eM
190   obtain ⟨U₀, U₁, hU₀, hU₁, hcc₀, hcc₁, hsChart, hrows, hq₀Chart, hq₁Chart⟩ := hChart
191   have hrowEq (z : σ) : qRow z =
192       algebraMap Rfin B (MvPolynomial.X (some (τ.symm z))) := by
193     simpa using (hrowsFin (τ.symm z)).symm
194   have hqRow (z : σ) : chart (algebraMap B (Localization.AtPrime M) (qRow z)) =
195       MvPowerSeries.C
196         (Stafford38.Geometry.PrescribedAffineResidueCompletion.residueCoordinates
197           (σ := Option (Fin (Fintype.card σ))) M eM (some (τ.symm z))) +
198         MvPowerSeries.X (τ.symm z).succ := by
199     rw [hrowEq z]
200     exact hrows (τ.symm z)
201   exact ⟨fUnit, fEtale, M, hM, eM, v₀, v₁, chart, U₀, U₁,
202     hfUnitP, hfUnitM, hPM, hfEtaleP, hfEtaleM, hStandard,
203     hv₀, hv₁, hAway₀, hAway₁, hOrders', hU₀, hU₁, hcc₀, hcc₁,
204     hsChart, hqRow, hq₀Chart, hq₁Chart, hEtM, rfl⟩
205 
206 end Stafford38.Geometry.ActualOptionGroundPointCompletion
207