@@ -25,20 +25,34 @@ open_locale big_operators
25
25
26
26
universes u v w u₁
27
27
28
- variables (ι : Type v) [dec_ι : decidable_eq ι] (β : ι → Type w) [Π i, add_comm_group (β i)]
28
+ variables (ι : Type v) [dec_ι : decidable_eq ι] (β : ι → Type w)
29
29
30
- /-- `direct_sum β` is the direct sum of a family of additive commutative groups `β i`.
30
+ /-- `direct_sum β` is the direct sum of a family of additive commutative monoids `β i`.
31
31
32
32
Note: `open_locale direct_sum` will enable the notation `⨁ i, β i` for `direct_sum β`. -/
33
- @[derive [has_coe_to_fun, add_comm_group , inhabited] ]
34
- def direct_sum : Type * := Π₀ i, β i
33
+ @[derive [has_coe_to_fun, add_comm_monoid , inhabited] ]
34
+ def direct_sum [Π i, add_comm_monoid (β i)] : Type * := Π₀ i, β i
35
35
36
36
localized " notation `⨁` binders `, ` r:(scoped f, direct_sum _ f) := r" in direct_sum
37
37
38
38
namespace direct_sum
39
39
40
40
variables {ι}
41
41
42
+ section add_comm_group
43
+
44
+ variables [Π i, add_comm_group (β i)]
45
+
46
+ instance : add_comm_group (direct_sum ι β) := dfinsupp.add_comm_group
47
+
48
+ variables {β}
49
+ @[simp] lemma sub_apply (g₁ g₂ : ⨁ i, β i) (i : ι) : (g₁ - g₂) i = g₁ i - g₂ i :=
50
+ dfinsupp.sub_apply _ _ _
51
+
52
+ end add_comm_group
53
+
54
+ variables [Π i, add_comm_monoid (β i)]
55
+
42
56
@[simp] lemma zero_apply (i : ι) : (0 : ⨁ i, β i) i = 0 := rfl
43
57
44
58
variables {β}
@@ -80,13 +94,13 @@ begin
80
94
solve_by_elim
81
95
end
82
96
83
- variables {γ : Type u₁} [add_comm_group γ]
97
+ variables {γ : Type u₁} [add_comm_monoid γ]
84
98
variables (φ : Π i, β i →+ γ)
85
99
86
100
variables (φ)
87
- /-- `to_group φ` is the natural homomorphism from `⨁ i, β i` to `γ`
101
+ /-- `to_add_monoid φ` is the natural homomorphism from `⨁ i, β i` to `γ`
88
102
induced by a family `φ` of homomorphisms `β i → γ`. -/
89
- def to_group : (⨁ i, β i) →+ γ :=
103
+ def to_add_monoid : (⨁ i, β i) →+ γ :=
90
104
{ to_fun := (λ f,
91
105
quotient.lift_on f (λ x, ∑ i in x.2 .to_finset, φ i (x.1 i)) $ λ x y H,
92
106
begin
@@ -121,17 +135,17 @@ def to_group : (⨁ i, β i) →+ γ :=
121
135
map_zero' := rfl
122
136
}
123
137
124
- @[simp] lemma to_group_of (i) (x : β i) : to_group φ (of β i x) = φ i x :=
138
+ @[simp] lemma to_add_monoid_of (i) (x : β i) : to_add_monoid φ (of β i x) = φ i x :=
125
139
(add_zero _).trans $ congr_arg (φ i) $ show (if H : i ∈ ({i} : finset _) then x else 0 ) = x,
126
140
from dif_pos $ finset.mem_singleton_self i
127
141
128
142
variables (ψ : (⨁ i, β i) →+ γ)
129
143
130
- theorem to_group .unique (f : ⨁ i, β i) :
131
- ψ f = to_group (λ i, ψ.comp (of β i)) f :=
144
+ theorem to_add_monoid .unique (f : ⨁ i, β i) :
145
+ ψ f = to_add_monoid (λ i, ψ.comp (of β i)) f :=
132
146
direct_sum.induction_on f
133
147
(by rw [add_monoid_hom.map_zero, add_monoid_hom.map_zero])
134
- (λ i x, by rw [to_group_of , add_monoid_hom.comp_apply])
148
+ (λ i x, by rw [to_add_monoid_of , add_monoid_hom.comp_apply])
135
149
(λ x y ihx ihy, by rw [add_monoid_hom.map_add, add_monoid_hom.map_add, ihx, ihy])
136
150
137
151
variables (β)
@@ -140,21 +154,21 @@ where `h : S ⊆ T`. -/
140
154
-- TODO: generalize this to remove the assumption `S ⊆ T`.
141
155
def set_to_set (S T : set ι) (H : S ⊆ T) :
142
156
(⨁ (i : S), β i) →+ (⨁ (i : T), β i) :=
143
- to_group $ λ i, of (λ (i : subtype T), β i) ⟨↑i, H i.prop⟩
157
+ to_add_monoid $ λ i, of (λ (i : subtype T), β i) ⟨↑i, H i.prop⟩
144
158
variables {β}
145
159
146
160
omit dec_ι
147
161
148
162
/-- The natural equivalence between `⨁ _ : ι, M` and `M` when `unique ι`. -/
149
- protected def id (M : Type v) (ι : Type * := punit) [add_comm_group M] [unique ι] :
163
+ protected def id (M : Type v) (ι : Type * := punit) [add_comm_monoid M] [unique ι] :
150
164
(⨁ (_ : ι), M) ≃+ M :=
151
- { to_fun := direct_sum.to_group (λ _, add_monoid_hom.id M),
165
+ { to_fun := direct_sum.to_add_monoid (λ _, add_monoid_hom.id M),
152
166
inv_fun := of (λ _, M) (default ι),
153
167
left_inv := λ x, direct_sum.induction_on x
154
168
(by rw [add_monoid_hom.map_zero, add_monoid_hom.map_zero])
155
- (λ p x, by rw [unique.default_eq p, to_group_of ]; refl)
169
+ (λ p x, by rw [unique.default_eq p, to_add_monoid_of ]; refl)
156
170
(λ x y ihx ihy, by rw [add_monoid_hom.map_add, add_monoid_hom.map_add, ihx, ihy]),
157
- right_inv := λ x, to_group_of _ _ _,
158
- ..direct_sum.to_group (λ _, add_monoid_hom.id M) }
171
+ right_inv := λ x, to_add_monoid_of _ _ _,
172
+ ..direct_sum.to_add_monoid (λ _, add_monoid_hom.id M) }
159
173
160
174
end direct_sum
0 commit comments