|
| 1 | +/- |
| 2 | +Copyright (c) 2025 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 | +module |
| 7 | + |
| 8 | +public import Mathlib.Algebra.Homology.ShortComplex.Ab |
| 9 | +public import Mathlib.Algebra.Homology.HomotopyCategory.HomComplex |
| 10 | +public import Mathlib.Algebra.Homology.HomotopyCategory.Shift |
| 11 | + |
| 12 | +/-! |
| 13 | +# Cohomology of the hom complex |
| 14 | +
|
| 15 | +Given `ℤ`-indexed cochain complexes `K` and `L`, and `n : ℤ`, we introduce |
| 16 | +a type `HomComplex.CohomologyClass K L n` which is the quotient |
| 17 | +of `HomComplex.Cocycle K L n` which identifies cohomologous cocycles. |
| 18 | +We construct this type of cohomology classes instead of using |
| 19 | +the homology API because `Cochain K L` can be considered both |
| 20 | +as a complex of abelian groups or as a complex of `R`-modules |
| 21 | +when the category is `R`-linear. This also complements the API |
| 22 | +around `HomComplex` which is centered on terms in types |
| 23 | +`Cochain` or `Cocycle` which are suitable for computations. |
| 24 | +
|
| 25 | +-/ |
| 26 | + |
| 27 | +@[expose] public section |
| 28 | + |
| 29 | +assert_not_exists TwoSidedIdeal |
| 30 | + |
| 31 | +open CategoryTheory Category Limits Preadditive |
| 32 | + |
| 33 | +universe v u |
| 34 | + |
| 35 | +variable {C : Type u} [Category.{v} C] [Preadditive C] {R : Type*} [Ring R] [Linear R C] |
| 36 | + |
| 37 | +namespace CochainComplex |
| 38 | + |
| 39 | +variable (K L : CochainComplex C ℤ) (n m p : ℤ) |
| 40 | + |
| 41 | +namespace HomComplex |
| 42 | + |
| 43 | +/-- The subgroup of `Cocycle K L n` consisting of coboundaries. -/ |
| 44 | +def coboundaries : AddSubgroup (Cocycle K L n) where |
| 45 | + carrier := setOf (fun α ↦ ∃ (m : ℤ) (hm : m + 1 = n) (β : Cochain K L m), δ m n β = α) |
| 46 | + zero_mem' := ⟨n - 1, by simp, 0, by simp⟩ |
| 47 | + add_mem' := by |
| 48 | + rintro α₁ α₂ ⟨m, hm, β₁, hβ₁⟩ ⟨m', hm', β₂, hβ₂⟩ |
| 49 | + obtain rfl : m = m' := by cutsat |
| 50 | + exact ⟨m, hm, β₁ + β₂, by aesop⟩ |
| 51 | + neg_mem' := by |
| 52 | + rintro α ⟨m, hm, β, hβ⟩ |
| 53 | + exact ⟨m, hm, -β, by aesop⟩ |
| 54 | + |
| 55 | +/-- The type of cohomology classes of degree `n` in the complex of morphisms |
| 56 | +from `K` to `L`. -/ |
| 57 | +def CohomologyClass : Type v := Cocycle K L n ⧸ coboundaries K L n |
| 58 | + |
| 59 | +instance : AddCommGroup (CohomologyClass K L n) := |
| 60 | + inferInstanceAs (AddCommGroup (Cocycle K L n ⧸ coboundaries K L n)) |
| 61 | + |
| 62 | +namespace CohomologyClass |
| 63 | + |
| 64 | +variable {K L n} |
| 65 | + |
| 66 | +/-- The cohomology class of a cocycle. -/ |
| 67 | +def mk (x : Cocycle K L n) : CohomologyClass K L n := |
| 68 | + Quotient.mk _ x |
| 69 | + |
| 70 | +lemma mk_surjective : Function.Surjective (mk : Cocycle K L n → _) := |
| 71 | + Quotient.mk_surjective |
| 72 | + |
| 73 | +variable (K L n) in |
| 74 | +@[simp] |
| 75 | +lemma mk_zero : |
| 76 | + mk (0 : Cocycle K L n) = 0 := rfl |
| 77 | + |
| 78 | +@[simp] |
| 79 | +lemma mk_add (x y : Cocycle K L n) : |
| 80 | + mk (x + y) = mk x + mk y := rfl |
| 81 | + |
| 82 | +@[simp] |
| 83 | +lemma mk_sub (x y : Cocycle K L n) : |
| 84 | + mk (x - y) = mk x - mk y := rfl |
| 85 | + |
| 86 | +@[simp] |
| 87 | +lemma mk_neg (x : Cocycle K L n) : |
| 88 | + mk (-x) = - mk x := rfl |
| 89 | + |
| 90 | +lemma mk_eq_zero_iff (x : Cocycle K L n) : |
| 91 | + mk x = 0 ↔ x ∈ coboundaries K L n := |
| 92 | + QuotientAddGroup.eq_zero_iff x |
| 93 | + |
| 94 | +variable (K L n) in |
| 95 | +/-- The projection map `Cocycle K L n →+ CohomologyClass K L n`. -/ |
| 96 | +@[simps] |
| 97 | +def mkAddMonoidHom : Cocycle K L n →+ CohomologyClass K L n where |
| 98 | + toFun := mk |
| 99 | + map_zero' := by simp |
| 100 | + map_add' := by simp |
| 101 | + |
| 102 | +section |
| 103 | + |
| 104 | +variable {G : Type*} [AddCommGroup G] |
| 105 | + (f : Cocycle K L n →+ G) (hf : coboundaries K L n ≤ f.ker) |
| 106 | + |
| 107 | +/-- Constructor for additive morphisms from `CohomologyClass K L n`. -/ |
| 108 | +def descAddMonoidHom : |
| 109 | + CohomologyClass K L n →+ G := |
| 110 | + QuotientAddGroup.lift _ f hf |
| 111 | + |
| 112 | +@[simp] |
| 113 | +lemma descAddMonoidHom_cohomologyClass (x : Cocycle K L n) : |
| 114 | + descAddMonoidHom f hf (mk x) = f x := rfl |
| 115 | + |
| 116 | +end |
| 117 | + |
| 118 | +end CohomologyClass |
| 119 | + |
| 120 | +/-- `CohomologyClass K L m` identifies to the cohomology of the complex `HomComplex K L` |
| 121 | +in degree `m`. -/ |
| 122 | +@[simps] |
| 123 | +def leftHomologyData' (hm : n + 1 = m) (hp : m + 1 = p) : |
| 124 | + ((HomComplex K L).sc' n m p).LeftHomologyData where |
| 125 | + K := .of (Cocycle K L m) |
| 126 | + H := .of (CohomologyClass K L m) |
| 127 | + i := AddCommGrpCat.ofHom (Cocycle.toCochainAddMonoidHom K L m) |
| 128 | + π := AddCommGrpCat.ofHom (CohomologyClass.mkAddMonoidHom K L m) |
| 129 | + wi := by cat_disch |
| 130 | + hi := Cocycle.isKernel K L _ _ hp |
| 131 | + wπ := by |
| 132 | + ext x |
| 133 | + dsimp |
| 134 | + rw [CohomologyClass.mk_eq_zero_iff] |
| 135 | + exact ⟨n, hm, x, rfl⟩ |
| 136 | + hπ := |
| 137 | + Cofork.IsColimit.mk _ |
| 138 | + (fun s ↦ AddCommGrpCat.ofHom (CohomologyClass.descAddMonoidHom s.π.hom |
| 139 | + (by |
| 140 | + rintro ⟨_, _⟩ ⟨q, hq, y, rfl⟩ |
| 141 | + obtain rfl : n = q := by cutsat |
| 142 | + simpa only [zero_comp] using ConcreteCategory.congr_hom s.condition y))) |
| 143 | + (fun s ↦ rfl) |
| 144 | + (fun s l hl ↦ by |
| 145 | + ext x |
| 146 | + obtain ⟨y, rfl⟩ := x.mk_surjective |
| 147 | + simpa using ConcreteCategory.congr_hom hl y) |
| 148 | + |
| 149 | +/-- `CohomologyClass K L m` identifies to the cohomology of the complex `HomComplex K L` |
| 150 | +in degree `m`. -/ |
| 151 | +@[simps!] |
| 152 | +noncomputable def leftHomologyData : |
| 153 | + ((HomComplex K L).sc n).LeftHomologyData := |
| 154 | + leftHomologyData' K L _ n _ (by simp) (by simp) |
| 155 | + |
| 156 | +/-- The homology of `HomComplex K L` in degree `n` identifies to `CohomologyClass K L n`. -/ |
| 157 | +noncomputable def homologyAddEquiv : |
| 158 | + (HomComplex K L).homology n ≃+ CohomologyClass K L n := |
| 159 | + (leftHomologyData K L n).homologyIso.addCommGroupIsoToAddEquiv |
| 160 | + |
| 161 | +end HomComplex |
| 162 | + |
| 163 | +end CochainComplex |
0 commit comments