[proofplan]
The proof is local in a coordinate chart on $Q$. In coordinates, the Legendre transform is given by $p_i=\partial L/\partial \dot q_i$, and the diffeomorphism hypothesis lets us solve uniquely for the velocity coordinates $\dot q_i$ as smooth functions of $(q,p)$. We write the Hamiltonian in these coordinates, differentiate it with respect to $p_i$ and $q_i$, and observe that the velocity-derivative terms cancel precisely because $p_i=\partial L/\partial \dot q_i$. The resulting identities convert Hamilton's equations into the Euler--Lagrange equations and conversely.
[/proofplan]
[step:Write the Legendre transform and Hamiltonian in local coordinates]
Let $t_0 \in I$ be fixed. Choose a coordinate chart $(U,\varphi)$ on $Q$ with $q(t_0) \in U$, and restrict $I$ to a smaller open interval $J \subset I$ containing $t_0$ such that $q(J) \subset U$. Write the induced tangent bundle coordinates on $TQ|_U$ as $(q_1,\dots,q_n,\dot q_1,\dots,\dot q_n)$ and the induced cotangent bundle coordinates on $T^*Q|_U$ as $(q_1,\dots,q_n,p_1,\dots,p_n)$.
In these coordinates, the Legendre transform $\mathbb{F}L:TQ|_U \to T^*Q|_U$ is
\begin{align*}
p_i=\frac{\partial L}{\partial \dot q_i}(q,\dot q)
\end{align*}
for each $i \in \{1,\dots,n\}$. Since $\mathbb{F}L:TQ \to P$ is a diffeomorphism, its coordinate inverse on $P \cap T^*Q|_U$ gives smooth velocity functions
\begin{align*}
v_i:P \cap T^*Q|_U \to \mathbb{R}
\end{align*}
defined by
\begin{align*}
(\mathbb{F}L)^{-1}(q,p)=(q,v(q,p)).
\end{align*}
Thus, on $P \cap T^*Q|_U$, the Hamiltonian is
\begin{align*}
H(q,p)=\sum_{j=1}^n p_j v_j(q,p)-L(q,v(q,p)).
\end{align*}
[/step]
[step:Differentiate the Hamiltonian with respect to the momentum variables]
Fix $i \in \{1,\dots,n\}$. Differentiating the coordinate expression for $H$ with respect to $p_i$ gives
\begin{align*}
\frac{\partial H}{\partial p_i}(q,p)=v_i(q,p)+\sum_{j=1}^n p_j\frac{\partial v_j}{\partial p_i}(q,p)-\sum_{j=1}^n \frac{\partial L}{\partial \dot q_j}(q,v(q,p))\frac{\partial v_j}{\partial p_i}(q,p).
\end{align*}
By the defining relation for the Legendre transform evaluated at $(q,v(q,p))$, we have
\begin{align*}
p_j=\frac{\partial L}{\partial \dot q_j}(q,v(q,p))
\end{align*}
for every $j \in \{1,\dots,n\}$. Substituting this equality into the differentiated formula cancels the two sums and yields
\begin{align*}
\frac{\partial H}{\partial p_i}(q,p)=v_i(q,p).
\end{align*}
[guided]
The purpose of this step is to show that the first Hamilton equation is exactly the statement that the cotangent curve has the same base velocity as the original tangent curve.
Fix $i \in \{1,\dots,n\}$. The Hamiltonian in local coordinates is
\begin{align*}
H(q,p)=\sum_{j=1}^n p_j v_j(q,p)-L(q,v(q,p)).
\end{align*}
When we differentiate with respect to $p_i$, there are two kinds of terms: the direct derivative of $p_j$ and the indirect derivative through the velocity functions $v_j(q,p)$. Applying the product rule to the first term and the chain rule to the second gives
\begin{align*}
\frac{\partial H}{\partial p_i}(q,p)=v_i(q,p)+\sum_{j=1}^n p_j\frac{\partial v_j}{\partial p_i}(q,p)-\sum_{j=1}^n \frac{\partial L}{\partial \dot q_j}(q,v(q,p))\frac{\partial v_j}{\partial p_i}(q,p).
\end{align*}
The cancellation is the defining feature of the Legendre transform. Since $(q,v(q,p))=(\mathbb{F}L)^{-1}(q,p)$, applying $\mathbb{F}L$ to this tangent vector returns $(q,p)$. In coordinates, this means
\begin{align*}
p_j=\frac{\partial L}{\partial \dot q_j}(q,v(q,p))
\end{align*}
for every $j \in \{1,\dots,n\}$. Therefore the two sums in the differentiated expression are identical with opposite signs. We obtain
\begin{align*}
\frac{\partial H}{\partial p_i}(q,p)=v_i(q,p).
\end{align*}
This identity says that the Hamiltonian derivative in the momentum direction recovers the velocity coordinate determined by the inverse Legendre transform.
[/guided]
[/step]
[step:Differentiate the Hamiltonian with respect to the configuration variables]
Fix $i \in \{1,\dots,n\}$. Differentiating the same coordinate expression for $H$ with respect to $q_i$ gives
\begin{align*}
\frac{\partial H}{\partial q_i}(q,p)=\sum_{j=1}^n p_j\frac{\partial v_j}{\partial q_i}(q,p)-\frac{\partial L}{\partial q_i}(q,v(q,p))-\sum_{j=1}^n \frac{\partial L}{\partial \dot q_j}(q,v(q,p))\frac{\partial v_j}{\partial q_i}(q,p).
\end{align*}
Using again
\begin{align*}
p_j=\frac{\partial L}{\partial \dot q_j}(q,v(q,p))
\end{align*}
for every $j \in \{1,\dots,n\}$, the two velocity-derivative sums cancel. Hence
\begin{align*}
\frac{\partial H}{\partial q_i}(q,p)=-\frac{\partial L}{\partial q_i}(q,v(q,p)).
\end{align*}
[/step]
[step:Show that Euler--Lagrange curves produce Hamiltonian curves]
Assume that $q:J \to U$ satisfies the Euler--Lagrange equations for $L$. Define the cotangent curve $\gamma:J \to P \cap T^*Q|_U$ by
\begin{align*}
\gamma(t)=\mathbb{F}L(q(t),\dot q(t)).
\end{align*}
Write $\gamma(t)=(q(t),p(t))$ in local coordinates. Then
\begin{align*}
p_i(t)=\frac{\partial L}{\partial \dot q_i}(q(t),\dot q(t)).
\end{align*}
Since $\gamma(t)=\mathbb{F}L(q(t),\dot q(t))$, the inverse velocity satisfies
\begin{align*}
v_i(q(t),p(t))=\dot q_i(t).
\end{align*}
Using the identity from the momentum differentiation step, we obtain
\begin{align*}
\dot q_i(t)=\frac{\partial H}{\partial p_i}(q(t),p(t)).
\end{align*}
The Euler--Lagrange equation gives
\begin{align*}
\dot p_i(t)=\frac{d}{dt}\frac{\partial L}{\partial \dot q_i}(q(t),\dot q(t))=\frac{\partial L}{\partial q_i}(q(t),\dot q(t)).
\end{align*}
Using the identity from the configuration differentiation step and the equality $\dot q(t)=v(q(t),p(t))$, this becomes
\begin{align*}
\dot p_i(t)=-\frac{\partial H}{\partial q_i}(q(t),p(t)).
\end{align*}
Thus $\gamma$ satisfies Hamilton's equations on $J$.
[/step]
[step:Show that Hamiltonian curves pulled back by the Legendre transform produce Euler--Lagrange curves]
Conversely, assume that $\gamma:J \to P \cap T^*Q|_U$ is the curve
\begin{align*}
\gamma(t)=\mathbb{F}L(q(t),\dot q(t))
\end{align*}
and that $\gamma(t)=(q(t),p(t))$ satisfies Hamilton's equations for $H$. As before,
\begin{align*}
p_i(t)=\frac{\partial L}{\partial \dot q_i}(q(t),\dot q(t)).
\end{align*}
Hamilton's second equation gives
\begin{align*}
\dot p_i(t)=-\frac{\partial H}{\partial q_i}(q(t),p(t)).
\end{align*}
Using the configuration derivative identity and $\dot q(t)=v(q(t),p(t))$, we get
\begin{align*}
\dot p_i(t)=\frac{\partial L}{\partial q_i}(q(t),\dot q(t)).
\end{align*}
Substituting the coordinate expression for $p_i(t)$ gives
\begin{align*}
\frac{d}{dt}\frac{\partial L}{\partial \dot q_i}(q(t),\dot q(t))=\frac{\partial L}{\partial q_i}(q(t),\dot q(t)).
\end{align*}
This is the Euler--Lagrange equation for the coordinate $q_i$ on $J$.
[/step]
[step:Pass from local coordinates to the full interval]
The preceding argument holds on every coordinate interval $J \subset I$ on which $q(J)$ lies in a single coordinate chart. The Euler--Lagrange equations and Hamilton's equations are coordinate equations for globally defined geometric equations on $TQ$ and $T^*Q$, respectively, so agreement on such coordinate intervals implies agreement on all of $I$. Therefore $q$ satisfies the Euler--Lagrange equations for $L$ if and only if $\gamma=\mathbb{F}L(q,\dot q)$ satisfies Hamilton's equations for $H$ on the open phase-space region $P=\mathbb{F}L(TQ)$. This proves the theorem.
[/step]