Stafford38/Paper/Section5/Steps.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 
3 public import Stafford38.Paper.Section5.ResidueBasis
4 public import Stafford38.Paper.Section5.Place
5 public import Stafford38.Paper.Section5.TangentCone
6 public import Stafford38.Paper.Section5.GenericTangentRank
7 public import Stafford38.Paper.Section5.Completion
8 public import Stafford38.Geometry.ActualWitnessConormalAssembly
9 public import Stafford38.Geometry.ConormalScalarExtensionVanishing
10 public import Stafford38.Geometry.ExactDivisorialVisibleFrameExistence
11 public import Stafford38.Geometry.FormalDivisorAxisLift
12 public import Stafford38.Geometry.PaperLaurentChartDerivation
13 public import Stafford38.Geometry.PaperResidueDerivationFrame
14 public import Stafford38.Geometry.PaperSameWitnessComponentFieldRank
15 public import Stafford38.Geometry.PaperRetainedChartAssembly
16 public import Stafford38.Geometry.ProjectiveConormalDirections
17 public import Stafford38.Geometry.SmoothConormalFibreVanishing
18 
19 @[expose] public section
20 
21 /-!
22 # The paragraphs of the proof of Theorem 5.7(i)
23 
24 Section 5.2 proves Theorem 5.7(i) by a chain of paragraphs between
25 Lemmas 5.9–5.13.  Each declaration below states the claim of one paragraph and
26 proves it.  `Stafford38.Paper.Section5.Proof` chains them.
27 
28 Notation.  `q : Fin (m+1) → κ[[t]]` is the column `q_i = x̄_i / x̄_j` in the
29 completed discrete valuation ring `V̂ ≅ κ[[t]]`, index `0` is the homogenizing
30 coordinate, the paper's index `1` is `Fin.succ ⟨0, hm⟩`, and `j` is the chart
31 with `q_j = 1`.  `laurentColumn` embeds `κ[[t]]` into `κ((t))`, and
32 `dehomogenizedPoint` is `y = (q_1/q_0, …, q_n/q_0)`.  The matrix
33 `M = (q, Z_{•1}, …, Z_{•d'}, τ)` is `formalTangentMatrix q Z τ`, whose column
34 index `Unit ⊕ (Fin d' ⊕ Unit)` lists `q`, then the `Z`-columns, then `τ`.
35 The row vector `u = (0, 1, 0, …, 0)` is `axisRow (Fin.succ ⟨0, hm⟩)`.
36 -/
37 
38 namespace Stafford38.Paper.Section5
39 
40 open IsLocalRing
41 open Stafford38.Geometry.AffineComponentCoordinateSplit
42 open Stafford38.Geometry.AffineConormalSpan
43 open Stafford38.Geometry.ActualWitnessConormalAssembly
44 open Stafford38.Geometry.AsymptoticDivisorExistence
45 open Stafford38.Geometry.ComponentFunctionFieldBoundary
46 open Stafford38.Geometry.ComponentProjectiveClosure
47 open Stafford38.Geometry.ConormalScalarExtensionVanishing
48 open Stafford38.Geometry.ContinuousPowerSeriesTangentFrame
49 open Stafford38.Geometry.ExactDivisorialVisibleFrameExistence
50 open Stafford38.Geometry.FormalDivisorLaurentConormal
51 open Stafford38.Geometry.GeneralDivisorialVisibleFrame
52 open Stafford38.Geometry.KaehlerVisibleDerivationFrame
53 open Stafford38.Geometry.LaurentConormalDirection
54 open Stafford38.Geometry.LaurentConormalResidueExtension
55 open Stafford38.Geometry.PaperActualDivisorTangent
56 open Stafford38.Geometry.PaperLaurentChartDerivation
57 open Stafford38.Geometry.PaperResidueDerivationFrame
58 open Stafford38.Geometry.PaperRetainedChartAssembly
59 open Stafford38.Geometry.PaperSameWitnessComponentFieldRank
60 open Stafford38.Geometry.ProjectiveConormalDehomogenization
61 open Stafford38.Geometry.ProjectiveConormalDirections
62 open Stafford38.Geometry.RelativeCoefficientDVR
63 open Stafford38.Geometry.RelativeRetainedBoundaryPlace
64 open Stafford38.Geometry.RetainedGroundMapIdentification
65 open Stafford38.Geometry.RetainedPlaceConormalTransport
66 open Stafford38.Geometry.RetainedProjectiveCompletion
67 open Stafford38.Geometry.ScalarExtensionPoints
68 open Stafford38.Geometry.SmoothConormalFibreVanishing
69 open Stafford38.GeometryFormalDivisorAxisLift
70 open Stafford38.GeometryFormalDivisorTangent
71 open Stafford38.GeometryPowerSeriesTangentLimit
72 open Stafford38.GeometryResidueMinorSelection
73 open Stafford38.GeometryRetractionSpecialization
74 open Stafford38.GeometrySplitTangentMatrix
75 
76 noncomputable section
77 
78 set_option linter.style.haveILetI false
79 set_option maxHeartbeats 12000000
80 set_option synthInstance.maxHeartbeats 500000
81 
82 universe u
83 
84 /-! ## The case `x̄_1` algebraic -/
85 
86 section AlgebraicCoordinate
87 
88 open Stafford38.Geometry.AffineConormalClosure
89 open Stafford38.Geometry.ConormalPrincipalOpenDensity
90 open Stafford38.Geometry.SmoothAffineConormal
91 open Stafford38.Geometry.CoisotropicTranslation
92 
93 /-- `Y = V(𝔭)` is nonempty for a prime `𝔭` (Nullstellensatz). -/
94 theorem exists_mem_zeroLocus_of_isPrime {k : Type*} [Field k] [IsAlgClosed k] {n : ℕ}
95     (I : PrimeSpectrum (MvPolynomial (Fin n) k)) :
96     ∃ y : Fin n → k, y ∈ MvPolynomial.zeroLocus k I.asIdeal := by
97   obtain ⟨M, hMmax, hPM⟩ := Ideal.exists_le_maximal I.asIdeal I.isPrime.ne_top
98   obtain ⟨y, hMy⟩ := MvPolynomial.isMaximal_iff_eq_vanishingIdeal_singleton.mp hMmax
99   refine ⟨y, fun f hf ↦ ?_⟩
100   have hfM : f ∈ M := hPM hf
101   rw [hMy, MvPolynomial.mem_vanishingIdeal_singleton_iff] at hfM
102   exact hfM
103 
104 /-- The smooth locus `Y_sm` of a nonempty `Y = V(𝔭)` is nonempty (it is dense in `Y`,
105 Definition 5.4(b)). -/
106 theorem exists_smoothAffinePoint {k : Type*} [Field k] [IsAlgClosed k] {n : ℕ}
107     (I : PrimeSpectrum (MvPolynomial (Fin n) k)) :
108     ∃ y : Fin n → k, SmoothAffinePoint I.asIdeal y := by
109   classical
110   by_contra hnone
111   push Not at hnone
112   obtain ⟨y, hy⟩ := exists_mem_zeroLocus_of_isPrime I
113   have hmem : (Sum.elim y 0 : Fin n ⊕ Fin n → k) ∈ equationConormalClosure I.asIdeal := by
114     intro f hf
115     refine hf _ ⟨fun g hg ↦ by simpa using hy g hg, ?_⟩
116     have h0 : coordinateCovector
117         (fun i : Fin n ↦ (Sum.elim y 0 : Fin n ⊕ Fin n → k) (.inr i)) = 0 := by
118       apply LinearMap.ext
119       intro v
120       simp [coordinateCovector_apply]
121     rw [h0]
122     exact Submodule.zero_mem _
123   rw [← equationConormalClosure_smoothAffine_eq I.asIdeal I.isPrime] at hmem
124   have hempty :
125       restrictedEquationConormalLocus I.asIdeal {y | SmoothAffinePoint I.asIdeal y} = ∅ := by
126     ext q
127     simp only [Set.mem_empty_iff_false, iff_false]
128     exact fun hq ↦ hnone _ hq.2
129   have h1 : (1 : MvPolynomial (Fin n ⊕ Fin n) k) ∈ MvPolynomial.vanishingIdeal k
130       (restrictedEquationConormalLocus I.asIdeal {y | SmoothAffinePoint I.asIdeal y}) := by
131     rw [hempty, MvPolynomial.mem_vanishingIdeal_iff]
132     intro x hx
133     exact absurd hx (Set.notMem_empty x)
134   simpa using hmem 1 h1
135 
136 /-- **First paragraph of the proof of Theorem 5.7 (`x̄_1` algebraic).**  A nonzero
137 `g` with `g(x̄_1) = 0` gives `g(x_1) ∈ 𝔭`; over the algebraically closed `K`,
138 `g(x_1) = λ ∏ (x_1 − c_i)` with `λ ∈ K^×`, and since `𝔭` is prime some factor
139 `x_1 − c` lies in `𝔭`.  Thus `x_1 = c` on `Y`, and `Y ≠ ∅`, `Y ∩ H = ∅` give
140 `c ≠ 0`.  The equation `f = x_1 − c` has `df_y = dx_1` at every smooth point `y`,
141 and `Y_sm ≠ ∅`, so `(1, 0, …, 0) ∈ N(Y)`. -/
142 theorem step_coordinate_algebraic {k : Type u} [Field k] [IsAlgClosed k] {m : ℕ} (hm : 0 < m)
143     (I : PrimeSpectrum (MvPolynomial (Fin m) k))
144     (havoid : ∀ y ∈ MvPolynomial.zeroLocus k I.asIdeal, y ⟨0, hm⟩ ≠ 0)
145     (halg : IsAlgebraic k (componentCoordinate I ⟨0, hm⟩)) :
146     ∃ c : k, MvPolynomial.X ⟨0, hm⟩ - MvPolynomial.C c ∈ I.asIdeal ∧ c ≠ 0 ∧
147       (fun i : Fin m ↦ if i = ⟨0, hm⟩ then (1 : k) else 0) ∈
148         smoothConormalFibreProjection I.asIdeal := by
149   classical
150   let i₀ : Fin m := ⟨0, hm⟩
151   let x₁ : MvPolynomial (Fin m) k := MvPolynomial.X i₀
152   -- A nonzero `g` with `g(x̄_1) = 0`, hence `g(x_1) ∈ 𝔭`.
153   obtain ⟨g, hg0, hgx⟩ := halg
154   have hgmem : Polynomial.aeval x₁ g ∈ I.asIdeal := by
155     have hcomp : componentCoordinate I i₀ =
156         ((IsScalarTower.toAlgHom k (MvPolynomial (Fin m) k ⧸ I.asIdeal)
157           (FractionRing (MvPolynomial (Fin m) k ⧸ I.asIdeal))).comp
158           (Ideal.Quotient.mkₐ k I.asIdeal)) x₁ := rfl
159     rw [hcomp, Polynomial.aeval_algHom_apply] at hgx
160     rw [← Ideal.Quotient.eq_zero_iff_mem]
161     apply IsFractionRing.injective (MvPolynomial (Fin m) k ⧸ I.asIdeal)
162       (FractionRing (MvPolynomial (Fin m) k ⧸ I.asIdeal))
163     rw [map_zero, ← hgx]
164     rfl
165   -- `K` algebraically closed: `g(x_1) = λ ∏ (x_1 − c_i)`, `λ ∈ K^×`.
166   have hfac := Polynomial.C_leadingCoeff_mul_prod_multiset_X_sub_C
167     (IsAlgClosed.card_roots_eq_natDegree (p := g))
168   have hlc : g.leadingCoeff ≠ 0 := Polynomial.leadingCoeff_ne_zero.mpr hg0
169   rw [← hfac, map_mul, Polynomial.aeval_C, map_multiset_prod, Multiset.map_map] at hgmem
170   -- `𝔭` is prime, so some factor `x_1 − c` lies in `𝔭`.
171   rcases I.isPrime.mem_or_mem hgmem with hC | hprod
172   · exact absurd (I.isPrime.ne_top ((Ideal.eq_top_iff_one _).mpr (by
173       have := Ideal.mul_mem_left _ (MvPolynomial.C g.leadingCoeff⁻¹) hC
174       simpa [MvPolynomial.algebraMap_eq, ← MvPolynomial.C_mul, inv_mul_cancel₀ hlc] using this)))
175       (by simp)
176   obtain ⟨_, hmem, hc⟩ := (I.isPrime.multiset_prod_mem_iff_exists_mem _).mp hprod
177   obtain ⟨c, -, rfl⟩ := Multiset.mem_map.mp hmem
178   have hc' : x₁ - MvPolynomial.C c ∈ I.asIdeal := by
179     simpa [x₁, Polynomial.aeval_X, MvPolynomial.algebraMap_eq] using hc
180   -- `x_1 = c` on `Y`; `Y ≠ ∅` and `Y ∩ H = ∅` give `c ≠ 0`.
181   obtain ⟨y, hy⟩ := exists_mem_zeroLocus_of_isPrime I
182   have hyc : y i₀ = c := by
183     have := hy _ hc'
184     simpa [x₁, sub_eq_zero] using this
185   have hc0 : c ≠ 0 := hyc ▸ havoid y hy
186   -- `f = x_1 − c ∈ 𝔭` has `df_y = dx_1` at a smooth point `y`, so `dx_1 ∈ N*_y Y ⊆ N(Y)`.
187   obtain ⟨y', hy'⟩ := exists_smoothAffinePoint I
188   refine ⟨c, hc', hc0, (definition_5_4_d I.asIdeal _).2 ⟨y', hy', ?_⟩⟩
189   have hdf : differentialAt y' (x₁ - MvPolynomial.C c) =
190       fun i : Fin m ↦ if i = i₀ then (1 : k) else 0 := by
191     funext i
192     by_cases hi : i = i₀
193     · subst hi; simp [differentialAt, x₁]
194     · simp [differentialAt, x₁, hi, MvPolynomial.pderiv_X, Ne.symm hi]
195   rw [← hdf]
196   exact Submodule.subset_span ⟨⟨_, hc'⟩, rfl⟩
197 
198 end AlgebraicCoordinate
199 
200 /-! ## Paragraphs over `κ[[t]]` -/
201 
202 section PowerSeriesSteps
203 
204 variable {k κ : Type u} [Field k] [Field κ] [Algebra k κ] [CharZero k] [CharZero κ]
205 
206 /-- **Paragraph after Lemma 5.11 (dual derivations and `Z`).**  If the
207 differentials `d(q_{i_l}(0))` form a basis of `Ω_{κ/K}`, there are dual
208 `K`-derivations `D_k` with `D_k(q_{i_l}(0)) = δ_{kl}` (Definition 5.2(c)).  The
209 matrix `Z_{ik} = Σ_r D_k(c_{ir}) t^r` then has `Z(0)` equal to the identity on
210 the rows `i_l`, so its selected minor has constant coefficient `1`; `Z_j = 0`;
211 and rows `0` and `1` are divisible by `t^a` and `t^b`. -/
212 theorem step_dual_derivations {m d : ℕ} (hm : 0 < m)
213     (q : Fin (m + 1) → PowerSeries κ) (rows : Fin d ↪ Fin (m + 1))
214     (hli : LinearIndependent κ
215       (fun l ↦ KaehlerDifferential.D k κ (PowerSeries.constantCoeff (q (rows l)))))
216     (hspan : Submodule.span κ (Set.range fun l ↦
217       KaehlerDifferential.D k κ (PowerSeries.constantCoeff (q (rows l)))) = ⊤)
218     (j : Fin (m + 1)) (hqj : q j = 1) (a b : ℕ) (u₀ u₁ : PowerSeries κ)
219     (hq0 : q 0 = (PowerSeries.X : PowerSeries κ) ^ a * u₀)
220     (hq1 : q (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ b * u₁) :
221     ∃ D : Fin d → Derivation k κ κ,
222       (∀ k' l, D k' (PowerSeries.constantCoeff (q (rows l))) = if k' = l then 1 else 0) ∧
223       (∀ l k', PowerSeries.constantCoeff (coefficientwiseTangentMatrix q D (rows l) k') =
224         if l = k' then 1 else 0) ∧
225       PowerSeries.constantCoeff
226         (selectedMinor (coefficientwiseTangentMatrix q D) rows).det = 1 ∧
227       (∀ k', coefficientwiseTangentMatrix q D j k' = 0) ∧
228       (∀ k', ∃ w : PowerSeries κ,
229         coefficientwiseTangentMatrix q D 0 k' = (PowerSeries.X : PowerSeries κ) ^ a * w) ∧
230       (∀ k', ∃ w : PowerSeries κ,
231         coefficientwiseTangentMatrix q D (Fin.succ ⟨0, hm⟩) k' =
232           (PowerSeries.X : PowerSeries κ) ^ b * w) := by
233   classical
234   let B : Module.Basis (Fin d) κ (Ω[κ⁄k]) := Module.Basis.mk hli hspan.ge
235   -- Definition 5.2(c): the dual derivations `D_k` of the basis `dβ_l`.
236   obtain ⟨D, hdual⟩ := definition_5_2_c (K := k) (L := κ)
237     (fun l ↦ PowerSeries.constantCoeff (q (rows l))) B (fun l ↦ Module.Basis.mk_apply _ _ _)
238   have hentry : ∀ l k', PowerSeries.constantCoeff (coefficientwiseTangentMatrix q D (rows l) k') =
239       if l = k' then 1 else 0 := by
240     intro l k'
241     rw [constantCoeff_coefficientwiseTangentMatrix, hdual]
242     by_cases h : k' = l
243     · subst h; simp
244     · simp [h, Ne.symm h]
245   refine ⟨D, hdual, hentry, ?_, ?_, ?_, ?_⟩
246   · rw [constantCoeff_selectedMinor_det]
247     have hone : selectedMinor (residueMatrix (coefficientwiseTangentMatrix q D)) rows = 1 := by
248       ext l k'
249       rw [Matrix.one_apply]
250       exact hentry l k'
251     rw [hone, Matrix.det_one]
252   · intro k'
253     rw [coefficientwiseTangentMatrix]
254     simp only [hqj]
255     exact (coefficientwiseDerivation (D k')).map_one_eq_zero
256   · intro k'
257     refine ⟨coefficientwiseDerivation (D k') u₀, ?_⟩
258     rw [coefficientwiseTangentMatrix, hq0]
259     exact coefficientwiseDerivation_X_pow_mul (D k') a u₀
260   · intro k'
261     refine ⟨coefficientwiseDerivation (D k') u₁, ?_⟩
262     rw [coefficientwiseTangentMatrix, hq1]
263     exact coefficientwiseDerivation_X_pow_mul (D k') b u₁
264 
265 omit [CharZero κ] in
266 /-- A series `t^n r` with `r(0) ≠ 0` has order exactly `n`. -/
267 theorem order_X_pow_mul_of_constantCoeff_ne_zero (n : ℕ) (r : PowerSeries κ)
268     (hr : PowerSeries.constantCoeff r ≠ 0) :
269     ((PowerSeries.X : PowerSeries κ) ^ n * r).order = n := by
270   rw [PowerSeries.order_mul, PowerSeries.order_X_pow,
271     PowerSeries.order_zero_of_isUnit (PowerSeries.isUnit_iff_constantCoeff.mpr (IsUnit.mk0 _ hr)),
272     add_zero]
273 
274 omit [CharZero κ] in
275 /-- If `q_i = t^n u` and every entry of row `i` of `Z` is divisible by `t^n`
276 (`n ≥ 1`), then `q'_i − (Zλ)_i = t^{n-1} r` with `r(0) = n u(0)`. -/
277 theorem derivative_sub_mulVec_eq_X_pow_mul {ι' : Type*} {d : ℕ} (q : ι' → PowerSeries κ)
278     (Z : Matrix ι' (Fin d) (PowerSeries κ)) (lambda : Fin d → PowerSeries κ) (i : ι') (n : ℕ)
279     (hn : 0 < n) (u : PowerSeries κ) (hq : q i = (PowerSeries.X : PowerSeries κ) ^ n * u)
280     (hZ : ∀ k', ∃ w : PowerSeries κ, Z i k' = (PowerSeries.X : PowerSeries κ) ^ n * w) :
281     ∃ r : PowerSeries κ,
282       PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i =
283         (PowerSeries.X : PowerSeries κ) ^ (n - 1) * r ∧
284       PowerSeries.constantCoeff r = n * PowerSeries.constantCoeff u := by
285   choose w hw using hZ
286   let S := ∑ k', w k' * lambda k'
287   have hXn : (PowerSeries.X : PowerSeries κ) ^ n = PowerSeries.X ^ (n - 1) * PowerSeries.X := by
288     rw [← pow_succ, Nat.sub_add_cancel hn]
289   refine ⟨(n : PowerSeries κ) * u + PowerSeries.X * (PowerSeries.derivative (R := κ) u - S), ?_, ?_⟩
290   · have hmv : Z.mulVec lambda i = PowerSeries.X ^ n * S := by
291       simp only [Matrix.mulVec, dotProduct, hw, S, Finset.mul_sum, mul_assoc]
292     rw [hq, hmv, Derivation.leibniz, PowerSeries.derivative_pow, PowerSeries.derivative_X, hXn]
293     simp only [smul_eq_mul]
294     ring
295   · simp [S]
296 
297 /-- **Paragraph defining `λ`, `w` and `τ`.**  `Z̃(0)` is the identity, so `Z̃`
298 is invertible over `κ[[t]]` and there is a unique `λ` with
299 `Z̃ λ = (q'_{i_1}, …, q'_{i_{d'}})`.  For `w = q' − Zλ`: `w_{i_l} = 0`;
300 `ord w_0 = a − 1` exactly; `c`, the minimal order of the entries of `w`,
301 satisfies `c ≤ a − 1`; `τ = t^{-c} w` lies in `κ[[t]]^{n+1}` (stated as
302 `w = t^c τ`) with `τ(0) ≠ 0`, `τ_{i_l} = 0`, `ord τ_1 ≥ b − a > 0` (so
303 `τ_1(0) = 0`) and `τ_j = 0`. -/
304 theorem step_lambda_w_tau {m d : ℕ} (hm : 0 < m)
305     (q : Fin (m + 1) → PowerSeries κ) (Z : Matrix (Fin (m + 1)) (Fin d) (PowerSeries κ))
306     (rows : Fin d ↪ Fin (m + 1)) (j : Fin (m + 1)) (a b : ℕ) (u₀ u₁ : PowerSeries κ)
307     (hqj : q j = 1) (hZj : ∀ k', Z j k' = 0) (ha : 0 < a) (hab : a < b)
308     (hq0 : q 0 = (PowerSeries.X : PowerSeries κ) ^ a * u₀)
309     (hu₀ : PowerSeries.constantCoeff u₀ ≠ 0)
310     (hZ0 : ∀ k', ∃ w : PowerSeries κ, Z 0 k' = (PowerSeries.X : PowerSeries κ) ^ a * w)
311     (hq1 : q (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ b * u₁)
312     (hZ1 : ∀ k', ∃ w : PowerSeries κ,
313       Z (Fin.succ ⟨0, hm⟩) k' = (PowerSeries.X : PowerSeries κ) ^ b * w)
314     (hminor : PowerSeries.constantCoeff (selectedMinor Z rows).det = 1) :
315     ∃ (lambda : Fin d → PowerSeries κ) (c : ℕ) (tau : Fin (m + 1) → PowerSeries κ),
316       (∀ l, PowerSeries.derivative (R := κ) (q (rows l)) = Z.mulVec lambda (rows l)) ∧
317       (∀ lambda' : Fin d → PowerSeries κ,
318         (∀ l, PowerSeries.derivative (R := κ) (q (rows l)) = Z.mulVec lambda' (rows l)) →
319           lambda' = lambda) ∧
320       (∀ l, PowerSeries.derivative (R := κ) (q (rows l)) - Z.mulVec lambda (rows l) = 0) ∧
321       (PowerSeries.derivative (R := κ) (q 0) - Z.mulVec lambda 0).order = (a - 1 : ℕ) ∧
322       (∀ i, (c : ℕ∞) ≤ (PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i).order) ∧
323       (∃ i, (PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i).order = c) ∧
324       c ≤ a - 1 ∧
325       (∀ i, PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i =
326         (PowerSeries.X : PowerSeries κ) ^ c * tau i) ∧
327       (∃ i, PowerSeries.constantCoeff (tau i) ≠ 0) ∧
328       (∀ l, tau (rows l) = 0) ∧
329       (∃ s : PowerSeries κ,
330         tau (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ (b - a) * s) ∧
331       PowerSeries.constantCoeff (tau (Fin.succ ⟨0, hm⟩)) = 0 ∧
332       tau j = 0 := by
333   classical
334   have hminor0 : PowerSeries.constantCoeff (selectedMinor Z rows).det ≠ 0 := by
335     rw [hminor]; exact one_ne_zero
336   -- `Z̃(0)` is the identity, so `Z̃` is invertible over `κ[[t]]` and
337   -- `λ = Z̃⁻¹ (q'_{i_1}, …, q'_{i_{d'}})` solves `Z̃ λ = (q'_{i_l})`.
338   let v : Fin (m + 1) → PowerSeries κ := fun i ↦ PowerSeries.derivative (R := κ) (q i)
339   let lambda : Fin d → PowerSeries κ := correctionCoefficients Z rows v
340   have hsel : ∀ l, PowerSeries.derivative (R := κ) (q (rows l)) = Z.mulVec lambda (rows l) :=
341     fun l ↦ sub_eq_zero.mp (correctedVector_selectedRow_eq_zero Z rows v hminor0 l)
342   -- The solution is unique.
343   have huniq : ∀ lambda' : Fin d → PowerSeries κ,
344       (∀ l, PowerSeries.derivative (R := κ) (q (rows l)) = Z.mulVec lambda' (rows l)) →
345         lambda' = lambda := by
346     intro lambda' h'
347     have hunit : IsUnit (selectedMinor Z rows) :=
348       (Matrix.isUnit_iff_isUnit_det _).mpr
349         (PowerSeries.isUnit_iff_constantCoeff.mpr (by rw [hminor]; exact isUnit_one))
350     apply Matrix.mulVec_injective_of_isUnit hunit
351     funext l
352     change Z.mulVec lambda' (rows l) = Z.mulVec lambda (rows l)
353     rw [← h', hsel]
354   -- `w = q' − Zλ` has `w_{i_l} = 0`.
355   let w : Fin (m + 1) → PowerSeries κ := fun i ↦
356     PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i
357   have hwrows : ∀ l, w (rows l) = 0 := fun l ↦ sub_eq_zero.mpr (hsel l)
358   -- `ord w_0 = a − 1`: `q'_0` has order exactly `a − 1` (its coefficient `a u_0(0)` of
359   -- `t^{a-1}` is nonzero in characteristic zero), while `Z_{0•} λ` has order `≥ a`.
360   obtain ⟨r₀, hr₀, hr₀c⟩ := derivative_sub_mulVec_eq_X_pow_mul q Z lambda 0 a ha u₀ hq0 hZ0
361   have hr₀ne : PowerSeries.constantCoeff r₀ ≠ 0 := by
362     rw [hr₀c]
363     exact mul_ne_zero (Nat.cast_ne_zero.mpr ha.ne') hu₀
364   have hw0 : (PowerSeries.derivative (R := κ) (q 0) - Z.mulVec lambda 0).order = (a - 1 : ℕ) := by
365     rw [hr₀]
366     exact order_X_pow_mul_of_constantCoeff_ne_zero _ _ hr₀ne
367   -- `c` is the minimal order among the entries of `w`; then `c ≤ a − 1`, and
368   -- `τ = t^{-c} w` lies in `κ[[t]]^{n+1}` with `τ(0) ≠ 0`.
369   have hcoeff : PowerSeries.coeff (a - 1) (w 0) ≠ 0 := by
370     change PowerSeries.coeff (a - 1)
371       (PowerSeries.derivative (R := κ) (q 0) - Z.mulVec lambda 0) ≠ 0
372     rw [hr₀]
373     simpa [PowerSeries.coeff_zero_eq_constantCoeff_apply] using
374       (show PowerSeries.coeff (0 + (a - 1)) ((PowerSeries.X : PowerSeries κ) ^ (a - 1) * r₀) ≠ 0 by
375         rw [PowerSeries.coeff_X_pow_mul]
376         simpa [PowerSeries.coeff_zero_eq_constantCoeff_apply] using hr₀ne)
377   obtain ⟨c, hc, tau, hfactor, hprim⟩ :=
378     exists_primitive_commonPower_of_coeff_ne_zero w 0 (a - 1) hcoeff
379   have hfactor' : ∀ i, PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i =
380       (PowerSeries.X : PowerSeries κ) ^ c * tau i := hfactor
381   have htau_of_w : ∀ i, w i = 0 → tau i = 0 := fun i hi ↦
382     (mul_eq_zero.mp ((hfactor i).symm.trans hi)).resolve_left
383       (pow_ne_zero c PowerSeries.X_ne_zero)
384   have htaurows : ∀ l, tau (rows l) = 0 := fun l ↦ htau_of_w _ (hwrows l)
385   -- In row `1`, `q'_1` and `Z_{1•} λ` have order `≥ b − 1`, so `ord τ_1 ≥ b − 1 − c ≥ b − a`.
386   obtain ⟨r₁, hr₁, -⟩ :=
387     derivative_sub_mulVec_eq_X_pow_mul q Z lambda _ b (ha.trans hab) u₁ hq1 hZ1
388   have htau1' : tau (Fin.succ ⟨0, hm⟩) =
389       (PowerSeries.X : PowerSeries κ) ^ (b - a) *
390         ((PowerSeries.X : PowerSeries κ) ^ (a - 1 - c) * r₁) := by
391     apply mul_left_cancel₀ (pow_ne_zero c (PowerSeries.X_ne_zero (R := κ)))
392     rw [← hfactor', hr₁, ← mul_assoc, ← mul_assoc, ← pow_add, ← pow_add]
393     congr 2
394     omega
395   have htau1 : PowerSeries.constantCoeff (tau (Fin.succ ⟨0, hm⟩)) = 0 := by
396     rw [htau1', map_mul, map_pow, PowerSeries.constantCoeff_X,
397       zero_pow (Nat.sub_ne_zero_of_lt hab), zero_mul]
398   -- `q'_j = 0` and `Z_{j•} = 0` (as `q_j = 1`), so `τ_j = 0`.
399   have htauj : tau j = 0 := by
400     apply htau_of_w
401     change PowerSeries.derivative (R := κ) (q j) - Z.mulVec lambda j = 0
402     rw [hqj, Derivation.map_one_eq_zero, zero_sub, neg_eq_zero]
403     simp [Matrix.mulVec, dotProduct, hZj]
404   refine ⟨lambda, c, tau, hsel, huniq, hwrows, hw0, ?_, ?_, hc,
405     hfactor', hprim, htaurows, ⟨_, htau1'⟩, htau1, htauj⟩
406   · intro i
407     rw [hfactor' i, PowerSeries.order_mul, PowerSeries.order_X_pow]
408     exact le_self_add
409   · obtain ⟨i, hi⟩ := hprim
410     exact ⟨i, by rw [hfactor' i]; exact order_X_pow_mul_of_constantCoeff_ne_zero c _ hi⟩
411 
412 omit [CharZero κ] in
413 /-- If some square minor `M_ι` of `M` has `det M_ι(0) ≠ 0`, then `det M_ι` is a
414 unit of `κ[[t]]` and the columns of `M` are linearly independent over
415 `κ((t))`. -/
416 theorem linearIndependent_laurent_of_selectedMinor {R ι : Type*} [Fintype R] [Fintype ι]
417     [DecidableEq ι] (M : Matrix R ι (PowerSeries κ)) (rowsι : ι ↪ R)
418     (h0 : PowerSeries.constantCoeff (selectedMinor M rowsι).det ≠ 0) :
419     IsUnit (selectedMinor M rowsι).det ∧
420       LinearIndependent (LaurentSeries κ)
421         (fun col i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ) (M i col)) := by
422   classical
423   have hunit : IsUnit (selectedMinor M rowsι).det :=
424     PowerSeries.isUnit_iff_constantCoeff.mpr (IsUnit.mk0 _ h0)
425   refine ⟨hunit, ?_⟩
426   let f := algebraMap (PowerSeries κ) (LaurentSeries κ)
427   let A := (selectedMinor M rowsι).map f
428   have hA : IsUnit A := by
429     rw [Matrix.isUnit_iff_isUnit_det]
430     change IsUnit (f.mapMatrix (selectedMinor M rowsι)).det
431     rw [← RingHom.map_det]
432     exact hunit.map f
433   rw [Fintype.linearIndependent_iff]
434   intro g hg
435   have hmv : A.mulVec g = 0 := by
436     funext c
437     have hi := congrFun hg (rowsι c)
438     simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, Pi.zero_apply] at hi
439     rw [Pi.zero_apply, ← hi]
440     simp only [Matrix.mulVec, dotProduct, A, Matrix.map_apply, selectedMinor]
441     exact Finset.sum_congr rfl fun col _ ↦ mul_comm _ _
442   have := Matrix.mulVec_injective_of_isUnit hA (hmv.trans (Matrix.mulVec_zero A).symm)
443   exact fun col ↦ congrFun this col
444 
445 /-- **Paragraph "`M(0)` has full column rank".**  For
446 `M = (q, Z_{•1}, …, Z_{•d'}, τ)`: `M(0)` has full column rank (row `j`, the
447 identity block on the rows `i_l`, and `τ(0) ≠ 0`); so some
448 `(d'+2) × (d'+2)` minor `M_ι(0)` is nonzero, the corresponding minor of `M(t)`
449 is a unit of `κ[[t]]`, and the columns of `M(t)` are linearly independent over
450 `κ((t))`.  Every column of `M(0)` has vanishing `1`-coordinate. -/
451 theorem step_M_minor {m d : ℕ} (hm : 0 < m)
452     (q : Fin (m + 1) → PowerSeries κ) (Z : Matrix (Fin (m + 1)) (Fin d) (PowerSeries κ))
453     (tau : Fin (m + 1) → PowerSeries κ) (rows : Fin d ↪ Fin (m + 1)) (j : Fin (m + 1))
454     (b : ℕ) (u₁ : PowerSeries κ)
455     (hqj : q j = 1) (hZj : ∀ k', Z j k' = 0) (htauj : tau j = 0)
456     (htaurows : ∀ l, tau (rows l) = 0)
457     (hminor : PowerSeries.constantCoeff (selectedMinor Z rows).det = 1)
458     (hprim : ∃ i, PowerSeries.constantCoeff (tau i) ≠ 0) (hb : 0 < b)
459     (hq1 : q (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ b * u₁)
460     (hZ1 : ∀ k', ∃ w : PowerSeries κ,
461       Z (Fin.succ ⟨0, hm⟩) k' = (PowerSeries.X : PowerSeries κ) ^ b * w)
462     (htau1 : PowerSeries.constantCoeff (tau (Fin.succ ⟨0, hm⟩)) = 0) :
463     Function.Injective (residueMatrix (formalTangentMatrix q Z tau)).mulVec ∧
464       (∃ rowsι : FormalTangentColumn (Fin d) ↪ Fin (m + 1),
465         PowerSeries.constantCoeff (selectedMinor (formalTangentMatrix q Z tau) rowsι).det ≠ 0 ∧
466         IsUnit (selectedMinor (formalTangentMatrix q Z tau) rowsι).det) ∧
467       LinearIndependent (LaurentSeries κ)
468         (fun col i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ)
469           (formalTangentMatrix q Z tau i col)) ∧
470       ∀ col, PowerSeries.constantCoeff
471         (formalTangentMatrix q Z tau (Fin.succ ⟨0, hm⟩) col) = 0 := by
472   classical
473   have hinj := residue_formalTangentMatrix_mulVec_injective q Z tau rows j hqj hZj htauj
474     htaurows (by rw [hminor]; exact one_ne_zero) hprim
475   obtain ⟨rowsι, hρ⟩ :=
476     powerSeries_exists_selectedMinor_constantCoeff_ne_zero_of_residue_mulVec_injective _ hinj
477   obtain ⟨hunit, hli⟩ := linearIndependent_laurent_of_selectedMinor _ rowsι hρ
478   exact ⟨hinj, ⟨rowsι, hρ, hunit⟩, hli,
479     constantCoeff_formalTangentMatrix_axis_eq_zero q Z tau _ b u₁ hb hq1 hZ1 htau1⟩
480 
481 omit [CharZero k] [CharZero κ] in
482 /-- **Paragraph "the columns of `M` span `𝒞`".**  The columns `q`, `Z_{•k}`
483 and `q'` have the form `δq` for `K`-derivations `δ` of `κ((t))` (the `D_k`
484 extended coefficientwise, and `d/dt`), so they lie in `𝒞` by Lemma 5.12(b);
485 `τ = t^{-c}(q' − Zλ)` is a `κ((t))`-combination of them.  With
486 `dim 𝒞 = dim Θ_y + 1` (Lemma 5.12(a)) and `dim Θ_y ≤ d' + 1`, the `d' + 2`
487 independent columns of `M` span `𝒞`. -/
488 theorem step_M_spans_cone {m d : ℕ}
489     (I : Ideal (MvPolynomial (Fin m) k)) (q : Fin (m + 1) → PowerSeries κ) (hq0 : q 0 ≠ 0)
490     (hbase : ∀ f ∈ I, MvPolynomial.eval₂ (algebraMap k (LaurentSeries κ))
491       (dehomogenizedPoint (laurentColumn q)) f = 0)
492     (D : Fin d → Derivation k κ κ) (Z : Matrix (Fin (m + 1)) (Fin d) (PowerSeries κ))
493     (hZ : Z = coefficientwiseTangentMatrix q D)
494     (lambda : Fin d → PowerSeries κ) (c : ℕ) (tau : Fin (m + 1) → PowerSeries κ)
495     (hfactor : ∀ i, PowerSeries.derivative (R := κ) (q i) - Z.mulVec lambda i =
496       (PowerSeries.X : PowerSeries κ) ^ c * tau i)
497     (hli : LinearIndependent (LaurentSeries κ)
498       (fun col i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ)
499         (formalTangentMatrix q Z tau i col)))
500     (hbound : Module.finrank (LaurentSeries κ) (tangentSpaceAt (laurentColumn q) I) ≤ d + 1) :
501     (∀ col, (fun i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ)
502         (formalTangentMatrix q Z tau i col)) ∈ tangentCone (laurentColumn q) I) ∧
503       Submodule.span (LaurentSeries κ) (Set.range fun col i ↦
504         algebraMap (PowerSeries κ) (LaurentSeries κ) (formalTangentMatrix q Z tau i col)) =
505         tangentCone (laurentColumn q) I := by
506   classical
507   let L := LaurentSeries κ
508   let f := algebraMap (PowerSeries κ) L
509   let qL := laurentColumn q
510   let 𝒞 := tangentCone qL I
511   have hq0L : qL 0 ≠ 0 := laurentColumn_ne_zero_of_ne_zero q hq0
512   -- Lemma 5.12(b) at `y = q/q₀`.
513   obtain ⟨hδ, hq⟩ := lemma_5_12_b qL hq0L I hbase
514   have hder : ∀ δ : Derivation k (PowerSeries κ) (PowerSeries κ),
515       laurentColumn (fun i ↦ δ (q i)) ∈ 𝒞 := by
516     intro δ
517     have h := hδ (extendPowerSeriesDerivation δ)
518     have hcol : (fun a ↦ extendPowerSeriesDerivation δ (qL a)) =
519         laurentColumn (fun i ↦ δ (q i)) := by
520       funext a
521       exact extendPowerSeriesDerivation_on_powerSeries δ (q a)
522     rw [hcol] at h
523     exact h
524   have hZcol : ∀ l, (fun i ↦ f (Z i l)) ∈ 𝒞 := by
525     intro l
526     have h := hder (coefficientwiseDerivation (D l))
527     rw [hZ]
528     exact h
529   have hq' : (fun i ↦ f (PowerSeries.derivative (R := κ) (q i))) ∈ 𝒞 :=
530     hder (uniformizerDerivation (k := k) (K := κ))
531   -- `τ = t^{-c} (q' − Σ λ_l Z_{•l})`.
532   let Xc : L := f ((PowerSeries.X : PowerSeries κ) ^ c)
533   have hXc : Xc ≠ 0 := by
534     simp [Xc, f]
535   have htau : (fun i ↦ f (tau i)) ∈ 𝒞 := by
536     have hcomb := 𝒞.smul_mem Xc⁻¹ (𝒞.sub_mem hq'
537       (𝒞.sum_mem fun l (_ : l ∈ Finset.univ) ↦ 𝒞.smul_mem (f (lambda l)) (hZcol l)))
538     convert hcomb using 1
539     funext i
540     have hi := congrArg f (hfactor i)
541     simp only [map_sub, map_mul, Matrix.mulVec, dotProduct, map_sum] at hi
542     simp only [Pi.smul_apply, Pi.sub_apply, Finset.sum_apply, smul_eq_mul]
543     rw [eq_inv_mul_iff_mul_eq₀ hXc]
544     rw [← hi]
545     congr 1
546     refine Finset.sum_congr rfl fun l _ ↦ ?_
547     ring
548   have hcols : ∀ col, (fun i ↦ f (formalTangentMatrix q Z tau i col)) ∈ 𝒞 := by
549     intro col
550     rcases col with _ | (l | _)
551     · exact hq
552     · exact hZcol l
553     · exact htau
554   refine ⟨hcols, ?_⟩
555   have hle : Submodule.span L (Set.range fun col i ↦ f (formalTangentMatrix q Z tau i col)) ≤ 𝒞 :=
556     Submodule.span_le.mpr (by rintro _ ⟨col, rfl⟩; exact hcols col)
557   apply Submodule.eq_of_le_of_finrank_le hle
558   rw [finrank_span_eq_card hli]
559   -- Lemma 5.12(a): `dim 𝒞 = dim Θ_y + 1 ≤ d' + 2`.
560   have hcone : Module.finrank (LaurentSeries κ) (tangentCone (laurentColumn q) I) =
561       Module.finrank (LaurentSeries κ) (tangentSpaceAt (laurentColumn q) I) + 1 :=
562     lemma_5_12_a_cone (laurentColumn q) hq0L I
563   change Module.finrank (LaurentSeries κ) (tangentCone (laurentColumn q) I) ≤ _
564   simp only [Fintype.card_sum, Fintype.card_unit, Fintype.card_fin]
565   omega
566 
567 /-- The row `u_υ`: the entries of `u` in the rows outside `ι`, and `0` on `ι`. -/
568 def complementRow {R ι : Type*} [DecidableEq R] [Fintype ι] (rowsι : ι ↪ R) (u : R → κ) :
569     R → PowerSeries κ :=
570   fun i ↦ if ∃ c, rowsι c = i then 0 else PowerSeries.C (u i)
571 
572 /-- The block `ℓ_ι = −u_υ M_υ M_ι⁻¹`. -/
573 def liftBlock {R ι : Type*} [Fintype R] [Fintype ι] [DecidableEq R] [DecidableEq ι]
574     (M : Matrix R ι (PowerSeries κ)) (rowsι : ι ↪ R) (u : R → κ) : ι → PowerSeries κ :=
575   -Matrix.vecMul (rowMul (complementRow rowsι u) M) (selectedMinor M rowsι)⁻¹
576 
577 /-- The paper's lift `ℓ` of `u`: `ℓ_υ = u_υ` and `ℓ_ι = −u_υ M_υ M_ι⁻¹`. -/
578 def liftRow {R ι : Type*} [Fintype R] [Fintype ι] [DecidableEq R] [DecidableEq ι]
579     (M : Matrix R ι (PowerSeries κ)) (rowsι : ι ↪ R) (u : R → κ) : R → PowerSeries κ :=
580   fun i ↦ complementRow rowsι u i + ∑ c, if rowsι c = i then liftBlock M rowsι u c else 0
581 
582 omit [CharZero κ] in
583 theorem liftRow_apply_of_not_mem {R ι : Type*} [Fintype R] [Fintype ι] [DecidableEq R]
584     [DecidableEq ι] (M : Matrix R ι (PowerSeries κ)) (rowsι : ι ↪ R) (u : R → κ) (i : R)
585     (hi : ¬ ∃ c, rowsι c = i) : liftRow M rowsι u i = PowerSeries.C (u i) := by
586   have hc : ∀ c, rowsι c ≠ i := fun c h ↦ hi ⟨c, h⟩
587   simp [liftRow, complementRow, hc]
588 
589 omit [CharZero κ] in
590 theorem liftRow_apply_rows {R ι : Type*} [Fintype R] [Fintype ι] [DecidableEq R]
591     [DecidableEq ι] (M : Matrix R ι (PowerSeries κ)) (rowsι : ι ↪ R) (u : R → κ) (c : ι) :
592     liftRow M rowsι u (rowsι c) = liftBlock M rowsι u c := by
593   simp [liftRow, complementRow, rowsι.injective.eq_iff]
594 
595 omit [CharZero κ] in
596 /-- **Paragraph lifting `u`.**  Let `M(0)` have full column rank and
597 `u M(0) = 0`.  There is a set `ι` of row indices with `M_ι(0)` invertible;
598 then `det M_ι` has nonzero constant term, so `M_ι` is invertible over
599 `κ[[t]]`, and `ℓ_υ = u_υ`, `ℓ_ι = −u_υ M_υ M_ι⁻¹` satisfies `ℓ M = 0` and
600 `ℓ(0) = u`. -/
601 theorem step_lift_ell_minor {R ι : Type*} [Fintype R] [Fintype ι] [DecidableEq R]
602     [DecidableEq ι] (M : Matrix R ι (PowerSeries κ))
603     (hinj : Function.Injective (residueMatrix M).mulVec) (u : R → κ)
604     (hu : rowMul u (residueMatrix M) = 0) :
605     ∃ rowsι : ι ↪ R,
606       (selectedMinor (residueMatrix M) rowsι).det ≠ 0 ∧
607       IsUnit (selectedMinor M rowsι).det ∧
608       (∀ i, (¬ ∃ c, rowsι c = i) → liftRow M rowsι u i = PowerSeries.C (u i)) ∧
609       (∀ c, liftRow M rowsι u (rowsι c) = liftBlock M rowsι u c) ∧
610       rowMul (liftRow M rowsι u) M = 0 ∧
611       residueColumn (liftRow M rowsι u) = u := by
612   classical
613   obtain ⟨rowsι, h0⟩ := exists_selectedMinor_det_ne_zero_of_mulVec_injective _ hinj
614   have h0' : PowerSeries.constantCoeff (selectedMinor M rowsι).det ≠ 0 := by
615     rwa [constantCoeff_selectedMinor_det]
616   have hunit : IsUnit (selectedMinor M rowsι).det :=
617     PowerSeries.isUnit_iff_constantCoeff.mpr (IsUnit.mk0 _ h0')
618   set ℓ := liftRow M rowsι u
619   -- `ℓ M = ℓ_ι M_ι + ℓ_υ M_υ = −u_υ M_υ + u_υ M_υ = 0`.
620   have hblock : Matrix.vecMul (liftBlock M rowsι u) (selectedMinor M rowsι) =
621       -rowMul (complementRow rowsι u) M := by
622     rw [liftBlock, Matrix.neg_vecMul, Matrix.vecMul_vecMul,
623       Matrix.nonsing_inv_mul _ hunit, Matrix.vecMul_one]
624   have hell : rowMul ℓ M = 0 := by
625     funext col
626     have h := congrFun hblock col
627     simp only [Matrix.vecMul, dotProduct, selectedMinor, Pi.neg_apply] at h
628     have hsplit : rowMul ℓ M col = rowMul (complementRow rowsι u) M col +
629         ∑ c, liftBlock M rowsι u c * M (rowsι c) col := by
630       simp only [ℓ, liftRow, rowMul, add_mul, Finset.sum_add_distrib, Finset.sum_mul]
631       congr 1
632       rw [Finset.sum_comm]
633       refine Finset.sum_congr rfl fun c _ ↦ ?_
634       simp only [ite_mul, zero_mul]
635       rw [Finset.sum_ite_eq]
636       simp
637     rw [hsplit, h, Pi.zero_apply, add_neg_cancel]
638   refine ⟨rowsι, h0, hunit, liftRow_apply_of_not_mem M rowsι u, liftRow_apply_rows M rowsι u,
639     hell, ?_⟩
640   -- `ℓ(0) − u` vanishes off `ι` and is killed by `M(0)`, hence vanishes on `ι`.
641   let δ : R → κ := residueColumn ℓ - u
642   have hoff : ∀ i, (¬ ∃ c, rowsι c = i) → δ i = 0 := by
643     intro i hi
644     simp [δ, residueColumn, ℓ, liftRow_apply_of_not_mem M rowsι u i hi]
645   have hδ : Matrix.vecMul (fun c ↦ δ (rowsι c)) (selectedMinor (residueMatrix M) rowsι) = 0 := by
646     funext col
647     have hℓ := congrArg PowerSeries.constantCoeff (congrFun hell col)
648     have hu' := congrFun hu col
649     simp only [rowMul, map_sum, map_mul, Pi.zero_apply, map_zero] at hℓ hu'
650     have hsum : ∑ i, δ i * residueMatrix M i col = 0 := by
651       simp only [δ, Pi.sub_apply, sub_mul, Finset.sum_sub_distrib]
652       rw [hu', sub_zero]
653       exact hℓ
654     rw [Pi.zero_apply, ← hsum]
655     simp only [Matrix.vecMul, dotProduct, selectedMinor]
656     refine Fintype.sum_of_injective rowsι rowsι.injective _ _ ?_ fun c ↦ rfl
657     intro i hi
658     rw [hoff i (by simpa using hi), zero_mul]
659   have hA : IsUnit (selectedMinor (residueMatrix M) rowsι) :=
660     (Matrix.isUnit_iff_isUnit_det _).mpr (IsUnit.mk0 _ h0)
661   have hzero := Matrix.vecMul_injective_of_isUnit hA (hδ.trans (Matrix.zero_vecMul _).symm)
662   funext i
663   by_cases hi : ∃ c, rowsι c = i
664   · obtain ⟨c, rfl⟩ := hi
665     exact sub_eq_zero.mp (congrFun hzero c)
666   · exact sub_eq_zero.mp (hoff i hi)
667 
668 omit [CharZero k] [CharZero κ] in
669 /-- **Paragraph "`ℓ` annihilates `𝒞`".**  If the columns of `M` span `𝒞` and
670 `ℓ M = 0`, then `ℓ` annihilates `𝒞`, so by Lemma 5.13 its affine part
671 `ℓ̃ = (ℓ_1, …, ℓ_n)` lies in `span {df_y : f ∈ 𝔭}`; and `ℓ(0) = u` gives
672 `ℓ̃(0) = (1, 0, …, 0)`. -/
673 theorem step_ell_conormal {m : ℕ} (hm : 0 < m) {ι : Type*} [Fintype ι]
674     (I : Ideal (MvPolynomial (Fin m) k)) (q : Fin (m + 1) → PowerSeries κ) (hq0 : q 0 ≠ 0)
675     (M : Matrix (Fin (m + 1)) ι (PowerSeries κ))
676     (hspan : Submodule.span (LaurentSeries κ) (Set.range fun col i ↦
677       algebraMap (PowerSeries κ) (LaurentSeries κ) (M i col)) = tangentCone (laurentColumn q) I)
678     (ell : Fin (m + 1) → PowerSeries κ) (hell : rowMul ell M = 0)
679     (hres : residueColumn ell = axisRow (k := κ) (Fin.succ ⟨0, hm⟩)) :
680     coordinateCovector (fun i : Fin m ↦ laurentColumn ell i.succ) ∈
681         equationCovectorSpan (dehomogenizedPoint (laurentColumn q))
682           (I.map (MvPolynomial.map (algebraMap k (LaurentSeries κ)))) ∧
683       residueColumn (fun i : Fin m ↦ ell i.succ) =
684         fun i ↦ if i = ⟨0, hm⟩ then 1 else 0 := by
685   classical
686   let L := LaurentSeries κ
687   let f := algebraMap (PowerSeries κ) L
688   let φ : (Fin (m + 1) → L) →ₗ[L] L :=
689     { toFun := fun v ↦ ∑ a, laurentColumn ell a * v a
690       map_add' := fun v w ↦ by simp [mul_add, Finset.sum_add_distrib]
691       map_smul' := fun c v ↦ by
692         simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply]
693         rw [Finset.mul_sum]
694         exact Finset.sum_congr rfl fun a _ ↦ by ring }
695   have hle : tangentCone (laurentColumn q) I ≤ LinearMap.ker φ := by
696     rw [← hspan, Submodule.span_le]
697     rintro _ ⟨col, rfl⟩
698     have h := congrArg f (congrFun hell col)
699     simp only [rowMul, map_sum, map_mul, Pi.zero_apply, map_zero] at h
700     exact h
701   have hann : ∀ v ∈ tangentCone (laurentColumn q) I, ∑ a, laurentColumn ell a * v a = 0 :=
702     fun v hv ↦ hle hv
703   refine ⟨lemma_5_13 (laurentColumn q) (laurentColumn_ne_zero_of_ne_zero q hq0) I
704     (laurentColumn ell) hann, ?_⟩
705   calc
706     residueColumn (fun i : Fin m ↦ ell i.succ) =
707         (fun i : Fin m ↦ residueColumn ell i.succ) := residueColumn_tail ell
708     _ = (fun i : Fin m ↦ axisRow (k := κ) (Fin.succ ⟨0, hm⟩) i.succ) := by
709       rw [hres]
710     _ = (fun i : Fin m ↦ if i = ⟨0, hm⟩ then 1 else 0) := by
711       funext i
712       by_cases hi : i = ⟨0, hm⟩
713       · subst i
714         simp [axisRow]
715       · have hne : i.succ ≠ Fin.succ ⟨0, hm⟩ := fun h ↦ hi (Fin.succ_injective m h)
716         rw [axisRow_apply_of_ne hne]
717         simp [hi]
718 
719 end PowerSeriesSteps
720 
721 /-! ## The final paragraph -/
722 
723 section PolynomialLimit
724 
725 /-- The closing computation of the final paragraph for a phase point of the
726 equation conormal: a polynomial vanishing on `N(Y)` vanishes at the residue of
727 a regular fibre coordinate `ξ(t)` attached to a Laurent point `y` of `Y`. -/
728 theorem eval_residue_eq_zero_of_mem_groundEquationConormalLocus
729     {k K : Type u} [Field k] [IsAlgClosed k] [Field K] [Algebra k K] {m : ℕ}
730     (I : PrimeSpectrum (MvPolynomial (Fin m) k)) (Pol : MvPolynomial (Fin m) k)
731     (hPol : Pol ∈ MvPolynomial.vanishingIdeal k (smoothConormalFibreProjection I.asIdeal))
732     (y : Fin m → LaurentSeries K) (xi : Fin m → PowerSeries K)
733     (hgeneric : Sum.elim y
734         (fun i ↦ algebraMap (PowerSeries K) (LaurentSeries K) (xi i)) ∈
735       groundEquationConormalLocus (k := k) (K := K) I.asIdeal) :
736     MvPolynomial.eval₂ (algebraMap k K) (residueColumn xi) Pol = 0 := by
737   have hfull := fibreLift_mem_vanishingIdeal_equationConormal I.asIdeal I.isPrime Pol hPol
738   -- `Φ(x, μ) = P(Σ μ_k ∇g_k(x))` has coefficients in `𝔭`, so it vanishes at `y`.
739   have hvan : ∀ q ∈ groundEquationConormalLocus (k := k) (K := K) I.asIdeal,
740       MvPolynomial.eval₂ (groundLaurentMap (k := k) (K := K)) q (fibreLift Pol) = 0 := by
741     letI : Algebra k (LaurentSeries K) :=
742       (groundLaurentMap (k := k) (K := K)).toAlgebra
743     intro q hq
744     exact scalarExtension_vanishing I.asIdeal (fibreLift Pol) hfull q hq
745   have hpoly := residueFibreLift_mem_extensionValuedVanishingIdeal_of_ground_vanishing
746     I.asIdeal Pol hvan
747   -- `P(ξ(t)) = 0` in `κ[[t]]`, so its constant term `P(ξ(0))` vanishes.
748   have hclosure := residue_mem_residueExtensionFibreClosure_of_laurent_generic
749     (K := K) (groundEquationConormalLocus (k := k) (K := K) I.asIdeal) y xi hgeneric
750   have hzero := hclosure _ hpoly
751   simpa [residuePolynomialMap, scalarPolynomialMap] using hzero
752 
753 /-- **Final paragraph.**  Let `P ∈ K[ξ]` vanish on `N(Y)`, let the equations
754 of `Y` vanish at the generic point `y ∈ κ((t))^n`, and let
755 `ℓ̃(t) ∈ κ[[t]]^n` lie in the `κ((t))`-span of `{dg_y : g ∈ 𝔭}`.  Then
756 `P(ℓ̃(0)) = 0`. -/
757 theorem step_polynomial_limit
758     {k κ : Type u} [Field k] [IsAlgClosed k] [Field κ] [Algebra k κ] {m : ℕ}
759     (I : PrimeSpectrum (MvPolynomial (Fin m) k)) (Pol : MvPolynomial (Fin m) k)
760     (hPol : Pol ∈ MvPolynomial.vanishingIdeal k (smoothConormalFibreProjection I.asIdeal))
761     (y : Fin m → LaurentSeries κ)
762     (hbase : ∀ f ∈ I.asIdeal, MvPolynomial.eval₂ (algebraMap k (LaurentSeries κ)) y f = 0)
763     (ell : Fin m → PowerSeries κ)
764     (hell : coordinateCovector (fun i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ) (ell i)) ∈
765       equationCovectorSpan y
766         (I.asIdeal.map (MvPolynomial.map (algebraMap k (LaurentSeries κ))))) :
767     MvPolynomial.eval₂ (algebraMap k κ) (residueColumn ell) Pol = 0 := by
768   apply eval_residue_eq_zero_of_mem_groundEquationConormalLocus I Pol hPol y ell
769   refine ⟨?_, ?_⟩
770   · have hker : I.asIdeal.map (groundPolynomialMap (k := k) (K := κ) (Fin m)) ≤
771         RingHom.ker (MvPolynomial.eval y) := by
772       rw [Ideal.map_le_iff_le_comap]
773       intro f hf
774       rw [Ideal.mem_comap, RingHom.mem_ker]
775       change MvPolynomial.eval y (MvPolynomial.map (algebraMap k (LaurentSeries κ)) f) = 0
776       rw [MvPolynomial.eval_map]
777       exact hbase f hf
778     intro f hf
779     exact RingHom.mem_ker.mp (hker hf)
780   · change coordinateCovector (fun i ↦ algebraMap (PowerSeries κ) (LaurentSeries κ) (ell i)) ∈
781       affineConormalSpace y (I.asIdeal.map (MvPolynomial.map (algebraMap k (LaurentSeries κ))))
782     rw [affineConormalSpace_eq_equationCovectorSpan]
783     exact hell
784 
785 end PolynomialLimit
786 
787 /-! ## Paragraphs at the place of Lemmas 5.9–5.10 -/
788 
789 section Place
790 
791 /-- **Paragraph "`a = ord q_0`", `a > 0`.**  If `a = 0`, then `q_0` is a unit of
792 `V`, hence all `x̄_i = q_i/q_0` lie in `V`, so `R ⊆ V` since also `K ⊆ V`,
793 contradicting Lemma 5.10(a) (`lemma_5_10_a_not_R_le`).  So `q_0 ∉ V^×`. -/
794 theorem step_a_pos {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
795     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
796     (w : GeneralDivisorialVisibleFrameWitness hm P)
797     (hunit : ∃ g : MvPolynomial (Fin m) k,
798       MvPolynomial.X ⟨0, hm⟩ * g - 1 ∈ P.asIdeal) :
799     letI : Algebra (CoordinateZeroLocalRing w.column.W.coefficientField)
800       (ComponentFractionField P) := w.column.W.ambientAlgebra
801     ¬ IsUnit (w.column.q 0) := by
802   let C := w.column
803   let W := C.W
804   let K := ComponentFractionField P
805   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) K := W.ambientAlgebra
806   let V := W.place.valuation
807   letI : IsDiscreteValuationRing V.toSubring := W.place.isDiscrete
808   let x : Fin m → K := fun j ↦ componentCoordinate P j
809   -- `1 = ḡ x̄_1` with `ḡ ∈ R = K[x̄_1, …, x̄_n]`.
810   obtain ⟨g, hg⟩ := hunit
811   let phi : MvPolynomial (Fin m) k →+* K :=
812     (algebraMap (MvPolynomial (Fin m) k ⧸ P.asIdeal) K).comp (Ideal.Quotient.mk P.asIdeal)
813   have hphiC : phi.comp MvPolynomial.C = algebraMap k K := by
814     ext c
815     exact IsScalarTower.algebraMap_apply k (MvPolynomial (Fin m) k ⧸ P.asIdeal) K c
816   have hpoly : phi g = MvPolynomial.eval₂ (algebraMap k K) x g := by
817     rw [MvPolynomial.map_mvPolynomial_eq_eval₂ phi g]
818     change MvPolynomial.eval₂Hom (phi.comp MvPolynomial.C) (fun j ↦ phi (MvPolynomial.X j)) g =
819       MvPolynomial.eval₂Hom (algebraMap k K) x g
820     exact MvPolynomial.eval₂Hom_congr hphiC rfl rfl
821   have hinverse : x ⟨0, hm⟩ * MvPolynomial.eval₂ (algebraMap k K) x g = 1 := by
822     have hzero : phi (MvPolynomial.X ⟨0, hm⟩ * g - 1) = 0 := by
823       have hmk : Ideal.Quotient.mk P.asIdeal (MvPolynomial.X ⟨0, hm⟩ * g - 1) = 0 :=
824         Ideal.Quotient.eq_zero_iff_mem.mpr hg
825       simpa [phi] using congrArg (algebraMap (MvPolynomial (Fin m) k ⧸ P.asIdeal) K) hmk
826     rw [map_sub, map_mul, map_one, sub_eq_zero, hpoly] at hzero
827     exact hzero
828   have hgR : MvPolynomial.eval₂ (algebraMap k K) x g ∈ Algebra.adjoin k (Set.range x) := by
829     rw [← MvPolynomial.aeval_def, Algebra.adjoin_range_eq_range_aeval]
830     exact ⟨g, rfl⟩
831   -- `x̄_1 = ϖ ∈ 𝔪_V`.
832   have hxV : x ⟨0, hm⟩ ∈ V.toSubring := by
833     change componentCoordinate P ⟨0, hm⟩ ∈ V.toSubring
834     rw [← W.parameter_eq_coordinate]
835     exact W.place.parameter.2
836   have hxm : (⟨x ⟨0, hm⟩, hxV⟩ : V.toSubring) ∈ maximalIdeal V.toSubring := by
837     have : (⟨x ⟨0, hm⟩, hxV⟩ : V.toSubring) = W.place.parameter :=
838       Subtype.ext W.parameter_eq_coordinate.symm
839     rw [this, mem_maximalIdeal, mem_nonunits_iff]
840     exact W.place.parameter_nonunit
841   have hR := lemma_5_10_a_not_R_le x ⟨0, hm⟩ V hxV hxm ⟨_, hgR, hinverse⟩
842   rintro ⟨u, hu⟩
843   apply hR
844   -- `q_0 ∈ V^×` puts every `x̄_i = q_i/q_0` in `V`.
845   have hq0 : (C.q 0 : K) = C.scale := by
846     simpa [componentProjectivePoint] using C.q_commonScale 0
847   have hxjV : ∀ j, x j ∈ V.toSubring := by
848     intro j
849     have hqj : (C.q (Fin.succ j) : K) = C.scale * x j := by
850       simpa [componentProjectivePoint] using C.q_commonScale (Fin.succ j)
851     have hscale : ((u : V.toSubring) : K) = C.scale := by rw [hu]; exact hq0
852     have hu1 : ((u : V.toSubring) : K) * ((↑(u⁻¹) : V.toSubring) : K) = 1 := by
853       rw [← Subring.coe_mul, Units.mul_inv]
854       rfl
855     have : x j = (C.q (Fin.succ j) : K) * ((↑(u⁻¹) : V.toSubring) : K) := by
856       rw [hqj, ← hscale, mul_comm ((u : V.toSubring) : K), mul_assoc, hu1, mul_one]
857     rw [this]
858     exact V.toSubring.mul_mem (C.q _).2 (↑(u⁻¹) : V.toSubring).2
859   intro z hz
860   induction hz using Algebra.adjoin_induction with
861   | mem z hz =>
862       obtain ⟨j, rfl⟩ := hz
863       exact hxjV j
864   | algebraMap c =>
865       rw [← C.groundCoeff_commutes]
866       exact (C.groundCoeff c).2
867   | add a b _ _ ha hb => exact V.toSubring.add_mem ha hb
868   | mul a b _ _ ha hb => exact V.toSubring.mul_mem ha hb
869 
870 /-- **Paragraph "`a = ord q_0`, `b = ord q_1`".**  For the column
871 `q_i = x̄_i / x̄_j` of the discrete valuation ring of Lemmas 5.9–5.10, read in
872 `κ[[t]]`: `q_0 = t^a u_0` and `q_1 = t^b u_1` with `u_0(0) ≠ 0 ≠ u_1(0)` and
873 `0 < a < b` (`a > 0` by `step_a_pos`, from Lemma 5.10(a)); hence `q_j = 1`
874 forces `j ∉ {0, 1}`.  The hypothesis `hunit` (`x̄_1` is a unit of `R`) is the
875 consequence of `Y ∩ H = ∅`. -/
876 theorem step_orders {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
877     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
878     (w : GeneralDivisorialVisibleFrameWitness hm P)
879     (hunit : ∃ g : MvPolynomial (Fin m) k,
880       MvPolynomial.X ⟨0, hm⟩ * g - 1 ∈ P.asIdeal) :
881     let C := w.column
882     let W := C.W
883     letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
884       (ComponentFractionField P) := W.ambientAlgebra
885     let V := W.place.valuation.toSubring
886     letI : IsDiscreteValuationRing V := W.place.isDiscrete
887     letI : Algebra W.coefficientField V :=
888       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
889     let κ := ResidueField V
890     let q : Fin (m + 1) → PowerSeries κ := fun a ↦ retainedToCompletedPowerSeries W (C.q a)
891     ∃ (a b : ℕ) (u₀ u₁ : PowerSeries κ),
892       0 < a ∧ a < b ∧
893       q 0 = (PowerSeries.X : PowerSeries κ) ^ a * u₀ ∧ PowerSeries.constantCoeff u₀ ≠ 0 ∧
894       q (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ b * u₁ ∧
895       PowerSeries.constantCoeff u₁ ≠ 0 ∧
896       q C.chart = 1 ∧ C.chart ≠ 0 ∧ C.chart ≠ Fin.succ ⟨0, hm⟩ := by
897   classical
898   intro C W V κ q
899   letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
900     (ComponentFractionField P) := W.ambientAlgebra
901   letI : IsDiscreteValuationRing V := W.place.isDiscrete
902   letI : Algebra W.coefficientField V :=
903     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
904   -- `a > 0` (`step_a_pos`, by Lemma 5.10(a)) and `b - a = ord x̄_1 > 0`.
905   have hq₀max : C.q 0 ∈ maximalIdeal V := by
906     rw [mem_maximalIdeal, mem_nonunits_iff]
907     exact step_a_pos hm P w hunit
908   have hparammax : W.place.parameter ∈ maximalIdeal V := by
909     rw [mem_maximalIdeal, mem_nonunits_iff]
910     exact W.place.parameter_nonunit
911   obtain ⟨a, b', u₀, u₁', ha, hab', hq0, hu₀, hq1'⟩ := completed_order_gap
912     (retainedToCompletedPowerSeries W)
913     (Stafford38.Geometry.CompletedDVRPowerSeries.chosenUniformizer V)
914     (retainedToCompletedPowerSeries_chosenUniformizer W)
915     (Stafford38.Geometry.CompletedDVRPowerSeries.chosenUniformizer_irreducible V)
916     (C.q 0) W.place.parameter (C.q (Fin.succ ⟨0, hm⟩)) C.q0_ne
917     W.place.parameter_ne hq₀max hparammax C.q_parameter
918   have hqj : q C.chart = 1 :=
919     (congrArg (retainedToCompletedPowerSeries W) C.chart_one).trans (map_one _)
920   -- `q_1 = q_0 x̄_1 ≠ 0`, so `b = ord q_1` is finite.
921   have hq1ne : q (Fin.succ ⟨0, hm⟩) ≠ 0 := by
922     intro h
923     have hV : C.q (Fin.succ ⟨0, hm⟩) = 0 :=
924       retainedToCompletedPowerSeries_injective W (h.trans (map_zero _).symm)
925     rw [C.q_parameter] at hV
926     exact mul_ne_zero C.q0_ne W.place.parameter_ne hV
927   have hu₁ : PowerSeries.constantCoeff (q (Fin.succ ⟨0, hm⟩)).divXPowOrder ≠ 0 :=
928     fun h ↦ hq1ne (PowerSeries.constantCoeff_divXPowOrder_eq_zero_iff.mp h)
929   have hq1'' : q (Fin.succ ⟨0, hm⟩) = (PowerSeries.X : PowerSeries κ) ^ b' * u₁' := hq1'
930   have hb : b' ≤ (q (Fin.succ ⟨0, hm⟩)).order.toNat := by
931     by_contra hlt
932     apply hu₁
933     rw [PowerSeries.constantCoeff_divXPowOrder]
934     generalize (q (Fin.succ ⟨0, hm⟩)).order.toNat = n at hlt ⊢
935     rw [hq1'', PowerSeries.coeff_X_pow_mul']
936     exact ite_eq_right_iff.mpr fun h ↦ absurd h (by omega)
937   have hconst : ∀ i, q i = (PowerSeries.X : PowerSeries κ) ^ a * u₀ → i ≠ C.chart := by
938     intro i hi hij
939     have hi1 : q i = 1 := by rw [hij]; exact hqj
940     have h1 := congrArg PowerSeries.constantCoeff (hi1.symm.trans hi)
941     simp [ha.ne'] at h1
942   have hconst1 : C.chart ≠ Fin.succ ⟨0, hm⟩ := by
943     intro hij
944     have hi1 : q (Fin.succ ⟨0, hm⟩) = 1 := by rw [← hij]; exact hqj
945     have h1 := congrArg PowerSeries.constantCoeff (hi1.symm.trans hq1'')
946     simp [(ha.trans hab').ne'] at h1
947   exact ⟨a, (q (Fin.succ ⟨0, hm⟩)).order.toNat, u₀, (q (Fin.succ ⟨0, hm⟩)).divXPowOrder,
948     ha, hab'.trans_le hb, hq0, hu₀, PowerSeries.X_pow_order_mul_divXPowOrder.symm, hu₁, hqj,
949     fun h ↦ hconst 0 hq0 h.symm, hconst1⟩
950 
951 /-- **Paragraph defining `y` (equation (generic)).**  The affine point
952 `y = (q_1/q_0, …, q_n/q_0) ∈ κ((t))^n` is the image of `(x̄_1, …, x̄_n)` under
953 `F ↪ κ((t))`, so `f(y) = 0 ↔ f ∈ 𝔭` for every `f ∈ K[x]`. -/
954 theorem step_generic_point {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
955     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
956     (w : GeneralDivisorialVisibleFrameWitness hm P) :
957     let C := w.column
958     let W := C.W
959     letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
960       (ComponentFractionField P) := W.ambientAlgebra
961     let V := W.place.valuation.toSubring
962     letI : IsDiscreteValuationRing V := W.place.isDiscrete
963     letI : Algebra W.coefficientField V :=
964       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
965     let κ := ResidueField V
966     letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
967     let q : Fin (m + 1) → PowerSeries κ := fun a ↦ retainedToCompletedPowerSeries W (C.q a)
968     ∀ f : MvPolynomial (Fin m) k,
969       MvPolynomial.eval₂ (algebraMap k (LaurentSeries κ))
970         (dehomogenizedPoint (laurentColumn q)) f = 0 ↔ f ∈ P.asIdeal := by
971   classical
972   intro C W V κ q
973   letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
974     (ComponentFractionField P) := W.ambientAlgebra
975   letI : IsDiscreteValuationRing V := W.place.isDiscrete
976   letI : Algebra W.coefficientField V :=
977     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
978   letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
979   have hground := retainedLaurentLift_comp_algebraMap P ⟨0, hm⟩ W
980   have hpoint := retainedLaurentLift_componentCoordinate P ⟨0, hm⟩ W C.q C.scale
981     C.q_commonScale C.q0_ne
982   have hker := component_generic_kernel_after_point_transport P
983     (retainedLaurentLift P ⟨0, hm⟩ W) (RingHom.injective _) hground _ hpoint
984   intro f
985   rw [← MvPolynomial.eval_map]
986   exact hker f
987 
988 /-- **Lemma 5.11 for the valuation ring of the formal proof.**  The residues
989 `res q_i` of its normalized column satisfy `res q_0 = res q_1 = 0`,
990 `res q_j = 1`, and some `res q_i` with `i ∉ {0, 1, j}` have differentials
991 forming a basis of `Ω_{κ/K}`. -/
992 theorem witness_lemma_5_11
993     {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
994     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
995     (w : GeneralDivisorialVisibleFrameWitness hm P)
996     (hunit : ∃ g : MvPolynomial (Fin m) k,
997       MvPolynomial.X ⟨0, hm⟩ * g - 1 ∈ P.asIdeal) :
998     let C := w.column
999     let W := C.W
1000     letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
1001       (ComponentFractionField P) := W.ambientAlgebra
1002     let V := W.place.valuation.toSubring
1003     letI : IsDiscreteValuationRing V := W.place.isDiscrete
1004     letI : Algebra W.coefficientField V :=
1005       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1006     let κ := ResidueField V
1007     letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1008     residue V (C.q 0) = 0 ∧ residue V (C.q (Fin.succ ⟨0, hm⟩)) = 0 ∧
1009       residue V (C.q C.chart) = 1 ∧
1010       ∃ (d' : ℕ) (rows : Fin d' → Fin (m + 1)),
1011         Function.Injective rows ∧
1012         (∀ l, rows l ≠ 0 ∧ rows l ≠ Fin.succ ⟨0, hm⟩ ∧ rows l ≠ C.chart) ∧
1013         LinearIndependent κ
1014           (fun l ↦ KaehlerDifferential.D k κ (residue V (C.q (rows l)))) ∧
1015         Submodule.span κ
1016           (Set.range fun l ↦ KaehlerDifferential.D k κ (residue V (C.q (rows l)))) = ⊤ ∧
1017         d' = Module.finrank κ (Ω[κ⁄k]) := by
1018   classical
1019   let C := w.column
1020   let W := C.W
1021   letI : Algebra (CoordinateZeroLocalRing W.coefficientField)
1022     (ComponentFractionField P) := W.ambientAlgebra
1023   let V := W.place.valuation.toSubring
1024   letI : IsDiscreteValuationRing V := W.place.isDiscrete
1025   letI : Algebra W.coefficientField V :=
1026     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1027   let κ := ResidueField V
1028   letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1029   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
1030   obtain ⟨a, b, u₀, u₁, ha, hab, hq0, -, hq1⟩ := order_gap_of_actual_witness hm P w hunit
1031   have hres := constantCoeff_retainedToCompleted_eq_residue (k := k) W
1032   have hr0 : residue V (C.q 0) = 0 := by
1033     rw [← hres, hq0]
1034     simp [ha.ne']
1035   have hr1 : residue V (C.q (Fin.succ ⟨0, hm⟩)) = 0 := by
1036     rw [← hres, hq1]
1037     simp [(ha.trans hab).ne']
1038   have hrj : residue V (C.q C.chart) = 1 := by
1039     rw [C.chart_one, map_one]
1040   have halg : Algebra.IsAlgebraic
1041       (IntermediateField.adjoin k (Set.range fun a ↦ residue V (C.q a)) :
1042         IntermediateField k κ) κ := by
1043     have h := w.halg
1044     have hle : IntermediateField.adjoin k
1045           (Set.range fun j : Fin m ↦ residue V (C.q (Fin.succ j))) ≤
1046         IntermediateField.adjoin k (Set.range fun a ↦ residue V (C.q a)) :=
1047       IntermediateField.adjoin.mono _ _ _ (by rintro _ ⟨j, rfl⟩; exact ⟨_, rfl⟩)
1048     exact ⟨fun z ↦ IsAlgebraic.tower_top_of_subalgebra_le
1049       (IntermediateField.toSubalgebra_le_toSubalgebra.mpr hle) (h.isAlgebraic z)⟩
1050   exact ⟨hr0, hr1, hrj,
1051     lemma_5_11 hm (fun a ↦ residue V (C.q a)) C.chart hr0 hr1 hrj halg⟩
1052 
1053 /-- **Lemmas 5.12(a), 5.12(b) and 5.13 at the Laurent generic point of the
1054 formal proof, given the bound `m ≤ d' + 1`.**  For the column `q(t)` of
1055 `witness_lemma_5_11`, with `y = q/q_0 ∈ κ((t))^n`: `dim Θ_y = dim_F Ω_{F/K}`,
1056 this equals `trdeg_K F = m`, and `m ≤ d' + 1` (the hypothesis `hfieldRank`);
1057 `dim 𝒞 = dim Θ_y + 1`; `δq ∈ 𝒞` for every `K`-derivation `δ` of `κ((t))` and
1058 `q ∈ 𝒞`; and every row annihilating `𝒞` has conormal affine part. -/
1059 theorem witness_lemma_5_12_5_13_of_bound
1060     {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
1061     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
1062     (w : GeneralDivisorialVisibleFrameWitness hm P)
1063     (hfieldRank :
1064       let C := w.column
1065       let W := C.W
1066       let F := ComponentFractionField P
1067       letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
1068       let V := W.place.valuation.toSubring
1069       letI : IsDiscreteValuationRing V := W.place.isDiscrete
1070       letI : Algebra W.coefficientField V :=
1071         (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1072       let κ := ResidueField V
1073       letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1074       Module.finrank F (Ω[F⁄k]) ≤ Module.finrank κ (Ω[κ⁄k]) + 1) :
1075     let C := w.column
1076     let W := C.W
1077     let F := ComponentFractionField P
1078     letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
1079     let V := W.place.valuation.toSubring
1080     letI : IsDiscreteValuationRing V := W.place.isDiscrete
1081     letI : Algebra W.coefficientField V :=
1082       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1083     let κ := ResidueField V
1084     letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1085     let E := LaurentSeries κ
1086     letI : Algebra k E := (groundLaurentMap (k := k) (K := κ)).toAlgebra
1087     letI : SMul k E := (inferInstance : Algebra k E).toSMul
1088     letI : Module k E := (inferInstance : Algebra k E).toModule
1089     let q : Fin (m + 1) → E :=
1090       laurentColumn fun a ↦ retainedToCompletedPowerSeries W (C.q a)
1091     (Module.finrank E (tangentSpaceAt q P.asIdeal) = Module.finrank F (Ω[F⁄k]) ∧
1092       (Module.finrank F (Ω[F⁄k]) : Cardinal) = Algebra.trdeg k F ∧
1093       Module.finrank F (Ω[F⁄k]) ≤ Module.finrank κ (Ω[κ⁄k]) + 1 ∧
1094       Module.finrank E (tangentCone q P.asIdeal) =
1095         Module.finrank E (tangentSpaceAt q P.asIdeal) + 1) ∧
1096     ((∀ δ : Derivation k E E, (fun a ↦ δ (q a)) ∈ tangentCone q P.asIdeal) ∧
1097       q ∈ tangentCone q P.asIdeal) ∧
1098     (∀ ell : Fin (m + 1) → E, (∀ v ∈ tangentCone q P.asIdeal, ∑ a, ell a * v a = 0) →
1099       coordinateCovector (fun i : Fin m ↦ ell i.succ) ∈
1100         equationCovectorSpan (dehomogenizedPoint q)
1101           (P.asIdeal.map (MvPolynomial.map (algebraMap k E)))) := by
1102   classical
1103   let C := w.column
1104   let W := C.W
1105   let F := ComponentFractionField P
1106   letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
1107   let V := W.place.valuation.toSubring
1108   letI : IsDiscreteValuationRing V := W.place.isDiscrete
1109   letI : Algebra W.coefficientField V :=
1110     (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1111   let κ := ResidueField V
1112   letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1113   let E := LaurentSeries κ
1114   letI : Algebra k E := (groundLaurentMap (k := k) (K := κ)).toAlgebra
1115   letI : SMul k E := (inferInstance : Algebra k E).toSMul
1116   letI : Module k E := (inferInstance : Algebra k E).toModule
1117   let q : Fin (m + 1) → E :=
1118     laurentColumn fun a ↦ retainedToCompletedPowerSeries W (C.q a)
1119   letI : IsLocalRing V := W.place.isDiscrete.toIsLocalRing
1120   letI : CharZero κ :=
1121     charZero_of_injective_algebraMap (FaithfulSMul.algebraMap_injective k κ)
1122   let i₀ : Fin m := ⟨0, hm⟩
1123   let ell : F →+* E := retainedLaurentLift P i₀ W
1124   have hground : ell.comp (algebraMap k F) = groundLaurentMap (k := k) (K := κ) :=
1125     retainedLaurentLift_comp_algebraMap P i₀ W
1126   have hpoint : ell ∘ componentCoordinate P = dehomogenizedPoint q :=
1127     retainedLaurentLift_componentCoordinate P i₀ W C.q C.scale C.q_commonScale C.q0_ne
1128   have hq0 : q 0 ≠ 0 := by
1129     intro h
1130     apply C.q0_ne
1131     have h1 : HahnSeries.ofPowerSeries ℤ κ (retainedToCompletedPowerSeries W (C.q 0)) = 0 := by
1132       simpa [q, laurentColumn] using h
1133     have h' : retainedToCompletedPowerSeries W (C.q 0) = 0 :=
1134       HahnSeries.ofPowerSeries_injective (h1.trans (map_zero _).symm)
1135     exact (retainedToCompletedPowerSeries_injective W) (by rw [h', map_zero])
1136   have hbase : ∀ f ∈ P.asIdeal,
1137       MvPolynomial.eval₂ (algebraMap k E) (dehomogenizedPoint q) f = 0 :=
1138     fun f hf ↦ component_equations_vanish_after_point_transport P ell hground _ hpoint hf
1139   have hcone := lemma_5_12_a_cone q hq0 P.asIdeal
1140   have hb := lemma_5_12_b q hq0 P.asIdeal hbase
1141   have h13 := fun ell hell ↦ lemma_5_13 q hq0 P.asIdeal ell hell
1142   -- Lemma 5.12(a): `dim Θ_y = dim_F Ω_{F/K} = trdeg_K F ≤ d' + 1`.
1143   letI : Algebra F E := ell.toAlgebra
1144   letI : SMul k F := (inferInstance : Algebra k F).toSMul
1145   letI : Module k F := (inferInstance : Algebra k F).toModule
1146   letI : IsScalarTower k F E := IsScalarTower.of_algebraMap_eq fun c ↦ by
1147     have h := congrArg (fun f : k →+* E ↦ f c) hground
1148     change (groundLaurentMap (k := k) (K := κ)) c = ell (algebraMap k F c)
1149     exact h.symm
1150   have hchartPoint : (fun j : Fin m ↦ algebraMap F E
1151       (Stafford38.Geometry.GenericPointKaehlerConormal.genericPoint P.asIdeal F j)) =
1152         dehomogenizedPoint q := by
1153     funext j
1154     exact congrFun hpoint j
1155   have hdim := generic_tangent_finrank_eq_component_kaehler_finrank (F := F) (E := E)
1156     (I := P.asIdeal)
1157   rw [hchartPoint] at hdim
1158   have htr := (component_kaehler_finrank_eq_trdeg (k := k) (componentCoordinate P)
1159     (componentCoordinate_adjoin_eq_top P)).1
1160   exact ⟨⟨hdim, htr, hfieldRank, hcone⟩, hb, h13⟩
1161 
1162 /-- **Lemmas 5.12(a), 5.12(b) and 5.13 at the Laurent generic point of the
1163 formal proof.**  For the column `q(t)` of `witness_lemma_5_11`, with
1164 `y = q/q_0 ∈ κ((t))^n`: `dim Θ_y = dim_F Ω_{F/K}`, this equals
1165 `trdeg_K F = m`, and `m ≤ d' + 1` by the printed argument
1166 (`witness_lemma_5_12_a_bound`: second fundamental exact sequence for `V → κ`,
1167 Nakayama with `Ω_{V/K}` finitely generated by Lemma 5.10(c), and
1168 `F ⊗_V Ω_{V/K} = Ω_{F/K}`); `dim 𝒞 = dim Θ_y + 1`; `δq ∈ 𝒞` for every
1169 `K`-derivation `δ` of `κ((t))` and `q ∈ 𝒞`; and every row annihilating `𝒞` has
1170 conormal affine part. -/
1171 theorem witness_lemma_5_12_5_13_paper
1172     {k : Type u} [Field k] [CharZero k] {m : ℕ} (hm : 0 < m)
1173     (P : PrimeSpectrum (MvPolynomial (Fin m) k))
1174     (w : GeneralDivisorialVisibleFrameWitness hm P)
1175     (hfin :
1176       letI : Algebra (CoordinateZeroLocalRing w.column.W.coefficientField)
1177         (ComponentFractionField P) := w.column.W.ambientAlgebra
1178       let V := w.column.W.place.valuation.toSubring
1179       letI : Algebra k V := w.column.groundCoeff.toAlgebra
1180       Module.Finite V (Ω[V⁄k])) :
1181     let C := w.column
1182     let W := C.W
1183     let F := ComponentFractionField P
1184     letI : Algebra (CoordinateZeroLocalRing W.coefficientField) F := W.ambientAlgebra
1185     let V := W.place.valuation.toSubring
1186     letI : IsDiscreteValuationRing V := W.place.isDiscrete
1187     letI : Algebra W.coefficientField V :=
1188       (relativeCoefficientMap W.coefficientField W.place).toAlgebra
1189     let κ := ResidueField V
1190     letI : Algebra k κ := retainedResidueGroundAlgebra P ⟨0, hm⟩ W
1191     let E := LaurentSeries κ
1192     letI : Algebra k E := (groundLaurentMap (k := k) (K := κ)).toAlgebra
1193     letI : SMul k E := (inferInstance : Algebra k E).toSMul
1194     letI : Module k E := (inferInstance : Algebra k E).toModule
1195     let q : Fin (m + 1) → E :=
1196       laurentColumn fun a ↦ retainedToCompletedPowerSeries W (C.q a)
1197     (Module.finrank E (tangentSpaceAt q P.asIdeal) = Module.finrank F (Ω[F⁄k]) ∧
1198       (Module.finrank F (Ω[F⁄k]) : Cardinal) = Algebra.trdeg k F ∧
1199       Module.finrank F (Ω[F⁄k]) ≤ Module.finrank κ (Ω[κ⁄k]) + 1 ∧
1200       Module.finrank E (tangentCone q P.asIdeal) =
1201         Module.finrank E (tangentSpaceAt q P.asIdeal) + 1) ∧
1202     ((∀ δ : Derivation k E E, (fun a ↦ δ (q a)) ∈ tangentCone q P.asIdeal) ∧
1203       q ∈ tangentCone q P.asIdeal) ∧
1204     (∀ ell : Fin (m + 1) → E, (∀ v ∈ tangentCone q P.asIdeal, ∑ a, ell a * v a = 0) →
1205       coordinateCovector (fun i : Fin m ↦ ell i.succ) ∈
1206         equationCovectorSpan (dehomogenizedPoint q)
1207           (P.asIdeal.map (MvPolynomial.map (algebraMap k E)))) :=
1208   witness_lemma_5_12_5_13_of_bound hm P w (witness_lemma_5_12_a_bound hm P w hfin)
1209 
1210 end Place
1211 
1212 #print axioms exists_mem_zeroLocus_of_isPrime
1213 #print axioms exists_smoothAffinePoint
1214 #print axioms step_coordinate_algebraic
1215 #print axioms step_dual_derivations
1216 #print axioms step_lambda_w_tau
1217 #print axioms step_M_minor
1218 #print axioms step_M_spans_cone
1219 #print axioms step_lift_ell_minor
1220 #print axioms step_ell_conormal
1221 #print axioms step_polynomial_limit
1222 #print axioms step_a_pos
1223 #print axioms step_orders
1224 #print axioms step_generic_point
1225 #print axioms witness_lemma_5_11
1226 #print axioms witness_lemma_5_12_5_13_of_bound
1227 #print axioms witness_lemma_5_12_5_13_paper
1228 
1229 end
1230 
1231 end Stafford38.Paper.Section5
1232