I have the Hilbert space of square integrable functions on $[a, b]$, and what I would like to have is to discretize this space, i.e., find a sequence of finite-dimensional Hilbert spaces $H_K$ of dimension $K$ such that
$|\langle u, v \rangle - \langle u^{(K)}, v^{(K)} \rangle| \rightarrow 0$
as $K \rightarrow \infty$, where $v^{(K)}$ is a 'discretization' of $v$, defined appropriately. My idea was to define discretized vectors in such a way that $\langle u^{(K)}, v^{(K)} \rangle$ is the $K$-th Riemann sum for the integral that I would get for $\langle u, v \rangle$ (say, by equally partitioning $[a, b]$ and taking the points of this partition to represent a basis for the finite spaces).
But I know that I need a Lebesgue limit rather than a Riemann limit. Is such discretization possible?
I think this is always possible when you have a countable orthonormal basis for the Hilbert space. Consider for such a base $\{ e_k \}_{k=1}^\infty$, the spaces $H_K:= \text{span}\big( \{e_k\}_{k=1}^K \big)$.
Then $u^{(k)}=\sum_{k=1}^K \langle u , e_k \rangle e_k$ and $v^{(k)}=\sum_{k=1}^K \langle v , e_k \rangle e_k$. Use the triangle inequality and Cauchy-Schwartz to get that
$$ |\langle u, v \rangle - \langle u^{(K)}, v^{(K)} \rangle| \leq | \langle u-u^{(K)}, v \rangle|+ | \langle u^{(k)}, v -v^{(K)} \rangle| \leq \Vert v\Vert \cdot \| u -u^{(K)} \| + \Vert u^{(K)}\Vert \cdot \| v -v^{(K)} \|. $$
You can now use Bessel's inequality and\or Parseval's inequality to get that $\| u^{(K)} \| \leq \Vert u\|$, while $\| u-u^{(K)} \|^2 \leq \sum_{k=K+1}^\infty | \langle u,e_k\rangle |^2 \overset{K\to \infty}{\to}0$ and likewise for $v-v^{(K)}$.
Now choose $\{ e_k \}$ to be your prefered orthonormal base of $L^2[a,b]$.