[proofplan]
We realize $\Gamma_{dS}$ as the image of the section $i_{dS}:Q\to T^*Q$, $q\mapsto dS_q$. The defining property of the tautological one-form gives $i_{dS}^*\lambda=dS$, and hence the pullback of $\omega_{\mathrm{can}}=-d\lambda$ to the graph is zero. Since the graph of a section of $T^*Q$ is an embedded copy of $Q$, it has dimension $n=\frac{1}{2}\dim T^*Q$, so isotropicity implies that it is Lagrangian. The same pullback identity identifies the restriction of $\lambda$ to the graph with the exact form $dS$.
[/proofplan]
[step:Realize the graph as an embedded copy of $Q$]
Let $\tau:T^*Q\to Q$ denote the cotangent bundle projection, and define
\begin{align*}
i_{dS}:Q&\to T^*Q
\end{align*}
by $i_{dS}(q)=dS_q$. Since $S\in C^\infty(Q;\mathbb R)$, the differential $dS$ is a smooth one-form on $Q$, so $i_{dS}$ is a smooth section of $\tau$.
We have $\tau\circ i_{dS}=\operatorname{id}_Q$. Hence $i_{dS}$ is injective, and $\tau|_{\Gamma_{dS}}:\Gamma_{dS}\to Q$ is its inverse as a set.
To see that $\Gamma_{dS}$ is an embedded submanifold, let $(U,\varphi)$ be a coordinate chart on $Q$ with coordinates $(x_1,\dots,x_n)$. Let
\begin{align*}
\Psi:\tau^{-1}(U)&\to \varphi(U)\times \mathbb R^n
\end{align*}
be the induced cotangent chart, where a covector $\alpha_q\in T_q^*Q$ is written uniquely as
\begin{align*}
\alpha_q=\sum_{j=1}^n \xi_j\,dx_j|_q,
\end{align*}
and $\Psi(\alpha_q)=(\varphi(q),\xi_1,\dots,\xi_n)$. In this chart,
\begin{align*}
\Psi(\Gamma_{dS}\cap \tau^{-1}(U))
=
\left\{(x,\xi)\in \varphi(U)\times\mathbb R^n:\xi_j=\partial_{x_j}(S\circ\varphi^{-1})(x)\text{ for }1\le j\le n\right\}.
\end{align*}
Thus $\Gamma_{dS}$ is locally the graph of a smooth map $\varphi(U)\to\mathbb R^n$. Therefore $\Gamma_{dS}$ is an embedded submanifold of $T^*Q$, and
\begin{align*}
\dim \Gamma_{dS}=n.
\end{align*}
[/step]
[step:Pull back the tautological one-form along the graph section]
We compute the pullback of $\lambda$ by $i_{dS}$. The tautological one-form $\lambda\in\Omega^1(T^*Q)$ is defined by the rule
\begin{align*}
\lambda_{\alpha_q}(V)=\alpha_q(d\tau_{\alpha_q}(V))
\end{align*}
for every $q\in Q$, every $\alpha_q\in T_q^*Q$, and every $V\in T_{\alpha_q}(T^*Q)$.
Let $q\in Q$ and let $v\in T_qQ$. Since $i_{dS}$ is a section of $\tau$, differentiating $\tau\circ i_{dS}=\operatorname{id}_Q$ at $q$ gives
\begin{align*}
d\tau_{i_{dS}(q)}(d(i_{dS})_q(v))=v.
\end{align*}
Using the defining formula for $\lambda$ at the covector $i_{dS}(q)=dS_q$, we obtain
\begin{align*}
(i_{dS}^*\lambda)_q(v)=\lambda_{i_{dS}(q)}(d(i_{dS})_q(v)).
\end{align*}
Therefore
\begin{align*}
(i_{dS}^*\lambda)_q(v)=dS_q(d\tau_{i_{dS}(q)}(d(i_{dS})_q(v))).
\end{align*}
Substituting the previous identity gives
\begin{align*}
(i_{dS}^*\lambda)_q(v)=dS_q(v).
\end{align*}
Since this holds for every $q\in Q$ and every $v\in T_qQ$, we have
\begin{align*}
i_{dS}^*\lambda=dS.
\end{align*}
[guided]
The important point is that the tautological one-form remembers the covector sitting over the base point. Let $\tau:T^*Q\to Q$ be the cotangent bundle projection, and let
\begin{align*}
i_{dS}:Q&\to T^*Q
\end{align*}
be the section defined by $i_{dS}(q)=dS_q$. Because $i_{dS}$ is a section, it satisfies
\begin{align*}
\tau\circ i_{dS}=\operatorname{id}_Q.
\end{align*}
Differentiating this identity at $q\in Q$ gives a linear identity between tangent maps:
\begin{align*}
d\tau_{i_{dS}(q)}\circ d(i_{dS})_q=\operatorname{id}_{T_qQ}.
\end{align*}
Thus, for every tangent vector $v\in T_qQ$,
\begin{align*}
d\tau_{i_{dS}(q)}(d(i_{dS})_q(v))=v.
\end{align*}
Now use the definition of the tautological one-form. For a covector $\alpha_q\in T_q^*Q$ and a tangent vector $V\in T_{\alpha_q}(T^*Q)$, it is defined by
\begin{align*}
\lambda_{\alpha_q}(V)=\alpha_q(d\tau_{\alpha_q}(V)).
\end{align*}
In our situation the covector is $\alpha_q=i_{dS}(q)=dS_q$, and the tangent vector in $T_{i_{dS}(q)}(T^*Q)$ is $V=d(i_{dS})_q(v)$. Therefore
\begin{align*}
(i_{dS}^*\lambda)_q(v)=\lambda_{i_{dS}(q)}(d(i_{dS})_q(v)).
\end{align*}
Applying the defining formula for $\lambda$ gives
\begin{align*}
(i_{dS}^*\lambda)_q(v)=dS_q(d\tau_{i_{dS}(q)}(d(i_{dS})_q(v))).
\end{align*}
The section identity computed above replaces the argument of $dS_q$ by $v$, so
\begin{align*}
(i_{dS}^*\lambda)_q(v)=dS_q(v).
\end{align*}
This equality holds at every point $q\in Q$ and on every tangent vector $v\in T_qQ$. Hence the one-forms are equal:
\begin{align*}
i_{dS}^*\lambda=dS.
\end{align*}
[/guided]
[/step]
[step:Show the canonical symplectic form vanishes on the graph]
Let $\omega_{\mathrm{can}}=-d\lambda$. Since pullback commutes with [exterior derivative](/theorems/1525), the identity $i_{dS}^*\lambda=dS$ gives
\begin{align*}
i_{dS}^*\omega_{\mathrm{can}}=i_{dS}^*(-d\lambda).
\end{align*}
Thus
\begin{align*}
i_{dS}^*\omega_{\mathrm{can}}=-d(i_{dS}^*\lambda).
\end{align*}
Using $i_{dS}^*\lambda=dS$, we get
\begin{align*}
i_{dS}^*\omega_{\mathrm{can}}=-d(dS)=0.
\end{align*}
Therefore $\omega_{\mathrm{can}}$ restricts to zero on $T\Gamma_{dS}$.
[/step]
[step:Conclude that the graph is Lagrangian]
The ambient symplectic manifold $T^*Q$ has dimension $2n$, while the embedded submanifold $\Gamma_{dS}$ has dimension $n$. The previous step shows that $\omega_{\mathrm{can}}|_{\Gamma_{dS}}=0$, so $\Gamma_{dS}$ is isotropic. An isotropic submanifold of half the ambient symplectic dimension is Lagrangian. Hence $\Gamma_{dS}$ is a Lagrangian submanifold of $(T^*Q,\omega_{\mathrm{can}})$.
[/step]
[step:Identify the restricted tautological form as an exact form]
The map $i_{dS}:Q\to\Gamma_{dS}$ is a diffeomorphism with inverse $\tau|_{\Gamma_{dS}}:\Gamma_{dS}\to Q$. Since $i_{dS}^*(\lambda|_{\Gamma_{dS}})=i_{dS}^*\lambda=dS$, the restricted tautological one-form corresponds to $dS$ under the identification $Q\cong\Gamma_{dS}$.
Equivalently, define the smooth function
\begin{align*}
F:\Gamma_{dS}&\to\mathbb R
\end{align*}
by
\begin{align*}
F=S\circ \tau|_{\Gamma_{dS}}.
\end{align*}
Pulling $dF$ back along $i_{dS}$ gives
\begin{align*}
i_{dS}^*(dF)=d(F\circ i_{dS}).
\end{align*}
Since $\tau\circ i_{dS}=\operatorname{id}_Q$, we have $F\circ i_{dS}=S$, and hence
\begin{align*}
i_{dS}^*(dF)=dS.
\end{align*}
Also $i_{dS}^*(\lambda|_{\Gamma_{dS}})=dS$. Because $i_{dS}$ is a diffeomorphism onto $\Gamma_{dS}$, equality after pullback by $i_{dS}$ implies
\begin{align*}
\lambda|_{\Gamma_{dS}}=dF.
\end{align*}
Thus $\lambda|_{\Gamma_{dS}}$ is exact, with primitive $S\circ\tau|_{\Gamma_{dS}}$. This proves the theorem.
[/step]