|
| 1 | +/- |
| 2 | +Copyright (c) 2023 Joël Riou. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Joël Riou |
| 5 | +-/ |
| 6 | + |
| 7 | +import Mathlib.Algebra.Homology.ShortComplex.Homology |
| 8 | +import Mathlib.CategoryTheory.Limits.Preserves.Finite |
| 9 | +import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels |
| 10 | + |
| 11 | +/-! |
| 12 | +# Functors which preserves homology |
| 13 | +
|
| 14 | +If `F : C ⥤ D` is a functor between categories with zero morphisms, we shall |
| 15 | +say that `F` preserves homology when `F` preserves both kernels and cokernels. |
| 16 | +This typeclass is named `[F.PreservesHomology]`, and is automatically |
| 17 | +satisfied when `F` preserves both finite limits and finite colimits. |
| 18 | +
|
| 19 | +TODO: If `S : ShortComplex C` and `[F.PreservesHomology]`, then there is an |
| 20 | +isomorphism `S.mapHomologyIso F : (S.map F).homology ≅ F.obj S.homology`. |
| 21 | +
|
| 22 | +-/ |
| 23 | + |
| 24 | +namespace CategoryTheory |
| 25 | + |
| 26 | +open Category Limits |
| 27 | + |
| 28 | +variable {C D : Type*} [Category C] [Category D] [HasZeroMorphisms C] [HasZeroMorphisms D] |
| 29 | + |
| 30 | +namespace Functor |
| 31 | + |
| 32 | +variable (F : C ⥤ D) |
| 33 | + |
| 34 | +/-- A functor preserves homology when it preserves both kernels and cokernels. -/ |
| 35 | +class PreservesHomology (F : C ⥤ D) [PreservesZeroMorphisms F] where |
| 36 | + /-- the functor preserves kernels -/ |
| 37 | + preservesKernels ⦃X Y : C⦄ (f : X ⟶ Y) : PreservesLimit (parallelPair f 0) F := |
| 38 | + by infer_instance |
| 39 | + /-- the functor preserves cokernels -/ |
| 40 | + preservesCokernels ⦃X Y : C⦄ (f : X ⟶ Y) : PreservesColimit (parallelPair f 0) F := |
| 41 | + by infer_instance |
| 42 | + |
| 43 | +variable [PreservesZeroMorphisms F] |
| 44 | + |
| 45 | +/-- A functor which preserves homology preserves kernels. -/ |
| 46 | +def PreservesHomology.preservesKernel [F.PreservesHomology] {X Y : C} (f : X ⟶ Y) : |
| 47 | + PreservesLimit (parallelPair f 0) F := |
| 48 | + PreservesHomology.preservesKernels _ |
| 49 | + |
| 50 | +/-- A functor which preserves homology preserves cokernels. -/ |
| 51 | +def PreservesHomology.preservesCokernel [F.PreservesHomology] {X Y : C} (f : X ⟶ Y) : |
| 52 | + PreservesColimit (parallelPair f 0) F := |
| 53 | + PreservesHomology.preservesCokernels _ |
| 54 | + |
| 55 | +noncomputable instance preservesHomologyOfExact |
| 56 | + [PreservesFiniteLimits F] [PreservesFiniteColimits F] : |
| 57 | + F.PreservesHomology where |
| 58 | + |
| 59 | +end Functor |
| 60 | + |
| 61 | +namespace ShortComplex |
| 62 | + |
| 63 | +variable {S S₁ S₂ : ShortComplex C} |
| 64 | + |
| 65 | +namespace LeftHomologyData |
| 66 | + |
| 67 | +variable (h : S.LeftHomologyData) (F : C ⥤ D) |
| 68 | + |
| 69 | +/-- A left homology data `h` of a short complex `S` is preserved by a functor `F` is |
| 70 | +`F` preserves the kernel of `S.g : S.X₂ ⟶ S.X₃` and the cokernel of `h.f' : S.X₁ ⟶ h.K`. -/ |
| 71 | +class IsPreservedBy [F.PreservesZeroMorphisms] where |
| 72 | + /-- the functor preserves the kernel of `S.g : S.X₂ ⟶ S.X₃`. -/ |
| 73 | + g : PreservesLimit (parallelPair S.g 0) F |
| 74 | + /-- the functor preserves the cokernel of `h.f' : S.X₁ ⟶ h.K`. -/ |
| 75 | + f' : PreservesColimit (parallelPair h.f' 0) F |
| 76 | + |
| 77 | +variable [F.PreservesZeroMorphisms] |
| 78 | + |
| 79 | +noncomputable instance isPreservedByOfPreservesHomology [F.PreservesHomology] : |
| 80 | + h.IsPreservedBy F where |
| 81 | + g := Functor.PreservesHomology.preservesKernel _ _ |
| 82 | + f' := Functor.PreservesHomology.preservesCokernel _ _ |
| 83 | + |
| 84 | +variable [h.IsPreservedBy F] |
| 85 | + |
| 86 | +/-- When a left homology data is preserved by a functor `F`, this functor |
| 87 | +preserves the kernel of `S.g : S.X₂ ⟶ S.X₃`. -/ |
| 88 | +def IsPreservedBy.hg : PreservesLimit (parallelPair S.g 0) F := |
| 89 | + @IsPreservedBy.g _ _ _ _ _ _ _ h F _ _ |
| 90 | + |
| 91 | +/-- When a left homology data `h` is preserved by a functor `F`, this functor |
| 92 | +preserves the cokernel of `h.f' : S.X₁ ⟶ h.K`. -/ |
| 93 | +def IsPreservedBy.hf' : PreservesColimit (parallelPair h.f' 0) F := IsPreservedBy.f' |
| 94 | + |
| 95 | +/-- When a left homology data `h` of a short complex `S` is preserved by a functor `F`, |
| 96 | +this is the induced left homology data `h.map F` for the short complex `S.map F`. -/ |
| 97 | +@[simps] |
| 98 | +noncomputable def map : (S.map F).LeftHomologyData := by |
| 99 | + have := IsPreservedBy.hg h F |
| 100 | + have := IsPreservedBy.hf' h F |
| 101 | + have wi : F.map h.i ≫ F.map S.g = 0 := by rw [← F.map_comp, h.wi, F.map_zero] |
| 102 | + have hi := KernelFork.mapIsLimit _ h.hi F |
| 103 | + let f' : F.obj S.X₁ ⟶ F.obj h.K := hi.lift (KernelFork.ofι (S.map F).f (S.map F).zero) |
| 104 | + have hf' : f' = F.map h.f' := Fork.IsLimit.hom_ext hi (by |
| 105 | + rw [Fork.IsLimit.lift_ι hi] |
| 106 | + simp only [KernelFork.map_ι, Fork.ι_ofι, map_f, ← F.map_comp, f'_i]) |
| 107 | + have wπ : f' ≫ F.map h.π = 0 := by rw [hf', ← F.map_comp, f'_π, F.map_zero] |
| 108 | + have hπ : IsColimit (CokernelCofork.ofπ (F.map h.π) wπ) := by |
| 109 | + let e : parallelPair f' 0 ≅ parallelPair (F.map h.f') 0 := |
| 110 | + parallelPair.ext (Iso.refl _) (Iso.refl _) (by simpa using hf') (by simp) |
| 111 | + refine' IsColimit.precomposeInvEquiv e _ |
| 112 | + (IsColimit.ofIsoColimit (CokernelCofork.mapIsColimit _ h.hπ' F) _) |
| 113 | + exact Cofork.ext (Iso.refl _) (by simp) |
| 114 | + exact |
| 115 | + { K := F.obj h.K |
| 116 | + H := F.obj h.H |
| 117 | + i := F.map h.i |
| 118 | + π := F.map h.π |
| 119 | + wi := wi |
| 120 | + hi := hi |
| 121 | + wπ := wπ |
| 122 | + hπ := hπ } |
| 123 | + |
| 124 | +@[simp] |
| 125 | +lemma map_f' : (h.map F).f' = F.map h.f' := by |
| 126 | + rw [← cancel_mono (h.map F).i, f'_i, map_f, map_i, ← F.map_comp, f'_i] |
| 127 | + |
| 128 | +end LeftHomologyData |
| 129 | + |
| 130 | +/-- Given a left homology map data `ψ : LeftHomologyMapData φ h₁ h₂` such that |
| 131 | +both left homology data `h₁` and `h₂` are preserved by a functor `F`, this is |
| 132 | +the induced left homology map data for the morphism `F.mapShortComplex.map φ`. -/ |
| 133 | +@[simps] |
| 134 | +def LeftHomologyMapData.map {φ : S₁ ⟶ S₂} {h₁ : S₁.LeftHomologyData} |
| 135 | + {h₂ : S₂.LeftHomologyData} (ψ : LeftHomologyMapData φ h₁ h₂) (F : C ⥤ D) |
| 136 | + [F.PreservesZeroMorphisms] [h₁.IsPreservedBy F] [h₂.IsPreservedBy F] : |
| 137 | + LeftHomologyMapData (F.mapShortComplex.map φ) (h₁.map F) (h₂.map F) where |
| 138 | + φK := F.map ψ.φK |
| 139 | + φH := F.map ψ.φH |
| 140 | + commi := by simpa only [F.map_comp] using F.congr_map ψ.commi |
| 141 | + commf' := by simpa only [LeftHomologyData.map_f', F.map_comp] using F.congr_map ψ.commf' |
| 142 | + commπ := by simpa only [F.map_comp] using F.congr_map ψ.commπ |
| 143 | + |
| 144 | +end ShortComplex |
| 145 | + |
| 146 | +end CategoryTheory |
0 commit comments