Skip to content

Commit 97f5402

Browse files
feat(LinearAlgebra/ExteriorPower): add Basis for exteriorPower (leanprover-community#32708)
This defines a basis for `exteriorPower R M` given a `Basis I R M` where `I` is linearly ordered and develops API for working with basis elements. Key results: - `Basis.exteriorPower R n b` is the basis of `⋀[R]^n M` induced by the basis `b` of `M` - if `M` is free over `R` then so is `⋀[R]^n M` - if `M` is free and finite then `Module.finrank R (⋀[R]^n M) = Nat.choose (Module.finrank R M) n`
1 parent 88bb6d2 commit 97f5402

4 files changed

Lines changed: 204 additions & 0 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4688,6 +4688,7 @@ public import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
46884688
public import Mathlib.LinearAlgebra.ExteriorAlgebra.Grading
46894689
public import Mathlib.LinearAlgebra.ExteriorAlgebra.OfAlternating
46904690
public import Mathlib.LinearAlgebra.ExteriorPower.Basic
4691+
public import Mathlib.LinearAlgebra.ExteriorPower.Basis
46914692
public import Mathlib.LinearAlgebra.ExteriorPower.Pairing
46924693
public import Mathlib.LinearAlgebra.FiniteDimensional.Basic
46934694
public import Mathlib.LinearAlgebra.FiniteDimensional.Defs

Mathlib/Data/Set/PowersetCard.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ theorem exists_mem_notMem (hn : 1 ≤ n) (hα : n < ENat.card α) {a b : α} (ha
8282
rwa [mem_iff, ← ENat.coe_inj, ← this.encard_eq_coe_toFinset_card]⟩,
8383
by simpa using has, by simpa using has'⟩
8484

85+
theorem exists_mem_notMem_iff_ne (s t : Set.powersetCard α n) : s ≠ t ↔ ∃ a ∈ s, a ∉ t := by
86+
contrapose!
87+
rw [eq_iff_subset]
88+
rfl
89+
8590
section map
8691

8792
variable (n) {β : Type*}
@@ -177,6 +182,10 @@ theorem coe_finset [Fintype α] :
177182
powersetCard α n = Finset.powersetCard n (Finset.univ : Finset α) := by
178183
ext; simp
179184

185+
instance [Fintype α] : Fintype (powersetCard α n) := by
186+
rw [coe_finset]
187+
infer_instance
188+
180189
instance [Finite α] : Finite (powersetCard α n) := by
181190
have : Fintype α := Fintype.ofFinite α
182191
simpa [coe_finset] using Subtype.finite
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
/-
2+
Copyright (c) 2025 Daniel Morrison. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Sophie Morel, Daniel Morrison
5+
-/
6+
module
7+
8+
public import Mathlib.LinearAlgebra.ExteriorPower.Basic
9+
public import Mathlib.LinearAlgebra.ExteriorPower.Pairing
10+
public import Mathlib.Order.Extension.Well
11+
public import Mathlib.RingTheory.Finiteness.Subalgebra
12+
public import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition
13+
14+
/-!
15+
# Constructs a basis for exterior powers
16+
-/
17+
18+
@[expose] public section
19+
20+
variable {R K M E : Type*} {n : ℕ}
21+
[CommRing R] [Field K] [AddCommGroup M] [Module R M] [AddCommGroup E] [Module K E]
22+
23+
open BigOperators
24+
25+
namespace exteriorPower
26+
27+
/-! Finiteness of the exterior power. -/
28+
29+
/-- The `n`th exterior power of a finite module is a finite module. -/
30+
instance instFinite [Module.Finite R M] : Module.Finite R (⋀[R]^n M) := by
31+
rw [Module.Finite.iff_fg, ExteriorAlgebra.exteriorPower, LinearMap.range_eq_map]
32+
exact Submodule.FG.pow (Submodule.FG.map _ Module.Finite.fg_top) n
33+
34+
/-! We construct a basis of `⋀[R]^n M` from a basis of `M`. -/
35+
36+
open Module Set Set.powersetCard
37+
38+
variable (R n)
39+
40+
/-- If `b` is a basis of `M` indexed by a linearly ordered type `I` and `s` is a finset of
41+
`I` of cardinality `n`, then we get a linear form on the `n`th exterior power of `M` by
42+
applying the `exteriorPower.linearForm` construction to the family of linear forms
43+
given by the coordinates of `b` indexed by elements of `s` (ordered using the given order on
44+
`I`). -/
45+
noncomputable def ιMultiDual {I : Type*} [LinearOrder I] (b : Basis I R M)
46+
(s : powersetCard I n) : Module.Dual R (⋀[R]^n M) :=
47+
pairingDual R M n (ιMulti_family R n b.coord s)
48+
49+
@[simp]
50+
lemma ιMultiDual_apply_ιMulti {I : Type*} [LinearOrder I] (b : Basis I R M)
51+
(s : powersetCard I n) (v : Fin n → M) :
52+
ιMultiDual R n b s (ιMulti R n v) =
53+
(Matrix.of fun i j => b.coord (powersetCard.ofFinEmbEquiv.symm s j) (v i)).det := by
54+
simp [ιMultiDual, ιMulti_family, pairingDual_ιMulti_ιMulti]
55+
56+
/-- Let `b` be a basis of `M` indexed by a linearly ordered type `I` and `s` be a finset of `I`
57+
of cardinality `n`. If we apply the linear form on `⋀[R]^n M` defined by `b` and `s`
58+
to the exterior product of the `b i` for `i ∈ s`, then we get `1`. -/
59+
lemma ιMultiDual_apply_diag {I : Type*} [LinearOrder I] (b : Basis I R M)
60+
(s : powersetCard I n) :
61+
ιMultiDual R n b s (ιMulti_family R n b s) = 1 := by
62+
rw [ιMulti_family, ιMultiDual_apply_ιMulti]
63+
suffices Matrix.of (fun i j => b.coord (powersetCard.ofFinEmbEquiv.symm s j)
64+
(b (powersetCard.ofFinEmbEquiv.symm s i))) = 1 by
65+
simp_rw [Function.comp_apply, this, Matrix.det_one]
66+
ext
67+
simp [Matrix.one_apply, Finsupp.single_apply]
68+
69+
/-- Let `b` be a basis of `M` indexed by a linearly ordered type `I` and `s` be a finset of `I`
70+
of cardinality `n`. Let `t` be a finset of `I` of cardinality `n` such that `s ≠ t`. If we apply
71+
the linear form on `⋀[R]^n M` defined by `b` and `s` to the exterior product of the
72+
`b i` for `i ∈ t`, then we get `0`. -/
73+
lemma ιMultiDual_apply_nondiag {I : Type*} [LinearOrder I] (b : Basis I R M)
74+
(s t : powersetCard I n) (hst : s ≠ t) :
75+
ιMultiDual R n b s (ιMulti_family R n b t) = 0 := by
76+
rw [ιMulti_family, ιMultiDual_apply_ιMulti]
77+
obtain ⟨i, his, hit⟩ := (exists_mem_notMem_iff_ne s t).mp hst
78+
obtain ⟨k, rfl⟩ := (mem_range_ofFinEmbEquiv_symm_iff_mem s i).mpr his
79+
apply Matrix.det_eq_zero_of_column_eq_zero k
80+
simp_rw [Matrix.of_apply, Basis.coord_apply, Function.comp_apply, Basis.repr_self]
81+
intro j
82+
apply Finsupp.single_eq_of_ne
83+
by_contra! h
84+
apply hit
85+
rw [h, powersetCard.ofFinEmbEquiv_symm_apply, ← powersetCard.mem_coe_iff]
86+
exact Finset.orderEmbOfFin_mem t.val t.prop j
87+
88+
/-- If `b` is a basis of `M` (indexed by a linearly ordered type), then the family
89+
`exteriorPower.ιMulti R n b` of the `n`-fold exterior products of its elements is linearly
90+
independent in the `n`th exterior power of `M`. -/
91+
lemma ιMulti_family_linearIndependent_ofBasis {I : Type*} [LinearOrder I] (b : Basis I R M) :
92+
LinearIndependent R (ιMulti_family R n b) :=
93+
LinearIndependent.of_pairwise_dual_eq_zero_one _ (fun s ↦ ιMultiDual R n b s)
94+
(fun _ _ h => ιMultiDual_apply_nondiag R n b _ _ h)
95+
(fun _ => ιMultiDual_apply_diag _ _ _ _)
96+
97+
variable {R} in
98+
/-- If `b` is a basis of `M` (indexed by a linearly ordered type), the basis of the `n`th
99+
exterior power of `M` formed by the `n`-fold exterior products of elements of `b`. -/
100+
noncomputable def _root_.Module.Basis.exteriorPower {I : Type*} [LinearOrder I] (b : Basis I R M) :
101+
Basis (powersetCard I n) R (⋀[R]^n M) :=
102+
Basis.mk (ιMulti_family_linearIndependent_ofBasis _ _ _)
103+
(eq_top_iff.mp <| ιMulti_family_span_of_span R b.span_eq)
104+
105+
@[simp]
106+
lemma coe_basis {I : Type*} [LinearOrder I] (b : Basis I R M) :
107+
DFunLike.coe (b.exteriorPower n) = ιMulti_family R n b :=
108+
Basis.coe_mk _ _
109+
110+
lemma basis_apply {I : Type*} [LinearOrder I] (b : Basis I R M) (s : powersetCard I n) :
111+
b.exteriorPower n s = ιMulti_family R n b s := by
112+
rw [coe_basis]
113+
114+
/-- If `b` is a basis of `M` indexed by a linearly ordered type `I` and `B` is the corresponding
115+
basis of the `n`th exterior power of `M`, indexed by the set of finsets `s` of `I` of cardinality
116+
`n`, then the coordinate function of `B` at `s` is the linear form on the `n`th exterior power
117+
defined by `b` and `s` in `exteriorPower.ιMultiDual`. -/
118+
lemma basis_coord {I : Type*} [LinearOrder I] (b : Basis I R M) (s : powersetCard I n) :
119+
Basis.coord (b.exteriorPower n) s = ιMultiDual R n b s := by
120+
apply LinearMap.ext_on (ιMulti_family_span_of_span R (Basis.span_eq b))
121+
rintro x ⟨t, rfl⟩
122+
rw [Basis.coord_apply]
123+
by_cases! hst : s = t
124+
· rw [hst, ιMultiDual_apply_diag, ← basis_apply, Basis.repr_self, Finsupp.single_eq_same]
125+
· rw [ιMultiDual_apply_nondiag R n b s t hst, ← basis_apply, Basis.repr_self,
126+
Finsupp.single_eq_of_ne hst]
127+
128+
lemma basis_repr_apply {I : Type*} [LinearOrder I] (b : Basis I R M) (x : ⋀[R]^n M)
129+
(s : powersetCard I n) :
130+
Basis.repr (b.exteriorPower n) x s = ιMultiDual R n b s x := by
131+
simpa [← Basis.coord_apply] using LinearMap.congr_fun (basis_coord R n b s) x
132+
133+
@[simp]
134+
lemma basis_repr_self {I : Type*} [LinearOrder I] (b : Basis I R M) (s : powersetCard I n) :
135+
Basis.repr (b.exteriorPower n) (ιMulti_family R n b s) s = 1 := by
136+
simpa [basis_repr_apply] using ιMultiDual_apply_diag R n b s
137+
138+
@[simp]
139+
lemma basis_repr_ne {I : Type*} [LinearOrder I] (b : Basis I R M)
140+
{s t : powersetCard I n} (hst : s ≠ t) :
141+
Basis.repr (b.exteriorPower n) (ιMulti_family R n b s) t = 0 := by
142+
simpa [basis_repr_apply] using ιMultiDual_apply_nondiag R n b t s hst.symm
143+
144+
lemma basis_repr {I : Type*} [LinearOrder I] (b : Basis I R M) (s : powersetCard I n) :
145+
Basis.repr (b.exteriorPower n) (ιMulti_family R n b s) = Finsupp.single s 1 := by
146+
ext t
147+
by_cases hst : s = t <;> simp [hst]
148+
149+
/-! ### Freeness and dimension of `⋀[R]^n M. -/
150+
151+
/-- If `M` is a free module, then so is its `n`th exterior power. -/
152+
instance instFree [Module.Free R M] : Module.Free R (⋀[R]^n M) :=
153+
have ⟨I, b⟩ := Module.Free.exists_basis R M
154+
letI : LinearOrder I := IsWellFounded.wellOrderExtension emptyWf.rel
155+
Module.Free.of_basis (b.exteriorPower n)
156+
157+
variable [Nontrivial R]
158+
159+
/-- If `R` is non-trivial and `M` is finite free of rank `r`, then
160+
the `n`th exterior power of `M` is of finrank `Nat.choose r n`. -/
161+
lemma finrank_eq [Module.Free R M] [Module.Finite R M] :
162+
Module.finrank R (⋀[R]^n M) = Nat.choose (Module.finrank R M) n := by
163+
letI : LinearOrder (Module.Free.ChooseBasisIndex R M) :=
164+
IsWellFounded.wellOrderExtension emptyWf.rel
165+
let B := (Module.Free.chooseBasis R M).exteriorPower n
166+
rw [Module.finrank_eq_card_basis (Module.Free.chooseBasis R M), Module.finrank_eq_card_basis B,
167+
Fintype.card_eq_nat_card, powersetCard.card, Fintype.card_eq_nat_card]
168+
169+
/-! Results that only hold over a field. -/
170+
171+
/-- If `v` is a linearly independent family of vectors (indexed by a linearly ordered type),
172+
then the family of its `n`-fold exterior products is also linearly independent. -/
173+
lemma ιMulti_family_linearIndependent_field {I : Type*} [LinearOrder I] {v : I → E}
174+
(hv : LinearIndependent K v) : LinearIndependent K (ιMulti_family K n v) := by
175+
let W := Submodule.span K (Set.range v)
176+
suffices ∃ b : Basis I K W, v = W.subtype ∘ b by
177+
obtain ⟨b, hb⟩ := this
178+
rw [hb, ← map_comp_ιMulti_family]
179+
exact LinearIndependent.map' (coe_basis K n b ▸ (b.exteriorPower n).linearIndependent)
180+
_ (LinearMap.ker_eq_bot.mpr (map_injective_field (Submodule.subtype_injective _)))
181+
use Module.Basis.span hv
182+
ext i
183+
rw [Submodule.coe_subtype, Function.comp_apply, Basis.span_apply]
184+
185+
end exteriorPower

Mathlib/Order/Hom/PowersetCard.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ lemma ofFinEmbEquiv_apply (f : Fin n ↪o I) :
4646
lemma ofFinEmbEquiv_symm_apply (s : powersetCard I n) :
4747
ofFinEmbEquiv.symm s = Finset.orderEmbOfFin s.val s.prop := rfl
4848

49+
@[simp]
50+
lemma mem_ofFinEmbEquiv_iff_mem_range (f : Fin n ↪o I) (i : I) :
51+
i ∈ ofFinEmbEquiv f ↔ i ∈ range f := by
52+
simp [ofFinEmbEquiv_apply]
53+
54+
lemma mem_range_ofFinEmbEquiv_symm_iff_mem (s : powersetCard I n) (i : I) :
55+
i ∈ range (ofFinEmbEquiv.symm s) ↔ i ∈ s := by
56+
simp [ofFinEmbEquiv_symm_apply]
57+
4958
end order
5059

5160
end Set.powersetCard

0 commit comments

Comments
 (0)