Discrete and continuous basis in Quantum Mechanics In the context of Quantum Mechanics and Hilbert spaces, I understand that a function can be interpreted as $\psi(x) = \langle x \vert \psi \rangle$ in the position basis, and things like $$\int_a^b|\psi(x)|^2dx$$make sense interpreting $x$ as a label. But if I think of $\psi(x)$ as an element of $L^2$ and expand $\psi(x)$ in a discrete basis, like $\psi(x)=\sum_a(\phi_a(x),\psi(x))\phi_a(x)$, now the label is $a$ and what does $x$ means now and why the inner product is still the same and does not make any reference to $a$?
 A: When you represent a periodic function by a Fourier series you do pretty much the same thing: you represent it by sines instead of δ-functions.
For your specific example, you have two alternate resolutions of the identity/ completeness relations,
$$
1\!\!1= \int\!\! dx ~|x\rangle\langle x| \\
1\!\!1= \sum_a |a\rangle \langle a|
 $$
where, importantly, $\langle a|x \rangle = \phi_a^* (x)$, your change of basis "matrix".
You then have
$$
\psi(x)=\langle x|\psi\rangle = \sum_a  \langle x|a\rangle \langle a|\psi\rangle =  \sum_a  \phi_a(x) ~~\psi_a, ~~\hbox{where}\\
\psi_a=\langle a|\psi\rangle= \int\!\! dx ~ \phi^*_a(x)~ \psi(x),
$$
by the above completeness relation.
In your expression, you used the same x as a variable, and as a dummy integration variable in your inner product--a disastrous practice.
It is crucial to test-drive this equivalence with the Hermite functions $\psi_n(x)=\langle x|n\rangle$, where the discrete index is the natural number identifying the quantum oscillator energy level, if you have not already done so.
Useful link as per your comment.
A: The expression
$$p(a,b)=\int_a^b|\psi(x)|^2dx$$
is the probability that you will find a particle in the interval $[a,b]$. So it is a measurement of position.
The expression
$$\psi(x)=\sum_c(\phi_c(x),\psi(x))\phi_c(x)$$
is writing down a function in terms of other functions, which doesn't change its value anywhere on the interval $[a,b]$ so it won't affect $p(a,b)$. Each $c$ is just a label, like the $x$: it's just a different way of labeling the same function.
