Stafford38/Geometry/RetractionSpecialization.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.Data.Matrix.Basic
3 public import Mathlib.RingTheory.PowerSeries.Basic
4 public import Mathlib.Algebra.MvPolynomial.Eval
5 
6 @[expose] public section
7 
8 /-!
9 # Retraction correction and power-series specialization
10 
11 This file contains only elementary algebra intended for use in a future
12 formalization of the asymptotic-conormal argument. In particular, it does not formalize a DVR,
13 normalization, a Grassmannian limit, or coisotropy.  The useful point is that
14 the two algebraic operations needed by that argument are explicit:
15 
16 * a left inverse for a column matrix gives an annihilator by a retraction;
17 * taking the residue of a power series commutes with polynomial evaluation.
18 
19 The last theorem records the resulting polynomial-specialization
20 contradiction for an arbitrary variable type and arbitrary specialization
21 vector.
22 -/
23 
24 namespace Stafford38.GeometryRetractionSpecialization
25 
26 noncomputable section
27 
28 universe u v w
29 
30 /-! ## Rows, columns, and the explicit retraction correction -/
31 
32 variable {R : Type u} [CommRing R]
33 
34 /-- A row vector multiplied by a matrix on the right. -/
35 def rowMul {ι κ : Type*} [Fintype ι] (a : ι → R) (B : Matrix ι κ R) : κ → R :=
36   fun j => ∑ i, a i * B i j
37 
38 theorem rowMul_mul {ι κ μ : Type*} [Fintype ι] [Fintype κ]
39     (a : ι → R) (B : Matrix ι κ R) (C : Matrix κ μ R) :
40     rowMul (rowMul a B) C = rowMul a (B * C) := by
41   funext j
42   simp only [rowMul, Matrix.mul_apply]
43   calc
44     (∑ x, (∑ i, a i * B i x) * C x j) =
45         ∑ x, ∑ i, (a i * B i x) * C x j := by
46           apply Finset.sum_congr rfl
47           intro x hx
48           rw [Finset.sum_mul]
49     _ = ∑ i, ∑ x, (a i * B i x) * C x j := Finset.sum_comm
50     _ = ∑ i, a i * (∑ x, B i x * C x j) := by
51           apply Finset.sum_congr rfl
52           intro i hi
53           rw [Finset.mul_sum]
54           apply Finset.sum_congr rfl
55           intro x hx
56           ring
57 
58 theorem map_rowMul {S : Type v} [CommRing S]
59     {ι κ : Type*} [Fintype ι] (f : R →+* S)
60     (a : ι → R) (B : Matrix ι κ R) (j : κ) :
61     f (rowMul a B j) =
62       rowMul (fun i => f (a i)) (fun i l => f (B i l)) j := by
63   simp [rowMul]
64 
65 theorem rowMul_sub {ι κ : Type*} [Fintype ι]
66     (a b : ι → R) (B : Matrix ι κ R) :
67     rowMul (fun i => a i - b i) B =
68       fun j => rowMul a B j - rowMul b B j := by
69   funext j
70   simp [rowMul, Finset.sum_sub_distrib, sub_mul]
71 
72 theorem rowMul_zero {ι κ : Type*} [Fintype ι]
73     (B : Matrix ι κ R) : rowMul (fun _ => (0 : R)) B = 0 := by
74   funext j
75   simp [rowMul]
76 
77 /--
78 The retraction correction for a row `a` and a column matrix `B`.
79 
80 If `C * B = 1`, then `C` is a coordinate retraction on the columns of `B`.
81 The displayed subtraction is the usual projection onto the annihilator of
82 those columns.
83 -/
84 def annihilatorLift {ι κ : Type*} [Fintype ι] [Fintype κ]
85     (a : ι → R) (B : Matrix ι κ R) (C : Matrix κ ι R) : ι → R :=
86   fun i => a i - rowMul (rowMul a B) C i
87 
88 theorem annihilatorLift_rowMul_eq_zero {ι κ : Type*} [Fintype ι] [Fintype κ]
89     [DecidableEq κ]
90     (a : ι → R) (B : Matrix ι κ R) (C : Matrix κ ι R)
91     (hCB : C * B = 1) :
92     rowMul (annihilatorLift a B C) B = 0 := by
93   change rowMul (fun i => a i - rowMul (rowMul a B) C i) B = 0
94   rw [rowMul_sub]
95   rw [rowMul_mul, rowMul_mul]
96   rw [hCB, Matrix.mul_one]
97   exact funext (fun j => sub_self (rowMul a B j))
98 
99 theorem map_annihilatorLift {S : Type v} [CommRing S]
100     {ι κ : Type*} [Fintype ι] [Fintype κ]
101     (f : R →+* S) (a : ι → R) (B : Matrix ι κ R) (C : Matrix κ ι R) (i : ι) :
102     f (annihilatorLift a B C i) =
103       annihilatorLift (fun j => f (a j))
104         (fun j l => f (B j l)) (fun l j => f (C l j)) i := by
105   simp only [annihilatorLift, map_sub]
106   rw [map_rowMul f (rowMul a B) C i]
107   have hinner :
108       rowMul (fun j => f (rowMul a B j)) (fun l j => f (C l j)) i =
109         rowMul (rowMul (fun j => f (a j)) (fun j l => f (B j l)))
110           (fun l j => f (C l j)) i := by
111     apply congrArg (fun z => rowMul z (fun l j => f (C l j)) i)
112     funext j
113     exact map_rowMul f a B j
114   exact congrArg (fun z => f (a i) - z) hinner
115 
116 /--
117 Explicit residue-preserving annihilator lift.
118 
119 The input row is any coefficientwise lift of the residue row. The correction
120 preserves that residue whenever the residue row annihilates the reduced
121 columns. Exact annihilation is supplied separately by
122 `annihilatorLift_rowMul_eq_zero` under the hypothesis `C * B = 1`.
123 -/
124 theorem residue_annihilatorLift_eq
125     {S : Type v} [CommRing S]
126     {ι κ : Type*} [Fintype ι] [Fintype κ]
127     (f : R →+* S) (a : ι → R) (a₀ : ι → S)
128     (B : Matrix ι κ R) (C : Matrix κ ι R)
129     (ha : ∀ i, f (a i) = a₀ i)
130     (h₀ : rowMul a₀ (fun i j => f (B i j)) = 0) :
131     ∀ i, f (annihilatorLift a B C i) = a₀ i := by
132   intro i
133   rw [map_annihilatorLift]
134   simp only [annihilatorLift, ha]
135   rw [h₀]
136   simp [rowMul]
137 
138 /-! ## Power-series columns and residue -/
139 
140 /-- A column with entries in a one-variable formal power-series ring. -/
141 abbrev PowerSeriesColumn (k : Type*) (ι : Type*) := ι → PowerSeries k
142 
143 def residueColumn {k : Type*} [CommRing k] {ι : Type*}
144     (a : PowerSeriesColumn k ι) : ι → k :=
145   fun i => PowerSeries.constantCoeff (a i)
146 
147 def constantColumn {k : Type*} [CommRing k] {ι : Type*}
148     (a : ι → k) : PowerSeriesColumn k ι :=
149   fun i => PowerSeries.C (a i)
150 
151 @[simp] theorem residueColumn_constantColumn {k : Type*} [CommRing k] {ι : Type*}
152     (a : ι → k) : residueColumn (constantColumn a) = a := by
153   funext i
154   simp [residueColumn, constantColumn]
155 
156 theorem powerSeries_annihilatorLift_rowMul_eq_zero
157     {k : Type*} [CommRing k] {ι κ : Type*} [Fintype ι] [Fintype κ]
158     [DecidableEq κ]
159     (a : PowerSeriesColumn k ι) (B : Matrix ι κ (PowerSeries k))
160     (C : Matrix κ ι (PowerSeries k)) (hCB : C * B = 1) :
161     rowMul (annihilatorLift a B C) B = 0 :=
162   annihilatorLift_rowMul_eq_zero a B C hCB
163 
164 theorem residue_powerSeries_annihilatorLift_eq
165     {k : Type*} [CommRing k] {ι κ : Type*} [Fintype ι] [Fintype κ]
166     (a : PowerSeriesColumn k ι) (a₀ : ι → k)
167     (B : Matrix ι κ (PowerSeries k)) (C : Matrix κ ι (PowerSeries k))
168     (ha : residueColumn a = a₀)
169     (h₀ : rowMul a₀ (fun i j => PowerSeries.constantCoeff (B i j)) = 0) :
170     ∀ i, residueColumn (annihilatorLift a B C) i = a₀ i := by
171   apply residue_annihilatorLift_eq PowerSeries.constantCoeff a a₀ B C
172   · intro i
173     simpa [residueColumn] using congrFun ha i
174   · simpa [residueColumn] using h₀
175 
176 /-- A split column matrix admits a corrected row which both annihilates the
177 matrix and retains the prescribed residue. -/
178 theorem powerSeries_annihilatorLift_spec
179     {k : Type*} [CommRing k] {ι κ : Type*} [Fintype ι] [Fintype κ]
180     [DecidableEq κ]
181     (a : PowerSeriesColumn k ι) (a₀ : ι → k)
182     (B : Matrix ι κ (PowerSeries k)) (C : Matrix κ ι (PowerSeries k))
183     (hCB : C * B = 1) (ha : residueColumn a = a₀)
184     (h₀ : rowMul a₀ (fun i j => PowerSeries.constantCoeff (B i j)) = 0) :
185     rowMul (annihilatorLift a B C) B = 0 ∧
186       residueColumn (annihilatorLift a B C) = a₀ := by
187   refine ⟨powerSeries_annihilatorLift_rowMul_eq_zero a B C hCB, ?_⟩
188   funext i
189   exact residue_powerSeries_annihilatorLift_eq a a₀ B C ha h₀ i
190 
191 /-! ## Residue/evaluation commutation for multivariate polynomials -/
192 
193 theorem residue_eval_map
194     {k : Type*} [CommRing k] {σ : Type*}
195     (P : MvPolynomial σ k) (v : σ → PowerSeries k) :
196     PowerSeries.constantCoeff
197         (MvPolynomial.eval v (MvPolynomial.map PowerSeries.C P)) =
198       MvPolynomial.eval (residueColumn v) P := by
199   rw [MvPolynomial.eval_map]
200   induction P using MvPolynomial.induction_on with
201   | C r => simp
202   | add p q hp hq => simp [hp, hq]
203   | mul_X p i hp =>
204       simp [hp, residueColumn, mul_comm]
205 
206 theorem residue_eval_eq_zero_of_eval_map_eq_zero
207     {k : Type*} [CommRing k] {σ : Type*}
208     (P : MvPolynomial σ k) (v : σ → PowerSeries k)
209     (hv : MvPolynomial.eval v (MvPolynomial.map PowerSeries.C P) = 0) :
210     MvPolynomial.eval (residueColumn v) P = 0 := by
211   rw [← residue_eval_map P v, hv]
212   simp
213 
214 /-! ## Polynomial-specialization contradiction -/
215 
216 theorem no_axis_specialization
217     {k : Type*} [CommRing k] {σ : Type*}
218     (P : MvPolynomial σ k) (v : σ → PowerSeries k) (axis : σ → k)
219     (hres : residueColumn v = axis)
220     (hvanish : MvPolynomial.eval v (MvPolynomial.map PowerSeries.C P) = 0)
221     (haxis : MvPolynomial.eval axis P ≠ 0) : False := by
222   apply haxis
223   rw [← hres]
224   exact residue_eval_eq_zero_of_eval_map_eq_zero P v hvanish
225 
226 /-! ## Small concrete pins used by the focused checker -/
227 
228 example {k : Type*} [CommRing k] {σ : Type*}
229     (P : MvPolynomial σ k) (v : σ → PowerSeries k) :
230     PowerSeries.constantCoeff
231         (MvPolynomial.eval v (MvPolynomial.map PowerSeries.C P)) =
232       MvPolynomial.eval (residueColumn v) P :=
233   residue_eval_map P v
234 
235 example {k : Type*} [CommRing k] {σ : Type*}
236     (P : MvPolynomial σ k) (v : σ → PowerSeries k) (axis : σ → k)
237     (hres : residueColumn v = axis)
238     (hvanish : MvPolynomial.eval v (MvPolynomial.map PowerSeries.C P) = 0)
239     (haxis : MvPolynomial.eval axis P ≠ 0) : False :=
240   no_axis_specialization P v axis hres hvanish haxis
241 
242 #print axioms rowMul
243 #print axioms rowMul_mul
244 #print axioms map_rowMul
245 #print axioms annihilatorLift
246 #print axioms annihilatorLift_rowMul_eq_zero
247 #print axioms map_annihilatorLift
248 #print axioms residue_annihilatorLift_eq
249 #print axioms PowerSeriesColumn
250 #print axioms residueColumn
251 #print axioms constantColumn
252 #print axioms residueColumn_constantColumn
253 #print axioms powerSeries_annihilatorLift_rowMul_eq_zero
254 #print axioms residue_powerSeries_annihilatorLift_eq
255 #print axioms powerSeries_annihilatorLift_spec
256 #print axioms residue_eval_map
257 #print axioms residue_eval_eq_zero_of_eval_map_eq_zero
258 #print axioms no_axis_specialization
259 
260 end
261 
262 end Stafford38.GeometryRetractionSpecialization
263