Skip to content

Commit 464a29c

Browse files
committed
staging
1 parent 77fd22e commit 464a29c

File tree

3 files changed

+121
-51
lines changed

3 files changed

+121
-51
lines changed

LeanCommAlg/Exterior.lean

Lines changed: 110 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ open Classical
2323

2424
infixr:20 "<∘ₗ>" => LinearMap.comp
2525

26+
universe u
27+
2628
variable {A : Type*} [Semiring A]
2729
variable {R : Type*} [CommRing R] [Algebra R A]
2830
variable {M : Type*} [AddCommGroup M] [Module R M]
31+
variable {ι : Type u}
2932

3033
open ExteriorAlgebra CategoryTheory
3134

@@ -76,7 +79,7 @@ end TensorPower
7679
#check exteriorPower.alternatingMapToDual
7780
noncomputable def linearFormOfFamily {n : ℕ} (f : (_ : Fin n) → (Module.Dual R M)) :
7881
Module.Dual R (⋀[R]^n M) :=
79-
(TensorPower.multilinearMapToDual R M n f) ∘ₗ (exteriorPower.toTensorPower R M n)
82+
TensorPower.linearFormOfFamily f ∘ₗ (exteriorPower.toTensorPower R M) n
8083

8184
@[simp]
8285
lemma linearFormOfFamily_apply (f : (_ : Fin n) → (M →ₗ[R] R)) (x : ⋀[R]^n M) :
@@ -112,40 +115,125 @@ lemma linearFormOfBasis_apply_ιMulti {I : Type*} [LinearOrder I] (b : Basis I R
112115
refine Finset.sum_congr rfl fun σ _ => ?_
113116
rw [LinearMap.map_smul_of_tower, TensorPower.linearFormOfFamily_apply_tprod]
114117

118+
/-- If `v : ι → M` is a family of vectors and there exists a family of linear forms
119+
`dv : ι → (M →ₗ[R] R)` such that `dv i (v j)` is `1` for `i = j` and `0` for `i ≠ j`, then
120+
`v` is linearly independent. -/
121+
theorem linearIndependent_of_dualFamily
122+
(v : ι → M) (dv : ι → (M →ₗ[R] R))
123+
(h1 : ∀ (a : ι) (b : ι), a ≠ b → (dv a) (v b) = 0) (h2 : ∀ (a : ι), (dv a) (v a) = 1) :
124+
LinearIndependent R v := by
125+
rw [linearIndependent_iff']
126+
intro s g hrel i hi
127+
apply_fun (fun x => dv i x) at hrel
128+
simp only [map_sum, map_smul, smul_eq_mul, _root_.map_zero] at hrel
129+
rw [Finset.sum_eq_single i (fun j _ hj ↦ by rw [h1 i j (Ne.symm hj), mul_zero])
130+
(fun hi' ↦ False.elim (hi' hi)), h2 i, mul_one] at hrel
131+
exact hrel
132+
133+
/-- Let `b` be a basis of `M` indexed by a linearly ordered type `I` and `s` be a finset of `I`
134+
of cardinality `n`. If we apply the linear form on `⋀[R]^n M` defined by `b` and `s`
135+
to the exterior product of the `b i` for `i ∈ s`, then we get `1`. -/
136+
lemma linearFormOfBasis_apply_diag {I : Type*} [LinearOrder I] (b : Basis I R M)
137+
{s : Finset I} (hs : Finset.card s = n) :
138+
linearFormOfBasis b hs (ιMulti_family R n b (Subtype.mk s hs)) = 1 := by
139+
trans ∑ σ : Fin n ≃ Fin n,
140+
TensorPower.linearFormOfFamily R n (fun i ↦ b.coord (Finset.orderIsoOfFin s hs i))
141+
(Equiv.Perm.sign σ • ⨂ₜ[R] i : Fin n, b (Finset.orderIsoOfFin s hs (σ i)))
142+
· rw [ιMulti_family, linearFormOfBasis_apply_ιMulti]
143+
congr
144+
ext σ
145+
rw [LinearMap.map_smul_of_tower, TensorPower.linearFormOfFamily_apply_tprod]
146+
· have hzero : ∀ σ ∈ Finset.univ, σ ≠ Equiv.refl (Fin n) →
147+
(TensorPower.linearFormOfFamily R n fun i ↦ b.coord (Finset.orderIsoOfFin s hs i))
148+
(Equiv.Perm.sign σ • ⨂ₜ[R] i, b (Finset.orderIsoOfFin s hs (σ i))) = 0 := by
149+
rintro σ - hσ
150+
rw [ne_eq, Equiv.ext_iff.not, not_forall] at hσ
151+
obtain ⟨i, hi⟩ := hσ
152+
rw [LinearMap.map_smul_of_tower, smul_eq_zero_iff_eq,
153+
TensorPower.linearFormOfFamily_apply_tprod]
154+
apply Finset.prod_eq_zero (Finset.mem_univ _) (a := i)
155+
rw [Finset.coe_orderIsoOfFin_apply, Basis.coord_apply, Basis.repr_self_apply,
156+
Finset.coe_orderIsoOfFin_apply, ite_eq_right_iff, OrderEmbedding.eq_iff_eq]
157+
exact fun a ↦ absurd a hi
158+
rw [Finset.sum_eq_single_of_mem (Equiv.refl (Fin n)) (Finset.mem_univ _) hzero,
159+
Equiv.Perm.sign_refl, one_smul, TensorPower.linearFormOfFamily_apply_tprod]
160+
apply Finset.prod_eq_one
161+
rintro i -
162+
rw [Basis.coord_apply, Basis.repr_self, Equiv.refl_apply, Finsupp.single_eq_same]
163+
164+
lemma linearFormOfBasis_apply_nondiag_aux {I : Type*} [LinearOrder I] {s t : Finset I}
165+
(hs : Finset.card s = n) (ht : Finset.card t = n) (hst : s ≠ t) (σ : Equiv.Perm (Fin n)) :
166+
∃ (i : Fin n), (Finset.orderIsoOfFin s hs i).1 ≠ (Finset.orderIsoOfFin t ht (σ i)).1 := by
167+
by_contra! habs
168+
apply hst
169+
apply Finset.eq_of_subset_of_card_le
170+
· intro a has
171+
let b := Finset.orderIsoOfFin t ht (σ ((Finset.orderIsoOfFin s hs).symm ⟨a, has⟩))
172+
have heq : a = b.1 := by
173+
rw [← habs]
174+
simp only [OrderIso.apply_symm_apply]
175+
rw [heq]
176+
exact b.2
177+
· rw [hs, ht]
178+
179+
/-- Let `b` be a basis of `M` indexed by a linearly ordered type `I` and `s` be a finset of `I`
180+
of cardinality `n`. Let `t` be a finset of `I` of cardinality `n` such that `s ≠ t`. If we apply
181+
the linear form on `⋀[R]^n M` defined by `b` and `s` to the exterior product of the
182+
`b i` for `i ∈ t`, then we get `0`. -/
183+
lemma linearFormOfBasis_apply_nondiag {I : Type*} [LinearOrder I] (b : Basis I R M)
184+
{s t : Finset I} (hs : Finset.card s = n) (ht : Finset.card t = n) (hst : s ≠ t) :
185+
linearFormOfBasis b hs (ιMulti_family R n b ⟨t, ht⟩) = 0 := by
186+
simp only [ιMulti_family]
187+
rw [linearFormOfBasis_apply_ιMulti]
188+
apply Finset.sum_eq_zero
189+
intro σ _
190+
have ⟨i, hi⟩ := linearFormOfBasis_apply_nondiag_aux n hs ht hst σ
191+
apply smul_eq_zero_of_right
192+
apply Finset.prod_eq_zero (Finset.mem_univ i)
193+
rw [Basis.coord_apply, Basis.repr_self_apply, if_neg (ne_comm.mp hi)]
115194

116195
/-! ### Freeness and dimension of `⋀[R]^n M. -/
117196

118197
lemma ιMulti_family_linearIndependent_ofBasis {I : Type*} [LinearOrder I] (b : Basis I R M) :
119-
LinearIndependent R (ιMulti_family R n b) := by
120-
-- linearIndependent_of_dualFamily _ (fun s ↦ linearFormOfBasis R n b s.2)
121-
-- (fun ⟨_, _⟩ ⟨_, _⟩ hst ↦ by
122-
-- rw [ne_eq, Subtype.mk.injEq] at hst
123-
-- exact linearFormOfBasis_apply_nondiag _ _ _ _ _ hst)
124-
-- (fun ⟨_, _⟩ ↦ linearFormOfBasis_apply_diag _ _ _ _)
125-
sorry
198+
LinearIndependent R (ιMulti_family R n b) :=
199+
linearIndependent_of_dualFamily _ (fun st ↦ linearFormOfBasis b st.2)
200+
(fun ⟨_, _⟩ ⟨_, _⟩ hst ↦ by
201+
rw [ne_eq, Subtype.mk.injEq] at hst
202+
exact linearFormOfBasis_apply_nondiag _ _ _ _ _ hst)
203+
(fun ⟨_, _⟩ ↦ linearFormOfBasis_apply_diag _ _ _ _)
204+
126205

127206
noncomputable def basisExteriorPower {I : Type*} [LinearOrder I] (b : Basis I R M) :
128207
Basis {s : Finset I // Finset.card s = n} R (⋀[R]^n M) := by
208+
-- by
209+
-- letI : LinearOrder {s : Finset I // Finset.card s = n} := IsWellFounded.wellOrderExtension emptyWf.rel
210+
-- apply Basis.mk
211+
-- . case hli =>
212+
-- apply ιMulti_family_linearIndependent_ofBasis R
213+
214+
-- #check exteriorPower.toTensorPower R M n
215+
216+
-- sorry
217+
-- . case hsp =>
218+
219+
-- sorry
220+
-- . case v =>
221+
-- -- use linearFormOfBasis
222+
129223

130-
-- Basis.mk (ιMulti_family_linearIndependent_ofBasis _ _ _)
131-
-- (eq_top_iff.mp <| span_top_of_span_top' R n (Basis.span_eq b))
224+
-- sorry
225+
apply Basis.mk (ιMulti_family_linearIndependent_ofBasis _ _ _)
226+
(eq_top_iff.mp <| span_top_of_span_top' R n (Basis.span_eq b))
132227
sorry
133228

134229
-- variable
135230

136231
/-- If `M` is a free module, then so is its `n`th exterior power. -/
137232
instance instFree [hfree : Module.Free R M] : Module.Free R (⋀[R]^n M) := by
138233
have ⟨I, b⟩ := hfree.exists_basis
139-
-- letI : LinearOrder I := IsWellFounded.wellOrderExtension (@WellFoundedRelation.emptyWf I)
140-
141-
letI : LinearOrder I := by
142-
apply IsWellFounded.wellOrderExtension emptyWf.rel
143-
144-
234+
letI : LinearOrder I := IsWellFounded.wellOrderExtension emptyWf.rel
145235
apply Module.Free.of_basis (basisExteriorPower b)
146236

147-
148-
149237
variable [StrongRankCondition R]
150238

151239
set_option linter.unusedTactic false
@@ -155,28 +243,10 @@ set_option linter.unusedTactic false
155243
the `n`th exterior power of `M` is of finrank `Nat.choose r n`. -/
156244
lemma finrank_eq [hfree : Module.Free R M] [Module.Finite R M] :
157245
Module.finrank R (⋀[R]^n M) = Nat.choose (Module.finrank R M) n := by
158-
-- have : IsWellFounded ((Module.Free.ChooseBasisIndex R M)) (@emptyWf.wf (Module.Free.ChooseBasisIndex R M)) := by
159-
160-
-- letI : LinearOrder hfree.ChooseBasisIndex := by
161-
-- apply IsWellFounded.wellOrderExtension (@emptyWf.wf (Module.Free.ChooseBasisIndex R M))
162-
163-
164-
165-
166-
have ⟨I, b⟩ := hfree.exists_basis
167-
letI lin : LinearOrder I := by sorry
168-
let B := @basisExteriorPower R _ M _ _ n I lin b
169-
rw [Module.finrank_eq_card_basis hfree.chooseBasis]
170-
171-
172-
haveI : Fintype {s : Finset I // s.card = n} := sorry
173-
rw [Module.finrank_eq_card_basis B]
174-
rw [← Fintype.card_finset_len]
175-
176-
177-
sorry
178-
179-
246+
letI : LinearOrder hfree.ChooseBasisIndex := IsWellFounded.wellOrderExtension emptyWf.rel
247+
let B := @basisExteriorPower R _ M _ _ n hfree.ChooseBasisIndex _ hfree.chooseBasis
248+
rw [Module.finrank_eq_card_basis hfree.chooseBasis,
249+
Module.finrank_eq_card_basis B, Fintype.card_finset_len]
180250

181251
instance ExteriorAlgebraFinite [E_finite : Module.Finite R E] :
182252
Module.Finite R (ExteriorAlgebra R E) := by

lake-manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "fc7ec703b36bc6ddf510ff84b58265318091f439",
18+
"rev": "507dd92b9ed9cfd43bd29d1438a458da6705d8a0",
1919
"name": "mathlib",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": null,
@@ -25,7 +25,7 @@
2525
"type": "git",
2626
"subDir": null,
2727
"scope": "leanprover-community",
28-
"rev": "8cee626a680fe217814c4bd444b94ceb31efd6b6",
28+
"rev": "61c44bec841faabd47d11c2eda15f57ec2ffe9d5",
2929
"name": "plausible",
3030
"manifestFile": "lake-manifest.json",
3131
"inputRev": "main",
@@ -35,7 +35,7 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "leanprover-community",
38-
"rev": "25078369972d295301f5a1e53c3e5850cf6d9d4c",
38+
"rev": "6c62474116f525d2814f0157bb468bf3a4f9f120",
3939
"name": "LeanSearchClient",
4040
"manifestFile": "lake-manifest.json",
4141
"inputRev": "main",
@@ -45,7 +45,7 @@
4545
"type": "git",
4646
"subDir": null,
4747
"scope": "leanprover-community",
48-
"rev": "c20832d6f0b3186a97ea9361cec0a5b87dd152a3",
48+
"rev": "140dc642f4f29944abcdcd3096e8ea9b4469c873",
4949
"name": "importGraph",
5050
"manifestFile": "lake-manifest.json",
5151
"inputRev": "main",
@@ -55,17 +55,17 @@
5555
"type": "git",
5656
"subDir": null,
5757
"scope": "leanprover-community",
58-
"rev": "ea953247aac573c9b5adea60bacd3e085f58aca4",
58+
"rev": "96c67159f161fb6bf6ce91a2587232034ac33d7e",
5959
"name": "proofwidgets",
6060
"manifestFile": "lake-manifest.json",
61-
"inputRev": "v0.0.56",
61+
"inputRev": "v0.0.67",
6262
"inherited": true,
6363
"configFile": "lakefile.lean"},
6464
{"url": "https://github.com/leanprover-community/aesop",
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "323e9f0b9bd41161ba116fe3bff86fc464d454f2",
68+
"rev": "a62ecd0343a2dcfbcac6d1e8243f5821879c0244",
6969
"name": "aesop",
7070
"manifestFile": "lake-manifest.json",
7171
"inputRev": "master",
@@ -75,7 +75,7 @@
7575
"type": "git",
7676
"subDir": null,
7777
"scope": "leanprover-community",
78-
"rev": "aa4c87abed970d9dfad2506000d99d30b02f476b",
78+
"rev": "867d9dc77534341321179c9aa40fceda675c50d4",
7979
"name": "Qq",
8080
"manifestFile": "lake-manifest.json",
8181
"inputRev": "master",
@@ -85,7 +85,7 @@
8585
"type": "git",
8686
"subDir": null,
8787
"scope": "leanprover-community",
88-
"rev": "f523fcb75db2b472cda7d94d6caa5d745b1a0c26",
88+
"rev": "3cabaef23886b82ba46f07018f2786d9496477d6",
8989
"name": "batteries",
9090
"manifestFile": "lake-manifest.json",
9191
"inputRev": "main",
@@ -95,7 +95,7 @@
9595
"type": "git",
9696
"subDir": null,
9797
"scope": "leanprover",
98-
"rev": "aff4176e5c41737a0d73be74ad9feb6a889bfa98",
98+
"rev": "e22ed0883c7d7f9a7e294782b6b137b783715386",
9999
"name": "Cli",
100100
"manifestFile": "lake-manifest.json",
101101
"inputRev": "main",

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.19.0-rc3
1+
leanprover/lean4:v4.22.0-rc3

0 commit comments

Comments
 (0)