I would like to understand the proof that shows that for any measurable function, we can approximate it with a sequence of simple functions. The proof is presented in (among others):
https://www.math.ucdavis.edu/~hunter/measure_theory/measure_notes_ch3.pdf
However, I am having some difficulty understanding why $\phi_n \to f$ in the ntoation of that pdf. I understand that since $f$ is measurable, we can take its pre-image: $E_{n,k} = f^{-1}(I_{n,k})$ and define indicator functions on that pre-image, $1_{E_{n,k}}$. I don't see, however, how $\phi_n =\sum_{k=0}^{2^n-1}\frac{k}{2^n}1_{E_{n,k}} \to f$.
This is not homework; just attempting to understand this.
Fix $x\in X$. If $f(x)=\infty$, then $\phi_n(x)=2^n$ for all $n$, hence there is convergence.
Assume that $f(x)$ is finite. Then $f(x)\leqslant 2^n$ for $n$ large enough, hence for these $n$, we have $x\in E_{n,k_n}$ for some $0\leqslant k_n\leqslant 2^{2n}-1$. This means that $f(x)\in (k_n2^{—n},(k_n+1)2^{—n})$. Since $f_n(x)=k_n2^{-n}$, we have $0\leqslant f(x)-f_n(x)\leqslant 2^{—n}$.