Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Cocycles, coboundaries, cohomology sets, characteristic and trivial cocycles

Definition
NLabCohomology_Cohomology

by LG · Nov 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

algebraic-topologycategory-theorycohomology

This definition file formalizes the general definition of cohomology from the nLab entry "cohomology", section "Definition / General definition". Let H\mathbf{H}H be an (∞,1)-category (as fixed in the companion definition file), and let XXX and AAA be objects of H\mathbf{H}H, with AAA the coefficient object.

  • A cocycle on XXX with coefficients in AAA is an object of the hom ∞-groupoid H(X,A)\mathbf{H}(X,A)H(X,A): a 000-simplex, i.e. a morphism c:X→Ac : X \to Ac:X→A in H\mathbf{H}H (Cocycle).
  • A coboundary between cocycles c1c_1c1​ and c2c_2c2​ is a morphism λ:c1→c2\lambda : c_1 \to c_2λ:c1​→c2​ in H(X,A)\mathbf{H}(X,A)H(X,A): an edge from c1c_1c1​ to c2c_2c2​ (Coboundary). Two cocycles connected by a coboundary are cohomologous (Cohomologous).
  • The cohomology class [c][c][c] of a cocycle is its class in the set of connected components (cohomologyClass), and the cohomology set of XXX with coefficients in AAA is
H(X,A)≔π0 H(X,A)H(X,A) \coloneqq \pi_0\,\mathbf{H}(X,A)H(X,A):=π0​H(X,A)

(Cohomology).

  • For a cocycle ccc on XXX and a cocycle k:A→Bk : A \to Bk:A→B on the coefficient object, charCocycle is the composite cocycle k(c):X→cA→kBk(c) : X \xrightarrow{c} A \xrightarrow{k} Bk(c):Xc​Ak​B; its cohomology class [k(c)]∈H(X,B)[k(c)] \in H(X,B)[k(c)]∈H(X,B) is the characteristic class of ccc with respect to kkk (well-definedness on cohomology is the mission's characteristic-class milestone).
  • If AAA is pointed by ∗→A* \to A∗→A, the trivial cocycle on XXX is the composite X→∗→AX \to * \to AX→∗→A (trivialCocycle), where X→∗X \to *X→∗ is any cocycle into the terminal object; any two such are cohomologous by the trivial-cocycle milestone, so its class is canonical. A cocycle cohomologous to the trivial cocycle is called a coboundary (IsCoboundary).

As the source remarks, there is no notion of cochain in this general setup: cochains are components of specific models of H(X,A)\mathbf{H}(X,A)H(X,A).

Formalization Note. Cocycles are 000-simplices, coboundaries are SSet.Edges, and the cohomology set is Mathlib's SSet.π₀ of the hom Kan complex; Cohomologous is Mathlib's SSet.π₀Rel (existence of an edge). The trivial cocycle uses Classical.choice of a cocycle into the terminal object, whose existence is part of contractibility.

Definition code
import Definitions.Def_NLabCohomology_Ambient
import Mathlib.AlgebraicTopology.SimplicialSet.CompStruct
import Mathlib.AlgebraicTopology.SimplicialSet.PiZero

/-!
# The general definition of cohomology (nLab, "cohomology", Definition)

Cocycles, coboundaries, cohomologous cocycles, cohomology classes, the
cohomology set `H(X, A) = π₀ 𝐇(X, A)`, the composite (characteristic) cocycle,
and the trivial cocycle of a pointed coefficient object, following the
"General definition" subsection of the nLab entry "cohomology".
-/

universe u

open CategoryTheory Simplicial Opposite

namespace NLabCohomology

variable (H : InfinityOneCategory.{u})

/-- A **cocycle** on `X` with coefficients in `A`: an object of the hom
∞-groupoid `𝐇(X, A)`, i.e. a `0`-simplex, a morphism `c : X ⟶ A` in `𝐇`. -/
abbrev Cocycle (X A : H.Obj) : Type u := H.hom X A _⦋0⦌

/-- A **coboundary** between cocycles `c₁` and `c₂`: a morphism `λ : c₁ ⟶ c₂`
in the hom ∞-groupoid `𝐇(X, A)`, i.e. an edge from `c₁` to `c₂`. -/
abbrev Coboundary {X A : H.Obj} (c₁ c₂ : Cocycle H X A) : Type u :=
  (H.hom X A).Edge c₁ c₂

/-- Two cocycles are **cohomologous** when they are connected by a coboundary. -/
def Cohomologous {X A : H.Obj} (c₁ c₂ : Cocycle H X A) : Prop :=
  SSet.π₀Rel c₁ c₂

/-- The **cohomology set** `H(X, A) ≔ π₀ 𝐇(X, A)`: the type of cohomology
classes of `A`-valued cocycles on `X`. -/
def Cohomology (X A : H.Obj) : Type u := SSet.π₀ (H.hom X A)

/-- The cohomology class `[c]` of a cocycle `c`. -/
def cohomologyClass {X A : H.Obj} (c : Cocycle H X A) : Cohomology H X A :=
  SSet.π₀.mk c

/-- The composite cocycle `k(c) : X ⟶ B` of a cocycle `c : X ⟶ A` on `X` and a
cocycle `k : A ⟶ B` on the coefficient object. Its cohomology class is the
characteristic class of `c` with respect to `k`. -/
def charCocycle {X A B : H.Obj} (c : Cocycle H X A) (k : Cocycle H A B) :
    Cocycle H X B :=
  H.comp c k

/-- The **trivial cocycle** on `X` with coefficients in a pointed object `A`:
the composite `X ⟶ * ⟶ A`, where `X ⟶ *` is any cocycle into the terminal
object. All cocycles into the terminal object are cohomologous (see
`NLabCohomology.trivialCocycle_cohomologous`), so the cohomology class of the
trivial cocycle is canonical. -/
noncomputable def trivialCocycle (T : TerminalObject H) (A : PointedObject H T)
    (X : H.Obj) : Cocycle H X A.A :=
  H.comp (Classical.choice (T.contractible X).1) A.pt

/-- A cocycle cohomologous to the trivial cocycle is called a **coboundary**
(the terminological specialization noted in the nLab general definition). -/
def IsCoboundary (T : TerminalObject H) (A : PointedObject H T) {X : H.Obj}
    (c : Cocycle H X A.A) : Prop :=
  Cohomologous H c (trivialCocycle H T A X)

end NLabCohomology
Source
nLab, 'cohomology', section 3 (Definition), subsection 'General definition'; https://ncatlab.org/nlab/show/cohomology#Definition (page last revised August 11, 2026). Bullets: cocycles; trivial cocycle; coboundaries and cohomologous cocycles; cohomology classes; the cohomology set H(X,A) = π₀𝐇(X,A); characteristic class [k(c)].
Human review
  • Endorsed by Shuze Chen · Nov 18, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Nov 18, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me