Stafford38/LinearAlgebra/SymplecticComplement.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.LinearAlgebra.BilinearForm.Orthogonal
3 
4 @[expose] public section
5 
6 /-!
7 # Nondegenerate symplectic planes and their orthogonal complements
8 
9 An alternating nondegenerate bilinear form splits off any normalized pair
10 `v,w` with `B v w = 1`.  The statement is phrased with Mathlib's right
11 orthogonal complement convention `B u x = 0` for all `u` in the subspace.
12 -/
13 
14 open LinearMap (BilinForm)
15 open Module
16 
17 namespace Stafford38.LinearAlgebra.SymplecticComplement
18 
19 universe u v
20 
21 variable {k : Type u} {V : Type v} [Field k] [AddCommGroup V] [Module k V]
22 
23 /-- The two-dimensional candidate symplectic plane spanned by `v` and `w`. -/
24 def pairPlane (v w : V) : Submodule k V := Submodule.span k {v, w}
25 
26 theorem pairComplementData [Module.Finite k V]
27     (B : BilinForm k V) (hAlt : ∀ x, B x x = 0) (hB : B.Nondegenerate)
28     (v w : V) (hvw : B v w = 1) :
29     let U : Submodule k V := Submodule.span k {v, w}
30     (B.restrict U).Nondegenerate ∧
31       IsCompl U (B.orthogonal U) ∧
32       (B.restrict (B.orthogonal U)).Nondegenerate ∧
33       Module.finrank k (B.orthogonal U) + 2 = Module.finrank k V := by
34   let U : Submodule k V := pairPlane v w
35   have hAlt' : B.IsAlt := hAlt
36   have hRefl : B.IsRefl := hAlt'.isRefl
37   have hwv : B w v = -1 := by
38     simpa [hvw] using (hAlt'.neg_eq v w).symm
39   have hvU : v ∈ U := Submodule.subset_span (by simp)
40   have hwU : w ∈ U := Submodule.subset_span (by simp)
41   have hdisj : Disjoint U (B.orthogonal U) := by
42     rw [Submodule.disjoint_def]
43     intro x hxU hxO
44     obtain ⟨a, b, hab⟩ := (Submodule.mem_span_pair).1 (by simpa [U, pairPlane] using hxU)
45     have hvx : B v x = 0 := hxO v hvU
46     have hwx : B w x = 0 := hxO w hwU
47     rw [← hab, BilinForm.add_right, BilinForm.smul_right, BilinForm.smul_right,
48       hAlt v, hvw] at hvx
49     rw [← hab, BilinForm.add_right, BilinForm.smul_right, BilinForm.smul_right,
50       hwv, hAlt w] at hwx
51     have hb : b = 0 := by simpa using hvx
52     have ha : a = 0 := by simpa [mul_comm] using hwx
53     rw [← hab, ha, hb]
54     simp
55   have hU_nd : (B.restrict U).Nondegenerate :=
56     BilinForm.nondegenerate_restrict_of_disjoint_orthogonal B hRefl hdisj
57   have hcompl : IsCompl U (B.orthogonal U) :=
58     BilinForm.isCompl_orthogonal_of_restrict_nondegenerate hRefl hU_nd
59   have hdouble : B.orthogonal (B.orthogonal U) = U :=
60     BilinForm.orthogonal_orthogonal hB hRefl U
61   have hdisj' : Disjoint (B.orthogonal U) (B.orthogonal (B.orthogonal U)) := by
62     rw [hdouble]
63     exact hcompl.disjoint.symm
64   have horth_nd : (B.restrict (B.orthogonal U)).Nondegenerate :=
65     BilinForm.nondegenerate_restrict_of_disjoint_orthogonal B hRefl hdisj'
66   have hli : LinearIndependent k ![v, w] := by
67     rw [LinearIndependent.pair_iff]
68     intro a b hab
69     have hvsum : B (a • v + b • w) w = 0 := by rw [hab, BilinForm.zero_left]
70     have hwsum : B (a • v + b • w) v = 0 := by rw [hab, BilinForm.zero_left]
71     rw [BilinForm.add_left, BilinForm.smul_left, BilinForm.smul_left,
72       hvw, hAlt w] at hvsum
73     rw [BilinForm.add_left, BilinForm.smul_left, BilinForm.smul_left,
74       hAlt v, hwv] at hwsum
75     constructor
76     · simpa using hvsum
77     · simpa [mul_comm] using hwsum
78   have hU_finrank : finrank k U = 2 := by
79     have hUeq : U = Submodule.span k (Set.range ![v, w]) := by
80       rw [show Set.range ![v, w] = ({v, w} : Set V) by
81         ext x
82         simp [or_comm]]
83       rfl
84     rw [hUeq]
85     simpa using (finrank_span_eq_card hli)
86   have hdim : finrank k (B.orthogonal U) = finrank k V - 2 := by
87     rw [BilinForm.finrank_orthogonal hB U, hU_finrank]
88   refine ⟨hU_nd, hcompl, horth_nd, ?_⟩
89   change finrank k (B.orthogonal U) + 2 = finrank k V
90   rw [hdim]
91   have hle : 2 ≤ finrank k V := by
92     rw [← hU_finrank]
93     exact Submodule.finrank_le _
94   omega
95 
96 end Stafford38.LinearAlgebra.SymplecticComplement
97