File size: 13,230 Bytes
760f90e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
import OAI.Computability.RationalHitting.SmallExpansion

namespace OAI

namespace RationalHitting.Rectangular
open Module Matrix
open scoped BigOperators Kronecker
noncomputable section
variable {F : Type*} [Field F]

/-- The ordinary Kronecker evaluation, with the two vector indices curried in
reverse order. This is only a coordinate convention. -/
def blockEval {w q e : ℕ} (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F) :
    (Fin e → Fin q → F) →ₗ[F] (Fin e → Fin q → F) where
  toFun v β := ∑ i, ∑ δ, X i β δ • (A i).mulVec (v δ)
  map_add' v u := by
    funext β
    simp only [Pi.add_apply, Matrix.mulVec_add, smul_add, Finset.sum_add_distrib]
  map_smul' c v := by
    funext β
    simp only [Pi.smul_apply, RingHom.id_apply, Matrix.mulVec_smul,
      Finset.smul_sum, smul_smul]
    apply Finset.sum_congr rfl
    intro i _
    apply Finset.sum_congr rfl
    intro δ _
    rw [mul_comm]

lemma no_shrunk_subspace {w q e : ℕ} (he : 0 < e)
    (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F)
    (hX : Function.Injective (blockEval A X))
    (V W : Submodule F (Fin q → F))
    (hVW : ∀ i, V.map (A i).mulVecLin ≤ W) : finrank F V ≤ finrank F W := by
  let g : (Fin e → V) →ₗ[F] (Fin e → W) :=
    { toFun := fun v β => ⟨∑ i, ∑ δ, X i β δ • (A i).mulVec (v δ), by
        apply W.sum_mem
        intro i _
        apply W.sum_mem
        intro δ _
        exact W.smul_mem _ (hVW i ⟨v δ, (v δ).property, rfl⟩)⟩
      map_add' := by
        intro v u
        funext β
        apply Subtype.ext
        simp only [Submodule.coe_add, Pi.add_apply, Matrix.mulVec_add,
          smul_add, Finset.sum_add_distrib]
      map_smul' := by
        intro c v
        funext β
        apply Subtype.ext
        simp only [Submodule.coe_smul, Pi.smul_apply, RingHom.id_apply,
          Matrix.mulVec_smul, Finset.smul_sum, smul_smul]
        apply Finset.sum_congr rfl
        intro i _
        apply Finset.sum_congr rfl
        intro δ _
        rw [mul_comm] }
  have hg : Function.Injective g := by
    intro v u h
    have hh : blockEval A X (fun δ => (v δ : Fin q → F)) =
        blockEval A X (fun δ => (u δ : Fin q → F)) := by
      funext β
      exact congrArg Subtype.val (congrFun h β)
    have heq := hX hh
    funext δ
    exact Subtype.ext (congrFun heq δ)
  have hd := LinearMap.finrank_le_finrank_of_injective hg
  simp only [Module.finrank_pi_fintype, Finset.sum_const,
    Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hd
  exact Nat.le_of_mul_le_mul_left hd he

/-- Full-rank blocks preserve the dimension of a common input subspace; this
form avoids any unwarranted specialization of Laurent-series coefficients. -/
lemma blockEval_injective_of_leftInverse {w q e : ℕ}
    (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F)
    (J : (Fin e → Fin q → F) →ₗ[F] (Fin e → Fin q → F))
    (hJ : J.comp (blockEval A X) = LinearMap.id) :
    Function.Injective (blockEval A X) := by
  apply Function.HasLeftInverse.injective
  exact ⟨J, fun v => DFunLike.congr_fun hJ v⟩


variable {P Q : Type*} [AddCommGroup P] [Module F P]
  [AddCommGroup Q] [Module F Q]

def componentSpace {q : ℕ} (f : Fin q → P) : Submodule F P :=
  Submodule.span F (Set.range f)

def component {q : ℕ} (f : Fin q → P) (α : Fin q) : componentSpace (F := F) f :=
  ⟨f α, Submodule.subset_span ⟨α, rfl⟩⟩

def coefficientMatrix {q k : ℕ} (f : Fin q → P)
    (b : Basis (Fin k) F (componentSpace (F := F) f)) : Matrix (Fin q) (Fin k) F :=
  fun α => b.equivFun (component (F := F) f α)

lemma span_component_top {q : ℕ} (f : Fin q → P) :
    Submodule.span F (Set.range (component (F := F) f)) = ⊤ := by
  apply Submodule.map_injective_of_injective (componentSpace (F := F) f).injective_subtype
  rw [Submodule.map_span, ← Set.range_comp, Submodule.map_top, Submodule.range_subtype]
  rfl

lemma rank_coefficientMatrix {q k : ℕ} (f : Fin q → P)
    (b : Basis (Fin k) F (componentSpace (F := F) f)) : (coefficientMatrix f b).rank = k := by
  have hs : Submodule.span F (Set.range (coefficientMatrix f b)) = ⊤ := by
    have hh := congrArg (Submodule.map b.equivFun.toLinearMap) (span_component_top f)
    rw [Submodule.map_span, ← Set.range_comp, Submodule.map_top,
      LinearMap.range_eq_top.mpr b.equivFun.surjective] at hh
    exact hh
  rw [Matrix.rank_eq_finrank_span_row]
  change finrank F (Submodule.span F (Set.range (coefficientMatrix f b))) = k
  rw [hs]
  simp

lemma coefficientMatrix_expansion {q k : ℕ} (f : Fin q → P)
    (b : Basis (Fin k) F (componentSpace (F := F) f)) (α : Fin q) :
    ∑ j, (coefficientMatrix f b) α j • (b j : P) = f α := by
  simpa only [coefficientMatrix, Basis.equivFun_apply, Submodule.coe_sum,
    Submodule.coe_smul, component] using congrArg Subtype.val (b.sum_repr (component (F := F) f α))

/-- The output map of the wk possible component images. -/
def imageCombination {w k : ℕ} (T : Fin w → P →ₗ[F] Q) (u : Fin k → P) :
    (Fin w × Fin k → F) →ₗ[F] Q :=
  Fintype.linearCombination F (fun ij => T ij.1 (u ij.2))

/-- The concatenated coefficient matrix. -/
def concatMatrix {w q k : ℕ} (A : Fin w → Matrix (Fin q) (Fin q) F)
    (P : Matrix (Fin q) (Fin k) F) : Matrix (Fin q) (Fin w × Fin k) F :=
  fun α ij => (A ij.1 * P) α ij.2

lemma concat_row_relation {w q k : ℕ}
    (A : Fin w → Matrix (Fin q) (Fin q) F) (T : Fin w → P →ₗ[F] Q)
    (f : Fin q → P) (b : Basis (Fin k) F (componentSpace (F := F) f))
    (hker : ∀ α, ∑ i, ∑ γ, A i α γ • T i (f γ) = 0) (α : Fin q) :
    (concatMatrix A (coefficientMatrix f b)).row α ∈
      (imageCombination T (fun j => (b j : P))).ker := by
  rw [LinearMap.mem_ker]
  change (∑ ij : Fin w × Fin k,
    (∑ γ, A ij.1 α γ * coefficientMatrix f b γ ij.2) • T ij.1 (b ij.2 : P)) = 0
  rw [Fintype.sum_prod_type]
  simp_rw [Finset.sum_smul]
  conv_lhs => arg 2; ext i; rw [Finset.sum_comm]
  simp_rw [mul_smul, ← Finset.smul_sum, ← map_smul, ← map_sum,
    coefficientMatrix_expansion]
  exact hker α

lemma rank_concat_lt {w q k : ℕ}
    (A : Fin w → Matrix (Fin q) (Fin q) F) (T : Fin w → P →ₗ[F] Q)
    (f : Fin q → P) (b : Basis (Fin k) F (componentSpace (F := F) f))
    (hker : ∀ α, ∑ i, ∑ γ, A i α γ • T i (f γ) = 0)
    (hex : (w-1)*k < finrank F (imageCombination T (fun j => (b j : P))).range)
    (hw : 1 ≤ w) : (concatMatrix A (coefficientMatrix f b)).rank < k := by
  let H := imageCombination T (fun j => (b j : P))
  have hle : Submodule.span F (Set.range (concatMatrix A (coefficientMatrix f b)).row) ≤
      H.ker := by
    rw [Submodule.span_le]
    rintro _ ⟨α, rfl⟩
    exact concat_row_relation A T f b hker α
  have hr := Submodule.finrank_mono hle
  rw [← Matrix.rank_eq_finrank_span_row] at hr
  have hd := H.finrank_range_add_finrank_ker
  simp only [Module.finrank_pi, Fintype.card_prod, Fintype.card_fin] at hd
  have hw' : (w-1)*k+k = w*k := by
    calc
      _ = (w-1+1)*k := by ring
      _ = _ := by congr 1; omega
  change (w-1)*k < finrank F H.range at hex
  omega

lemma coefficient_image_le_concat {w q k : ℕ}
    (A : Fin w → Matrix (Fin q) (Fin q) F) (P : Matrix (Fin q) (Fin k) F) (i : Fin w) :
    (Submodule.span F (Set.range P.col)).map (A i).mulVecLin ≤
      Submodule.span F (Set.range (concatMatrix A P).col) := by
  rw [Submodule.map_span, Submodule.span_le]
  rintro _ ⟨v, ⟨j, rfl⟩, rfl⟩
  apply Submodule.subset_span
  refine ⟨(i,j), ?_⟩
  funext α
  simp [concatMatrix, Matrix.mulVec, Matrix.mul_apply, dotProduct]


lemma component_image_le_range {w q k : ℕ} (T : Fin w → P →ₗ[F] Q)
    (f : Fin q → P) (b : Basis (Fin k) F (componentSpace (F := F) f)) (i : Fin w) :
    (componentSpace (F := F) f).map (T i) ≤
      (imageCombination T (fun j => (b j : P))).range := by
  rw [imageCombination, Fintype.range_linearCombination]
  rintro _ ⟨x, hx, rfl⟩
  have he : (∑ j, (b.repr ⟨x,hx⟩) j • (b j : P)) = x := by
    simpa only [Submodule.coe_sum, Submodule.coe_smul] using
      congrArg Subtype.val (b.sum_repr ⟨x,hx⟩)
  rw [← he, map_sum]
  apply Submodule.sum_mem
  intro j _
  rw [map_smul]
  apply Submodule.smul_mem
  exact Submodule.subset_span ⟨(i,j), rfl⟩

/-- A kernel vector with sufficiently expansive component span contradicts
any invertible block evaluation of the same coefficient matrices. -/
theorem kernel_impossible {w q k e : ℕ} (hw : 1 ≤ w) (he : 0 < e)
    (A : Fin w → Matrix (Fin q) (Fin q) F) (T : Fin w → P →ₗ[F] Q)
    (X : Fin w → Matrix (Fin e) (Fin e) F)
    (hX : Function.Injective (blockEval A X))
    (f : Fin q → P) (b : Basis (Fin k) F (componentSpace (F := F) f))
    (hker : ∀ α, ∑ i, ∑ γ, A i α γ • T i (f γ) = 0)
    (hex : (w-1)*k < finrank F (imageCombination T (fun j => (b j : P))).range) :
    False := by
  let Pmat := coefficientMatrix f b
  let Cmat := concatMatrix A Pmat
  let V := Submodule.span F (Set.range Pmat.col)
  let W := Submodule.span F (Set.range Cmat.col)
  have hVW : ∀ i, V.map (A i).mulVecLin ≤ W :=
    fun i => coefficient_image_le_concat A Pmat i
  have hd := no_shrunk_subspace he A X hX V W hVW
  have hV : finrank F V = k := by
    rw [← Matrix.rank_eq_finrank_span_cols]
    exact rank_coefficientMatrix f b
  have hW : finrank F W < k := by
    rw [← Matrix.rank_eq_finrank_span_cols]
    exact rank_concat_lt A T f b hker hex hw
  omega


def blockMatrix {w q e : ℕ} (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F) :
    Matrix (Fin q × Fin e) (Fin q × Fin e) F := ∑ i, A i ⊗ₖ X i

lemma blockMatrix_mulVec {w q e : ℕ} (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F) (v : Fin e → Fin q → F)
    (α : Fin q) (β : Fin e) :
    (blockMatrix A X).mulVec (fun j => v j.2 j.1) (α,β) = blockEval A X v β α := by
  classical
  simp only [blockMatrix, Matrix.mulVec, dotProduct, Matrix.sum_apply,
    Matrix.kronecker_apply, Finset.sum_mul, Fintype.sum_prod_type,
    blockEval, LinearMap.coe_mk, AddHom.coe_mk, Finset.sum_apply,
    Pi.smul_apply, smul_eq_mul]
  simp_rw [Finset.mul_sum]
  rw [Finset.sum_comm]
  conv_lhs => arg 2; ext δ; rw [Finset.sum_comm]
  rw [Finset.sum_comm]
  apply Finset.sum_congr rfl
  intro i _
  apply Finset.sum_congr rfl
  intro δ _
  apply Finset.sum_congr rfl
  intro γ _
  ring

lemma blockEval_injective_of_isUnit {w q e : ℕ}
    (A : Fin w → Matrix (Fin q) (Fin q) F)
    (X : Fin w → Matrix (Fin e) (Fin e) F) (h : IsUnit (blockMatrix A X)) :
    Function.Injective (blockEval A X) := by
  have hh := Matrix.mulVec_injective_iff_isUnit.mpr h
  intro v u hv
  have hflat : (fun j : Fin q × Fin e => v j.2 j.1) = (fun j => u j.2 j.1) := by
    apply hh
    funext j
    rw [blockMatrix_mulVec, blockMatrix_mulVec]
    exact congrFun (congrFun hv j.2) j.1
  funext β α
  exact congrFun hflat (α,β)

end
end RationalHitting.Rectangular


namespace RationalHitting.RectangularExpansion
open Module Matrix
open scoped BigOperators
open LaurentReduction SmallExpansion Rectangular
noncomputable section
variable {K : Type*} [Field K] [CharZero K]

/-- The rectangular Taylor tests have no nonzero kernel component family when
the same coefficients have an invertible matrix witness. -/
theorem rectangular_kernel_zero (w B M N q e : ℕ) (hw : 1 ≤ w) (hN : 1 ≤ N)
    (hMN : M = N + 2*w^3*B) (hq : q ≤ B) (he : 0 < e)
    (points : Fin w → K) (hp : Function.Injective points)
    (A : Fin w → Matrix (Fin q) (Fin q) (F K))
    (X : Fin w → Matrix (Fin e) (Fin e) (F K))
    (hX : Function.Injective (blockEval A X))
    (f : Fin q → Fin M → F K)
    (hf : ∀ α j, N ≤ j.val → f α j = 0)
    (hker : ∀ α, ∑ i, ∑ γ, A i α γ • testMap M (points i) (f γ) = 0) : f = 0 := by
  classical
  by_contra hn
  obtain ⟨α, hα⟩ : ∃ α, f α ≠ 0 := by
    by_contra! hh
    exact hn (funext hh)
  let U := componentSpace (F := F K) f
  let k := finrank (F K) U
  let b := Module.finBasis (F K) U
  let T := fun i => testMap M (points i)
  let W := (imageCombination T (fun j => (b j : Fin M → F K))).range
  have hk : 1 ≤ k := by
    apply finrank_pos_iff_exists_ne_zero.mpr
    refine ⟨component (F := F K) f α, ?_⟩
    intro hz
    exact hα (congrArg Subtype.val hz)
  have hkq : k ≤ q := by
    simpa using finrank_le_of_span_eq_top (span_component_top (F := F K) f)
  have hU : ∀ x ∈ U, ∀ j : Fin M, N ≤ j.val → x j = 0 := by
    intro x hx
    induction hx using Submodule.span_induction with
    | mem x hx => obtain ⟨α, rfl⟩ := hx; exact hf α
    | zero => intro j _; rfl
    | add x y _ _ hx hy => intro j hj; simp [hx j hj, hy j hj]
    | smul c x _ hx => intro j hj; simp [hx j hj]
  have hW : ∀ i, U.map (T i) ≤ W := fun i => component_image_le_range T f b i
  have hex := small_expansion w B M N hw hN hMN points hp U W hU hW hk (hkq.trans hq)
  exact kernel_impossible hw he A T X hX f b hker hex

end
end RationalHitting.RectangularExpansion

end OAI