This question is inspired by [this physics stack exchange post](https://physics.stackexchange.com/questions/604644/how-to-compute-gauge-potential-a-from-the-field-strength-f), which is recent and has not received an answer yet, nontheless I feel that there is a better way to ask this question here with a larger scope than the OP did there.




---


At first I am primarily interested in the local question so let $X$ be an $n$ dimensional smooth real manifold that if necessary might be assumed to be contractible or otherwise topological trivial.


Let us fix a Lie algebra $\mathfrak g$, let $\Omega^k(X,\mathfrak g)$ denote the module of smooth $\mathfrak g$-valued $k$-forms.


The following is known. Let us define $C:\Omega^1(X,\mathfrak g)\rightarrow \Omega^2(X,\mathfrak g)$ by $$ C(\omega)=d\omega+\frac{1}{2}[\omega\wedge\omega], $$ and call $C$ the curvature operator. It is known that at least locally $C(\omega)=0$ if and only if there is a function $f\in C^\infty(X,G)$ (where $G$ is a/the Lie group associated with $\mathfrak g$) such that $$ \omega=f^\ast\Xi\_G\equiv \Delta\_Gf, $$ where $\Xi\_G\in\Omega^1(G,\mathfrak g)$ is the Maurer-Cartan form of $G$. I have taken the liberty of using $\Delta\_G$ for this operation (nonstandard notation) and iirc this is sometimes referred to as the *Darboux-derivative* (treated in Sharpe for example).


Now, let $F=C(\omega)=d\omega+\frac{1}{2}[\omega\wedge\omega]\in\Omega^2(X,\mathfrak g)$. Such curvature forms satisfy the (differential) Bianchi identity $$ d\_\omega F=dF+[\omega\wedge F]=0. $$


It this seems that one may define a cochain complex-like structure $$ 0\longrightarrow C^\infty(X,G)\longrightarrow^{\Delta\_G}\Omega^1(X,\mathfrak g)\longrightarrow^{C}\Omega^2(X,\mathfrak g)\longrightarrow^{d\_\omega}\Omega^3(X,\mathfrak g) ... $$
in that the composition of two subsequent arrows always return $0$, however this is not a true cochain complex because for example $C^\infty(X,G)$ is not an Abelian group (if $G$ is nonabelian).




---


What I am primarily interested in is whether it is possible to define such a sequence rigorously in some way which satisfies a local exactness property. This sequence is locally exact at $\Omega^1(X,\mathfrak g)$, which can be verified using the Frobenius integrability theorem, but - in my opinion - a more interesting question is the $\Omega^2(X,\mathfrak g)$.


Specifically what is the necessary and sufficient (local) condition for a Lie algebra valued $2$-form to be the curvature form of a connexion? Even if the Bianchi identity is a complete local integrability condition, it is formulated in terms of $2$-forms so Frobenius' theorem does not apply, moreover in order to calculate the covariant exterior derivative of the curvature $2$-form one already needs to know the connection form as well.


If a necessary and sufficient condition can be given, is there an explicit "homotopy operator" that allows one to construct a connection form from a given curvature form?




---


*Remark:*\* In $\dim X=3$ the curvature form is the Euler-Lagrange form of the Chern-Simons Lagrangian, so I guess methods of the variational bicomplex could be used to attack this problem. As far as I see this only works in three dimensions though.



A non-Abelian de Rham complex?
What is being described in the main post is simply the de Rham (crossed) complex valued in a Lie group (not necessarily commutative).


See, for example, Section 6.2 in Anders Kock's [Synthetic Geometry of Manifolds](https://users-math.au.dk/%7Ekock/SGM-final.pdf).


One easy way to see what is going on is as follows.
Consider the usual singular simplicial set of a smooth manifold M.


One can construct singular cochains on M valued in an abelian group A
by applying the functor S↦Map(S,A) in each simplicial degree
and then invoking the Dold–Kan correspondence to convert the resulting
cosimplicial abelian group to a cochain complex.


The Dold–Kan correspondence is an equivalence of categories
(in fact, an equivalence of model categories),
so we can omit it and work with the original cosimplicial group instead.
The advantage of this is that the group A can now be nonabelian,
producing a cosimplicial group.


There is a generalized Dold–Kan correspondence for cosimplicial groups,
it produces [crossed complexes](https://ncatlab.org/nlab/show/crossed%20complex),
which is the “cochain complex-like structure” from the main post.


In our case, to get the de Rham (crossed) complex, we must impose the following additional conditions:


* singular simplices must be smooth (as maps Δ^n→M);
* cochains must be smooth (as maps C^∞(Δ^n,M)→G);
* singular simplices must be infinitesimal: their vertices must be infinitesimally close to each other to the first order.
In coordinates, this means that the difference of coordinates
of any pair of vertices must be a real number that squares to zero.


The last condition can (must) be encoded using the formalism of functor of points, working on the site of C^∞-rings or just the Cahiers site.
(See Moerdijk and Reyes, [Models for smooth infinitesimal analysis](http://gen.lib.rus.ec/book/index.php?md5=4D59D75A75C61BC4D274856E5DECE867).)


If G is a real vector space, the resulting cochain complex
is precisely the de Rham complex valued in the real vector space G.


If G is an abelian Lie group, we get the Deligne complex,
used to define bundle n-gerbes with connection, alias Deligne cohomology.


If G is nonabelian, we get the de Rham (crossed) complex of differential forms
valued in a Lie group.


Its first terms are as described in the main post, but this crossed complex extends indefinitely, to arbitrary degrees.
In degree k>0, we have differential k-forms valued
in the Lie algebra of G.
The differential, however, is not the usual de Rham differential.


In particular, this crossed complex can be used to answer your question about Lie-algebra valued 2-forms in the expected way.
(For a textbook-length treatment of crossed complexes,
see Brown–Higgins–Sivera, [Nonabelian Algebraic Topology](http://gen.lib.rus.ec/book/index.php?md5=6236E0CBE3F0074CE00ECF3057F4A695).)


