Proving that implicit midpoint method for Hamiltonian systems is symplectic using a criterion The implicit midpoint rule is defined as
$$y_{n+1}=y_n+hJ^{-1}\nabla H\left(\frac{y_{n+1}+y_n}{2}\right).$$
where $y=(p,q)$.
I know how to prove that this method is symplectic by hand, using the definition of symplecticity and very lengthy computation. But in this note, it says that we only have to use the following critierion (Theorem 5 on page 11):

Let $(p,q)\rightarrow (P,Q)$ be a smooth mapping, close to the
identity. It is symplectic if and only if one of the following
conditions holds locally: $$(Q-q)^T d(P+p)-(P-p)^Td(Q+q)=2dS \mbox{ for some function } S((P+p)/2,(Q+q)/2).$$

I tried to prove the symplecticity of the method using this criterion but I was not able to, even for the most simple case where $p$ and $q$ has only one dimension. This is what I tried:
$$Q=q+h\frac{\partial H}{\partial p}\left(\frac{q+Q}{2},\frac{p+P}{2}\right)$$
$$P=p-h\frac{\partial H}{\partial q}\left(\frac{q+Q}{2},\frac{p+P}{2}\right)$$
So that
\begin{align*}
&\quad(Q-q)^T d(P+p)-(P-p)^Td(Q+q)\\
&=h\frac{\partial H}{\partial p}\left(\frac{q+Q}{2},\frac{p+P}{2}\right) d\left(2p-h\frac{\partial H}{\partial q}\left(\frac{q+Q}{2},\frac{p+P}{2}\right)\right)\\
&\quad h\frac{\partial H}{\partial q}\left(\frac{q+Q}{2},\frac{p+P}{2}\right) d\left(2q+h\frac{\partial H}{\partial p}\left(\frac{q+Q}{2},\frac{p+P}{2}\right)\right)
\end{align*}
I continued to expand the terms, but I don't see how to find the function $S((P+p)/2,(Q+q)/2)$ so that the above is equal to $2dS$. But in the notes, it sounds like that it should be easy.
Could you help? Thanks in advance!
 A: I do not have access to the notes you are sharing, but given your theorem we deduce that S must be equal to $h H$.
First, note that the function $S$ takes the momenta as its first argument, and the position as its second argument, but for your computations you take the other way around. This might be why you do not get the result. Note that you have written the implicit midpoint rule with $J^{-1}$ and not $J$, which means that momenta must be the first variable of the Hamiltonian function $H$.
Now, in your theorem, the total variation $dS$ is equal to
$$
dS=(\partial_1 S)^T d(P+p)/2 + (\partial_2 S)^T d(Q+q)/2,
$$
where $\partial_1$ (respectively $\partial_2$) is the derivative with respect to the first (respectively second) variable.
One therefore obtains
$$
(Q-q-\partial_1S)^Td(P+p) = (P-p+\partial_2S)^Td(Q+q).
$$
Since $(dp,dP,dq,dQ)$ is a dual basis, this implies that it must hold
$$
\left\lbrace
\begin{aligned}
Q &= q+\partial_1S\left(\dfrac{p+P}{2},\dfrac{q+Q}{2}\right),\\
P &= p-\partial_2S\left(\dfrac{p+P}{2},\dfrac{q+Q}{2}\right),
\end{aligned}
\right.
$$
which can be compactly rewritten as
$$
Y=y+J^{-1}\nabla \tilde{S}\left(\dfrac{y+Y}{2}\right)
$$
with $Y=(P,Q)$, $y=(p,q)$, $\tilde{S}(y)=S(q,p)$, $\nabla\tilde{S}=(\partial_1S,\partial_2S)$ and $J$ the symplectic matrix.
From this expression, one should use $\tilde{S}=hH$ to get the result.
