182
182
/-- If a vector space is finite-dimensional, then the cardinality of any basis is equal to its
183
183
`findim`. -/
184
184
lemma findim_eq_card_basis' [finite_dimensional K V] {ι : Type w} {b : ι → V} (h : is_basis K b) :
185
- (findim K V : cardinal.{w}) = cardinal.mk ι :=
185
+ (findim K V : cardinal.{w}) = cardinal.mk ι :=
186
186
begin
187
187
rcases exists_is_basis_finite K V with ⟨s, s_basis, s_finite⟩,
188
188
letI: fintype s := s_finite.fintype,
@@ -196,6 +196,153 @@ begin
196
196
exact (lift_inj.mp this ).symm
197
197
end
198
198
199
+ -- Note here we've restrictied the universe levels of `ι` and `V` to be the same, for convenience.
200
+ lemma cardinal_mk_le_findim_of_linear_independent
201
+ [finite_dimensional K V] {ι : Type v} {b : ι → V} (h : linear_independent K b) :
202
+ cardinal.mk ι ≤ findim K V :=
203
+ begin
204
+ convert cardinal_le_dim_of_linear_independent h,
205
+ rw ←findim_eq_dim K V
206
+ end
207
+
208
+ -- Note here we've restrictied the universe levels of `ι` and `V` to be the same, for convenience.
209
+ lemma fintype_card_le_findim_of_linear_independent
210
+ [finite_dimensional K V] {ι : Type v} [fintype ι] {b : ι → V} (h : linear_independent K b) :
211
+ fintype.card ι ≤ findim K V :=
212
+ by simpa [fintype_card] using cardinal_mk_le_findim_of_linear_independent h
213
+
214
+ lemma finset_card_le_findim_of_linear_independent [finite_dimensional K V] {b : finset V}
215
+ (h : linear_independent K (λ x, x : (↑b : set V) → V)) :
216
+ b.card ≤ findim K V :=
217
+ begin
218
+ rw ←fintype.card_coe,
219
+ exact fintype_card_le_findim_of_linear_independent h,
220
+ end
221
+
222
+ section
223
+ open_locale big_operators
224
+ open finset
225
+
226
+ /--
227
+ If a finset has cardinality larger than the dimension of the space,
228
+ then there is a nontrivial linear relation amongst its elements.
229
+ -/
230
+ lemma exists_nontrivial_relation_of_dim_lt_card
231
+ [finite_dimensional K V] {t : finset V} (h : findim K V < t.card) :
232
+ ∃ f : V → K, ∑ e in t, f e • e = 0 ∧ ∃ x ∈ t, f x ≠ 0 :=
233
+ begin
234
+ have := mt finset_card_le_findim_of_linear_independent (by { simpa using h }),
235
+ rw linear_dependent_iff at this ,
236
+ obtain ⟨s, g, sum, z, zm, nonzero⟩ := this ,
237
+ -- Now we have to extend `g` to all of `t`, then to all of `V`.
238
+ let f : V → K := λ x, if h : x ∈ t then if (⟨x, h⟩ : (↑t : set V)) ∈ s then g ⟨x, h⟩ else 0 else 0 ,
239
+ -- and finally clean up the mess caused by the extension.
240
+ refine ⟨f, _, _⟩,
241
+ { dsimp [f],
242
+ rw ← sum,
243
+ fapply sum_bij_ne_zero (λ v hvt _, (⟨v, hvt⟩ : {v // v ∈ t})),
244
+ { intros v hvt H, dsimp,
245
+ rw [dif_pos hvt] at H,
246
+ contrapose! H,
247
+ rw [if_neg H, zero_smul], },
248
+ { intros _ _ _ _ _ _, exact subtype.mk.inj, },
249
+ { intros b hbs hb,
250
+ use b,
251
+ simpa only [hbs, exists_prop, dif_pos, mk_coe, and_true, if_true, finset.coe_mem,
252
+ eq_self_iff_true, exists_prop_of_true, ne.def] using hb, },
253
+ { intros a h₁, dsimp, rw [dif_pos h₁],
254
+ intro h₂, rw [if_pos], contrapose! h₂,
255
+ rw [if_neg h₂, zero_smul], }, },
256
+ { refine ⟨z, z.2 , _⟩, dsimp only [f], erw [dif_pos z.2 , if_pos]; rwa [subtype.coe_eta] },
257
+ end
258
+
259
+ /--
260
+ If a finset has cardinality larger than `findim + 1`,
261
+ then there is a nontrivial linear relation amongst its elements,
262
+ such that the coefficients of the relation sum to zero.
263
+ -/
264
+ lemma exists_nontrivial_relation_sum_zero_of_dim_succ_lt_card
265
+ [finite_dimensional K V] {t : finset V} (h : findim K V + 1 < t.card) :
266
+ ∃ f : V → K, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, f x ≠ 0 :=
267
+ begin
268
+ -- Pick an element x₀ ∈ t,
269
+ have card_pos : 0 < t.card := lt_trans (nat.succ_pos _) h,
270
+ obtain ⟨x₀, m⟩ := (finset.card_pos.1 card_pos).bex,
271
+ -- and apply the previous lemma to the {xᵢ - x₀}
272
+ let shift : V ↪ V := ⟨λ x, x - x₀, add_left_injective (-x₀)⟩,
273
+ let t' := (t.erase x₀).map shift,
274
+ have h' : findim K V < t'.card,
275
+ { simp only [t', card_map, finset.card_erase_of_mem m],
276
+ exact nat.lt_pred_iff.mpr h, },
277
+ -- to obtain a function `g`.
278
+ obtain ⟨g, gsum, x₁, x₁_mem, nz⟩ := exists_nontrivial_relation_of_dim_lt_card h',
279
+ -- Then obtain `f` by translating back by `x₀`,
280
+ -- and setting the value of `f` at `x₀` to ensure `∑ e in t, f e = 0`.
281
+ let f : V → K := λ z, if z = x₀ then - ∑ z in (t.erase x₀), g (z - x₀) else g (z - x₀),
282
+ refine ⟨f, _ ,_ ,_⟩,
283
+ -- After this, it's a matter of verifiying the properties,
284
+ -- based on the corresponding properties for `g`.
285
+ { show ∑ (e : V) in t, f e • e = 0 ,
286
+ -- We prove this by splitting off the `x₀` term of the sum,
287
+ -- which is itself a sum over `t.erase x₀`,
288
+ -- combining the two sums, and
289
+ -- observing that after reindexing we have exactly
290
+ -- ∑ (x : V) in t', g x • x = 0.
291
+ simp only [f],
292
+ conv_lhs { apply_congr, skip, rw [ite_smul], },
293
+ rw [finset.sum_ite],
294
+ conv { congr, congr, apply_congr, simp [filter_eq', m], },
295
+ conv { congr, congr, skip, apply_congr, simp [filter_ne'], },
296
+ rw [sum_singleton, neg_smul, add_comm, ←sub_eq_add_neg, sum_smul, ←sum_sub_distrib],
297
+ simp only [←smul_sub],
298
+ -- At the end we have to reindex the sum, so we use `change` to
299
+ -- express the summand using `shift`.
300
+ change (∑ (x : V) in t.erase x₀, (λ e, g e • e) (shift x)) = 0 ,
301
+ rw ←sum_map _ shift,
302
+ exact gsum, },
303
+ { show ∑ (e : V) in t, f e = 0 ,
304
+ -- Again we split off the `x₀` term,
305
+ -- observing that it exactly cancels the other terms.
306
+ rw [← insert_erase m, sum_insert (not_mem_erase x₀ t)],
307
+ dsimp [f],
308
+ rw [if_pos rfl],
309
+ conv_lhs { congr, skip, apply_congr, skip, rw if_neg (show x ≠ x₀, from (mem_erase.mp H).1 ), },
310
+ exact neg_add_self _, },
311
+ { show ∃ (x : V) (H : x ∈ t), f x ≠ 0 ,
312
+ -- We can use x₁ + x₀.
313
+ refine ⟨x₁ + x₀, _, _⟩,
314
+ { rw finset.mem_map at x₁_mem,
315
+ rcases x₁_mem with ⟨x₁, x₁_mem, rfl⟩,
316
+ rw mem_erase at x₁_mem,
317
+ simp only [x₁_mem, sub_add_cancel, function.embedding.coe_fn_mk], },
318
+ { dsimp only [f],
319
+ rwa [if_neg, add_sub_cancel],
320
+ rw [add_left_eq_self], rintro rfl,
321
+ simpa only [sub_eq_zero, exists_prop, finset.mem_map, embedding.coe_fn_mk, eq_self_iff_true,
322
+ mem_erase, not_true, exists_eq_right, ne.def, false_and] using x₁_mem, } },
323
+ end
324
+
325
+ section
326
+ variables {L : Type *} [discrete_linear_ordered_field L]
327
+ variables {W : Type v} [add_comm_group W] [vector_space L W]
328
+
329
+ /--
330
+ A slight strengthening of `exists_nontrivial_relation_sum_zero_of_dim_succ_lt_card`
331
+ available when working over an ordered field:
332
+ we can ensure a positive coefficient, not just a nonzero coefficient.
333
+ -/
334
+ lemma exists_relation_sum_zero_pos_coefficient_of_dim_succ_lt_card
335
+ [finite_dimensional L W] {t : finset W} (h : findim L W + 1 < t.card) :
336
+ ∃ f : W → L, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, 0 < f x :=
337
+ begin
338
+ obtain ⟨f, sum, total, nonzero⟩ := exists_nontrivial_relation_sum_zero_of_dim_succ_lt_card h,
339
+ exact ⟨f, sum, total, exists_pos_of_sum_zero_of_exists_nonzero f total nonzero⟩,
340
+ end
341
+
342
+ end
343
+
344
+ end
345
+
199
346
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
200
347
whole space. -/
201
348
lemma eq_top_of_findim_eq [finite_dimensional K V] {S : submodule K V}
0 commit comments