group cohomology, nonabelian group cohomology, Lie group cohomology
cohomology with constant coefficients / with a local system of coefficients
differential cohomology
Where cohomology classifies cocycles on an object $X$ with coefficients in some object $A$, relative cohomology for a map morphism $Y \to X$ classifies cocycles on $X$ that satisfy some condition when pulled back to $Y$, such as being trivializable there. Or rather: cocycles equipped with some structure on their pullback to $Y$, such as a trivialization.
We first give a general abstract definition and then reduce to certain special cases.
Recall the general abstract definition of cohomology, as discussed there:
for $\mathbf{H}$ an (∞,1)-topos, and $X, A \in \mathbf{H}$ two objects, a cocycle on $X$ with coefficients in $A$ is a morphism $X \to A$, the ∞-groupoid of cocycles, coboundaries and higher coboundaries is the (∞,1)-categorical hom space $\mathbf{H}(X,A)$ and the cohomology classes themselves are the connected components / homotopy classes in there
Let $i : Y \to X$ and $f : B \to A$ be two morphisms in $\mathbf{H}$. Then the relative cohomology of $X$ with coefficients in $A$ relative to these morphisms is the connected components of the $\infty$-groupoid of relative cocycles
where $\mathbf{H}^I$ the arrow (∞,1)-topos of $\mathbf{H}$, hence the (∞,1)-category of (∞,1)-functors $I \to \mathbf{H}$, where $I$ is the interval category.
Often relative cohomology is considered for the special case where $A$ is a pointed object, $B = *$ is the terminal object and $B \simeq * \to A$ is the point inclusion. In this case we may write just
The $\infty$-groupoid of relative cocycles is the (∞,1)-pullback in
This makes manifest the interpretation of relative cocycles as $A$-cocycles on $X$ whose restriction to $Y$ is equipped with a coboundary to a $B$-cocycle on $Y$.
If $B$ is the point then this means: $A$ cocycles on $X$ which are equipped with a trivialization on $Y$.
If we fix an $A$-cocycle $\mathbf{c}$ on $X$, then we may consider the relative cohomology just of this cocycle, hence the homotopy fiber of the $\infty$-groupoid of relative cocycles over $\mathbf{c}$
By the pasting law it follows that this fiber is equivalently given by the following (∞,1)-pullback
Comparison shows that this identifies $\mathbf{H}^I_{\mathbf{c}}(i,f)$ as the cocycle $\infty$-groupoid of the $[i^* \mathbf{c}]$-twisted cohomology of $Y$ with coefficients in the homotopy fiber of $f$.
See for instance the example of twisted bundles on D-branes below.
A special case of the general definition of cohomology is abelian sheaf cohomology, obtained by taking the coefficient objects $A$ and $B$ to be in the image of chain complexes under the Dold-Kan correspondence.
If moreover we restrict attention to the case that $B = *$, then by remark 1 the relative cohomology is given by the homotopy fiber of a morphism of cochain complexes $C^\bullet(X,A) \to C^\bullet(Y,A)$, presenting the morphism $\mathbf{H}(X, A) \to \mathbf{H}(Y,A)$. Such homotopy fibers are given for instance by dual mapping cone complexes. Accordingly, in the abelian case the $A$-cohomology on $X$ relative to $Y$ is the cochain cohomology of this mapping cone complex. This is the definition one finds in much traditional literature.
We consider an example of relative cohomology for the general case where $B \to A$ is not the point inclusion, but exhibits an additional twist, according to 2.
This example is motivated from the physics of D-branes in type II string theory, as well as from twisted K-theory.
Let the ambient (∞,1)-topos be $\mathbf{H} :=$ Smooth∞Grpd. For any $n \in \mathbb{N}$ consider the sequence of Lie groups
exhibiting the unitary group as a central extension of groups of the projective unitary group. The fiber sequence on delooping smooth ∞-groupoids induced by this is
For $Y$ a smooth manifold, the $f$-twisted cohomology of $X$ is classifies $U(n)$-principal twisted bundles on $Y$, as discussed there. These appear in string theory/twisted K-theory, where the twist is a B-field/circle 2-bundle/bundle gerbe classified by $Y \to \mathbf{B}^2 U(1)$.
But in these applications, this 2-bundle is the restriction of an ambient 2-bundle classified by $\mathbf{c} : X \to \mathbf{B}^2 U(1)$ on a spacetime $X$ along an embedding $Y \hookrightarrow X$ of the D-brane worldvolume. Therefore the moduli stack of total field configurations consisting of the ambient B-field and the gauge field on the D-brane (see Freed-Witten anomaly for the details of this mechanism) is the $\infty$-groupoid of $(Y \hookrightarrow X)$-relative cocycles with coefficients in $(\mathbf{B}PU \to \mathbf{B}^2 U(1))$.