/-
Copyright (c) 2023 Joël Riou. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joël Riou
-/
module
public import Mathlib.Algebra.Category.Grp.Abelian
public import Mathlib.Algebra.Category.Grp.Kernels
public import Mathlib.Algebra.Homology.ShortComplex.ShortExact
import Mathlib.GroupTheory.QuotientGroup.Finite
/-!
# Homology and exactness of short complexes of abelian groups
In this file, the homology of a short complex `S` of abelian groups is identified
with the quotient of `AddMonoidHom.ker S.g` by the image of the morphism
`S.abToCycles : S.X₁ →+ AddMonoidHom.ker S.g` induced by `S.f`.
The definitions are made in the `ShortComplex` namespace so as to enable dot notation.
The names contain the prefix `ab` in order to allow similar constructions for
other categories like `ModuleCat`.
## Main definitions
- `ShortComplex.abHomologyIso` identifies the homology of a short complex of abelian
groups to an explicit quotient.
- `ShortComplex.ab_exact_iff` expresses that a short complex of abelian groups `S`
is exact iff any element in the kernel of `S.g` belongs to the image of `S.f`.
-/
@[expose] public section
universe u
namespace CategoryTheory
namespace ShortComplex
variable (S : ShortComplex Ab.{u})
@[simp]
lemma ab_zero_apply (x : S.X₁) : S.g (S.f x) = 0 := by
rw [← ConcreteCategory.comp_apply, S.zero]
rfl
/-- The canonical additive morphism `S.X₁ →+ AddMonoidHom.ker S.g` induced by `S.f`. -/
@[simps!]
def abToCycles : S.X₁ →+ AddMonoidHom.ker S.g.hom :=
AddMonoidHom.mk' (fun x => ⟨S.f x, S.ab_zero_apply x⟩) (by aesop)
/-- The explicit left homology data of a short complex of abelian group that is
given by a kernel and a quotient given by the `AddMonoidHom` API. -/
@[simps, implicit_reducible]
def abLeftHomologyData : S.LeftHomologyData where
K := ↧S.g.hom.ker
H := ↧(S.g.hom.ker ⧸ S.abToCycles.range)
i := AddCommGrpCat.ofHom (AddMonoidHom.ker S.g.hom).subtype
π := AddCommGrpCat.ofHom <| QuotientAddGroup.mk' _
wi := by
ext ⟨_, hx⟩
exact hx
hi := AddCommGrpCat.kernelIsLimit _
wπ := by
ext (x : S.X₁)
dsimp
rw [QuotientAddGroup.eq_zero_iff, AddMonoidHom.mem_range]
apply exists_apply_eq_apply
hπ := AddCommGrpCat.cokernelIsColimit (AddCommGrpCat.ofHom S.abToCycles)
@[simp]
lemma abLeftHomologyData_f' : S.abLeftHomologyData.f' = AddCommGrpCat.ofHom S.abToCycles := rfl
/-- Given a short complex `S` of abelian groups, this is the isomorphism between
the abstract `S.cycles` of the homology API and the more concrete description as
`AddMonoidHom.ker S.g`. -/
noncomputable def abCyclesIso : S.cycles ≅ ↧(AddMonoidHom.ker S.g.hom) :=
S.abLeftHomologyData.cyclesIso
-- This was a simp lemma until we made `AddCommGrpCat.coe_of` a simp lemma,
-- after which the simp normal form linter complains.
-- It was not used a simp lemma in Mathlib.
-- Possible solution: higher priority function coercions that remove the `of`?
-- @[simp]
lemma abCyclesIso_inv_apply_iCycles (x : AddMonoidHom.ker S.g.hom) :
S.iCycles (S.abCyclesIso.inv x) = x := by
dsimp only [abCyclesIso]
rw [← ConcreteCategory.comp_apply, S.abLeftHomologyData.cyclesIso_inv_comp_iCycles]
rfl
/-- Given a short complex `S` of abelian groups, this is the isomorphism between
the abstract `S.homology` of the homology API and the more explicit
quotient of `AddMonoidHom.ker S.g` by the image of
`S.abToCycles : S.X₁ →+ AddMonoidHom.ker S.g`. -/
noncomputable def abHomologyIso : S.homology ≅
↧((AddMonoidHom.ker S.g.hom) ⧸ AddMonoidHom.range S.abToCycles) :=
S.abLeftHomologyData.homologyIso
lemma exact_iff_surjective_abToCycles :
S.Exact ↔ Function.Surjective S.abToCycles := by
rw [S.abLeftHomologyData.exact_iff_epi_f', abLeftHomologyData_f',
AddCommGrpCat.epi_iff_surjective]
rfl
lemma ab_exact_iff :
S.Exact ↔ ∀ (x₂ : S.X₂) (_ : S.g x₂ = 0), ∃ (x₁ : S.X₁), S.f x₁ = x₂ := by
rw [exact_iff_surjective_abToCycles]
constructor
· intro h x₂ hx₂
obtain ⟨x₁, hx₁⟩ := h ⟨x₂, hx₂⟩
exact ⟨x₁, by simpa only [Subtype.ext_iff, abToCycles_apply_coe] using hx₁⟩
· rintro h ⟨x₂, hx₂⟩
obtain ⟨x₁, rfl⟩ := h x₂ hx₂
exact ⟨x₁, rfl⟩
lemma ab_exact_iff_function_exact :
S.Exact ↔ Function.Exact S.f S.g := by
rw [S.ab_exact_iff]
apply forall_congr'
intro x₂
constructor
· intro h
refine ⟨h, ?_⟩
rintro ⟨x₁, rfl⟩
simp only [ab_zero_apply]
· tauto
variable {S}
lemma ab_exact_iff_ker_le_range : S.Exact ↔ S.g.hom.ker ≤ S.f.hom.range := S.ab_exact_iff
lemma ab_exact_iff_range_eq_ker : S.Exact ↔ S.f.hom.range = S.g.hom.ker := by
rw [ab_exact_iff_ker_le_range]
constructor
· intro h
refine le_antisymm ?_ h
rintro _ ⟨x₁, rfl⟩
rw [AddMonoidHom.mem_ker, ← ConcreteCategory.comp_apply, S.zero]
rfl
· intro h
rw [h]
alias ⟨Exact.ab_range_eq_ker, _⟩ := ab_exact_iff_range_eq_ker
/-- In an exact sequence of abelian groups, if the first and last groups are finite, then so is the
middle one. -/
lemma Exact.ab_finite {S : ShortComplex Ab.{u}} (hS : S.Exact) [Finite S.X₁] [Finite S.X₃] :
Finite S.X₂ := by
have : Finite S.f.hom.range := Set.finite_range _
have : Finite (S.X₂ ⧸ S.f.hom.range) := by
rw [hS.ab_range_eq_ker]
exact .of_equiv _ (QuotientAddGroup.quotientKerEquivRange _).toEquiv.symm
exact .of_addSubgroup_quotient (H := S.f.hom.range)
lemma ShortExact.ab_injective_f (hS : S.ShortExact) :
Function.Injective S.f :=
(AddCommGrpCat.mono_iff_injective _).1 hS.mono_f
lemma ShortExact.ab_surjective_g (hS : S.ShortExact) :
Function.Surjective S.g :=
(AddCommGrpCat.epi_iff_surjective _).1 hS.epi_g
/-- In a short exact sequence of abelian groups, the middle group is finite iff the first and last
are. -/
lemma ShortExact.ab_finite_iff {S : ShortComplex Ab.{u}} (hS : S.ShortExact) :
Finite S.X₂ ↔ Finite S.X₁ ∧ Finite S.X₃ where
mp _ := ⟨.of_injective _ hS.ab_injective_f, .of_surjective _ hS.ab_surjective_g⟩
mpr | ⟨_, _⟩ => hS.exact.ab_finite
end ShortComplex
end CategoryTheory
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland