forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.lean
More file actions
97 lines (77 loc) · 3.71 KB
/
Copy pathCard.lean
File metadata and controls
97 lines (77 loc) · 3.71 KB
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
/-
Copyright (c) 2024 Thomas Lanard. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Birkbeck, Inna Capdeboscq, Johan Commelin, Thomas Lanard, Peiran Wu
-/
module
public import Mathlib.FieldTheory.Finiteness
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs
public import Mathlib.LinearAlgebra.Matrix.Rank
/-!
# Cardinal of the general linear group over finite rings
This file computes the cardinal of the general linear group over finite rings.
## Main statements
* `card_linearIndependent` gives the cardinal of the set of linearly independent vectors over a
finite-dimensional vector space over a finite field.
* `Matrix.card_GL_field` gives the cardinal of the general linear group over a finite field.
-/
@[expose] public section
open LinearMap Module
section LinearIndependent
variable {K V : Type*} [DivisionRing K] [AddCommGroup V] [Module K V]
variable [Fintype K] [Finite V]
local notation "q" => Fintype.card K
local notation "n" => Module.finrank K V
attribute [local instance] Fintype.ofFinite in
open Fintype in
/-- The cardinal of the set of linearly independent vectors over a finite-dimensional vector space
over a finite field. -/
theorem card_linearIndependent {k : ℕ} (hk : k ≤ n) :
Nat.card { s : Fin k → V // LinearIndependent K s } =
∏ i : Fin k, (q ^ n - q ^ i.val) := by
rw [Nat.card_eq_fintype_card]
induction k with
| zero =>
have : Unique { s : Fin 0 → V // (⊤ : Submodule K (Fin 0 →₀ K)) = ⊥ } :=
uniqueOfSubsingleton ⟨0, Subsingleton.elim ..⟩
simp_rw [linearIndependent_iff_ker, Finsupp.linearCombination_fin_zero, ker_zero,
Finset.univ_eq_empty, Finset.prod_empty, card_unique]
| succ k ih =>
have (s : { s : Fin k → V // LinearIndependent K s }) :
card ((Submodule.span K (Set.range (s : Fin k → V)))ᶜ : Set (V)) =
(q) ^ n - (q) ^ k := by
rw [card_compl_set, Module.card_eq_pow_finrank (K := K)
(V := ((Submodule.span K (Set.range (s : Fin k → V))) : Set (V)))]
simp only [SetLike.coe_sort_coe, finrank_span_eq_card s.2, card_fin]
rw [Module.card_eq_pow_finrank (K := K)]
simp [card_congr (equiv_linearIndependent k), sum_congr _ _ this, ih (Nat.le_of_succ_le hk),
mul_comm, Fin.prod_univ_succAbove _ (Fin.last k), -Set.fintypeCard_eq_ncard]
end LinearIndependent
namespace Matrix
section field
variable {𝔽 : Type*} [Field 𝔽] [Fintype 𝔽]
local notation "q" => Fintype.card 𝔽
variable (n : ℕ)
/-- Equivalence between `GL n F` and `n` vectors of length `n` that are linearly independent. Given
by sending a matrix to its columns. -/
noncomputable def equiv_GL_linearindependent :
GL (Fin n) 𝔽 ≃ { s : Fin n → Fin n → 𝔽 // LinearIndependent 𝔽 s } where
toFun M := ⟨M.1.col, by
apply linearIndependent_iff_card_eq_finrank_span.2
rw [Set.finrank, ← rank_eq_finrank_span_cols, rank_unit]⟩
invFun M := GeneralLinearGroup.mk'' (transpose (M.1)) <| by
classical
let b := basisOfPiSpaceOfLinearIndependent M.2
have := (Pi.basisFun 𝔽 (Fin n)).invertibleToMatrix b
rw [← Basis.coePiBasisFun.toMatrix_eq_transpose,
← coe_basisOfPiSpaceOfLinearIndependent M.2]
exact isUnit_det_of_invertible _
right_inv := by exact congrFun rfl
/-- The cardinal of the general linear group over a finite field. -/
theorem card_GL_field :
Nat.card (GL (Fin n) 𝔽) = ∏ i : (Fin n), (q ^ n - q ^ (i : ℕ)) := by
rw [Nat.card_congr (equiv_GL_linearindependent n), card_linearIndependent,
Module.finrank_fintype_fun_eq_card, Fintype.card_fin]
simp only [Module.finrank_fintype_fun_eq_card, Fintype.card_fin, le_refl]
end field
end Matrix