Shock wave solutions of the Einstein equations have been constructed in coordinate systems in which the gravitational metric is only Lipschitz continuous, but the connection $\Gamma$ and curvature $Riem(\Gamma)$ are both in $L^{\infty}$. At this low level of regularity, the physical meaning of such gravitational metrics remains problematic. Here we address the mathematical problem as to whether the condition that $Riem(\Gamma)$ has the same regularity as $\Gamma$, is sufficient for the existence of a coordinate transformation which perfectly cancels out the jumps in the leading order derivatives of $\delta\Gamma$, thereby raising the regularity of the connection and the metric by one order--a subtle problem. We have now discovered, in a framework much more general than GR shock waves, that the regularization of non-optimal connections is determined by a nonlinear system of elliptic equations with matrix valued differential forms as unknowns, the Regularity Transformation equations, or RT-equations. In this paper we establish the first existence theory for the nonlinear RT-equations in the general case when $\Gamma, {\rm Riem}(\Gamma)\in W^{m,p}$, $m\geq1$, $n<p< \infty$, where $\Gamma$ is any affine connection on an $n$-dimensional manifold. From this we conclude that for any such connection $\Gamma(x) \in W^{m,p}$ with ${\rm Riem}(\Gamma) \in W^{m,p}$, $m\geq1$, $n<p< \infty$, given in $x$-coordinates, there always exists a coordinate transformation $x\to y$ such that $\Gamma(y) \in W^{m+1,p}$. That is, $\Gamma$ exhibits optimal regularity in $y$-coordinates. The problem of optimal regularity for the hyperbolic Einstein equations is thus resolved by elliptic regularity theory in $L^p$-spaces applied to the RT-equations.