[proofplan]
We first fix the Chern-Weil convention by treating the invariant polynomial $q$ as its associated symmetric multilinear map on $\mathfrak g$-valued forms. The curvature form is horizontal and equivariant, so applying the $\operatorname{Ad}$-invariant polynomial produces a basic form and hence a descended form on $M$. Closedness follows from the Bianchi identity together with the infinitesimal invariance identity for $q$. For two connections, we join them by the affine path $A_t=A_0+t(A_1-A_0)$, differentiate the Chern-Weil form, identify the derivative as an [exterior derivative](/theorems/1525) of a transgression form, and integrate over $t\in[0,1]$.
[/proofplan]
custom_env
admin
[step:Fix the Chern-Weil convention and descend the curvature polynomial]
Let $A$ be a principal connection on $P$, and let $F_A\in \Omega^2(P;\mathfrak g)$ be its curvature form. We use the standard Chern-Weil extension of the symmetric $k$-[linear map](/page/Linear%20Map) $q:\mathfrak g^k\to \mathbb R$ to $\mathfrak g$-valued forms: if $\beta_j\in \Omega^{r_j}(P;\mathfrak g)$, then $q(\beta_1,\dots,\beta_k)\in \Omega^{r_1+\cdots+r_k}(P)$ is obtained by wedging the scalar form components and applying $q$ to the Lie-algebra components with the usual Koszul symmetrisation. In particular,
\begin{align*}
q(F_A)=q(F_A,\dots,F_A)\in \Omega^{2k}(P).
\end{align*}
The curvature form $F_A$ is horizontal and $\operatorname{Ad}$-equivariant under the principal right action. Since $q$ is $\operatorname{Ad}$-invariant, the form $q(F_A,\dots,F_A)$ is horizontal and invariant, hence basic. Therefore, by the [descent of Chern-Weil forms](/theorems/9762) [citetheorem:9762], there is a unique form on $M$, denoted again by $q(F_A)\in \Omega^{2k}(M)$, such that
\begin{align*}
\pi^*q(F_A)=q(F_A,\dots,F_A).
\end{align*}
[/step]
custom_env
admin
[step:Prove closedness from Bianchi and infinitesimal invariance]
It is enough to prove closedness after pulling back to $P$, because $\pi:P\to M$ is a surjective submersion and pullback by a surjective submersion is injective on differential forms. Let $d_A$ denote the covariant exterior derivative on $\mathfrak g$-valued forms determined by $A$. The Bianchi identity for a principal connection states
\begin{align*}
d_A F_A=0.
\end{align*}
For an invariant symmetric polynomial, the exterior derivative of the scalar form obtained by applying $q$ to $\mathfrak g$-valued forms may be computed using the covariant exterior derivative. Indeed, replacing $d$ by $d_A$ introduces bracket terms of the form obtained by inserting $[Y,X_j]$ in the $j$th argument of $q$ at each tangent-vector evaluation. These bracket contributions sum to zero by the infinitesimal invariance identity [citetheorem:9759]. Applying this to the $k$ copies of the even-degree form $F_A$ gives
\begin{align*}
d\,q(F_A,\dots,F_A)=k\,q(d_A F_A,F_A,\dots,F_A).
\end{align*}
Using $d_A F_A=0$, the right-hand side vanishes. Thus
\begin{align*}
d\,q(F_A,\dots,F_A)=0.
\end{align*}
Since
\begin{align*}
\pi^*(d\,q(F_A))=d(\pi^*q(F_A))=d\,q(F_A,\dots,F_A)=0,
\end{align*}
injectivity of $\pi^*$ implies $d\,q(F_A)=0$ on $M$.
[/step]
custom_env
admin
[step:Differentiate along the affine path of connections]
Let $A_0$ and $A_1$ be principal connections on $P$. Define
\begin{align*}
\alpha:=A_1-A_0\in \Omega^1(P;\mathfrak g).
\end{align*}
The difference of two principal connections is horizontal and $\operatorname{Ad}$-equivariant, so $\alpha$ represents a $1$-form on $M$ with values in the adjoint bundle. Define the affine path of connections
\begin{align*}
A_t:=A_0+t\alpha
\end{align*}
for $t\in[0,1]$, and let $F_t:=F_{A_t}\in \Omega^2(P;\mathfrak g)$ denote its curvature. Since $\alpha$ is horizontal and $\operatorname{Ad}$-equivariant, $A_t$ again reproduces fundamental vector fields and satisfies the connection transformation law under the principal right action. Thus $t\mapsto A_t$ is a smooth path of principal connections, and its velocity is the horizontal $\operatorname{Ad}$-equivariant form $\dot A_t=\alpha$.
By the [infinitesimal Chern-Weil variation formula](/theorems/9790) [citetheorem:9790], applied to this smooth path of principal connections, we have
\begin{align*}
\frac{d}{dt}q(F_t,\dots,F_t)=k\,d\,q(\alpha,F_t,\dots,F_t).
\end{align*}
Here $F_t$ appears $k-1$ times in the expression on the right.
[/step]
custom_env
admin
[step:Check that the transgression form descends to the base]For each $t\in[0,1]$, the form $\alpha$ is horizontal and $\operatorname{Ad}$-equivariant, and $F_t$ is horizontal and $\operatorname{Ad}$-equivariant. Since $q$ is $\operatorname{Ad}$-invariant, the scalar form
\begin{align*}
q(\alpha,F_t,\dots,F_t)\in \Omega^{2k-1}(P)
\end{align*}
is horizontal and invariant, hence basic. Therefore there is a unique form
\begin{align*}
\tau_t\in \Omega^{2k-1}(M)
\end{align*}
such that
\begin{align*}
\pi^*\tau_t=k\,q(\alpha,F_t,\dots,F_t).
\end{align*}[/step]
custom_env
admin
[guided]The exactness conclusion must live on $M$, not merely on the total space $P$. For this reason we must verify that the transgression term descends.
The form $\alpha=A_1-A_0$ is horizontal because both $A_0$ and $A_1$ reproduce the same fundamental vector field on vertical tangent vectors, so their difference vanishes on vertical vectors. It is $\operatorname{Ad}$-equivariant because both connection forms transform by the same affine rule under the principal right action, and the inhomogeneous Maurer-Cartan term cancels in the difference. For every $t\in[0,1]$, the curvature $F_t$ of the connection $A_t$ is horizontal and $\operatorname{Ad}$-equivariant.
Now apply the $\operatorname{Ad}$-invariance of $q$. If a principal right translation acts on each Lie-algebra component by $\operatorname{Ad}_{g^{-1}}$, then applying $q$ leaves the scalar value unchanged. Hence
\begin{align*}
q(\alpha,F_t,\dots,F_t)
\end{align*}
is invariant. Since all of its arguments are horizontal, the resulting scalar form is horizontal as well. Thus it is basic, and the defining property of basic forms gives a unique form $\tau_t\in \Omega^{2k-1}(M)$ satisfying
\begin{align*}
\pi^*\tau_t=k\,q(\alpha,F_t,\dots,F_t).
\end{align*}
This verification is the point that ensures the primitive for the difference of Chern-Weil forms is an actual form on the base manifold.[/guided]
custom_env
admin
[step:Integrate the transgression identity and obtain exactness]
Let $\mathcal L^1$ denote one-dimensional [Lebesgue measure](/page/Lebesgue%20Measure) on $[0,1]$. Define the transgression form
\begin{align*}
T_q(A_0,A_1)\in \Omega^{2k-1}(M)
\end{align*}
by the parameter integral
\begin{align*}
T_q(A_0,A_1):=\int_{[0,1]}\tau_t\,d\mathcal L^1(t).
\end{align*}
The family $t\mapsto \tau_t$ is smooth because $t\mapsto A_t$ and $t\mapsto F_t$ are smooth polynomial families of differential forms. Differentiation under the parameter integral for smooth families of differential forms gives
\begin{align*}
q(F_{A_1})-q(F_{A_0})=\int_{[0,1]}\frac{d}{dt}q(F_t)\,d\mathcal L^1(t).
\end{align*}
Pulling this identity back to $P$ and using the variation formula gives
\begin{align*}
\pi^*\bigl(q(F_{A_1})-q(F_{A_0})\bigr)=\int_{[0,1]}d\,\pi^*\tau_t\,d\mathcal L^1(t).
\end{align*}
Since exterior differentiation commutes with integration over the compact parameter interval for smooth families of forms,
\begin{align*}
\pi^*\bigl(q(F_{A_1})-q(F_{A_0})\bigr)=\pi^*\bigl(dT_q(A_0,A_1)\bigr).
\end{align*}
Injectivity of $\pi^*$ on forms therefore yields
\begin{align*}
q(F_{A_1})-q(F_{A_0})=dT_q(A_0,A_1).
\end{align*}
Thus the two closed Chern-Weil forms differ by an exact form on $M$.
[/step]
custom_env
admin
[step:Pass from exactness to independence of the de Rham class]
For every connection $A$ on $P$, the form $q(F_A)$ is closed by the closedness step. If $A_0$ and $A_1$ are two connections, the preceding step gives
\begin{align*}
q(F_{A_1})-q(F_{A_0})=dT_q(A_0,A_1).
\end{align*}
Therefore $q(F_{A_1})$ and $q(F_{A_0})$ determine the same de Rham cohomology class:
\begin{align*}
[q(F_{A_1})]=[q(F_{A_0})]\in H^{2k}_{\mathrm{dR}}(M).
\end{align*}
This proves that $[q(F_A)]$ is independent of the chosen principal connection $A$.
[/step]