[step:Rewrite the Cramér-von Mises statistic as a functional of the uniform empirical process]For each $n\in\mathbb N$, define the empirical distribution function of the original sample $F_n:\mathbb R\to[0,1]$ by
\begin{align*}
F_n(x)=\frac{1}{n}\sum_{i=1}^n \mathbb{1}_{(-\infty,x]}(X_i)
\end{align*}
for $x\in\mathbb R$. The Cramér-von Mises statistic is the real-valued [random variable](/page/Random%20Variable) $W_n^2:\Omega\to\mathbb R$ defined by
\begin{align*}
W_n^2=n\int_{\mathbb R}\bigl(F_n(x)-F_0(x)\bigr)^2\,dF_0(x),
\end{align*}
where $F_0$ also denotes the probability measure on $(\mathbb R,\mathcal B(\mathbb R))$ induced by the distribution function $F_0$.
We claim that, almost surely,
\begin{align*}
W_n^2
=
\int_0^1 \left(\sqrt{n}\bigl(H_n(t)-t\bigr)\right)^2\,d\mathcal{L}^1(t).
\end{align*}
Let $\mu_0$ denote the probability measure on $(\mathbb R,\mathcal B(\mathbb R))$ induced by the distribution function $F_0$. Define the pushforward measure $(F_0)_\#\mu_0$ on $([0,1],\mathcal B([0,1]))$ by
\begin{align*}
(F_0)_\#\mu_0(E)=\mu_0(F_0^{-1}(E))
\end{align*}
for every $E\in\mathcal B([0,1])$. Since $F_0$ is continuous, the [Probability Integral Transform](/theorems/1139) gives $(F_0)_\#\mu_0=\mathcal{L}^1|_{[0,1]}$. Equivalently, for every bounded Borel function $\varphi: [0,1]\to\mathbb{R}$,
\begin{align*}
\int_{\mathbb{R}} \varphi(F_0(x))\,d\mu_0(x)
=
\int_0^1 \varphi(t)\,d\mathcal{L}^1(t).
\end{align*}
For each fixed $\omega\in\Omega$ and each $i\in\{1,\dots,n\}$, define
\begin{align*}
A_i(\omega):=\{x\in\mathbb R: \mathbb{1}_{(-\infty,x]}(X_i(\omega))\ne \mathbb{1}_{[0,F_0(x)]}(F_0(X_i(\omega)))\}.
\end{align*}
If $x\in A_i(\omega)$, monotonicity of $F_0$ implies $x<X_i(\omega)$ and $F_0(x)=F_0(X_i(\omega))$. Hence $A_i(\omega)\subset F_0^{-1}(\{F_0(X_i(\omega))\})$. The pushforward identity above gives
\begin{align*}
F_0\bigl(F_0^{-1}(\{F_0(X_i(\omega))\})\bigr)=\mathcal L^1(\{F_0(X_i(\omega))\})=0,
\end{align*}
so $F_0(A_i(\omega))=0$. Since the finite union $A(\omega):=\bigcup_{i=1}^n A_i(\omega)$ also has $F_0$-measure zero, for every $x\in\mathbb R\setminus A(\omega)$ we have
\begin{align*}
F_n(x)=H_n(F_0(x)).
\end{align*}
Using this identity for $F_0$-almost every $x$ and the preceding change of variables with the map $\varphi:[0,1]\to\mathbb{R}$ defined by $\varphi(t):=\bigl(H_n(t)-t\bigr)^2$, we obtain
\begin{align*}
W_n^2=n\int_{\mathbb{R}}\bigl(F_n(x)-F_0(x)\bigr)^2\,dF_0(x)
\end{align*}
by the definition of $W_n^2$. Substituting $F_n(x)=H_n(F_0(x))$ for $F_0$-almost every $x$ gives
\begin{align*}
W_n^2=n\int_{\mathbb{R}}\bigl(H_n(F_0(x))-F_0(x)\bigr)^2\,dF_0(x).
\end{align*}
The pushforward change of variables for $F_0$ gives
\begin{align*}
W_n^2=n\int_0^1 \bigl(H_n(t)-t\bigr)^2\,d\mathcal{L}^1(t).
\end{align*}
Rewriting the factor $n$ inside the square yields
\begin{align*}
W_n^2=\int_0^1 \left(\sqrt{n}\bigl(H_n(t)-t\bigr)\right)^2\,d\mathcal{L}^1(t).
\end{align*}[/step]