In order to define the cohomology of a topological group G, we first have to introduce the concept of a classifying space. A classifying space BG is the base space of a principal G bundle EG. The EG is the universal bundle: Any principal G bundle E over a manifold M allows a bundle map into the universal bundle, and any two such morphisms are smoothly homotopic. Given $$ \gamma: M \to BG $$ the induced map of the base manifolds, it is the so-called classifying map.
The topology of the bundle E is completely determined by the homotopy class of the classifying map $\gamma$. That is, the different components of the space Map(M,BG) correspond to the different bundles E over M. It can be shown that up to homotopy BG is uniquely determined by requiring EG to be contractible. That is, any contractible space with a free action of G is a realization of EG. In general, the classifying space BG of a compact group is an infinite-dimensional space.
Attempt 1:
Naively, we can have a generalized statement by modifying the map to a product of Eilenberg–MacLane space: $$ \gamma: M \to K(G_1,1) \times K(G_2,2) $$ where $G_1$ and $G_2$ are two different groups. The $G_1$ can be non-abelian.
How can we be more precise to state the similar structure, defining a "2"-group cohomology, by generalizing the relation between the "group cohomology" and the "topological cohomology of classifying space"?
Is it necessary to have $G_2$ be abelian?
Attempt 2
- A more general classifying map may be: $$ \gamma: M \to BG' $$ where $BG'$ is the possible fibration $$1 \to K(G_2,2)\to BG' \to K(G_1,1) \to 1,$$ where we may classify the fibration by Postinikov class $$[a] \in H^d(K(G_1,1), G_2).$$ Is this formulation precise?
- How can we be sure that $d=3$ is the only solution and $[a] \in H^d(K(G_1,1), G_2)$ classifies all sensible "2" group cohomology?
I am not sure if the following gives the answer you want, but there is a notion of crossed module $\mathcal M =(\mu: M \to P)$ (due to JHC Whitehead) where $M,P$ are groups and $P$ acts on $M$ satisfyng two rules, which I won't detail here. These crossed modules classify pointed homotopy $2$-types. A crossed module $\mathcal M$ has a classifying space $B \mathcal M$. with first and second homotopy groups Coker $\mu$, Ker $\mu $ respectively. Full details are in the book Nonabelian Algebraic Topology.
This book does not contain much on the topological or Lie case.