[guided]The Hermite basis theorem is the analytic input that converts the ladder construction into a full spectral theorem. It applies here because the functions $(\phi_n)_{n=0}^{\infty}$ are exactly the normalized Hermite functions obtained from the normalized Gaussian by repeated application of the raising operator. The theorem gives two conclusions: first, $(\phi_n)_{n=0}^{\infty}$ is a complete orthonormal basis of $L^2(\mathbb{R},\mathcal{B}(\mathbb{R}),\mathcal{L}^1)$; second, if $f \in \mathcal{S}(\mathbb{R})$, then its Hermite expansion converges to $f$ in the Schwartz topology. In particular, for every integer $r \ge 0$ there is a constant $C_r(f)>0$ such that
\begin{align*}
|(f,\phi_n)_{L^2}| \le C_r(f)(1+n)^{-r}
\end{align*}
for all $n \ge 0$. This rapid decay is what justifies using the unbounded diagonal operator on Schwartz functions.
We now define the diagonal operator associated with the eigenvalue list. Let $T$ be the operator on $L^2(\mathbb{R})$ with domain
\begin{align*}
D(T) = \left\{f \in L^2(\mathbb{R}) : \sum_{n=0}^{\infty}\left(n+\frac{1}{2}\right)^2 |(f,\phi_n)_{L^2}|^2 < \infty\right\}.
\end{align*}
For $f \in D(T)$, define
\begin{align*}
Tf = \sum_{n=0}^{\infty}\left(n+\frac{1}{2}\right)(f,\phi_n)_{L^2}\phi_n.
\end{align*}
The square-summability condition in $D(T)$ is exactly the condition that the displayed series converge in $L^2(\mathbb{R})$.
The operator $T$ is self-adjoint. To see this, define the coefficient map
\begin{align*}
W: L^2(\mathbb{R}) \to \ell^2(\mathbb{N}\cup\{0\}), \qquad Wf = ((f,\phi_n)_{L^2})_{n=0}^{\infty}.
\end{align*}
Completeness and orthonormality of the Hermite functions imply that $W$ is unitary. Under this unitary map, $T$ becomes multiplication by the real sequence $(n+\frac{1}{2})_{n=0}^{\infty}$ on the maximal domain of all square-summable coefficient sequences for which the multiplied sequence is still square-summable. Multiplication by a real sequence on this maximal domain is self-adjoint, so $T$ is self-adjoint.
We also need to verify that $T$ extends the differential operator $h_0$ on the Schwartz core. The ladder identities give
\begin{align*}
A\phi_n = \sqrt{n}\,\phi_{n-1}
\end{align*}
for $n \ge 1$, and
\begin{align*}
A^*\phi_n = \sqrt{n+1}\,\phi_{n+1}
\end{align*}
for $n \ge 0$. Hence
\begin{align*}
A^*A\phi_n = n\phi_n.
\end{align*}
Since $h_0 = A^*A + \frac{1}{2}I$ on $\mathcal{S}(\mathbb{R})$, this gives
\begin{align*}
h_0\phi_n = \left(n+\frac{1}{2}\right)\phi_n
\end{align*}
for every $n \ge 0$.
Now let $f \in \mathcal{S}(\mathbb{R})$. The Hermite expansion of $f$ converges to $f$ in the Schwartz topology, and the map $g \mapsto -\frac{1}{2}g''+\frac{1}{2}y^2g$ is continuous from $\mathcal{S}(\mathbb{R})$ to itself. Therefore applying the differential expression term by term is justified in $\mathcal{S}(\mathbb{R})$, and hence also in $L^2(\mathbb{R})$. Using the eigenfunction identity just proved, we get
\begin{align*}
h_0f = \sum_{n=0}^{\infty}\left(n+\frac{1}{2}\right)(f,\phi_n)_{L^2}\phi_n = Tf.
\end{align*}
Thus $T$ extends $h_0$.
Finally, because $h$ is the closure of $h_0$, every vector in $D(h)$ is a graph-norm limit of Schwartz functions for $h_0$. Since $T$ is closed and extends $h_0$, this gives $h \subseteq T$. Both $h$ and $T$ are self-adjoint. If the inclusion were proper, then the self-adjoint operator $T$ would be a proper symmetric extension of the self-adjoint operator $h$, which is impossible because [self-adjoint operators](/page/Self-Adjoint%20Operators) are maximal symmetric. Hence $h=T$.
This is the step where completeness is used. Without completeness, the ladder construction would only produce eigenvectors inside some invariant subspace; it would not rule out additional spectral components orthogonal to all constructed eigenfunctions.[/guided]