Stafford38/Characteristic/SquareZeroLinearTrace.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.LinearAlgebra.Trace
3 public import Mathlib.LinearAlgebra.Projection
4 
5 @[expose] public section
6 
7 /-!
8 # The square-zero linear trace calculation
9 
10 This file isolates the finite-dimensional block calculation used in the local
11 trace argument.  Composition is written in Lean's order:
12 `F.comp G` sends `v` to `F (G v)`.  Thus the commutator hypothesis below is
13 
14 `A.comp B - B.comp A = C.comp Z`.
15 
16 If `ker C = range C`, then `C` identifies `V / range C` with `range C`.
17 Choosing a linear section of the quotient map gives the usual two-by-two
18 block decomposition.  The off-diagonal block of the displayed commutator is
19 a sum of two rectangular commutators, so its trace is zero.
20 -/
21 
22 noncomputable section
23 
24 namespace Stafford38.Characteristic.SquareZeroLinearTrace
25 
26 open Function
27 
28 variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V]
29 
30 /-- An endomorphism commuting with `C` preserves `range C`. -/
31 lemma mapsTo_range_of_comp_comm (C F : V →ₗ[k] V)
32     (hF : F.comp C = C.comp F) : Set.MapsTo F (LinearMap.range C) (LinearMap.range C) := by
33   rintro _ ⟨v, rfl⟩
34   refine ⟨F v, ?_⟩
35   exact LinearMap.congr_fun hF.symm v
36 
37 /-- The endomorphism induced by `F` on `V / range C`. -/
38 def quotientEnd (C F : V →ₗ[k] V) (hF : F.comp C = C.comp F) :
39     (V ⧸ LinearMap.range C) →ₗ[k] (V ⧸ LinearMap.range C) :=
40   (LinearMap.range C).mapQ (LinearMap.range C) F
41     (mapsTo_range_of_comp_comm C F hF)
42 
43 /-- The restriction of a commuting endomorphism to `range C`. -/
44 def rangeEnd (C F : V →ₗ[k] V) (hF : F.comp C = C.comp F) :
45     LinearMap.range C →ₗ[k] LinearMap.range C :=
46   F.restrict (mapsTo_range_of_comp_comm C F hF)
47 
48 /-- Exactness makes the map induced by `C` from the quotient to its range an equivalence. -/
49 def quotientToRangeEquiv (C : V →ₗ[k] V) (hExact : LinearMap.ker C = LinearMap.range C) :
50     (V ⧸ LinearMap.range C) ≃ₗ[k] LinearMap.range C := by
51   let cbar : (V ⧸ LinearMap.range C) →ₗ[k] LinearMap.range C :=
52     (LinearMap.range C).liftQ C.rangeRestrict (by
53       intro x hx
54       rw [LinearMap.mem_ker]
55       apply Subtype.ext
56       exact LinearMap.mem_ker.mp (hExact ▸ hx))
57   refine LinearEquiv.ofBijective cbar ⟨?_, ?_⟩
58   · intro q₁ q₂ hq
59     obtain ⟨x, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range C) q₁
60     obtain ⟨y, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range C) q₂
61     apply (Submodule.Quotient.eq (LinearMap.range C)).mpr
62     rw [← hExact, LinearMap.mem_ker]
63     rw [map_sub, sub_eq_zero]
64     simpa [cbar] using Subtype.ext_iff.mp hq
65   · intro y
66     obtain ⟨x, hx⟩ := y.property
67     refine ⟨Submodule.Quotient.mk x, ?_⟩
68     exact Subtype.ext hx
69 
70 @[simp]
71 lemma quotientToRangeEquiv_apply_mk (C : V →ₗ[k] V)
72     (hExact : LinearMap.ker C = LinearMap.range C) (v : V) :
73     quotientToRangeEquiv C hExact (Submodule.Quotient.mk v) = C.rangeRestrict v := rfl
74 
75 private lemma trace_commutator_sum_eq_zero
76     {W : Type*} [AddCommGroup W] [Module k W] [FiniteDimensional k W]
77     (P Q X Y : W →ₗ[k] W) :
78     LinearMap.trace k W
79       (P.comp Y - Y.comp P + (X.comp Q - Q.comp X)) = 0 := by
80   simp only [map_add, map_sub]
81   rw [LinearMap.trace_comp_comm' P Y, LinearMap.trace_comp_comm' X Q]
82   abel
83 
84 /-- The upper-right block of a commuting endomorphism relative to a section of
85 the quotient by `range C`. -/
86 def offDiagonal (C F : V →ₗ[k] V) (hF : F.comp C = C.comp F)
87     (s : (V ⧸ LinearMap.range C) →ₗ[k] V)
88     (hs : (LinearMap.range C).mkQ.comp s = LinearMap.id) :
89     (V ⧸ LinearMap.range C) →ₗ[k] LinearMap.range C :=
90   (F.comp s - s.comp (quotientEnd C F hF)).codRestrict (LinearMap.range C) (by
91     intro x
92     have hz :
93         (LinearMap.range C).mkQ
94           ((F.comp s - s.comp (quotientEnd C F hF)) x) = 0 := by
95       change (LinearMap.range C).mkQ
96         (F (s x) - s (quotientEnd C F hF x)) = 0
97       rw [map_sub]
98       have hsx : (LinearMap.range C).mkQ (s x) = x := by
99         exact LinearMap.congr_fun hs x
100       have hsFx :
101           (LinearMap.range C).mkQ (s (quotientEnd C F hF x)) = quotientEnd C F hF x := by
102         exact LinearMap.congr_fun hs (quotientEnd C F hF x)
103       have hFq :
104           (LinearMap.range C).mkQ (F (s x)) = quotientEnd C F hF x := by
105         calc
106           (LinearMap.range C).mkQ (F (s x)) =
107               quotientEnd C F hF ((LinearMap.range C).mkQ (s x)) := rfl
108           _ = quotientEnd C F hF x := congrArg (quotientEnd C F hF) hsx
109       rw [hFq, hsFx, sub_self]
110     have hxker :
111         (F.comp s - s.comp (quotientEnd C F hF)) x ∈
112           LinearMap.ker (LinearMap.range C).mkQ := LinearMap.mem_ker.mpr hz
113     simpa only [Submodule.ker_mkQ] using hxker)
114 
115 /-- The exact square-zero trace lemma.  Exactness itself implies `C² = 0`,
116 so neither a separate square-zero hypothesis nor a characteristic assumption
117 is needed for this linear calculation. -/
118 theorem quotientEnd_trace_eq_zero
119     [FiniteDimensional k V]
120     (C A B Z : V →ₗ[k] V)
121     (hExact : LinearMap.ker C = LinearMap.range C)
122     (hAC : A.comp C = C.comp A)
123     (hBC : B.comp C = C.comp B)
124     (hZC : Z.comp C = C.comp Z)
125     (hcomm : A.comp B - B.comp A = C.comp Z) :
126     LinearMap.trace k (V ⧸ LinearMap.range C) (quotientEnd C Z hZC) = 0 := by
127   let q : V →ₗ[k] (V ⧸ LinearMap.range C) := (LinearMap.range C).mkQ
128   obtain ⟨s, hs⟩ := q.exists_rightInverse_of_surjective
129     (LinearMap.range_eq_top.mpr (Submodule.mkQ_surjective (LinearMap.range C)))
130   let e := quotientToRangeEquiv C hExact
131   let Aq := quotientEnd C A hAC
132   let Bq := quotientEnd C B hBC
133   let Zq := quotientEnd C Z hZC
134   let Ak := rangeEnd C A hAC
135   let Bk := rangeEnd C B hBC
136   let Au := offDiagonal C A hAC s hs
137   let Bu := offDiagonal C B hBC s hs
138 
139   have hs_apply (x : V ⧸ LinearMap.range C) : q (s x) = x := by
140     exact LinearMap.congr_fun hs x
141 
142   have hquot_comm : Aq.comp Bq = Bq.comp Aq := by
143     apply LinearMap.ext
144     intro x
145     obtain ⟨v, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range C) x
146     apply (Submodule.Quotient.eq (LinearMap.range C)).mpr
147     change A (B v) - B (A v) ∈ LinearMap.range C
148     refine ⟨Z v, ?_⟩
149     exact (LinearMap.congr_fun hcomm v).symm
150 
151   have heA : e.toLinearMap.comp Aq = Ak.comp e.toLinearMap := by
152     apply LinearMap.ext
153     intro x
154     obtain ⟨v, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range C) x
155     apply Subtype.ext
156     exact LinearMap.congr_fun hAC.symm v
157 
158   have heB : e.toLinearMap.comp Bq = Bk.comp e.toLinearMap := by
159     apply LinearMap.ext
160     intro x
161     obtain ⟨v, rfl⟩ := Submodule.mkQ_surjective (LinearMap.range C) x
162     apply Subtype.ext
163     exact LinearMap.congr_fun hBC.symm v
164 
165   have hblock :
166       e.toLinearMap.comp Zq =
167         Ak.comp Bu + Au.comp Bq - Bk.comp Au - Bu.comp Aq := by
168     apply LinearMap.ext
169     intro x
170     apply Subtype.ext
171     have hABx : Aq (Bq x) = Bq (Aq x) := LinearMap.congr_fun hquot_comm x
172     have hleft : e (Zq x) = C.rangeRestrict (Z (s x)) := by
173       calc
174         e (Zq x) = e (Zq (q (s x))) := by rw [hs_apply x]
175         _ = C.rangeRestrict (Z (s x)) := rfl
176     change (e (Zq x) : V) = _
177     rw [hleft]
178     dsimp [Ak, Bk, Au, Bu, rangeEnd, offDiagonal]
179     change C (Z (s x)) =
180       A (B (s x) - s (Bq x)) +
181           (A (s (Bq x)) - s (Aq (Bq x))) -
182         B (A (s x) - s (Aq x)) -
183       (B (s (Aq x)) - s (Bq (Aq x)))
184     have hh := LinearMap.congr_fun hcomm (s x)
185     simp only [LinearMap.sub_apply, LinearMap.comp_apply] at hh
186     rw [← hh]
187     simp only [LinearMap.sub_apply, LinearMap.comp_apply, map_sub]
188     rw [hABx]
189     abel
190 
191   let X : (V ⧸ LinearMap.range C) →ₗ[k] (V ⧸ LinearMap.range C) :=
192     e.symm.toLinearMap.comp Au
193   let Y : (V ⧸ LinearMap.range C) →ₗ[k] (V ⧸ LinearMap.range C) :=
194     e.symm.toLinearMap.comp Bu
195 
196   have hZblock : Zq = Aq.comp Y - Y.comp Aq + (X.comp Bq - Bq.comp X) := by
197     apply LinearMap.ext
198     intro x
199     apply e.injective
200     have hb := LinearMap.congr_fun hblock x
201     simp only [LinearMap.comp_apply, LinearMap.add_apply, LinearMap.sub_apply] at hb ⊢
202     have hY (u : V ⧸ LinearMap.range C) : e (Y u) = Bu u := by
203       exact e.apply_symm_apply (Bu u)
204     have hX (u : V ⧸ LinearMap.range C) : e (X u) = Au u := by
205       exact e.apply_symm_apply (Au u)
206     have hAY : e (Aq (Y x)) = Ak (Bu x) := by
207       calc
208         e (Aq (Y x)) = Ak (e (Y x)) := LinearMap.congr_fun heA (Y x)
209         _ = Ak (Bu x) := congrArg Ak (hY x)
210     have hBX : e (Bq (X x)) = Bk (Au x) := by
211       calc
212         e (Bq (X x)) = Bk (e (X x)) := LinearMap.congr_fun heB (X x)
213         _ = Bk (Au x) := congrArg Bk (hX x)
214     rw [map_add, map_sub, map_sub, hAY, hY, hX, hBX]
215     exact hb.trans (by abel)
216 
217   change LinearMap.trace k (V ⧸ LinearMap.range C) Zq = 0
218   rw [hZblock]
219   exact trace_commutator_sum_eq_zero Aq Bq X Y
220 
221 #print axioms quotientEnd_trace_eq_zero
222 
223 end Stafford38.Characteristic.SquareZeroLinearTrace
224