Let $G$ be a real or complex Lie group with Lie algebra $\mathfrak g$, and let $\mathbb C[\mathfrak g]$ be the algebra of $\mathbb C$-valued polynomials on $\mathfrak g$. Denote by $$\mathbb C[\mathfrak g]^G=\{f\in \mathbb C[\mathfrak g] | ~f(Ad_g x)=f(x),~ \forall g \in G,~ \forall x\in \mathfrak g\}$$ the subalgebra of fixed points in $\mathbb C[\mathfrak g]$ under the adjoint action of $G$.

Now, given principal $G$-bundle $P$ on a manifold $M$, the *Chern-Weil homomorphism* is an homomorphism of $\mathbb C$-algebras $\mathbb C[\mathfrak g]^G \to H^*_{dR}(M, \mathbb C)$, which is given by $f\mapsto f(F_\nabla)$ for some connection $\nabla$ on the given bundle.

Suppose $G$ is compact, then according to Wikipedia, we have an isomorphism of $\mathbb C$-algebras $$\mathbb C[\mathfrak g]^G \cong H^*_{dR}(BG, \mathbb C) $$

**Question:** Is this isomorphism given by the Chern-Weil homomorphism?

If so, a problem is that $BG$ may fail to be a smooth manifold, so additional conditions should be needed. And, what $G$-bundles on $BG$ should be taken into consideration? And, can we construct explicitly the inverse homomorphism?

If not, how to understand this isomorphism?