  We solve a problem posed by Calabi more than 60 years ago, known as the
Saint-Venant compatibility problem: Given a compact Riemannian manifold,
generally with boundary, find a compatibility operator for Lie derivatives of
the metric tensor. This problem is related to other compatibility problems in
mathematical physics, and to their inherent gauge freedom. To this end, we
develop a framework generalizing the theory of elliptic complexes for sequences
of linear differential operators $(A_{\bullet})$ between sections of vector
bundles. We call such a sequence an elliptic pre-complex if the operators
satisfy overdetermined ellipticity conditions, and the order of $A_{k+1}A_k$
does not exceed the order of $A_k$. We show that every elliptic pre-complex
$(A_{\bullet})$ can be "corrected" into a complex $(\mathcal{A}_{\bullet})$ of
pseudodifferential operators, where $\mathcal{A}_k - A_k$ is a zero-order
correction within this class. The induced complex $(\mathcal{A}_{\bullet})$
yields Hodge-like decompositions, which in turn lead to explicit integrability
conditions for overdetermined boundary-value problems, with uniqueness and
gauge freedom clauses. We apply the theory on elliptic pre-complexes of
exterior covariant derivatives of vector-valued forms and double forms
satisfying generalized algebraic Bianchi identities, thus resolving a set of
compatibility and gauge problems, among which one is the Saint-Venant problem.

Analysis of PDEs;Differential Geometry