I've been reading Michael Shulman's blog posts defining cohomology in homotopy type theory, and I'd like to understand (using HoTT) why cohomology of BG is group cohomology.
if I understand correctly, given a parametrized spectrum (i.e. a fibration by spectra) $E: X \to \mathsf{Spectra}$, we define the twisted cohomology of $X$ with coefficients in $E$ to be $H^n(X; E) \equiv \Vert \prod_{x:X} \Omega^{-n} E_0 \Vert_0$.
In particular, if we have a parametrized family $V: X \to \mathsf{AbGroup}$ then we can compose with the Eilenberg-MacLane construction $H: \mathsf{AbGroup} \to \mathsf{Spectra}$ to get a parametrized family of Spectra $HV: X \to \mathsf{Spectra}$. The cohomology $H^n(X; HV)$ is cohomology with local coefficients, which is the twisted version of ordinary cohomology.
Now if we consider the case $X = BG$ (i.e. $BG=K(G,1)$ ) for $G$ a set-group, then a parametrized family $V: BG \to \mathsf{AbGroup}$ is the same as a group representation of $G$, since functions are functorial on paths in HoTT. In other words, given $g: \bullet = \bullet$, we get a path $g_*: V(\bullet) = V(\bullet)$. Now, if we consider the corresponding twisted cohomology $H^n(BG; HV) \equiv \Vert \prod_{x:BG} K(V(x);n) \Vert_0$, why do we get group cohomology?
For now let's just consider $H^0(BG; HV) \equiv \Vert \prod_{x:BG} V(x) \Vert_0 = \prod_{x:BG} V(x)$, where the second equality follows because $V(x)$ is a set. In order to get group cohomology, it should be the case that any $v: \prod_{x:BG} V(x)$ encodes a $G$-invariant element of the $G$-representation. But it isn't immediately obvious to me why this should be the case.
Any help would be greatly appreciated!