Global Chern-Simons forms and topological gauge theories I am reading the classic Dijkgraaf and  Witten paper on topological gauge theories and something struck me that I didn't understand. For a trivial bundle $E$ on smooth 3-manifold $M$ with compact gauge group $G$ the Chern-Simons form is of course
$$S(A)=\frac{k}{8\pi^2}\int Tr (A\wedge dA + \frac{2}{3}A\wedge A\wedge A).$$
The confusing sentence is the following: "If  the bundle $E$ is not trivial, the formula for the action does not make sense, since a connection  on a non-trivial bundle  cannot be represented by a Lie algebra valued 1-form as in that formula." My concern is that this is wrong - of course we can represent a connection in a non-trivial bundle with a Lie-algebra valued 1-form! In fact, some texts define the connection in exactly that way (my trusty Choquet-Bruhat and DeWitt-Morette has that as one of their three equivalent definitions for a connection)- locally, a connection is represented as a linear map $\omega_p:T_p(E)\to \mathfrak{g}$.
So are we supposed to read the "as in that formula" to mean "globally"? Since of course, if the bundle is not trivial there isn't a global Lie-algebra valued 1-form that we can use for the Chern-Simons action. So that seems like a fine argument, but in QFT we are always writing down actions with sections of bundles (fields $\phi(x)$, say) which are not trivial - we just make sure that the action is invariant under the gauge transformations.
So, what is going on with that statement? Is it really saying we cannot represent a connection in such a way, or is it just stating the action is now local, and the rest of the paper is going to go on and tell me how to fix this with an element of $H^3(BG,\mathbb{R})$, etc.?
 A: As you say yourself, indeed every connection on a bundle is locally given by a Lie algebra valued 1-form and in general only locally.
Let's say this more in detail: for $X$ any manifold, a $G$-principal connection on it is (in "Cech data"):


*

*a choice of good open cover $\{U_i \to X\}$;

*on each patch a 1-form $A_i \in \Omega^1(U_i)\otimes \mathfrak{g}$;

*on each double intersection of patches a gauge transformation function $g_{i j} \in C^\infty(U_i \cap U_j, G)$
such that


*

*on each double intersectin $U_i \cap U_j$ we have the equation $A_j = g_{i j}^{-1} A g_{i j} + g_{i j}^{-1} \mathbf{d} g_{i j}$

*on each triple intersection $U_i \cap U_j \cap U_k$ we have the equation $g_{i j} g_{j k} = g_{i k}$.
Okay, now you would like to form a Chern-Simons 3-form... something out of this. What you immediately get from the above data is a bunch of local differential 3-forms, one on each patch: $CS(A_i) \in \Omega^3(U_i)$.
To make these 3-forms globally glue together to what is called a 3-form connection we need the evident data of higher gauge transformation


*

*on each patch we have the local 3-form $CS(A_i)$;

*on each double intersection there should be a 2-form $B_{i j} \in \Omega^2(U_i \cap U_j)$ which gauge transforms the respective CS-3-forms into each other, by $CS(A_j) = CS(A_i) + \mathbf{d} B_{i j}$;

*on each triple intersection there should be a 1-form $\alpha_{i j k} \in \Omega^1(U_i \cap U_j \cap U_k)$ which exhibits a second-order gauge transformation ("ghosts of ghosts"!) between the first order gauge trasformations, in that $B_{i j} + B_{j k} = B_{i  k} + \mathbf{d} \alpha_{ i j k}$

*finally on each quadruple intersection there should be a smooth function $h_{i j k l} \in C^\infty(U_i \cap U_j \cap U_k \cap U_l, U(1))$ which gauge-of-gauge-of-gauge-transforms the gauge-of-gauge-transforms into each other, in that $\alpha_{i j k} + \alpha_{i k l} = \alpha_{j k l} + \alpha_{i j l} + h_{i j k l}^{-1}\mathbf{d}h_{i j k l}$.
That's the data that makes the local Chern-Simons 3-form into a globally well-defined 3-form field. (For instance the supergravity C-field is of this form, with some further twists and bells and whistles added, as we have discussed here).
In mathematical language one says that this kind of local gauge-of-gauge-of-gauge gluing data for global definition of higher form fields is a "degree-4 cocycle in Cech-Deligne cohomology". This is precisely the right data needed to have a well-defined 3-dimensional higher holonomy as is needed here for the definition, because the Chern-Simons action functional is nothing but the 3-dimensional higher holonomy of this 3-form connection.
If you can build it, that is. From the above it is not entirely obvious how to build the 3-form cocycle data $\{CS(A_i), B_{i j}, \alpha_{i j k}, h_{i j k}\}$ from the given gauge field data $\{A_i, g_{i j}\}$.
But this can be done. This is what Cheeger-Simons differential characters were discovered for. An explicit construction that is very natural for the application to Chern-Simons theory we have given in 


*

*Fiorenza, Schreiber, Stasheff, Cech cocycles for differential characteristic classes, Advances in Theoretical and Mathematical Phyiscs, Volume 16 Issue 1 (2012) (arXiv:1011.4735, web)


Based on this we give a detailed introduction to and discussion of Chern-Simons action functionals for globally non-trivial situations like above in 


*

*Fiorenza, Sati, Schreiber, A higher stacky perspective on Chern-Simons theory (arXiv:1301.2580, web)


That article gives the local formulas that apply generally, discusses the simplifications that occur when the 3-manifold can be assumed to be bounding, discusses what happens if not, and then explores various other properties of globally defined Chern-Simons theory, such as how to couple Wilson lines to the above story. If you just look at the first part, I think you should find what you need.

edit: In the comments below came up the question why a similar discussion is not also needed when writing down the Yang-Mills action functional, whose Lagrangian is the 4-form $\langle F_A \wedge \star F_A \rangle$ (where $\star$ is the Hodge star of a given metric (gravity) and $\langle -,-\rangle$ is an invariant polynomial, the "Killing form" or trace), or similarly the topological Yang-Mills action functional, whose Lagrangian is the 4-form $\langle F_A \wedge  F_A \rangle$.
The reason is that these Lagrangians are built from curvatures evaluated in an invariant polynomial. The very invariance of these invariant polynomials under the adjoint action of the gauge group on its arguments ensures that if $\{U_i \to X\}$ is a good open cover of 4-dimensional space(-time) and if the gauge field is given by the Cech-cocycle data $\{A_i, g_{i j}\}$ with respect to these local patches, that then on double overlaps the two (topological or not) Yang-Mills Lagrangians  coming from two patches are already equal
$$
  \langle F_{A_i} \wedge F_{A_i}\rangle = \langle F_{A_j}\wedge F_{A_j}\rangle
  \,.
$$
Hence if we write $\nabla = \{A_i, g_{i j}\}$ for the gauge field connection abstractly and denote the (topological) Yang-Mills Lagrangian globally by $\langle F_\nabla \wedge F_\nabla\rangle$, then this is already a globally defined 4-form. Mathematically, this statement is what is at the core of Chern-Weil theory.
Notice that there is nevertheless an intricate relation to the story of the Chern-Simons functional. Namely the local Chern-Simons form $CS(A_i)$ has the special property (essentially by definition) that its differential is the topological Yang-Mills Lagrangian:
$$
  \mathbf{d}CS(A_i) = \langle F_{A_i} \wedge F_{A_i}\rangle
  \,.
$$
This means that with the Chern-Simons Lagrangian regarded as a 3-form connection then the topological Yang-Mills Lagrangian is its curvature 4-form.  Therefore the relation between the topological Yang-Mills Lagrangian 4-form and the Chern-Simons 3-form is precisely an analogue in higher gauge theory of the familiar relation two degrees down of how the electromagnetic potential 1-form -- which is not globally defined in general -- has a curvature 2-form that is globally well defined. 
Mathematically this is why Chern-Simons functionals are called "secondary invariants"
Indeed, this is a bit more than just an analogy: the Chern-Simons 3-form is precisely a doubly higher analog of the electromagnetic field as we pass from the point, via the string, to the membrane.
I have some lecture notes with more along these lines at nLab:twisted smooth cohomology in string theory.
