-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathSingle.lean
More file actions
316 lines (260 loc) · 10.6 KB
/
Single.lean
File metadata and controls
316 lines (260 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/-
Copyright (c) 2021 Kim Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kim Morrison
-/
import Mathlib.Algebra.Homology.HomologicalComplex
/-!
# Homological complexes supported in a single degree
We define `single V j c : V ⥤ HomologicalComplex V c`,
which constructs complexes in `V` of shape `c`, supported in degree `j`.
In `ChainComplex.toSingle₀Equiv` we characterize chain maps to an
`ℕ`-indexed complex concentrated in degree 0; they are equivalent to
`{ f : C.X 0 ⟶ X // C.d 1 0 ≫ f = 0 }`.
(This is useful translating between a projective resolution and
an augmented exact complex of projectives.)
-/
open CategoryTheory Category Limits ZeroObject
universe v u
variable (V : Type u) [Category.{v} V] [HasZeroMorphisms V] [HasZeroObject V]
namespace HomologicalComplex
variable {ι : Type*} [DecidableEq ι] (c : ComplexShape ι)
/-- The functor `V ⥤ HomologicalComplex V c` creating a chain complex supported in a single degree.
-/
noncomputable def single (j : ι) : V ⥤ HomologicalComplex V c where
obj A :=
{ X := fun i => if i = j then A else 0
d := fun _ _ => 0 }
map f :=
{ f := fun i => if h : i = j then eqToHom (by dsimp; rw [if_pos h]) ≫ f ≫
eqToHom (by dsimp; rw [if_pos h]) else 0 }
map_id A := by
ext
dsimp
split_ifs with h
· subst h
simp
· change OfNat.ofNat 0 = _; dsimp only [id_eq]; rw [if_neg h, id_zero]
map_comp f g := by
ext
dsimp
split_ifs with h
· subst h
simp
· simp
variable {V}
@[simp]
lemma single_obj_X_self (j : ι) (A : V) :
((single V c j).obj A).X j = A := if_pos rfl
lemma isZero_single_obj_X (j : ι) (A : V) (i : ι) (hi : i ≠ j) :
IsZero (((single V c j).obj A).X i) := by
dsimp [single]
rw [if_neg hi]
exact Limits.isZero_zero V
/-- The object in degree `i` of `(single V c h).obj A` is just `A` when `i = j`. -/
noncomputable def singleObjXIsoOfEq (j : ι) (A : V) (i : ι) (hi : i = j) :
((single V c j).obj A).X i ≅ A :=
eqToIso (by subst hi; simp [single])
/-- The object in degree `j` of `(single V c h).obj A` is just `A`. -/
noncomputable def singleObjXSelf (j : ι) (A : V) : ((single V c j).obj A).X j ≅ A :=
singleObjXIsoOfEq c j A j rfl
@[simp]
lemma single_obj_d (j : ι) (A : V) (k l : ι) :
((single V c j).obj A).d k l = 0 := rfl
@[reassoc]
theorem single_map_f_self (j : ι) {A B : V} (f : A ⟶ B) :
((single V c j).map f).f j = (singleObjXSelf c j A).hom ≫
f ≫ (singleObjXSelf c j B).inv := by
dsimp [single]
rw [dif_pos rfl]
rfl
variable (V)
/-- The natural isomorphism `single V c j ⋙ eval V c j ≅ 𝟭 V`. -/
@[simps!]
noncomputable def singleCompEvalIsoSelf (j : ι) : single V c j ⋙ eval V c j ≅ 𝟭 V :=
NatIso.ofComponents (singleObjXSelf c j) (fun {A B} f => by simp [single_map_f_self])
lemma isZero_single_comp_eval (j i : ι) (hi : i ≠ j) : IsZero (single V c j ⋙ eval V c i) :=
Functor.isZero _ (fun _ ↦ isZero_single_obj_X c _ _ _ hi)
variable {V c}
@[ext]
lemma from_single_hom_ext {K : HomologicalComplex V c} {j : ι} {A : V}
{f g : (single V c j).obj A ⟶ K} (hfg : f.f j = g.f j) : f = g := by
ext i
by_cases h : i = j
· subst h
exact hfg
· apply (isZero_single_obj_X c j A i h).eq_of_src
@[ext]
lemma to_single_hom_ext {K : HomologicalComplex V c} {j : ι} {A : V}
{f g : K ⟶ (single V c j).obj A} (hfg : f.f j = g.f j) : f = g := by
ext i
by_cases h : i = j
· subst h
exact hfg
· apply (isZero_single_obj_X c j A i h).eq_of_tgt
instance (j : ι) : (single V c j).Faithful where
map_injective {A B f g} w := by
rw [← cancel_mono (singleObjXSelf c j B).inv,
← cancel_epi (singleObjXSelf c j A).hom, ← single_map_f_self,
← single_map_f_self, w]
instance (j : ι) : (single V c j).Full where
map_surjective {A B} f :=
⟨(singleObjXSelf c j A).inv ≫ f.f j ≫ (singleObjXSelf c j B).hom, by
ext
simp [single_map_f_self]⟩
/-- Constructor for morphisms to a single homological complex. -/
noncomputable def mkHomToSingle {K : HomologicalComplex V c} {j : ι} {A : V} (φ : K.X j ⟶ A)
(hφ : ∀ (i : ι), c.Rel i j → K.d i j ≫ φ = 0) :
K ⟶ (single V c j).obj A where
f i :=
if hi : i = j
then (K.XIsoOfEq hi).hom ≫ φ ≫ (singleObjXIsoOfEq c j A i hi).inv
else 0
comm' i k hik := by
dsimp
rw [comp_zero]
split_ifs with hk
· subst hk
simp only [XIsoOfEq_rfl, Iso.refl_hom, id_comp, reassoc_of% hφ i hik, zero_comp]
· apply (isZero_single_obj_X c j A k hk).eq_of_tgt
@[simp]
lemma mkHomToSingle_f {K : HomologicalComplex V c} {j : ι} {A : V} (φ : K.X j ⟶ A)
(hφ : ∀ (i : ι), c.Rel i j → K.d i j ≫ φ = 0) :
(mkHomToSingle φ hφ).f j = φ ≫ (singleObjXSelf c j A).inv := by
dsimp [mkHomToSingle]
rw [dif_pos rfl, id_comp]
rfl
/-- Constructor for morphisms from a single homological complex. -/
noncomputable def mkHomFromSingle {K : HomologicalComplex V c} {j : ι} {A : V} (φ : A ⟶ K.X j)
(hφ : ∀ (k : ι), c.Rel j k → φ ≫ K.d j k = 0) :
(single V c j).obj A ⟶ K where
f i :=
if hi : i = j
then (singleObjXIsoOfEq c j A i hi).hom ≫ φ ≫ (K.XIsoOfEq hi).inv
else 0
comm' i k hik := by
dsimp
rw [zero_comp]
split_ifs with hi
· subst hi
simp only [XIsoOfEq_rfl, Iso.refl_inv, comp_id, assoc, hφ k hik, comp_zero]
· apply (isZero_single_obj_X c j A i hi).eq_of_src
@[simp]
lemma mkHomFromSingle_f {K : HomologicalComplex V c} {j : ι} {A : V} (φ : A ⟶ K.X j)
(hφ : ∀ (k : ι), c.Rel j k → φ ≫ K.d j k = 0) :
(mkHomFromSingle φ hφ).f j = (singleObjXSelf c j A).hom ≫ φ := by
dsimp [mkHomFromSingle]
rw [dif_pos rfl, comp_id]
rfl
instance (j : ι) : (single V c j).PreservesZeroMorphisms where
end HomologicalComplex
namespace ChainComplex
/-- The functor `V ⥤ ChainComplex V ℕ` creating a chain complex supported in degree zero. -/
noncomputable abbrev single₀ : V ⥤ ChainComplex V ℕ :=
HomologicalComplex.single V (ComplexShape.down ℕ) 0
variable {V}
@[simp]
lemma single₀_obj_zero (A : V) :
((single₀ V).obj A).X 0 = A := rfl
@[simp]
lemma single₀_map_f_zero {A B : V} (f : A ⟶ B) :
((single₀ V).map f).f 0 = f := by
rw [HomologicalComplex.single_map_f_self]
dsimp [HomologicalComplex.singleObjXSelf, HomologicalComplex.singleObjXIsoOfEq]
rw [comp_id, id_comp]
@[simp]
lemma single₀ObjXSelf (X : V) :
HomologicalComplex.singleObjXSelf (ComplexShape.down ℕ) 0 X = Iso.refl _ := rfl
/-- Morphisms from an `ℕ`-indexed chain complex `C`
to a single object chain complex with `X` concentrated in degree 0
are the same as morphisms `f : C.X 0 ⟶ X` such that `C.d 1 0 ≫ f = 0`.
-/
@[simps apply_coe]
noncomputable def toSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
(C ⟶ (single₀ V).obj X) ≃ { f : C.X 0 ⟶ X // C.d 1 0 ≫ f = 0 } where
toFun φ := ⟨φ.f 0, by rw [← φ.comm 1 0, HomologicalComplex.single_obj_d, comp_zero]⟩
invFun f := HomologicalComplex.mkHomToSingle f.1 (fun i hi => by
obtain rfl : i = 1 := by simpa using hi.symm
exact f.2)
left_inv φ := by aesop_cat
right_inv f := by simp
@[simp]
lemma toSingle₀Equiv_symm_apply_f_zero {C : ChainComplex V ℕ} {X : V}
(f : C.X 0 ⟶ X) (hf : C.d 1 0 ≫ f = 0) :
((toSingle₀Equiv C X).symm ⟨f, hf⟩).f 0 = f := by
simp [toSingle₀Equiv]
/-- Morphisms from a single object chain complex with `X` concentrated in degree 0
to an `ℕ`-indexed chain complex `C` are the same as morphisms `f : X → C.X 0`.
-/
@[simps apply]
noncomputable def fromSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
((single₀ V).obj X ⟶ C) ≃ (X ⟶ C.X 0) where
toFun f := f.f 0
invFun f := HomologicalComplex.mkHomFromSingle f (fun i hi => by simp at hi)
left_inv := by aesop_cat
right_inv := by aesop_cat
@[simp]
lemma fromSingle₀Equiv_symm_apply_f_zero
{C : ChainComplex V ℕ} {X : V} (f : X ⟶ C.X 0) :
((fromSingle₀Equiv C X).symm f).f 0 = f := by
simp [fromSingle₀Equiv]
@[simp]
lemma fromSingle₀Equiv_symm_apply_f_succ
{C : ChainComplex V ℕ} {X : V} (f : X ⟶ C.X 0) (n : ℕ) :
((fromSingle₀Equiv C X).symm f).f (n + 1) = 0 := rfl
end ChainComplex
namespace CochainComplex
/-- The functor `V ⥤ CochainComplex V ℕ` creating a cochain complex supported in degree zero. -/
noncomputable abbrev single₀ : V ⥤ CochainComplex V ℕ :=
HomologicalComplex.single V (ComplexShape.up ℕ) 0
variable {V}
@[simp]
lemma single₀_obj_zero (A : V) :
((single₀ V).obj A).X 0 = A := rfl
@[simp]
lemma single₀_map_f_zero {A B : V} (f : A ⟶ B) :
((single₀ V).map f).f 0 = f := by
rw [HomologicalComplex.single_map_f_self]
dsimp [HomologicalComplex.singleObjXSelf, HomologicalComplex.singleObjXIsoOfEq]
rw [comp_id, id_comp]
@[simp]
lemma single₀ObjXSelf (X : V) :
HomologicalComplex.singleObjXSelf (ComplexShape.up ℕ) 0 X = Iso.refl _ := rfl
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
obtain rfl : i = 1 := by simpa using hi.symm
exact f.2)
left_inv φ := by aesop_cat
right_inv := by aesop_cat
@[simp]
lemma fromSingle₀Equiv_symm_apply_f_zero {C : CochainComplex V ℕ} {X : V}
(f : X ⟶ C.X 0) (hf : f ≫ C.d 0 1 = 0) :
((fromSingle₀Equiv C X).symm ⟨f, hf⟩).f 0 = f := by
simp [fromSingle₀Equiv]
/-- Morphisms to a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C` are the same as morphisms `f : C.X 0 ⟶ X`.
-/
@[simps apply]
noncomputable def toSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
(C ⟶ (single₀ V).obj X) ≃ (C.X 0 ⟶ X) where
toFun f := f.f 0
invFun f := HomologicalComplex.mkHomToSingle f (fun i hi => by simp at hi)
left_inv := by aesop_cat
right_inv := by aesop_cat
@[simp]
lemma toSingle₀Equiv_symm_apply_f_zero
{C : CochainComplex V ℕ} {X : V} (f : C.X 0 ⟶ X) :
((toSingle₀Equiv C X).symm f).f 0 = f := by
simp [toSingle₀Equiv]
@[simp]
lemma toSingle₀Equiv_symm_apply_f_succ
{C : CochainComplex V ℕ} {X : V} (f : C.X 0 ⟶ X) (n : ℕ) :
((toSingle₀Equiv C X).symm f).f (n + 1) = 0 := by
rfl
end CochainComplex