Long time listener, first time caller!

Suppose that I have a locally free sheaf $\mathcal{E}$ on an smooth algebraic variety $X/k$. Let $\Delta^{(1)}\subset X\times X$ denote the first-order neighbourhood of the diagonal, with projection maps $p_1,p_2:\Delta^{(1)}\to X$. Then there are a few different ways one can describe a connection on $\mathcal{E}$:

As a $k$-linear map $D:\mathcal{E}\to\mathcal{E}\otimes\Omega^1_X$ that satisfies the Leibniz rule.

As an $\mathcal{O}_X$-linear splitting $s$ of the first jet bundle exact sequence $0 \to \mathcal{E}\otimes\Omega^1_X \to J^1(\mathcal{E})\to \mathcal{E}\to 0$. (Recall that $J^1(\mathcal{E}) = p_{1\ast}p_2^\ast\mathcal{E}$.)

As an isomorphism $\phi:p_1^\ast\mathcal{E}\simeq p_2^\ast\mathcal{E}$ which restricts to the identity map on the diagonal $\Delta\subset X\times X$.

Passing between these different descriptions of a connection is fairly straightforward: given $D$ one obtains a splitting $s$ by taking $s = D+ j^1$ where $j^1$ is the $k$-linear "jet prolongation" splitting of the jet bundle exact sequence; given a splitting $s$ one obtains an isomorphism $\phi$ by pulling back along $p_1$ and applying the counit of the $(p_1^\ast,p_{1\ast})$ adjunction. So far, so good.

Now, there are various types of "integrability" conditions one might be interested in for a connection:

**Flatness:**The connection is*flat*if the curvature $F(D)\in\Omega_X^2(End(\mathcal{E}))$ vanishes.**Integrability:**Let $\Delta^{(1)}_3\subset X\times X\times X$ be the first order neighbourhood of the small diagonal with projections $q_1,q_2,q_3$, and let $\phi_{ij}:q_i^\ast\mathcal{E}\simeq q_j^\ast\mathcal{E}$ be the isomorphisms induced by $\phi$. Then the connection is*integrable*if it satisfies the cocycle condition $\phi_{23}\circ\phi_{12} = \phi_{13}$.**Formal lifting:**The connection can be lifted to as isomorphism $p_1^\ast\mathcal{E}\simeq p_2^\ast\mathcal{E}$ on every finite order neighbourhood of the diagonal $\Delta^{(n)}$.

My question is as follows: **What is the relation between these three integrability conditions?**

- I believe I was once told that integrability $\Rightarrow$ formal lifting in characteristic zero, although I've never seen a proof (and have thus far failed to cook one up myself).
- I naively thought that there would be a straightforward relation between flatness and integrability, but if my calculations are correct the connection $D=d_{dR} + t^1dt^2$ on $\mathbb{A}_k^2$ provides a simple example of an integrable nonflat connection. (Of course, my calculations could always be wrong!)
- The curvature of a connection lies in $\Omega_X^2(End(\mathcal{E}))$, while the obstruction to lifting from the first- to second-order neighbourhood of the diagonal lives in $H^1(X;\text{Sym}^2(\Omega_X^1)\otimes\mathcal{E}nd(\mathcal{E}))$ (to get the obstruction to lifting from $\Delta^{(n)}$ to $\Delta^{(n+1)}$ replace $\text{Sym}^2$ with $\text{Sym}^{n+1}$). Should I take this as a hint that flatness and formal lifting are unrelated, or is there some sort of relation between the curvature and this lifting obstruction?

**Edited to add:**

Since it isn't *explicit* in the answer below or the comments that follow: the correct relation here is that for $X$ smooth and in characteristic zero, flatness is equivalent to formal lifting **together with** the cocycle condition.