Prove the following:
Every non trivial separable Hilbert space $H$ has an orthonormal basis, i.e., an orthonormal set whose linear span is dense in $H$
My attempt:
Let $V = (v_n)_{n\geq1}$ be a dense countable set of vectors in $H$. Remove all vectors that are $0$, and then, skim the sequence from the left to the right and remove every vector that is a linear combination of the previous ones. Call the obtained sequence, which is possibly finite, $(y_n)_{n\geq1}$.
By construction, this sequence of vectors is linearly independent, so we can apply the Gram-Schmidt (GS) algorithm to find a sequence $(\phi_n)_n$ of vectors such that $O := \{\phi_n\mid n\}$ is an orthonormal set of vectors.
It now suffices to show that the linear span of $O$ is dense in $H$, in order to conclude that $O$ is an orthonormal basis. For this, it suffices to show that $O^\perp = \{0\}$.
So, let $v \in O^\perp$. Then $\langle v,\phi\rangle = 0$ for every $\phi \in O$, and by linearity of the inner product, it follows that $v \in \operatorname{span}(O)^\perp$. By continuity of the inner product, it follows that $v \in \left(\overline{\operatorname{span}(O)}\right)^\perp$.
Now, $\operatorname{span} O = \operatorname{span}\{\phi_n \mid n\} =^{GS} \operatorname{span}\{y_n\mid n\} = \operatorname{span} V$
so that $\left(\overline{\operatorname{span}(O)}\right)^\perp = \left(\overline{\operatorname{span(V)}}\right)^\perp \subseteq \operatorname{span}(\overline{V})^\perp = \operatorname{span}(H)^\perp = H^\perp = \{0\}$, where we used that $X \subseteq Y \implies Y^\perp \subseteq X^\perp$ and hence $v = 0$
Is this correct?