Solution (source code)

= Solution

The real <L2 space> on a <probability space> consists of equivalence classes of <measurable functions> $X:\Omega\to\mathbb R$ satisfying $\mathbb E[X^2]<\infty$, where two <random variables> represent the same element if they are equal <almost surely>. Its <norm> is
$$
\|X\|_2=(\mathbb E[X^2])^{1/2}.
$$
Passing to equivalence classes makes this a genuine <norm>: $\|X\|_2=0$ exactly when $X=0$ <almost surely>. The <Minkowski inequality> gives the <triangle inequality>.

Let $(X_n)$ be a <Cauchy sequence> in this <norm>. Choose an increasing sequence of indices $n_k$ such that
$$
\|X_{n_{k+1}}-X_{n_k}\|_2\leq2^{-k}\qquad(k\geq1).
$$
This is possible by choosing $n_k$ beyond a Cauchy threshold for tolerance $2^{-k}$. Set $D_k=X_{n_{k+1}}-X_{n_k}$. The <Cauchy-Schwarz inequality> on a <probability space> gives $\mathbb E|D_k|\leq\|D_k\|_2$. By <Tonelli theorem>,
$$
\mathbb E\!\left[\sum_{k\geq1}|D_k|\right]
=\sum_{k\geq1}\mathbb E|D_k|\leq\sum_{k\geq1}2^{-k}<\infty.
$$
Thus the <series> of absolute differences is finite <almost surely>. Define $X=X_{n_1}+\sum_{k\geq1}D_k$ on this <probability>-one <event>, and give it the value zero on its complement. It is a <measurable function>, and $X_{n_k}\to X$ <almost surely>.

For $l>k$, the <Minkowski inequality> gives
$$
\|X_{n_l}-X_{n_k}\|_2\leq\sum_{j=k}^{l-1}2^{-j}.
$$
Apply the <Fatou lemma> to the squared difference as $l\to\infty$. It follows that
$$
\|X-X_{n_k}\|_2\leq\sum_{j=k}^\infty2^{-j}=2^{1-k}.
$$
In particular $X-X_{n_1}\in L^2$, and therefore $X\in L^2$ by the <Minkowski inequality>. This proves <convergence in L2> of the subsequence. To recover the entire sequence, for a prescribed $\varepsilon>0$ choose a Cauchy threshold $N$ for $\varepsilon/2$, then choose $k$ with $n_k\geq N$ and $\|X-X_{n_k}\|_2<\varepsilon/2$. For every $n\geq N$,
$$
\|X_n-X\|_2\leq\|X_n-X_{n_k}\|_2+\|X_{n_k}-X\|_2<\varepsilon.
$$
Hence $\boxed{X_n\to X\text{ in }L^2}$, proving <completeness of Lp spaces> for $p=2$ without assuming the desired completeness in the argument.