Skip to content

Commit ecdd87a

Browse files
committed
refactor(Algebra/Homology): remove single₀ (#8208)
This PR removes the special definitions of `single₀` for chain and cochain complexes, so as to avoid duplication of code with `HomologicalComplex.single` which is the functor constructing the complex that is supported by a single arbitrary degree. `single₀` was supposed to have better definitional properties, but it turns out that in Lean4, it is no longer true (at least for the action of this functor on objects). The computation of the homology of these single complexes is generalized for `HomologicalComplex.single` using the new homology API: this result is moved to a separate file `Algebra.Homology.SingleHomology`.
1 parent 3901cb5 commit ecdd87a

File tree

17 files changed

+559
-545
lines changed

17 files changed

+559
-545
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ import Mathlib.Algebra.Homology.ShortComplex.SnakeLemma
259259
import Mathlib.Algebra.Homology.ShortExact.Abelian
260260
import Mathlib.Algebra.Homology.ShortExact.Preadditive
261261
import Mathlib.Algebra.Homology.Single
262+
import Mathlib.Algebra.Homology.SingleHomology
262263
import Mathlib.Algebra.IndicatorFunction
263264
import Mathlib.Algebra.Invertible.Basic
264265
import Mathlib.Algebra.Invertible.Defs

Mathlib/Algebra/Homology/Additive.lean

Lines changed: 18 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ TODO: similarly for `R`-linear.
2121

2222
universe v u
2323

24-
open Classical
25-
26-
noncomputable section
27-
2824
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits HomologicalComplex
2925

3026
variable {ι : Type*}
@@ -276,12 +272,11 @@ variable [HasZeroObject V] {W : Type*} [Category W] [Preadditive W] [HasZeroObje
276272

277273
namespace HomologicalComplex
278274

279-
attribute [local simp] eqToHom_map
280-
281275
/-- Turning an object into a complex supported at `j` then applying a functor is
282276
the same as applying the functor then forming the complex.
283277
-/
284-
def singleMapHomologicalComplex (F : V ⥤ W) [F.Additive] (c : ComplexShape ι) (j : ι) :
278+
noncomputable def singleMapHomologicalComplex (F : V ⥤ W) [F.Additive] (c : ComplexShape ι)
279+
[DecidableEq ι] (j : ι) :
285280
single V c j ⋙ F.mapHomologicalComplex _ ≅ F ⋙ single W c j :=
286281
NatIso.ofComponents
287282
(fun X =>
@@ -292,27 +287,30 @@ def singleMapHomologicalComplex (F : V ⥤ W) [F.Additive] (c : ComplexShape ι)
292287
dsimp
293288
split_ifs with h
294289
· simp [h]
295-
· rw [zero_comp, if_neg h]
296-
exact (zero_of_source_iso_zero _ F.mapZeroObject).symm
290+
· rw [zero_comp, ← F.map_id,
291+
(isZero_single_obj_X c j X _ h).eq_of_src (𝟙 _) 0, F.map_zero]
297292
inv_hom_id := by
298293
ext i
299294
dsimp
300295
split_ifs with h
301296
· simp [h]
302-
· rw [zero_comp, if_neg h]
303-
simp })
297+
· apply (isZero_single_obj_X c j _ _ h).eq_of_src })
304298
fun f => by
305-
ext i
306-
dsimp
307-
split_ifs with h <;> simp [h]
299+
ext i
300+
dsimp
301+
split_ifs with h
302+
· subst h
303+
simp [single_map_f_self, singleObjXSelf, singleObjXIsoOfEq, eqToHom_map]
304+
· apply (isZero_single_obj_X c j _ _ h).eq_of_tgt
308305
#align homological_complex.single_map_homological_complex HomologicalComplex.singleMapHomologicalComplex
309306

310-
variable (F : V ⥤ W) [Functor.Additive F] (c)
307+
variable (F : V ⥤ W) [Functor.Additive F] (c) [DecidableEq ι]
311308

312309
@[simp]
313310
theorem singleMapHomologicalComplex_hom_app_self (j : ι) (X : V) :
314-
((singleMapHomologicalComplex F c j).hom.app X).f j = eqToHom (by simp) := by
315-
simp [singleMapHomologicalComplex]
311+
((singleMapHomologicalComplex F c j).hom.app X).f j =
312+
F.map (singleObjXSelf c j X).hom ≫ (singleObjXSelf c j (F.obj X)).inv := by
313+
simp [singleMapHomologicalComplex, singleObjXSelf, singleObjXIsoOfEq, eqToHom_map]
316314
#align homological_complex.single_map_homological_complex_hom_app_self HomologicalComplex.singleMapHomologicalComplex_hom_app_self
317315

318316
@[simp]
@@ -323,8 +321,9 @@ theorem singleMapHomologicalComplex_hom_app_ne {i j : ι} (h : i ≠ j) (X : V)
323321

324322
@[simp]
325323
theorem singleMapHomologicalComplex_inv_app_self (j : ι) (X : V) :
326-
((singleMapHomologicalComplex F c j).inv.app X).f j = eqToHom (by simp) := by
327-
simp [singleMapHomologicalComplex]
324+
((singleMapHomologicalComplex F c j).inv.app X).f j =
325+
(singleObjXSelf c j (F.obj X)).hom ≫ F.map (singleObjXSelf c j X).inv := by
326+
simp [singleMapHomologicalComplex, singleObjXSelf, singleObjXIsoOfEq, eqToHom_map]
328327
#align homological_complex.single_map_homological_complex_inv_app_self HomologicalComplex.singleMapHomologicalComplex_inv_app_self
329328

330329
@[simp]
@@ -334,115 +333,3 @@ theorem singleMapHomologicalComplex_inv_app_ne {i j : ι} (h : i ≠ j) (X : V)
334333
#align homological_complex.single_map_homological_complex_inv_app_ne HomologicalComplex.singleMapHomologicalComplex_inv_app_ne
335334

336335
end HomologicalComplex
337-
338-
namespace ChainComplex
339-
340-
/-- Turning an object into a chain complex supported at zero then applying a functor is
341-
the same as applying the functor then forming the complex.
342-
-/
343-
def single₀MapHomologicalComplex (F : V ⥤ W) [F.Additive] :
344-
single₀ V ⋙ F.mapHomologicalComplex _ ≅ F ⋙ single₀ W :=
345-
NatIso.ofComponents
346-
(fun X =>
347-
{ hom :=
348-
{ f := fun i =>
349-
match i with
350-
| 0 => 𝟙 _
351-
| _ + 1 => F.mapZeroObject.hom }
352-
inv :=
353-
{ f := fun i =>
354-
match i with
355-
| 0 => 𝟙 _
356-
| _ + 1 => F.mapZeroObject.inv }
357-
hom_inv_id := by
358-
ext (_|_)
359-
· simp
360-
· exact IsZero.eq_of_src (IsZero.of_iso (isZero_zero _) F.mapZeroObject) _ _
361-
inv_hom_id := by
362-
ext (_|_)
363-
· simp
364-
· exact IsZero.eq_of_src (isZero_zero _) _ _ })
365-
fun f => by ext (_|_) <;> simp
366-
#align chain_complex.single₀_map_homological_complex ChainComplex.single₀MapHomologicalComplex
367-
368-
@[simp]
369-
theorem single₀MapHomologicalComplex_hom_app_zero (F : V ⥤ W) [F.Additive] (X : V) :
370-
((single₀MapHomologicalComplex F).hom.app X).f 0 = 𝟙 _ :=
371-
rfl
372-
#align chain_complex.single₀_map_homological_complex_hom_app_zero ChainComplex.single₀MapHomologicalComplex_hom_app_zero
373-
374-
@[simp]
375-
theorem single₀MapHomologicalComplex_hom_app_succ (F : V ⥤ W) [F.Additive] (X : V) (n : ℕ) :
376-
((single₀MapHomologicalComplex F).hom.app X).f (n + 1) = 0 :=
377-
rfl
378-
#align chain_complex.single₀_map_homological_complex_hom_app_succ ChainComplex.single₀MapHomologicalComplex_hom_app_succ
379-
380-
@[simp]
381-
theorem single₀MapHomologicalComplex_inv_app_zero (F : V ⥤ W) [F.Additive] (X : V) :
382-
((single₀MapHomologicalComplex F).inv.app X).f 0 = 𝟙 _ :=
383-
rfl
384-
#align chain_complex.single₀_map_homological_complex_inv_app_zero ChainComplex.single₀MapHomologicalComplex_inv_app_zero
385-
386-
@[simp]
387-
theorem single₀MapHomologicalComplex_inv_app_succ (F : V ⥤ W) [F.Additive] (X : V) (n : ℕ) :
388-
((single₀MapHomologicalComplex F).inv.app X).f (n + 1) = 0 :=
389-
rfl
390-
#align chain_complex.single₀_map_homological_complex_inv_app_succ ChainComplex.single₀MapHomologicalComplex_inv_app_succ
391-
392-
end ChainComplex
393-
394-
namespace CochainComplex
395-
396-
/-- Turning an object into a cochain complex supported at zero then applying a functor is
397-
the same as applying the functor then forming the cochain complex.
398-
-/
399-
def single₀MapHomologicalComplex (F : V ⥤ W) [F.Additive] :
400-
single₀ V ⋙ F.mapHomologicalComplex _ ≅ F ⋙ single₀ W :=
401-
NatIso.ofComponents
402-
(fun X =>
403-
{ hom :=
404-
{ f := fun i =>
405-
match i with
406-
| 0 => 𝟙 _
407-
| _ + 1 => F.mapZeroObject.hom }
408-
inv :=
409-
{ f := fun i =>
410-
match i with
411-
| 0 => 𝟙 _
412-
| _ + 1 => F.mapZeroObject.inv }
413-
hom_inv_id := by
414-
ext (_|_)
415-
· simp
416-
· exact IsZero.eq_of_src (IsZero.of_iso (isZero_zero _) F.mapZeroObject) _ _
417-
inv_hom_id := by
418-
ext (_|_)
419-
· simp
420-
· exact IsZero.eq_of_src (isZero_zero _) _ _ })
421-
fun f => by ext (_|_) <;> simp
422-
#align cochain_complex.single₀_map_homological_complex CochainComplex.single₀MapHomologicalComplex
423-
424-
@[simp]
425-
theorem single₀MapHomologicalComplex_hom_app_zero (F : V ⥤ W) [F.Additive] (X : V) :
426-
((single₀MapHomologicalComplex F).hom.app X).f 0 = 𝟙 _ :=
427-
rfl
428-
#align cochain_complex.single₀_map_homological_complex_hom_app_zero CochainComplex.single₀MapHomologicalComplex_hom_app_zero
429-
430-
@[simp]
431-
theorem single₀MapHomologicalComplex_hom_app_succ (F : V ⥤ W) [F.Additive] (X : V) (n : ℕ) :
432-
((single₀MapHomologicalComplex F).hom.app X).f (n + 1) = 0 :=
433-
rfl
434-
#align cochain_complex.single₀_map_homological_complex_hom_app_succ CochainComplex.single₀MapHomologicalComplex_hom_app_succ
435-
436-
@[simp]
437-
theorem single₀MapHomologicalComplex_inv_app_zero (F : V ⥤ W) [F.Additive] (X : V) :
438-
((single₀MapHomologicalComplex F).inv.app X).f 0 = 𝟙 _ :=
439-
rfl
440-
#align cochain_complex.single₀_map_homological_complex_inv_app_zero CochainComplex.single₀MapHomologicalComplex_inv_app_zero
441-
442-
@[simp]
443-
theorem single₀MapHomologicalComplex_inv_app_succ (F : V ⥤ W) [F.Additive] (X : V) (n : ℕ) :
444-
((single₀MapHomologicalComplex F).inv.app X).f (n + 1) = 0 :=
445-
rfl
446-
#align cochain_complex.single₀_map_homological_complex_inv_app_succ CochainComplex.single₀MapHomologicalComplex_inv_app_succ
447-
448-
end CochainComplex

Mathlib/Algebra/Homology/QuasiIso.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Scott Morrison, Joël Riou
55
-/
66
import Mathlib.Algebra.Homology.Homotopy
7-
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
7+
import Mathlib.Algebra.Homology.SingleHomology
88
import Mathlib.CategoryTheory.Abelian.Homology
99

1010
#align_import algebra.homology.quasi_iso from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
@@ -20,9 +20,7 @@ Define the derived category as the localization at quasi-isomorphisms? (TODO @jo
2020
-/
2121

2222

23-
open CategoryTheory
24-
25-
open CategoryTheory.Limits
23+
open CategoryTheory Limits
2624

2725
universe v u
2826

@@ -133,8 +131,7 @@ theorem to_single₀_epi_at_zero [hf : QuasiIso' f] : Epi (f.f 0) := by
133131

134132
theorem to_single₀_exact_d_f_at_zero [hf : QuasiIso' f] : Exact (X.d 1 0) (f.f 0) := by
135133
rw [Preadditive.exact_iff_homology'_zero]
136-
have h : X.d 1 0 ≫ f.f 0 = 0 := by
137-
simp only [← f.2 1 0 rfl, ChainComplex.single₀_obj_X_d, comp_zero]
134+
have h : X.d 1 0 ≫ f.f 0 = 0 := by simp only [← f.comm 1 0, single_obj_d, comp_zero]
138135
refine' ⟨h, Nonempty.intro (homology'IsoKernelDesc _ _ _ ≪≫ _)⟩
139136
suffices IsIso (cokernel.desc _ _ h) by apply kernel.ofMono
140137
rw [← toSingle₀CokernelAtZeroIso_hom_eq]
@@ -186,8 +183,7 @@ theorem from_single₀_mono_at_zero [hf : QuasiIso' f] : Mono (f.f 0) := by
186183

187184
theorem from_single₀_exact_f_d_at_zero [hf : QuasiIso' f] : Exact (f.f 0) (X.d 0 1) := by
188185
rw [Preadditive.exact_iff_homology'_zero]
189-
have h : f.f 0 ≫ X.d 0 1 = 0 := by
190-
simp only [HomologicalComplex.Hom.comm, CochainComplex.single₀_obj_X_d, zero_comp]
186+
have h : f.f 0 ≫ X.d 0 1 = 0 := by simp
191187
refine' ⟨h, Nonempty.intro (homology'IsoCokernelLift _ _ _ ≪≫ _)⟩
192188
suffices IsIso (kernel.lift (X.d 0 1) (f.f 0) h) by apply cokernel.ofEpi
193189
rw [← fromSingle₀KernelAtZeroIso_inv_eq f]

0 commit comments

Comments
 (0)