Stafford38/Geometry/ResidueMinorSelection.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Stafford38.Geometry.SplitTangentMatrix
3 public import Mathlib.LinearAlgebra.Matrix.Rank
4 public import Mathlib.LinearAlgebra.Basis.VectorSpace
5 
6 @[expose] public section
7 
8 /-!
9 # Selecting a nonsingular residue minor
10 
11 A rectangular matrix over a field with full column rank has a square row minor
12 with nonzero determinant.  The selected rows are returned as an embedding of
13 the column index type into the row index type, matching the input expected by
14 `GeometrySplitTangentMatrix`.
15 -/
16 
17 namespace Stafford38.GeometryResidueMinorSelection
18 
19 noncomputable section
20 
21 open Stafford38.GeometrySplitTangentMatrix
22 
23 universe u v w
24 
25 variable {k : Type u} [Field k]
26 
27 /-- Full column rank produces an explicitly indexed square row minor with
28 nonzero determinant. -/
29 theorem exists_selectedMinor_det_ne_zero_of_rank_eq_card
30     {ι : Type v} {κ : Type w} [Fintype ι] [Fintype κ]
31     [DecidableEq ι] [DecidableEq κ]
32     (B : Matrix ι κ k) (hrank : B.rank = Fintype.card κ) :
33     ∃ rows : κ ↪ ι, (selectedMinor B rows).det ≠ 0 := by
34   let S : Submodule k (κ → k) := Submodule.span k (Set.range B.row)
35   have hfinrank : Module.finrank k S = Module.finrank k (κ → k) := by
36     rw [← Matrix.rank_eq_finrank_span_row B, hrank, Module.finrank_pi]
37   have hS : S = ⊤ := Submodule.eq_top_of_finrank_eq hfinrank
38   let b := Module.Basis.ofSpan (K := k) (s := Set.range B.row) (hS.ge)
39   letI : Fintype ((linearIndepOn_empty k id).extend
40       (Set.empty_subset (Set.range B.row))) := Fintype.ofFinite _
41   let e : κ ≃ ((linearIndepOn_empty k id).extend
42       (Set.empty_subset (Set.range B.row))) :=
43     Fintype.equivOfCardEq (by
44       rw [← Module.finrank_eq_card_basis b, Module.finrank_pi])
45   have hb_range (a : κ) : b (e a) ∈ Set.range B :=
46     Module.Basis.ofSpan_subset (K := k) (V := κ → k) (hS.ge) ⟨e a, rfl⟩
47   let row (a : κ) : ι := Classical.choose (hb_range a)
48   have hrow (a : κ) : B (row a) = b (e a) := Classical.choose_spec (hb_range a)
49   have hrow_injective : Function.Injective row := by
50     intro a₁ a₂ h
51     apply e.injective
52     apply b.injective
53     rw [← hrow a₁, ← hrow a₂, h]
54   let rows : κ ↪ ι := ⟨row, hrow_injective⟩
55   have hli : LinearIndependent k (fun a : κ => selectedMinor B rows a) := by
56     have he : LinearIndependent k (fun a : κ => b (e a)) :=
57       b.linearIndependent.comp _ e.injective
58     have hfamily : (fun a : κ => selectedMinor B rows a) = fun a => b (e a) := by
59       funext a
60       exact hrow a
61     rw [hfamily]
62     exact he
63   have hunit : IsUnit (selectedMinor B rows) :=
64     Matrix.linearIndependent_rows_iff_isUnit.mp hli
65   exact ⟨rows, ((Matrix.isUnit_iff_isUnit_det _).mp hunit).ne_zero⟩
66 
67 /-- Injectivity of the residue matrix on column vectors is the usual
68 hypothesis implying the existence of a nonsingular selected row minor. -/
69 theorem exists_selectedMinor_det_ne_zero_of_mulVec_injective
70     {ι : Type v} {κ : Type w} [Fintype ι] [Fintype κ]
71     [DecidableEq ι] [DecidableEq κ]
72     (B : Matrix ι κ k) (hinj : Function.Injective B.mulVec) :
73     ∃ rows : κ ↪ ι, (selectedMinor B rows).det ≠ 0 := by
74   apply exists_selectedMinor_det_ne_zero_of_rank_eq_card B
75   have hker : LinearMap.ker B.mulVecLin = ⊥ := LinearMap.ker_eq_bot.mpr hinj
76   have hker_finrank : Module.finrank k (LinearMap.ker B.mulVecLin) = 0 := by
77     rw [hker]
78     exact finrank_bot k (κ → k)
79   have hrn := LinearMap.finrank_range_add_finrank_ker B.mulVecLin
80   rw [hker_finrank, add_zero, Module.finrank_pi] at hrn
81   simpa only [Matrix.rank] using hrn
82 
83 /-! ## Power-series residue matrices -/
84 
85 /-- Entrywise constant coefficient of a power-series matrix. -/
86 def residueMatrix
87     {ι : Type v} {κ : Type w} (B : Matrix ι κ (PowerSeries k)) : Matrix ι κ k :=
88   fun i j => PowerSeries.constantCoeff (B i j)
89 
90 theorem constantCoeff_selectedMinor_det
91     {ι : Type v} {κ : Type w} [Fintype κ] [DecidableEq κ]
92     (B : Matrix ι κ (PowerSeries k)) (rows : κ ↪ ι) :
93     PowerSeries.constantCoeff (selectedMinor B rows).det =
94       (selectedMinor (residueMatrix B) rows).det := by
95   rw [RingHom.map_det]
96   congr 1
97 
98 /-- Injectivity after reduction to constant coefficients selects a minor whose
99 power-series determinant is a unit. -/
100 theorem powerSeries_exists_selectedMinor_constantCoeff_ne_zero_of_residue_mulVec_injective
101     {ι : Type v} {κ : Type w} [Fintype ι] [Fintype κ]
102     [DecidableEq ι] [DecidableEq κ]
103     (B : Matrix ι κ (PowerSeries k))
104     (hinj : Function.Injective (residueMatrix B).mulVec) :
105     ∃ rows : κ ↪ ι,
106       PowerSeries.constantCoeff (selectedMinor B rows).det ≠ 0 := by
107   obtain ⟨rows, hrows⟩ :=
108     exists_selectedMinor_det_ne_zero_of_mulVec_injective (residueMatrix B) hinj
109   exact ⟨rows, by rwa [constantCoeff_selectedMinor_det]⟩
110 
111 /-- The residue-rank criterion composed with the selected-minor construction:
112 the power-series matrix has an explicit left inverse. -/
113 theorem powerSeries_exists_leftInverse_of_residue_mulVec_injective
114     {ι : Type v} {κ : Type w} [Fintype ι] [Fintype κ]
115     [DecidableEq ι] [DecidableEq κ]
116     (B : Matrix ι κ (PowerSeries k))
117     (hinj : Function.Injective (residueMatrix B).mulVec) :
118     ∃ C : Matrix κ ι (PowerSeries k), C * B = 1 := by
119   obtain ⟨rows, hrows⟩ :=
120     powerSeries_exists_selectedMinor_constantCoeff_ne_zero_of_residue_mulVec_injective B hinj
121   exact powerSeries_exists_leftInverse_of_selectedMinor_constantCoeff_ne_zero B rows hrows
122 
123 #print axioms exists_selectedMinor_det_ne_zero_of_rank_eq_card
124 #print axioms exists_selectedMinor_det_ne_zero_of_mulVec_injective
125 #print axioms constantCoeff_selectedMinor_det
126 #print axioms powerSeries_exists_selectedMinor_constantCoeff_ne_zero_of_residue_mulVec_injective
127 #print axioms powerSeries_exists_leftInverse_of_residue_mulVec_injective
128 
129 end
130 
131 end Stafford38.GeometryResidueMinorSelection
132