@@ -22,68 +22,70 @@ open Set LinearMap Submodule
22
22
23
23
universe u v w
24
24
25
+ namespace DFinsupp
26
+
27
+ variable {ι : Type *} {R : Type *} {M : ι → Type *}
28
+ variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)]
29
+
30
+ /-- The direct sum of free modules is free.
31
+
32
+ Note that while this is stated for `DFinsupp` not `DirectSum`, the types are defeq. -/
33
+ noncomputable def basis {η : ι → Type *} (b : ∀ i, Basis (η i) R (M i)) :
34
+ Basis (Σ i, η i) R (Π₀ i, M i) :=
35
+ .ofRepr
36
+ ((mapRange.linearEquiv fun i => (b i).repr).trans (sigmaFinsuppLequivDFinsupp R).symm)
37
+
38
+ variable (R M) in
39
+ instance _root_.Module.Free.dfinsupp [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
40
+ .of_basis <| DFinsupp.basis fun i => Module.Free.chooseBasis R (M i)
41
+
42
+ variable [DecidableEq ι] {φ : ι → Type *} (f : ∀ i, φ i → M i)
43
+
44
+ open Finsupp (linearCombination)
45
+
46
+ theorem linearIndependent_single (hf : ∀ i, LinearIndependent R (f i)) :
47
+ LinearIndependent R fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 ) := by
48
+ classical
49
+ have : linearCombination R (fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 )) =
50
+ DFinsupp.mapRange.linearMap (fun i ↦ linearCombination R (f i)) ∘ₗ
51
+ (sigmaFinsuppLequivDFinsupp R).toLinearMap := by ext; simp
52
+ rw [LinearIndependent, this]
53
+ exact ((DFinsupp.mapRange_injective _ fun _ ↦ map_zero _).mpr hf).comp (Equiv.injective _)
54
+
55
+ lemma linearIndependent_single_iff :
56
+ LinearIndependent R (fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 )) ↔
57
+ ∀ i, LinearIndependent R (f i) :=
58
+ ⟨fun h i ↦ (h.comp _ sigma_mk_injective).of_comp (lsingle i), linearIndependent_single _⟩
59
+
60
+ end DFinsupp
61
+
25
62
namespace Finsupp
26
63
27
64
section Semiring
28
65
29
66
variable {R : Type *} {M : Type *} {ι : Type *}
30
67
variable [Semiring R] [AddCommMonoid M] [Module R M]
31
68
32
- theorem linearIndependent_single {φ : ι → Type *} (f : ∀ ι , φ ι → M)
69
+ theorem linearIndependent_single {φ : ι → Type *} (f : ∀ i , φ i → M)
33
70
(hf : ∀ i, LinearIndependent R (f i)) :
34
71
LinearIndependent R fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 ) := by
35
72
classical
36
- have : linearCombination R (fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 )) =
37
- (finsuppLequivDFinsupp R).symm.toLinearMap ∘ₗ
38
- DFinsupp.mapRange.linearMap (fun i ↦ linearCombination R (f i)) ∘ₗ
39
- (sigmaFinsuppLequivDFinsupp R).toLinearMap := by ext; simp
40
- rw [LinearIndependent, this]
41
- exact (finsuppLequivDFinsupp R).symm.injective.comp <|
42
- ((DFinsupp.mapRange_injective _ fun _ ↦ map_zero _).mpr hf).comp (Equiv.injective _)
73
+ convert (DFinsupp.linearIndependent_single _ hf).map_injOn
74
+ _ (finsuppLequivDFinsupp R).symm.injective.injOn
75
+ simp
43
76
44
- lemma linearIndependent_single_iff {φ : ι → Type *} {f : ∀ ι , φ ι → M} :
77
+ lemma linearIndependent_single_iff {φ : ι → Type *} {f : ∀ i , φ i → M} :
45
78
LinearIndependent R (fun ix : Σ i, φ i ↦ single ix.1 (f ix.1 ix.2 )) ↔
46
- ∀ i, LinearIndependent R (f i) := by
47
- refine ⟨fun h i => ?_, linearIndependent_single _⟩
48
- replace h := h.comp _ (sigma_mk_injective (i := i))
49
- exact .of_comp (Finsupp.lsingle i) h
79
+ ∀ i, LinearIndependent R (f i) :=
80
+ ⟨fun h i ↦ (h.comp _ sigma_mk_injective).of_comp (lsingle i), linearIndependent_single _⟩
50
81
51
82
open LinearMap Submodule
52
83
53
84
open scoped Classical in
54
85
/-- The basis on `ι →₀ M` with basis vectors `fun ⟨i, x⟩ ↦ single i (b i x)`. -/
55
- protected def basis {φ : ι → Type *} (b : ∀ i, Basis (φ i) R M) : Basis (Σi, φ i) R (ι →₀ M) :=
56
- Basis.ofRepr
57
- { toFun := fun g =>
58
- { toFun := fun ix => (b ix.1 ).repr (g ix.1 ) ix.2
59
- support := g.support.sigma fun i => ((b i).repr (g i)).support
60
- mem_support_toFun := fun ix => by
61
- simp only [Finset.mem_sigma, mem_support_iff, and_iff_right_iff_imp, Ne]
62
- intro b hg
63
- simp [hg] at b }
64
- invFun := fun g =>
65
- { toFun := fun i => (b i).repr.symm (g.comapDomain _ sigma_mk_injective.injOn)
66
- support := g.support.image Sigma.fst
67
- mem_support_toFun := fun i => by
68
- rw [Ne, ← (b i).repr.injective.eq_iff, (b i).repr.apply_symm_apply,
69
- DFunLike.ext_iff]
70
- simp only [exists_prop, LinearEquiv.map_zero, comapDomain_apply, zero_apply,
71
- exists_and_right, mem_support_iff, exists_eq_right, Sigma.exists, Finset.mem_image,
72
- not_forall] }
73
- left_inv := fun g => by
74
- ext i
75
- rw [← (b i).repr.injective.eq_iff]
76
- ext x
77
- simp only [coe_mk, LinearEquiv.apply_symm_apply, comapDomain_apply]
78
- right_inv := fun g => by
79
- ext ⟨i, x⟩
80
- simp only [coe_mk, LinearEquiv.apply_symm_apply, comapDomain_apply]
81
- map_add' := fun g h => by
82
- ext ⟨i, x⟩
83
- simp only [coe_mk, add_apply, LinearEquiv.map_add]
84
- map_smul' := fun c h => by
85
- ext ⟨i, x⟩
86
- simp only [coe_mk, smul_apply, LinearEquiv.map_smul, RingHom.id_apply] }
86
+ protected def basis {φ : ι → Type *} (b : ∀ i, Basis (φ i) R M) : Basis (Σ i, φ i) R (ι →₀ M) :=
87
+ .ofRepr <| (finsuppLequivDFinsupp R).trans <|
88
+ (DFinsupp.mapRange.linearEquiv fun i ↦ (b i).repr).trans (sigmaFinsuppLequivDFinsupp R).symm
87
89
88
90
@[simp]
89
91
theorem basis_repr {φ : ι → Type *} (b : ∀ i, Basis (φ i) R M) (g : ι →₀ M) (ix) :
@@ -95,7 +97,6 @@ theorem coe_basis {φ : ι → Type*} (b : ∀ i, Basis (φ i) R M) :
95
97
⇑(Finsupp.basis b) = fun ix : Σi, φ i => single ix.1 (b ix.1 ix.2 ) :=
96
98
funext fun ⟨i, x⟩ =>
97
99
Basis.apply_eq_iff.mpr <| by
98
- classical
99
100
ext ⟨j, y⟩
100
101
by_cases h : i = j
101
102
· cases h
@@ -136,24 +137,6 @@ end Ring
136
137
137
138
end Finsupp
138
139
139
- namespace DFinsupp
140
- variable {ι : Type *} {R : Type *} {M : ι → Type *}
141
- variable [Semiring R] [∀ i, AddCommMonoid (M i)] [∀ i, Module R (M i)]
142
-
143
- /-- The direct sum of free modules is free.
144
-
145
- Note that while this is stated for `DFinsupp` not `DirectSum`, the types are defeq. -/
146
- noncomputable def basis {η : ι → Type *} (b : ∀ i, Basis (η i) R (M i)) :
147
- Basis (Σi, η i) R (Π₀ i, M i) :=
148
- .ofRepr
149
- ((mapRange.linearEquiv fun i => (b i).repr).trans (sigmaFinsuppLequivDFinsupp R).symm)
150
-
151
- variable (R M) in
152
- instance _root_.Module.Free.dfinsupp [∀ i : ι, Module.Free R (M i)] : Module.Free R (Π₀ i, M i) :=
153
- .of_basis <| DFinsupp.basis fun i => Module.Free.chooseBasis R (M i)
154
-
155
- end DFinsupp
156
-
157
140
lemma Module.Free.trans {R S M : Type *} [CommSemiring R] [Semiring S] [Algebra R S]
158
141
[AddCommMonoid M] [Module R M] [Module S M] [IsScalarTower R S M] [Module.Free S M]
159
142
[Module.Free R S] : Module.Free R M :=
0 commit comments