I am trying to understand whether there is a sense in which cohomology always relates to topology or whether this is the case only in particular examples. According to the Wikipedia [page](https://en.wikipedia.org/wiki/Chain_complex), a cochain complex is defined as: 


“… a sequence of abelian groups or modules ..., $A\_0$, $A\_1$, $A\_2$, $A\_3$, $A\_4$, ... connected by homomorphisms $d^n$ : $A^n$ → $A^{n+1}$ satisfying $d^{n+1} \cdot d^n$ = 0. “


Based on this one defines the nth cohomology group $H^n$ as the group


$H^n := ker \, d^n / \, im \, d^{n-1}$ .


As a physicist, I am most familiar with examples of cochains and cohomology appearing in the context of *topology*. For instance, de Rham cohomology in which $d$ is identified with the exterior derivative and $A^n$ with the space of differential forms of degree $n$ on a smooth manifold $M$. In this case cohomology groups capture topological invariants of the manifold $M$.  


Although the general definition above makes no explicit reference to a topological space, I often see the claim that cohomology is a branch of topology. In fact, from the mathoverflow [page](https://mathoverflow.net/questions/tagged/cohomology) cohomology is defined as:


"A branch of algebraic topology concerning the study of cocycles and coboundaries."


Thus, my question is the following:


Q: Is there a sense in which, given a *general* cochain complex, its cohomology captures topological invariants of *some* underlying topological space?


Q': If so, what defines the underlying topological space? 


Q'': If not, is there still a sense in which cohomology groups are some sort of “invariants?”



Is cohomology always related to topology?
While it is always possible to introduce topology, it is not always the obvious or most useful thing to do. So at least in this sense, there are notions of cohomology that do not immediately connect to topology.


As an example group (co)homology, Lie algebra (co)homology, Hochschild (co)homology, ... all appear in algebraic contexts without necessarily having topological interpretations all too closely connected to them. There are of course topological interpretations, e.g. group cohomology is the topology of the classifying space of the group, but that's not necessarily the most useful way to view them. More useful often is the connection to representation theory (says the guy with a degree in representation theory) which comes from the view point that they're all derived functors on some module category.


EDIT: Because negatively-graded complexes were mentioned in the comments, let me just point you towards Tate cohomology which is a generalization of group cohomology to negative degrees.


