-
Notifications
You must be signed in to change notification settings - Fork 12
/
Ext.lean
447 lines (388 loc) Β· 17.3 KB
/
Ext.lean
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
import for_mathlib.endomorphisms.basic
import for_mathlib.derived.les_facts
import for_mathlib.additive_functor
noncomputable theory
universes v u
open category_theory category_theory.limits opposite
open bounded_homotopy_category
namespace homological_complex
variables {π : Type u} [category.{v} π] [abelian π]
variables {ΞΉ : Type*} {c : complex_shape ΞΉ}
def e (X : homological_complex (endomorphisms π) c) :
End (((endomorphisms.forget π).map_homological_complex c).obj X) :=
{ f := Ξ» i, (X.X i).e,
comm' := Ξ» i j hij, (X.d i j).comm }
def mk_end (X : homological_complex π c) (f : X βΆ X) :
homological_complex (endomorphisms π) c :=
{ X := Ξ» i, β¨X.X i, f.f iβ©,
d := Ξ» i j, β¨X.d i j, f.comm i jβ©,
shape' := by { intros i j h, ext, apply X.shape i j h },
d_comp_d' := by { intros, ext, apply X.d_comp_d } }
end homological_complex
namespace homotopy_category
variables {π : Type u} [category.{v} π] [abelian π]
variables {π : Type*} [category π] [abelian π]
variables (F : π β₯€ π) [functor.additive F]
instance map_homotopy_category_is_bounded_above
(X : homotopy_category π $ complex_shape.up β€) [X.is_bounded_above] :
((F.map_homotopy_category _).obj X).is_bounded_above :=
begin
obtain β¨b, hbβ© := is_bounded_above.cond X,
exact β¨β¨b, Ξ» i hi, category_theory.functor.map_is_zero _ (hb i hi)β©β©,
end
end homotopy_category
namespace bounded_homotopy_category
variables {π : Type u} [category.{v} π] [abelian π]
variables [has_coproducts_of_shape (ulift.{v} β) π]
variables [has_products_of_shape (ulift.{v} β) π]
variables (X : bounded_homotopy_category (endomorphisms π))
/-- `unEnd` is the "forget the endomorphism" map from the category whose objects are complexes
of pairs `(Aβ±,eβ±)` with morphisms defined up to homotopy, to the category whose objects are
complexes of objects `Aβ±` with morphisms defined up to homotopy. -/
def unEnd : bounded_homotopy_category π :=
of $ ((endomorphisms.forget _).map_homotopy_category _).obj X.val
def e : End X.unEnd := (homotopy_category.quotient _ _).map $ X.val.as.e
end bounded_homotopy_category
namespace category_theory
section
variables {C : Type*} [category C] {X Y Z : C} (f : X βΆ Y) (g : Y βΆ Z)
lemma is_iso.comp_right_iff [is_iso g] : is_iso (f β« g) β is_iso f :=
begin
split; introI h,
{ have : is_iso ((f β« g) β« inv g), { apply_instance },
simpa only [category.assoc, is_iso.hom_inv_id, category.comp_id] },
{ apply_instance }
end
lemma is_iso.comp_left_iff [is_iso f] : is_iso (f β« g) β is_iso g :=
begin
split; introI h,
{ have : is_iso (inv f β« (f β« g)), { apply_instance },
simpa only [category.assoc, is_iso.inv_hom_id_assoc] },
{ apply_instance }
end
end
namespace endomorphisms
variables {π : Type u} [category.{v} π] [abelian π] [enough_projectives π]
variables [has_coproducts_of_shape (ulift.{v} β) π]
variables [has_products_of_shape (ulift.{v} β) π]
def mk_bo_ho_ca' (X : cochain_complex π β€)
[((homotopy_category.quotient π (complex_shape.up β€)).obj X).is_bounded_above] (f : X βΆ X) :
bounded_homotopy_category (endomorphisms π) :=
{ val := { as :=
{ X := Ξ» i, β¨X.X i, f.f iβ©,
d := Ξ» i j, β¨X.d i j, f.comm _ _β©,
shape' := Ξ» i j h, by { ext, exact X.shape i j h, },
d_comp_d' := Ξ» i j k hij hjk, by { ext, apply homological_complex.d_comp_d } } },
bdd := begin
obtain β¨a, haβ© := homotopy_category.is_bounded_above.cond ((homotopy_category.quotient π (complex_shape.up β€)).obj X),
refine β¨β¨a, Ξ» i hi, _β©β©,
rw is_zero_iff_id_eq_zero, ext, dsimp, rw β is_zero_iff_id_eq_zero,
exact ha i hi,
end }
def mk_bo_ho_ca (X : bounded_homotopy_category π) (f : X βΆ X) :
bounded_homotopy_category (endomorphisms π) :=
@mk_bo_ho_ca' _ _ _ _ _ _ X.val.as (by { cases X with X hX, cases X, exact hX }) f.out
.
lemma quot_out_single_map {X Y : π} (f : X βΆ Y) (i : β€) :
((homotopy_category.single π i).map f).out = (homological_complex.single π _ i).map f :=
begin
have h := homotopy_category.homotopy_out_map
((homological_complex.single π (complex_shape.up β€) i).map f),
ext k,
erw h.comm k,
suffices : (d_next k) h.hom + (prev_d k) h.hom = 0, { rw [this, zero_add] },
obtain (hki|rfl) := ne_or_eq k i,
{ apply limits.is_zero.eq_of_src,
show is_zero (ite (k = i) X _), rw [if_neg hki], apply is_zero_zero },
{ have hk1 : (complex_shape.up β€).rel (k-1) k := sub_add_cancel _ _,
have hk2 : (complex_shape.up β€).rel k (k+1) := rfl,
rw [prev_d_eq _ hk1, d_next_eq _ hk2],
have aux1 : h.hom (k + 1) k = 0,
{ apply limits.is_zero.eq_of_src, show is_zero (ite _ X _), rw if_neg, apply is_zero_zero,
linarith },
have aux2 : h.hom k (k - 1) = 0,
{ apply limits.is_zero.eq_of_tgt, show is_zero (ite _ Y _), rw if_neg, apply is_zero_zero,
linarith },
rw [aux1, aux2, comp_zero, zero_comp, add_zero], }
end
def mk_bo_ha_ca'_single (X : π) (f : X βΆ X) :
mk_bo_ho_ca' ((homological_complex.single _ _ 0).obj X) (functor.map _ f) β
(single _ 0).obj β¨X, fβ© :=
bounded_homotopy_category.mk_iso
begin
refine (homotopy_category.quotient _ _).map_iso _,
refine homological_complex.hom.iso_of_components _ _,
{ intro i,
refine endomorphisms.mk_iso _ _,
{ dsimp, split_ifs, { exact iso.refl _ },
{ refine (is_zero_zero _).iso _, apply endomorphisms.is_zero_X,
exact is_zero_zero (endomorphisms π), } },
{ dsimp, split_ifs with hi,
{ subst i, dsimp, erw [iso.refl_hom], simp only [category.id_comp, category.comp_id],
convert rfl, },
{ apply is_zero.eq_of_src, rw [if_neg hi], exact is_zero_zero _ } } },
{ rintro i j (rfl : _ = _),
by_cases hi : i = 0,
{ apply is_zero.eq_of_tgt, dsimp, rw [if_neg], exact is_zero_zero _, linarith only [hi] },
{ apply is_zero.eq_of_src, dsimp, rw [is_zero_iff_id_eq_zero], ext, dsimp, rw [if_neg hi],
apply (is_zero_zero _).eq_of_src } }
end
def mk_bo_ha_ca_single (X : π) (f : X βΆ X) :
mk_bo_ho_ca ((single _ 0).obj X) ((single _ 0).map f) β
(single _ 0).obj β¨X, fβ© :=
bounded_homotopy_category.mk_iso
begin
dsimp only [mk_bo_ho_ca, single],
refine (homotopy_category.quotient _ _).map_iso _,
refine homological_complex.hom.iso_of_components _ _,
{ intro i,
refine endomorphisms.mk_iso _ _,
{ dsimp, split_ifs, { exact iso.refl _ },
{ refine (is_zero_zero _).iso _, apply endomorphisms.is_zero_X,
exact is_zero_zero (endomorphisms π), } },
{ dsimp, erw quot_out_single_map, dsimp, split_ifs with hi,
{ subst i, dsimp, erw [iso.refl_hom], simp only [category.id_comp, category.comp_id],
convert rfl, },
{ apply is_zero.eq_of_src, rw [if_neg hi], exact is_zero_zero _ } } },
{ rintro i j (rfl : _ = _),
by_cases hi : i = 0,
{ apply is_zero.eq_of_tgt, dsimp, rw [if_neg], exact is_zero_zero _, linarith only [hi] },
{ apply is_zero.eq_of_src, dsimp, rw [is_zero_iff_id_eq_zero], ext, dsimp, rw [if_neg hi],
apply (is_zero_zero _).eq_of_src } }
end
.
/-
Mathematical summary of the `Ext_is_zero_iff` `sorry` according to kmb's
possibly flawed understanding:
The lemma will follow from the following things:
1) If X is a complex in the bounded homotopy category
and Y is an object, thought of as a `single`
complex, then Extβ±(X,Y) is the homology of the complex
(Cα΅’) whose i'th term is Hom(Pβ±,Y), where P is a projective
replacement of X. This applies to both the category π
and to the endomorphism category. The reason is
that Extβ±(X,Y)=Hom(P,Yβ¦iβ§).
2) For a cleverly chosen choice of Pβ± (see `exists_K_projective_endomorphism_replacement`)
we have a short exact sequence of complexes
0 -> Hom_{endos}(Pβ±,Y) -> Hom(Pβ±,Y) -> Hom(Pβ±,Y)->0
where the surjection is e(P) - e(Y), with e the endomorphism.
This can be checked to be surjective via an explicit construction;
the trick is that Pβ± is going to be `free Q` for some object `Q : π`
-/
-- This is an approximation of the statement we need
-- for Pβ±. Hopefully this is what we need. I might need
-- to add extra things, hopefully not, but let's see
-- if it's enough to prove `Ext_is_zero_iff`.
-- Question: does `projective Q` imply `projective (free Q)`?
-- Adam says we have this in `endomorphisms/basic`.
lemma exists_K_projective_endomorphism_replacement
(X : bounded_homotopy_category (endomorphisms π)) :
β (P : bounded_homotopy_category (endomorphisms π))
(f : P βΆ X),
homotopy_category.is_K_projective P.val β§
homotopy_category.is_quasi_iso f
β§ (β j, β (Q : π) (i: P.val.as.X j β
free Q), projective Q)
-- β§ β k, projective (P.val.as.X k) -- should follow
-- β§ β k, projective (P.val.as.X k).X -- should follow
:= sorry
def K_projective_endomorphism_replacement (X : bounded_homotopy_category (endomorphisms π)) :=
(exists_K_projective_endomorphism_replacement X).some
/-
Next: make the complexes Hom_T(P^*,Y) and Hom(P^*,Y)
Next: make the SES
-/
/-
Idea : We need a short exact sequence of complexes as above, and then
the below follows from the associated long exact sequence
of cohomology.
* SES
* six_term_exact_seq
-/
lemma Ext_is_zero_iff (X : chain_complex π β) (Y : π)
(f : X βΆ X) (g : Y βΆ Y) :
(β i, is_zero (((Ext i).obj (op $ chain_complex.to_bounded_homotopy_category.obj (X.mk_end f))).obj $ (single _ 0).obj β¨Y, gβ©)) β
(β i, is_iso $ ((Ext i).map (chain_complex.to_bounded_homotopy_category.map f).op).app _ -
((Ext i).obj (op _)).map ((single _ 0).map g)) :=
begin
sorry,
end
-- this is an older version; there might be a couple of useful
-- things here. The first line is not right though, we can't
-- use `exists_K_projective_replacement`, the idea is
-- to use `exists_K_projective_endomorphism_replacement` instead.
/-
lemma Ext_is_zero_iff' (X Y : bounded_homotopy_category (endomorphisms π)) :
(β i, is_zero (((Ext i).obj (op $ X)).obj $ Y)) β
(β i, is_iso $
((Ext i).map (quiver.hom.op X.e)).app Y.unEnd - ((Ext i).obj (op X.unEnd)).map Y.e) :=
begin
-- update: this proof plan might well not work.
-- this might be refactored out
obtain β¨P, _inst, f, h1, h2β© := exists_K_projective_replacement X.unEnd,
resetI,
let fP := (functor.map_homological_complex (functor.free π) (complex_shape.up β€)).obj P.val.as,
obtain β¨N, hNβ© := P.bdd,
have hN' : β (i : β€), N β€ i β
is_zero (((homotopy_category.quotient (endomorphisms π) (complex_shape.up β€)).obj fP).as.X i),
{ exact Ξ» i hNi, (functor.free π).map_is_zero (hN i hNi), },
have hfPbdd : homotopy_category.is_bounded_above ((homotopy_category.quotient _ _).obj fP),
{ exact β¨β¨N, hN'β©β©, },
haveI hproj : β i, projective (fP.X i),
{ intro i,
apply free.projective, },
let fP' : bounded_homotopy_category (endomorphisms π) :=
{ val := (homotopy_category.quotient _ _).obj fP,
bdd := hfPbdd },
/-
* Then use an argument similar to the proof of this lemma
https://github.com/leanprover-community/lean-liquid/blob/0e192c63da9d578301d4ca75c778abe342f7474f/src/for_mathlib/derived/lemmas.lean#L536
to see that the complex you have obtained is a K_projective
replacement of A and of A.unEnd.
-/
haveI : ((homotopy_category.quotient _ _).obj fP).is_K_projective,
{ refine β¨_β©,
intros Y hY f,
convert homotopy_category.eq_of_homotopy _ _
(projective.null_homotopic_of_projective_to_acyclic f.out N hproj hN' hY.1),
{ simp }, },
/-
* Use Ext_iso to calculate both Ext(A,B) and Ext(A.unEnd, B.unEnd) with this replacement.
-/
end
-/
open_locale zero_object
def single_unEnd (X : endomorphisms π) : ((single _ 0).obj X).unEnd β
(single _ 0).obj X.X :=
{ hom := quot.mk _
{ f := Ξ» i, show (ite (i = 0) X 0).X βΆ ite (i = 0) X.X 0,
from if hi : i = 0 then eq_to_hom (by { simp only [if_pos hi] })
else 0,
comm' := begin
rintros i j _,
change _ β« 0 = 0 β« _, simp, end },
inv := quot.mk _ {
f := Ξ» i, show ite (i = 0) X.X 0 βΆ (ite (i = 0) X 0).X,
from if hi : i = 0 then eq_to_hom (by { simp only [if_pos hi] })
else 0,
comm' := begin
rintros i j (rfl : _ = _),
change _ β« 0 = 0 β« _, simp, end },
hom_inv_id' := begin
change quot.mk _ (_ β« _) = quot.mk _ _,
apply congr_arg,
ext i,
simp only [homological_complex.comp_f, homological_complex.id_f],
split_ifs,
{ simp },
{ rw [comp_zero, eq_comm, β limits.is_zero.iff_id_eq_zero],
change is_zero (ite (i = 0) X 0).X,
rw if_neg h,
apply is_zero_X,
apply is_zero_zero,
},
end,
inv_hom_id' := begin
change quot.mk _ (_ β« _) = quot.mk _ _,
apply congr_arg,
ext i,
simp only [homological_complex.comp_f, homological_complex.id_f],
split_ifs,
{ simp },
{ rw [comp_zero, eq_comm, β limits.is_zero.iff_id_eq_zero],
change is_zero (ite (i = 0) X.X 0),
rw if_neg h,
apply is_zero_zero, },
end }
lemma single_unEnd_e (X : endomorphisms π) :
(single_unEnd X).hom β« (single _ 0).map X.e = ((single _ 0).obj X).e β« (single_unEnd X).hom :=
begin
change quot.mk _ (_ β« _) = quot.mk _ _,
apply congr_arg,
ext i,
change dite _ _ _ β« dite _ _ _ = _ β« dite _ _ _,
split_ifs,
{ subst h,
rw [eq_to_hom_trans_assoc, β category.assoc],
congr',
simp,
refl, },
{ simp, },
end
lemma single_e (X : endomorphisms π) :
(single_unEnd X).hom β« (single _ 0).map X.e β« (single_unEnd X).inv = ((single _ 0).obj X).e :=
by rw [β category.assoc, iso.comp_inv_eq, single_unEnd_e]
open category_theory.preadditive
def embed_single (X : π) :
(homological_complex.embed complex_shape.embedding.nat_down_int_up).obj
((homological_complex.single π (complex_shape.down β) 0).obj X) β
(homological_complex.single π (complex_shape.up β€) 0).obj X :=
homological_complex.hom.iso_of_components (by rintro ((_|i)|i); exact iso.refl _)
begin
rintro (i|i) j (rfl : _ = _),
{ apply is_zero.eq_of_tgt, exact is_zero_zero _ },
{ apply is_zero.eq_of_src, exact is_zero_zero _ },
end
def to_bounded_homotopy_category_single (X : π) :
chain_complex.to_bounded_homotopy_category.obj ((homological_complex.single _ _ 0).obj X) β
(single _ 0).obj X :=
bounded_homotopy_category.mk_iso $ (homotopy_category.quotient _ _).map_iso $
embed_single X
lemma to_bounded_homotopy_category_single_naturality (X : π) (f : X βΆ X) :
(to_bounded_homotopy_category_single X).op.hom β«
(chain_complex.to_bounded_homotopy_category.map
((homological_complex.single π (complex_shape.down β) 0).map f)).op β«
(to_bounded_homotopy_category_single X).op.inv = ((single _ 0).map f).op :=
begin
dsimp only [iso.op], simp only [β op_comp], congr' 1,
dsimp only [to_bounded_homotopy_category_single, chain_complex.to_bounded_homotopy_category,
bounded_homotopy_category.mk_iso, functor.comp_map, functor.map_iso, single,
homotopy_category.single],
erw [β functor.map_comp, β functor.map_comp], congr' 1,
ext ((_|i)|i),
{ dsimp,
erw [category.comp_id, category.id_comp],
convert rfl, },
{ apply is_zero.eq_of_src, apply is_zero_zero },
{ apply is_zero.eq_of_src, apply is_zero_zero },
end
def to_bounded_homotopy_category_mk_end_single (X : π) (f : X βΆ X) :
chain_complex.to_bounded_homotopy_category.obj
(((homological_complex.single π _ 0).obj X).mk_end
((homological_complex.single π _ 0).map f)) β
(single (endomorphisms π) 0).obj (β¨X,fβ©) :=
begin
refine _ βͺβ« to_bounded_homotopy_category_single _,
apply functor.map_iso,
refine homological_complex.hom.iso_of_components _ _,
{ rintro (_|i); refine endomorphisms.mk_iso _ _,
{ exact iso.refl _ },
{ dsimp [homological_complex.mk_end],
simp only [category.id_comp, category.comp_id, if_pos rfl], refl, },
{ apply (is_zero_zero _).iso, apply is_zero_X, apply is_zero_zero },
{ apply (is_zero_zero _).eq_of_src }, },
{ rintro _ i (rfl : _ = _), apply is_zero.eq_of_src, rw is_zero_iff_id_eq_zero, ext, }
end
.
attribute [reassoc] nat_trans.comp_app
lemma Ext'_is_zero_iff (X Y : π) (f : X βΆ X) (g : Y βΆ Y) :
(β i, is_zero (((Ext' i).obj (op $ endomorphisms.mk X f)).obj $ endomorphisms.mk Y g)) β
(β i, is_iso $ ((Ext' i).map f.op).app _ - ((Ext' i).obj _).map g) :=
begin
convert (Ext_is_zero_iff ((homological_complex.single _ _ 0).obj X) Y (functor.map _ f) g)
using 1,
{ apply propext, apply forall_congr, intro i,
apply iso.is_zero_iff, dsimp only [Ext', functor.comp_obj, functor.flip_obj_obj],
apply iso.app, apply functor.map_iso, dsimp only [functor.op_obj], apply iso.op,
apply to_bounded_homotopy_category_mk_end_single },
{ apply propext, apply forall_congr, intro i,
let e := ((Ext i).map_iso (to_bounded_homotopy_category_single X).op).app ((single _ 0).obj Y),
rw [β is_iso.comp_left_iff e.hom, β is_iso.comp_right_iff _ e.inv],
simp only [comp_sub, sub_comp, iso.app_hom, iso.app_inv, category.assoc,
functor.map_iso_hom, functor.map_iso_inv, β nat_trans.comp_app, β functor.map_comp,
to_bounded_homotopy_category_single_naturality],
clear e,
dsimp only [Ext', functor.comp_obj, functor.comp_map],
congr' 3,
rw [nat_trans.naturality, β nat_trans.comp_app_assoc, β functor.map_comp, iso.hom_inv_id,
functor.map_id, nat_trans.id_app, category.id_comp],
refl },
end
end endomorphisms
end category_theory