Consider the Lagrangian of an isotropic-homogeneous spacetime (Robertson-Walker metric), containing a simple scalar field and a cosmological constant (this expression comes from the standard Hilbert-Einstein and scalar field action, in an isotropic-homogeneous spacetime) : \begin{equation}\tag{1} \mathcal{L} = -\: \frac{1}{8 \pi G} (3 \, a \, \dot{a}^2 - 3 k \, a + \Lambda \, a^3) + \frac{1}{2} \; \dot{\phi}^2 a^3 - \mathcal{V}(\phi) \, a^3. \end{equation} The function $\mathcal{V}(\phi)$ is the potential energy density of the scalar field. It's easy to find the differential equation of the scalar field from the Euler-Lagrange equation : \begin{equation}\tag{2} \frac{\partial \mathcal{L}}{\partial \, \phi} - \frac{d}{d t} \Big( \frac{\partial \mathcal{L}}{\partial \, \dot{\phi}} \Big) = 0 \quad \Rightarrow \quad \ddot{\phi} + 3 \frac{\dot{a}}{a} \, \dot{\phi} + \frac{d \mathcal{V}}{d \, \phi} = 0. \end{equation} For the scale factor $a$, Euler-Lagrange gives this equation : \begin{equation}\tag{3} \frac{\partial \mathcal{L}}{\partial \, a} - \frac{d}{d t} \Big( \frac{\partial \mathcal{L}}{\partial \, \dot{a}} \Big) = 0 \quad \Rightarrow \quad 2 \, \frac{\ddot{a}}{a} + \frac{\dot{a}^2}{a^2} + \frac{k}{a^2} = \Lambda - 8 \pi G \Big( \frac{1}{2} \, \dot{\phi}^2 - \mathcal{V}(\phi) \Big). \end{equation} This is actually a linear combination of the two Friedmann-Lemaître equations. The last part on the right is the scalar field pressure $p$. The FL equations are these (they are found by solving the Einstein's equation, instead of going the Lagrangian route) : \begin{gather}\tag{4} \frac{\dot{a}^2}{a^2} + \frac{k}{a^2} = \frac{8 \pi G}{3} \, \rho + \frac{\Lambda}{3}, \quad \text{(first Friedmann-Lemaître equ.)} \\[12pt] \frac{\ddot{a}}{a} = -\: \frac{4 \pi G}{3} (\rho + 3 \, p) + \frac{\Lambda}{3}, \quad \text{(second Friedmann-Lemaître equ.)} \tag{5} \end{gather}
Now, since equation (3) is a linear combination of equations (4) and (5), I want to find the other Friedmann-Lemaître equation. The Hamiltonian is easy to find : \begin{equation}\tag{6} \mathcal{H} \equiv \dot{a} \, \frac{\partial \mathcal{L}}{\partial \, \dot{a}} + \dot{\phi} \, \frac{\partial \mathcal{L}}{\partial \, \dot{\phi}} - \mathcal{L} = -\: \frac{3}{8 \pi G} \Big( \frac{\dot{a}^2}{a^2} + \frac{k}{a^2} - \frac{\Lambda}{3} \Big) \, a^3 + \Big( \frac{1}{2} \, \dot{\phi}^2 + \mathcal{V}(\phi) \Big) \, a^3. \end{equation} The last part on the right is the scalar field energy density $\rho$. The Hamiltonian (6) would give the first Friedmann-Lemaître equation (4) only if $\mathcal{H} = 0$.
So the question is this :
How to prove that the Hamiltonian (6) should be 0, using the Lagrangian (1) ?
EDIT : By deriving the Hamiltonian (6) and using equations (2) and (3), it's easy to verify that the Hamiltonian is conserved : \begin{equation}\tag{7} \frac{d \mathcal{H}}{d t} = 0 \quad \Rightarrow \quad \mathcal{H} = \textit{cste}. \end{equation} But how to prove that this constant is actually 0 ?