Interpretation of the Weil algebra Cartan introduced the Weil algebra $W(\mathfrak{g})$ associated to a Lie algebra $\mathfrak{g}$ over a field $k$ of characteristic $0$. This consists of a dga whose underlying graded abelian group is given by $Sym(\mathfrak{g}^*)\otimes \Lambda^* \mathfrak{g}^*$ with a differential which can be constructed as follows.
We first define the graded derivation $h \colon W(\mathfrak{g}) \rightarrow W(\mathfrak{g})$ giveny by
\begin{equation}
h(V \otimes x_1\wedge \dots \wedge x_n)=\sum_{i=1}^n(-1)^{i-1} (x \otimes V) \otimes x_1 \wedge \dots \wedge \hat{x_i} \wedge \dots \wedge x_n \qquad h(V \otimes 1)=0
\end{equation}
where $V \in Sym(\mathfrak{g}^*)$ and $x_1\wedge \dots \wedge x_n \in \Lambda^n \mathfrak{g}^*$. Then we add this $h$ to the usual differential defined on the Chevalley-Eilenberg complex of $\mathfrak{g}$ where we consider $Sym(\mathfrak{g}^*)$ as coefficient module. The wiki page gives a detailed formula https://en.wikipedia.org/wiki/Lie_algebra_cohomology.
It is a core result that the cohomology of this complex reduces to the base field $k$ in degree $0$. From this we can produce the Cartan map, which is a function going from the invariant elements of $Sym(\mathfrak{g}^*)$ to the space of primitive elements of $H^*(\mathfrak{g}; k)$. If the Lie algebra is reductive it can be see this is a bijection.
I found a complete reference in "Cohomology of principal bundle and homogeneous" by Greub, Halperin and Vanstone, so I am not asking for clarification about a particular point of this theory. What I am looking for is some kind of explanation of what's the idea behind this cochain complex. Everything in this formulas and constructions works but I have no idea why or how these came to be.
I read somewhere that the Weil algebra is some kind of link between the "connections" (I do not know what these should be) and the cohomology of $\mathfrak{g}$. If someone could explain this I would really be grateful.
 A: I am personally not quite sure on the precise history, but the earliest paper mentioning the Weil algebra seems to be "Cohomologie réelle d’un espace fibré principal différentiable." by Cartan. I am going to present to you the story that convinced me that it is a very natural concept that one could reasonably come up with oneself, if you accept that certain other geometric concepts are worthwhile studying. I also believe this is closely related to what Cartan originally did in his paper.
I'm not going to say anything new, all of this is contained in the book by Greub, Halperin and Vanstone that you cite, but I'll try to streamline the idea. I just hope you're comfortable with some differential geometry :)

Let $P$ and $M$ be smooth manifolds, and $P \to M$ a principal $G$-bundle. Recall that that means that you have a free and transitive action of the Lie group $G$ on the fibres of the bundle. This allows you to define, for every $\xi \in \mathfrak{g}$, the fundamental vector field $\xi_P \in \Gamma(TP)$
Then a $\mathfrak{g}$-valued differential form $\omega \in \Omega^1(P,\mathfrak{g}) = \Omega^1(P) \otimes \mathfrak{g} = \Gamma(T^* P) \otimes \mathfrak{g}$ is called a connection form for the principal bundle if we have:

*

*It is equivariant with respect to the induced action of $G$ on vector fields $\Gamma(TP)$ and the adjoint action of $G$ on $\mathfrak{g}$, viewing $\omega$ as a map $\Gamma(TP) \to \mathfrak{g}$,

*It maps fundamental vector fields to its generators, meaning that for every $\xi \in \mathfrak{g}$, it fulfils $\omega(\xi_P) = \xi$.

Geometrically, this notion allows one to split up the principal bundle $P$ into vertical and horizontal directions with respect to the bundle structure, so it is definitely useful, but it may be a bit tricky to remember the precise definition.

We can see such a $\mathfrak{g}$-valued differential form as an element of $\Gamma(T^*P) \otimes \mathfrak{g}$, as a map $\Gamma(TP) \to C^\infty(P,\mathfrak{g})$, but to understand the connection to the Weil algebra, let us take on the perspective that $\omega$ is a $G$-equivariant map $$\omega: \mathfrak{g}^* \to \Omega^1(P).$$
Now, naively, both sides of this map could be understood as naturally sitting inside two well-known cochain complexes, the left-hand side $\mathfrak{g}^*$ sitting in the first degree of the Chevalley-Eilenberg complex $C^\bullet_{\text{CE}}(\mathfrak{g})$, and $\Omega^1(P)$ in the first degree of the de Rham complex $\Omega^\bullet(P)$. An instinctive reaction should then be to extend this map to a map of complexes $C^\bullet_{\text{CE}}(\mathfrak{g}) \to \Omega^\bullet(P)$ by setting for all $\alpha_1,\dots,\alpha_n \in \mathfrak{g}^*$:
$$\omega (\alpha_1 \wedge \dots \wedge \alpha_n) := \omega(\alpha_1) \wedge \dots \wedge \omega(\alpha_n) \in \Omega^n(P).$$

Turns out: This cannot be done in general! This map does not always respect the differential on both sides. The failure to do so is characterized by what geometers call the curvature $\Omega$ of the connection $\omega$, which, without going into too much detail, can be defined as the difference "$(\omega \wedge \omega) \circ d_{\text{CE}} - d_{\text{dR}} \circ \omega$", and turns out to just be a $\mathfrak{g}$-valued 2-form $\Omega \in \Omega^2(P, \mathfrak{g})$, or, equivalently, a map
$ \Omega : \mathfrak{g}^* \to \Omega^2(P)$. If this curvature is zero, we call $\omega$ a flat connection, and your map of complexes does indeed extend to a map between the Chevalley-Eilenberg and the de Rham complex, but this is not always the case.
This is now why the Weil algebra appears to be a natural concept: What ends up being possible, even when your connection is not flat, is to extend the connection to a map from the Weil algebra to the de Rham complex, by including the curvature of your connection in your considerations: If $W(\mathfrak{g}) = S^\bullet \mathfrak{g}^* \otimes \Lambda^\bullet \mathfrak{g}^*$, then define
$$\zeta: W(\mathfrak{g}) \to \Omega^\bullet(P)$$
by setting for $\alpha \in \mathfrak{g}^*$:
$$\zeta (1 \otimes \alpha) := \omega(\alpha), \quad \zeta (\alpha \otimes 1) := \Omega(\alpha),$$
and extending in a natural, graded manner to all of $W(\mathfrak{g})$.

From this point of view, giving a connection on a principal fibre bundle $P \to M$ is equivalent to giving a morphism $\zeta : W(\mathfrak{g}) \to \Omega^\bullet(P)$ intertwining the $G$-action, cochain differential and insertion of Lie algebra elements/fundamental vector fields on both sides. The paper that inspired me to learn about this, "The cohomology of vector fields on a manifold" by Bott & Segal (Section 3), calls such a $\zeta$ a "morphism of $G$-cochain algebras". The name for this structure in the Greub/Halperin/Vanstone book is "operation of a Lie algebra".
No matter what you call it, I personally find it quite impressive that a simple morphism like this encodes so much geometric information about a bundle. And all it takes to come up with it is the acknowledgment of curvature, and the extension of $C^\bullet_{\text{CE}}(\mathfrak{g})$ to a complex that can deal with curvature. Perhaps this is a standard story to a lot of people, if they are more familiar with this whole Chern-Weil theory business, but I hadn't seen it up until very recently, and found it too cool not to post. :) Okay, I'm done now!
