@@ -3,10 +3,24 @@ Copyright (c) 2019 Kenny Lau. All rights reserved.
3
3
Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Kenny Lau
5
5
6
- Direct sum of abelian groups, indexed by a discrete type.
7
6
-/
8
7
import data.dfinsupp
9
8
9
+ /-!
10
+ # Direct sum
11
+
12
+ This file defines the direct sum of abelian groups, indexed by a discrete type.
13
+
14
+ ## Notation
15
+
16
+ `⨁ i, β i` is the n-ary direct sum `direct_sum`.
17
+ This notation is in the `direct_sum` locale, accessible after `open_locale direct_sum`.
18
+
19
+ ## References
20
+
21
+ * https://en.wikipedia.org/wiki/Direct_sum
22
+ -/
23
+
10
24
open_locale big_operators
11
25
12
26
universes u v w u₁
@@ -15,20 +29,22 @@ variables (ι : Type v) [decidable_eq ι] (β : ι → Type w) [Π i, add_comm_g
15
29
16
30
def direct_sum : Type * := Π₀ i, β i
17
31
32
+ localized " notation `⨁` binders `, ` r:(scoped f, direct_sum _ f) := r" in direct_sum
33
+
18
34
namespace direct_sum
19
35
20
36
variables {ι β}
21
37
22
- instance : add_comm_group (direct_sum ι β ) :=
38
+ instance : add_comm_group (⨁ i, β i ) :=
23
39
dfinsupp.add_comm_group
24
40
25
- instance : inhabited (direct_sum ι β ) := ⟨0 ⟩
41
+ instance : inhabited (⨁ i, β i ) := ⟨0 ⟩
26
42
27
43
variables β
28
- def mk : Π s : finset ι, (Π i : (↑s : set ι), β i.1 ) → direct_sum ι β :=
44
+ def mk : Π s : finset ι, (Π i : (↑s : set ι), β i.1 ) → ⨁ i, β i :=
29
45
dfinsupp.mk
30
46
31
- def of : Π i : ι, β i → direct_sum ι β :=
47
+ def of : Π i : ι, β i → ⨁ i, β i :=
32
48
dfinsupp.single
33
49
variables {β}
34
50
@@ -69,8 +85,8 @@ theorem of_injective (i : ι) : function.injective (of β i) :=
69
85
λ x y H, congr_fun (mk_injective _ H) ⟨i, by simp⟩
70
86
71
87
@[elab_as_eliminator]
72
- protected theorem induction_on {C : direct_sum ι β → Prop }
73
- (x : direct_sum ι β ) (H_zero : C 0 )
88
+ protected theorem induction_on {C : (⨁ i, β i) → Prop }
89
+ (x : ⨁ i, β i ) (H_zero : C 0 )
74
90
(H_basic : ∀ (i : ι) (x : β i), C (of β i x))
75
91
(H_plus : ∀ x y, C x → C y → C (x + y)) : C x :=
76
92
begin
@@ -83,7 +99,7 @@ variables {γ : Type u₁} [add_comm_group γ]
83
99
variables (φ : Π i, β i → γ) [Π i, is_add_group_hom (φ i)]
84
100
85
101
variables (φ)
86
- def to_group (f : direct_sum ι β ) : γ :=
102
+ def to_group (f : ⨁ i, β i ) : γ :=
87
103
quotient.lift_on f (λ x, ∑ i in x.2 .to_finset, φ i (x.1 i)) $ λ x y H,
88
104
begin
89
105
have H1 : x.2 .to_finset ∩ y.2 .to_finset ⊆ x.2 .to_finset, from finset.inter_subset_left _ _,
@@ -135,9 +151,9 @@ is_add_group_hom.map_sub _ x y
135
151
(add_zero _).trans $ congr_arg (φ i) $ show (if H : i ∈ ({i} : finset _) then x else 0 ) = x,
136
152
from dif_pos $ finset.mem_singleton_self i
137
153
138
- variables (ψ : direct_sum ι β → γ) [is_add_group_hom ψ]
154
+ variables (ψ : (⨁ i, β i) → γ) [is_add_group_hom ψ]
139
155
140
- theorem to_group.unique (f : direct_sum ι β ) :
156
+ theorem to_group.unique (f : ⨁ i, β i ) :
141
157
ψ f = @to_group _ _ _ _ _ _ (λ i, ψ ∘ of β i) (λ i, is_add_group_hom.comp (of β i) ψ) f :=
142
158
by haveI : ∀ i, is_add_group_hom (ψ ∘ of β i) := (λ _, is_add_group_hom.comp _ _); exact
143
159
direct_sum.induction_on f
@@ -147,14 +163,14 @@ direct_sum.induction_on f
147
163
148
164
variables (β)
149
165
def set_to_set (S T : set ι) (H : S ⊆ T) :
150
- direct_sum S (β ∘ subtype.val ) → direct_sum T (β ∘ subtype.val ) :=
166
+ (⨁ (i : S), β i ) → (⨁ (i : T), β i ) :=
151
167
to_group $ λ i, of (β ∘ @subtype.val _ T) ⟨i.1 , H i.2 ⟩
152
168
variables {β}
153
169
154
170
instance (S T : set ι) (H : S ⊆ T) : is_add_group_hom (set_to_set β S T H) :=
155
171
to_group.is_add_group_hom
156
172
157
- protected def id (M : Type v) [add_comm_group M] : direct_sum punit (λ _ , M) ≃ M :=
173
+ protected def id (M : Type v) [add_comm_group M] : (⨁ (_ : punit) , M) ≃ M :=
158
174
{ to_fun := direct_sum.to_group (λ _, id),
159
175
inv_fun := of (λ _, M) punit.star,
160
176
left_inv := λ x, direct_sum.induction_on x
@@ -163,7 +179,7 @@ protected def id (M : Type v) [add_comm_group M] : direct_sum punit (λ _, M)
163
179
(λ x y ihx ihy, by rw [to_group_add, of_add, ihx, ihy]),
164
180
right_inv := λ x, to_group_of _ _ _ }
165
181
166
- instance : has_coe_to_fun (direct_sum ι β ) :=
182
+ instance : has_coe_to_fun (⨁ i, β i ) :=
167
183
dfinsupp.has_coe_to_fun
168
184
169
185
end direct_sum
0 commit comments