Stafford38/Characteristic/SymplecticCompletion.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.LinearAlgebra.Matrix.BilinearForm
3 public import Stafford38.MathlibCompat.MvPolynomialCoeff
4 public import Stafford38.Weyl.Symplectic
5 public import Stafford38.Characteristic.HomogeneousChart
6 public import Stafford38.Characteristic.PaperSymplecticBasis
7 
8 @[expose] public section
9 
10 /-!
11 # Symplectic completion of a phase vector
12 
13 An explicit symplectic transvection preserves the standard phase pairing.
14 One transvection sends a nonzero vector to another when they pair nontrivially;
15 an elementary bridge vector reduces the remaining case to two transvections.
16 Consequently any nonzero phase vector can occupy a prescribed matrix column.
17 Combined with homogeneous nonvanishing, this makes the transformed pure-power
18 coefficient nonzero over the original characteristic-zero field.
19 -/
20 
21 namespace Stafford38.CharacteristicSymplecticCompletion
22 
23 open Stafford38.Characteristic
24 open Stafford38.CharacteristicHomogeneousChart
25 open Stafford38.WeylSymplectic
26 
27 noncomputable section
28 universe u
29 variable (k : Type u) [Field k]
30 
31 def phasePairing {n : ℕ} (u v : PhaseVar n → k) : k :=
32   ∑ i, (u (.inr i) * v (.inl i) - u (.inl i) * v (.inr i))
33 
34 def phaseBasis {n : ℕ} (j : PhaseVar n) : PhaseVar n → k :=
35   fun i => if i = j then 1 else 0
36 
37 def symplecticTransvection {n : ℕ} (a : k) (u : PhaseVar n → k) :
38     Matrix (PhaseVar n) (PhaseVar n) k :=
39   fun i j => (if i = j then 1 else 0) +
40     a * phasePairing k (phaseBasis k j) u * u i
41 
42 theorem phasePairing_basis_left {n : ℕ} (j : PhaseVar n)
43     (u : PhaseVar n → k) :
44     phasePairing k (phaseBasis k j) u =
45       match j with
46       | .inl i => -u (.inr i)
47       | .inr i => u (.inl i) := by
48   cases j with
49   | inl j =>
50       simp [phasePairing, phaseBasis]
51   | inr j =>
52       simp [phasePairing, phaseBasis]
53 
54 theorem transvection_mulVec {n : ℕ} (a : k) (u z : PhaseVar n → k)
55     (i : PhaseVar n) :
56     Matrix.mulVec (symplecticTransvection k a u) z i =
57       z i + a * phasePairing k z u * u i := by
58   simp only [Matrix.mulVec, dotProduct, symplecticTransvection]
59   simp_rw [add_mul]
60   rw [Finset.sum_add_distrib]
61   rw [show (∑ x, (if i = x then 1 else 0) * z x) = z i by simp]
62   congr 1
63   rw [phasePairing]
64   rw [Fintype.sum_sum_type]
65   simp only [phasePairing_basis_left]
66   simp only [Finset.sum_sub_distrib]
67   rw [mul_sub, sub_mul]
68   rw [Finset.mul_sum, Finset.mul_sum, Finset.sum_mul, Finset.sum_mul]
69   rw [← Finset.sum_sub_distrib, ← Finset.sum_add_distrib]
70   apply Finset.sum_congr rfl
71   intro x hx
72   ring
73 
74 theorem phasePairing_add_left {n : ℕ} (u v w : PhaseVar n → k) :
75     phasePairing k (u + v) w = phasePairing k u w + phasePairing k v w := by
76   simp [phasePairing, Finset.sum_add_distrib]
77   simp_rw [add_mul]
78   rw [Finset.sum_add_distrib, Finset.sum_add_distrib]
79   ring
80 
81 theorem phasePairing_add_right {n : ℕ} (u v w : PhaseVar n → k) :
82     phasePairing k u (v + w) = phasePairing k u v + phasePairing k u w := by
83   simp [phasePairing, Finset.sum_add_distrib]
84   simp_rw [mul_add]
85   rw [Finset.sum_add_distrib, Finset.sum_add_distrib]
86   ring
87 
88 theorem phasePairing_smul_left {n : ℕ} (c : k) (u v : PhaseVar n → k) :
89     phasePairing k (c • u) v = c * phasePairing k u v := by
90   simp [phasePairing, Finset.mul_sum]
91   rw [mul_sub]
92   rw [Finset.mul_sum, Finset.mul_sum]
93   congr 1 <;> apply Finset.sum_congr rfl <;> intro x hx <;> ring
94 
95 theorem phasePairing_smul_right {n : ℕ} (c : k) (u v : PhaseVar n → k) :
96     phasePairing k u (c • v) = c * phasePairing k u v := by
97   simp [phasePairing, Finset.mul_sum]
98   rw [mul_sub]
99   rw [Finset.mul_sum, Finset.mul_sum]
100   congr 1 <;> apply Finset.sum_congr rfl <;> intro x hx <;> ring
101 
102 theorem phasePairing_skew {n : ℕ} (u v : PhaseVar n → k) :
103     phasePairing k u v = -phasePairing k v u := by
104   simp [phasePairing, Finset.sum_neg_distrib]
105   congr 1 <;> apply Finset.sum_congr rfl <;> intro x hx <;> ring
106 
107 theorem phasePairing_self {n : ℕ} (u : PhaseVar n → k) :
108     phasePairing k u u = 0 := by
109   simp [phasePairing]
110   have hsum : (∑ x, u (.inl x) * u (.inr x)) =
111       ∑ x, u (.inr x) * u (.inl x) := by
112     apply Finset.sum_congr rfl
113     intro x hx
114     ring
115   rw [hsum, sub_self]
116 
117 theorem transvection_preserves_pairing {n : ℕ} (a : k)
118     (u x y : PhaseVar n → k) :
119     phasePairing k (Matrix.mulVec (symplecticTransvection k a u) x)
120         (Matrix.mulVec (symplecticTransvection k a u) y) =
121       phasePairing k x y := by
122   have hx : Matrix.mulVec (symplecticTransvection k a u) x =
123       x + (a * phasePairing k x u) • u := by
124     funext i
125     rw [transvection_mulVec]
126     rfl
127   have hy : Matrix.mulVec (symplecticTransvection k a u) y =
128       y + (a * phasePairing k y u) • u := by
129     funext i
130     rw [transvection_mulVec]
131     rfl
132   rw [hx, hy, phasePairing_add_left]
133   simp_rw [phasePairing_add_right, phasePairing_smul_left,
134     phasePairing_smul_right, phasePairing_self]
135   rw [phasePairing_skew k u y]
136   ring
137 
138 theorem transpose_standardForm_mul_apply {n : ℕ}
139     (A : Matrix (PhaseVar n) (PhaseVar n) k) (i j : PhaseVar n) :
140     (Matrix.transpose A * standardForm k n * A) i j =
141       phasePairing k (fun l => A l i) (fun l => A l j) := by
142   simp [Matrix.mul_apply, standardForm, Matrix.J, phasePairing,
143     Matrix.one_apply]
144   ring
145 
146 theorem phasePairing_basis {n : ℕ} (i j : PhaseVar n) :
147     phasePairing k (phaseBasis k i) (phaseBasis k j) =
148       standardForm k n i j := by
149   cases i <;> cases j <;>
150     simp [phasePairing, phaseBasis, standardForm, Matrix.J, Matrix.one_apply,
151       eq_comm]
152 
153 theorem mulVec_phaseBasis {n : ℕ}
154     (A : Matrix (PhaseVar n) (PhaseVar n) k) (j : PhaseVar n) :
155     Matrix.mulVec A (phaseBasis k j) = fun i => A i j := by
156   funext i
157   simp [Matrix.mulVec, dotProduct, phaseBasis]
158 
159 theorem symplecticTransvection_mem {n : ℕ} (a : k)
160     (u : PhaseVar n → k) :
161     symplecticTransvection k a u ∈ Matrix.symplecticGroup (Fin n) k := by
162   rw [SymplecticGroup.mem_iff']
163   ext i j
164   rw [transpose_standardForm_mul_apply]
165   change phasePairing k (fun l => symplecticTransvection k a u l i)
166       (fun l => symplecticTransvection k a u l j) = standardForm k n i j
167   rw [← phasePairing_basis k i j]
168   rw [← mulVec_phaseBasis k (symplecticTransvection k a u) i,
169     ← mulVec_phaseBasis k (symplecticTransvection k a u) j]
170   exact transvection_preserves_pairing k a u (phaseBasis k i) (phaseBasis k j)
171 
172 theorem phasePairing_sub_right {n : ℕ} (u v w : PhaseVar n → k) :
173     phasePairing k u (v - w) = phasePairing k u v - phasePairing k u w := by
174   simp [phasePairing, Finset.sum_sub_distrib]
175   simp_rw [mul_sub]
176   rw [Finset.sum_sub_distrib, Finset.sum_sub_distrib]
177   ring
178 
179 theorem exists_phasePairing_right_ne_zero {n : ℕ}
180     {u : PhaseVar n → k} (hu : u ≠ 0) :
181     ∃ z : PhaseVar n → k, phasePairing k u z ≠ 0 := by
182   have hex : ∃ i, u i ≠ 0 := by
183     by_contra h
184     push_neg at h
185     apply hu
186     funext i
187     exact h i
188   rcases hex with ⟨i, hi⟩
189   cases i with
190   | inl i =>
191       refine ⟨phaseBasis k (.inr i), ?_⟩
192       simpa [phasePairing, phaseBasis] using neg_ne_zero.mpr hi
193   | inr i =>
194       refine ⟨phaseBasis k (.inl i), ?_⟩
195       simpa [phasePairing, phaseBasis] using hi
196 
197 theorem exists_phasePairing_left_ne_zero {n : ℕ}
198     {u : PhaseVar n → k} (hu : u ≠ 0) :
199     ∃ z : PhaseVar n → k, phasePairing k z u ≠ 0 := by
200   rcases exists_phasePairing_right_ne_zero k hu with ⟨z, hz⟩
201   refine ⟨z, ?_⟩
202   rw [phasePairing_skew k z u]
203   exact neg_ne_zero.mpr hz
204 
205 theorem exists_phasePairing_bridge {n : ℕ}
206     {e v : PhaseVar n → k} (he : e ≠ 0) (hv : v ≠ 0) :
207     ∃ w : PhaseVar n → k,
208       phasePairing k e w ≠ 0 ∧ phasePairing k w v ≠ 0 := by
209   rcases exists_phasePairing_right_ne_zero k he with ⟨r, her⟩
210   rcases exists_phasePairing_left_ne_zero k hv with ⟨s, hsv⟩
211   by_cases hrv : phasePairing k r v ≠ 0
212   · exact ⟨r, her, hrv⟩
213   by_cases hes : phasePairing k e s ≠ 0
214   · exact ⟨s, hes, hsv⟩
215   refine ⟨r + s, ?_, ?_⟩
216   · rw [phasePairing_add_right]
217     simpa [not_not.mp hes] using her
218   · rw [phasePairing_add_left]
219     simpa [not_not.mp hrv] using hsv
220 
221 def transvectionSending {n : ℕ} (x y : PhaseVar n → k) :
222     Matrix (PhaseVar n) (PhaseVar n) k :=
223   symplecticTransvection k (phasePairing k x y)⁻¹ (y - x)
224 
225 theorem transvectionSending_mem {n : ℕ} (x y : PhaseVar n → k) :
226     transvectionSending k x y ∈ Matrix.symplecticGroup (Fin n) k :=
227   symplecticTransvection_mem k _ _
228 
229 theorem transvectionSending_mulVec {n : ℕ} (x y : PhaseVar n → k)
230     (hxy : phasePairing k x y ≠ 0) :
231     Matrix.mulVec (transvectionSending k x y) x = y := by
232   funext i
233   rw [transvectionSending, transvection_mulVec]
234   rw [phasePairing_sub_right, phasePairing_self, sub_zero]
235   rw [inv_mul_cancel₀ hxy]
236   simp
237 
238 theorem exists_symplectic_mulVec_eq {n : ℕ}
239     {e v : PhaseVar n → k} (he : e ≠ 0) (hv : v ≠ 0) :
240     ∃ M : Matrix (PhaseVar n) (PhaseVar n) k,
241       M ∈ Matrix.symplecticGroup (Fin n) k ∧ Matrix.mulVec M e = v := by
242   by_cases hn : n = 0
243   · subst n
244     letI : IsEmpty (PhaseVar 0) := inferInstance
245     have he0 : e = 0 := by funext i; exact isEmptyElim i
246     exact (he he0).elim
247   · let m := n - 1
248     have hn' : n = m + 1 := by dsimp [m]; omega
249     let B : LinearMap.BilinForm k (PhaseVar n → k) :=
250       { toFun := fun x =>
251           { toFun := fun y => phasePairing k x y
252             map_add' := phasePairing_add_right k x
253             map_smul' := by
254               intro c y
255               simpa [smul_eq_mul] using phasePairing_smul_right k c x y }
256         map_add' := by
257           intro x y
258           apply LinearMap.ext
259           intro z
260           exact phasePairing_add_left k x y z
261         map_smul' := by
262           intro c x
263           apply LinearMap.ext
264           intro z
265           simpa [smul_eq_mul] using phasePairing_smul_left k c x z }
266     have hAlt : ∀ x, B x x = 0 := by
267       intro x
268       exact phasePairing_self k x
269     have hB : B.Nondegenerate := by
270       constructor
271       · intro x hx
272         by_contra hxne
273         obtain ⟨z, hz⟩ := exists_phasePairing_right_ne_zero k hxne
274         exact hz (hx z)
275       · intro y hy
276         by_contra hyne
277         obtain ⟨z, hz⟩ := exists_phasePairing_left_ne_zero k hyne
278         exact hz (hy z)
279     have hdim : Module.finrank k (PhaseVar n → k) = 2 * (m + 1) := by
280       rw [Module.finrank_eq_card_basis (Pi.basisFun k (PhaseVar n))]
281       simp [hn']
282       ring
283     obtain ⟨g, hg, hge⟩ :=
284       Stafford38.CharacteristicPaperSymplecticBasis.exists_symplectic_equiv_sending_nonzero
285         m B hAlt hB hdim e v he hv
286     let f : (PhaseVar n → k) →ₗ[k] PhaseVar n → k := g.toLinearMap
287     let M : Matrix (PhaseVar n) (PhaseVar n) k := LinearMap.toMatrix' f
288     have hcomp : B.comp f f = B := by
289       apply (LinearMap.BilinForm.ext_iff_basis (Pi.basisFun k (PhaseVar n))).2
290       intro i j
291       exact hg _ _
292     have hBmatrix : LinearMap.BilinForm.toMatrix' B = standardForm k n := by
293       ext i j
294       rw [LinearMap.BilinForm.toMatrix'_apply]
295       change phasePairing k (Pi.single i 1) (Pi.single j 1) = _
296       have hsingle (i : PhaseVar n) : Pi.single i (1 : k) = phaseBasis k i := by
297         funext l
298         simp [Pi.single_apply, phaseBasis]
299       rw [hsingle, hsingle, phasePairing_basis]
300     have hmatrix := LinearMap.BilinForm.toMatrix'_comp B f f
301     have hM : Matrix.transpose M * standardForm k n * M = standardForm k n := by
302       calc
303         Matrix.transpose M * standardForm k n * M = LinearMap.BilinForm.toMatrix' (B.comp f f) := by
304           simpa [M, hBmatrix] using hmatrix.symm
305         _ = standardForm k n := by rw [hcomp, hBmatrix]
306     refine ⟨M, SymplecticGroup.mem_iff'.2 hM, ?_⟩
307     calc
308       Matrix.mulVec M e = f e := by simpa [M] using LinearMap.toMatrix'_mulVec f e
309       _ = v := hge
310 
311 theorem exists_symplectic_column_eq {n : ℕ} (t : PhaseVar n)
312     {v : PhaseVar n → k} (hv : v ≠ 0) :
313     ∃ M : Matrix (PhaseVar n) (PhaseVar n) k,
314       M ∈ Matrix.symplecticGroup (Fin n) k ∧ (fun i => M i t) = v := by
315   have hb : phaseBasis k t ≠ 0 := by
316     intro h
317     have := congrFun h t
318     simp [phaseBasis] at this
319   rcases exists_symplectic_mulVec_eq k hb hv with ⟨M, hM, hMv⟩
320   refine ⟨M, hM, ?_⟩
321   rw [← mulVec_phaseBasis]
322   exact hMv
323 
324 theorem exists_symplectic_pureCoefficient_ne_zero [CharZero k]
325     {n N : ℕ} (t : PhaseVar n) {P : SymbolRing k n}
326     (hP : P.IsHomogeneous N) (hne : P ≠ 0) (hN : 0 < N) :
327     ∃ M : Matrix (PhaseVar n) (PhaseVar n) k,
328       M ∈ Matrix.symplecticGroup (Fin n) k ∧
329       MvPolynomial.coeff (Finsupp.single () N)
330           (axisPolynomial k t
331             (Stafford38.CharacteristicLinearAction.symbolLinearAlgHom k M P)) ≠ 0 := by
332   rcases exists_eval_ne_zero_of_homogeneous k hP hne with ⟨v, hv⟩
333   have hvne : v ≠ 0 := by
334     intro hvzero
335     subst v
336     apply hv
337     have hc : MvPolynomial.coeff 0 P = 0 :=
338       hP.coeff_eq_zero (by simpa using Nat.ne_of_lt hN)
339     simpa [hc]
340   rcases exists_symplectic_column_eq k t hvne with ⟨M, hM, hcol⟩
341   refine ⟨M, hM, ?_⟩
342   rw [pureCoefficient_symbolLinearAlgHom k M t hP]
343   rw [hcol]
344   exact hv
345 
346 theorem exists_symplectic_chart_matrices [CharZero k]
347     {n N : ℕ} (t : PhaseVar n) {P : SymbolRing k n}
348     (hP : P.IsHomogeneous N) (hne : P ≠ 0) (hN : 0 < N) :
349     ∃ M Ninv : Matrix (PhaseVar n) (PhaseVar n) k,
350       M * standardForm k n * Matrix.transpose M = standardForm k n ∧
351       Ninv * standardForm k n * Matrix.transpose Ninv = standardForm k n ∧
352       M * Ninv = 1 ∧ Ninv * M = 1 ∧
353       MvPolynomial.coeff (Finsupp.single () N)
354           (axisPolynomial k t
355             (Stafford38.CharacteristicLinearAction.symbolLinearAlgHom k M P)) ≠ 0 := by
356   rcases exists_symplectic_pureCoefficient_ne_zero k t hP hne hN with
357     ⟨M, hM, hcoeff⟩
358   let A : Matrix.symplecticGroup (Fin n) k := ⟨M, hM⟩
359   let Ninv : Matrix (PhaseVar n) (PhaseVar n) k := ↑(A⁻¹)
360   refine ⟨M, Ninv, SymplecticGroup.mem_iff.mp hM,
361     SymplecticGroup.mem_iff.mp (A⁻¹).property, ?_, ?_, hcoeff⟩
362   · dsimp only [Ninv]
363     calc
364       M * (↑(A⁻¹) : Matrix (PhaseVar n) (PhaseVar n) k) = ↑(A * A⁻¹) := rfl
365       _ = ↑(1 : Matrix.symplecticGroup (Fin n) k) := by simp
366       _ = 1 := rfl
367   · dsimp only [Ninv]
368     calc
369       (↑(A⁻¹) : Matrix (PhaseVar n) (PhaseVar n) k) * M = ↑(A⁻¹ * A) := rfl
370       _ = ↑(1 : Matrix.symplecticGroup (Fin n) k) := by simp
371       _ = 1 := rfl
372 
373 /- Exact statement pins for symplectic column completion and the monic-symbol
374 precursor. -/
375 theorem symplectic_column_statement {n : ℕ} (t : PhaseVar n)
376     {v : PhaseVar n → k} (hv : v ≠ 0) :
377     ∃ M : Matrix (PhaseVar n) (PhaseVar n) k,
378       M ∈ Matrix.symplecticGroup (Fin n) k ∧ (fun i => M i t) = v :=
379   exists_symplectic_column_eq k t hv
380 
381 theorem symplectic_pureCoefficient_statement [CharZero k]
382     {n N : ℕ} (t : PhaseVar n) {P : SymbolRing k n}
383     (hP : P.IsHomogeneous N) (hne : P ≠ 0) (hN : 0 < N) :
384     ∃ M : Matrix (PhaseVar n) (PhaseVar n) k,
385       M ∈ Matrix.symplecticGroup (Fin n) k ∧
386       MvPolynomial.coeff (Finsupp.single () N)
387           (axisPolynomial k t
388             (Stafford38.CharacteristicLinearAction.symbolLinearAlgHom k M P)) ≠ 0 :=
389   exists_symplectic_pureCoefficient_ne_zero k t hP hne hN
390 
391 theorem symplectic_chart_matrices_statement [CharZero k]
392     {n N : ℕ} (t : PhaseVar n) {P : SymbolRing k n}
393     (hP : P.IsHomogeneous N) (hne : P ≠ 0) (hN : 0 < N) :
394     ∃ M Ninv : Matrix (PhaseVar n) (PhaseVar n) k,
395       M * standardForm k n * Matrix.transpose M = standardForm k n ∧
396       Ninv * standardForm k n * Matrix.transpose Ninv = standardForm k n ∧
397       M * Ninv = 1 ∧ Ninv * M = 1 ∧
398       MvPolynomial.coeff (Finsupp.single () N)
399           (axisPolynomial k t
400             (Stafford38.CharacteristicLinearAction.symbolLinearAlgHom k M P)) ≠ 0 :=
401   exists_symplectic_chart_matrices k t hP hne hN
402 
403 #print axioms phasePairing
404 #print axioms phaseBasis
405 #print axioms symplecticTransvection
406 #print axioms phasePairing_basis_left
407 #print axioms transvection_mulVec
408 #print axioms phasePairing_add_left
409 #print axioms phasePairing_add_right
410 #print axioms phasePairing_smul_left
411 #print axioms phasePairing_smul_right
412 #print axioms phasePairing_skew
413 #print axioms phasePairing_self
414 #print axioms transvection_preserves_pairing
415 #print axioms transpose_standardForm_mul_apply
416 #print axioms phasePairing_basis
417 #print axioms mulVec_phaseBasis
418 #print axioms symplecticTransvection_mem
419 #print axioms phasePairing_sub_right
420 #print axioms exists_phasePairing_right_ne_zero
421 #print axioms exists_phasePairing_left_ne_zero
422 #print axioms exists_phasePairing_bridge
423 #print axioms transvectionSending
424 #print axioms transvectionSending_mem
425 #print axioms transvectionSending_mulVec
426 #print axioms exists_symplectic_mulVec_eq
427 #print axioms exists_symplectic_column_eq
428 #print axioms exists_symplectic_pureCoefficient_ne_zero
429 #print axioms exists_symplectic_chart_matrices
430 #print axioms symplectic_column_statement
431 #print axioms symplectic_pureCoefficient_statement
432 #print axioms symplectic_chart_matrices_statement
433 
434 end
435 end Stafford38.CharacteristicSymplecticCompletion
436