Hamiltonian formulation of general relativity
The basic Hamiltonian formulation of GR is the Arnowitt-Deser-Misner (ADM) formalism from 1959. The Legendre transformation of the Einstein-Hilbert Lagrangian density is singular, which leads to constraints.
References:
- ADM, arXiv:gr-qc/0405109.
The short answer to your question is: nothing. Nothing stops us from deriving an Hamiltonian for GR. The Einstein-Hilbert Hamiltonian (i.e. the ADM Hamiltonian) for GR, modulo boundary terms, is the following:
$$ H_{EH}=\int d^{3}x\ \ \bigg\{\alpha\,\bigg[\,\frac{2\kappa}{\sqrt{q}}\ G(\pi,\pi)-\frac{\sqrt{q}}{2\kappa}\ R[q]\bigg]-2<\beta,\text{div}\pi>\bigg\} $$
$H_{EH}$ is a functional of the variables $(\alpha, \beta^{i}, q_{ij}, \pi^{ij})$ with the following definitions: $\kappa=8\pi G$, $G$ is Newton's constant, $q_{ij}$ is the metric of 3-dimensional space (not of $4$-dimensional spacetime!), $R[q]$ is its Ricci scalar, the divergence and the product $<,>$ are to be understood with respect to the three-dimensional metric, $\pi^{ij}$ is the momentum conjugate to $q_{ij}$, $\alpha$ is a function, $\beta^{i}$ is a three-dimensional vector and
$$ G_{ijkl}=\frac{1}{2}(q_{ik}q_{jl}+q_{il}q_{jk}-q_{ij}q_{kl}) $$
is called the Wheeler-De Witt metric and is itself a function of $q_{ij}$, as you can see. The relation between $\alpha, \beta^{i}$ and $q_{ij}$ and the usual $4$-dimensional metric $g_{\mu\nu}$ is given by the following equations:
$$ g_{00}=-\alpha^{2}+q_{ij}\beta^{i}\beta^{j}\qquad g_{0i}=q_{ij}\beta^{j}\qquad g_{ij}=q_{ij} $$
So what's the problem with the Hamiltonian formulation of GR? The answer can be easily given by considering the following example. As you may know, the Lagrangian for a free special-relativistic particle is
$$ L=-m\sqrt{-\eta_{\mu\nu}\frac{dx^{\mu}}{ds}\frac{dx^{\nu}}{ds}} $$
where $x^{\mu}$ is the position $4$-vector of the particle, $s$ is a real parameter and $\eta_{\mu\nu}$ is the Minkowski metric. Now try to define a conjugate momentum to each of the $x^{\mu}$'s:
$$ p_{\mu}=\frac{\partial L}{\partial \dot{x}^{\mu}}=m\frac{\eta_{\mu\nu}\dot{x}^{\nu}}{\sqrt{-\eta_{\sigma\tau}\dot{x}^{\sigma}\dot{x}^{\tau}}} $$
where I set $\dot{x}^{\mu}=dx^{\mu}/ds$. If we were to use the ordinary definition for the Hamiltonian, i.e. $H=p_{\mu}\dot{x}^{\mu}-L$, we would find that $H=0$, since
$$ p_{\mu}\dot{x}^{\mu}=m\frac{\eta_{\mu\nu}\dot{x}^{\mu}\dot{x}^{\nu}}{\sqrt{-\eta_{\sigma\tau}\dot{x}^{\sigma}\dot{x}^{\tau}}}=-m\sqrt{-\eta_{\mu\nu}\dot{x}^{\mu}\dot{x}^{\nu}}=L $$
It can be shown that this happens because the action for the free special-relativistic particle is invariant under the transformation of the parameter $s$ into another arbitrary parameter $s'$. This is called a diffeomorphism invariance of the parameter space, and in our specific case it can be shown to lead to the following constraint on the phase space:
$$ p^{2}=\eta^{\mu\nu}\pi_{\mu}\pi_{\nu}=-m^{2} $$
which you can compute by yourself. The existence of this constraint spoils the possibility of differentiating the Hamiltonian with respect to the momentum variables, since these are explicitly not independent from one another. However, one can exploit the independence of the action from the parameter $s$ to fix it to be equal to the time variable $t$, i.e. we can set $s=t=x^{0}$. With this choice one has
$$ L=-m\sqrt{1-\delta_{ij}\,\dot{x}^{i}\dot{x}^{j}} $$
where now the dot is a derivative with respect to the parameter $t$ and the $x^{0}$ component of the $4$-position vector does not enter the Lagrangian any longer (in the above $t$ is just a parameter!). One can then define a modified Hamiltonian $H'=\pi_{i}\dot{x}^{i}-L$, which turns out to be equal to
$$ H'=\frac{m}{\sqrt{1-\delta_{ij}\,\dot{x}^{i}\dot{x}^{j}}}=E\neq 0 $$
where $E$ is the relativistic energy of the free particle. With respect to this Hamiltonian the dynamics of the particle is well-defined with the Hamilton's equations as a starting point.
How does this apply to GR? The action of GR, namely
$$ S_{EH}=\frac{1}{16\pi G}\ \int d^{4}x\ \sqrt{|g|}\ R[g] $$
is again diffeomorphism-invariant, in the sense that if we arbitrarily change the coordinates $x^{\mu}$ (which act as parameters for the gravitational field) with respect to which the above quantities are defined, the action does not change. This can be shown to lead, again, to the vanishing of the ordinary Hamiltonian $H=\pi_{g} g-L$ (exactly in the same fashion as before) so that a modified Hamiltonian must be used instead. The definition is one order of magnitude more involved than the one I used above for the special-relativistic free particle. The rationale is the following: one fixes a time coordinate $t$ with respect to which the metric $g_{\mu\nu}$ takes the form given above,
$$ g_{00}=-\alpha^{2}+q_{ij}\beta^{i}\beta^{j}\qquad g_{0i}=q_{ij}\beta^{j}\qquad g_{ij}=q_{ij} $$
where $\alpha$ is a function and $\beta$ is a three-dimensional vector (called the lapse function and shift vector). One then expresses all the quantities of the theory in terms of $\alpha$, $\beta$, $q$ and their derivatives and defines a modified Hamiltonian $H'$ as
$$ H'=\int d^{3}x\ \ \pi_{\alpha}\dot{\alpha}+\pi_{\beta}\dot{\beta}+\pi_{q} q-L $$
It turns out that $\dot{\alpha}$ and $\dot{\beta}$ are not present in the Lagrangian of GR, so that $\pi_{\alpha}=\pi_{\beta}=0$ and
$$ H'=\int d^{3}x\ \ \pi_{q} q-L $$
With this definition, $H'=H_{EH}$, with $H_{EH}$ as given above. The Hamilton's equations now need to be slightly modified. Since the momenta conjugate to $\alpha$ and $\beta$ vanish, we must impose that
$$ 0=\dot{\pi}_{\alpha}=\frac{\delta H_{EH}}{\delta \alpha}\qquad\qquad 0=\dot{\pi}_{\beta}=\frac{\delta H_{EH}}{\delta \beta} $$
and this gives rise to 4 more equations apart from the usual ones (albeit with three-dimensional rather than 4-dimensional indices), namely
$$ \dot{q}_{ij}=\frac{\delta H_{EH}}{\delta \pi^{ij}}\qquad\qquad \dot{\pi}^{ij}=-\frac{\delta H_{EH}}{\delta q_{ij}} $$
In summary, the problem with the Hamiltonian formulation of GR is two-fold: first of all in GR there is no preferred notion of time, and one needs time in order to define a meaningful Hamiltonian; second of all the (modified) Hamiltonian for GR is constrained, meaning that there are constraints on the phase space of the theory. The two problems are actually related to one another: if there is no preferred notion of time, then there must be some form of parameter-independence of the action; this in turn can be shown to lead systematically to the existence of constraints (as we have seen through examples).
The subject of Hamiltonian dynamics itself is fairly complex due to the appearance of constraints. The "modified" Hamiltonians I defined above are actually standardly defined in the general setting of Hamiltonian field theory. As I said, in order to formulate the theory one must ALWAYS first of all choose a notion of time, with respect to which then one can evolve the degrees of freedom of the system. The standard definition of $H$, however, is pretty involved (this is the reason why I'm not giving it). It reduces to the usual one when a time can be chosen non-arbitrarily and/or if there are no constraints on the phase space of the theory. If you are interested in the subject you should have a look at Gotay and Marsden's series of articles "Momentum Maps and Classical Fields" (they require a pretty solid knowledge of differential geometry). The application of the theory to GR without the mathematical nuances associated the so-called fiber bundle formulation is just known as the ADM formulation of General Relativity.