I have difficulties understanding the proof of the following proposition:
Proposition$\quad$ Let $(X,\mathscr{A},\mu)$ be a measure space, and let $p$ satisfy $1\leq p$. Then the simple functions in $\mathscr{L}^{\infty}(X,\mathscr{A},\mu)$ form a dense subspace of $\mathscr{L}^{\infty}(X,\mathscr{A},\mu)$
The book defines $\mathscr{L}^{\infty}$ as follows:
Definition$\quad$ Let $\mathscr{L}^{\infty}(X,\mathscr{A},\mu,\mathbb{R})$ be the set of all bounded real-valued $\mathscr{A}$-measurable functions on $X$. Define $\|\cdot\|_{\infty}$ by letting $\|f\|_{\infty}$ be the infimum of those nonnegative numbers $M$ such that $\{x\in X:|f(x)|>M\}$ is locally $\mu$-null.
We only consider real-valued functions. Here is the proof:
Proof$\quad$ Let $f$ belong to $\mathscr{L}^{\infty}(X,\mathscr{A},\mu,\mathbb{R})$, and let $\epsilon$ be a positive number. Choose real numbers $a_0,a_1,\dots,a_n$ such that \begin{align} a_0<a_1<\dots<a_n \end{align} and such that the intervals $(a_{i-1},a_i]$ cover the interval $[-\|f\|_{\infty},\|f\|_{\infty}]$ and have lengths at most $\epsilon$. Let $A_i=f^{-1}((a_{i-1},a_i])$ for $i=1,\dots,n$, and let $f_{\epsilon}=\sum_{i=1}^na_i\chi_{A_i}$. Then $f_{\epsilon}$ is a simple $\mathscr{A}$-measurable function that satisfies $\|f-f_{\epsilon}\|_{\infty}<\epsilon$. Since $f$ and $\epsilon$ are arbitrary, the proof is complete.
So my understanding of the idea of this proof is the following:
For each $f\in\mathscr{L}^{\infty}(X,\mathscr{A},\mu,\mathbb{R})$ and each $\epsilon>0$, we want to construct a simple function $f_{\epsilon}$ in $\mathscr{L}^{\infty}(X,\mathscr{A},\mu,\mathbb{R})$ so that $$ \|f-f_{\epsilon}\|_{\infty} = \inf\Big\{M\in\mathbb{R}_+:\{x: X:|f(x) - f_{\epsilon}(x)|>M\}\ \text{is locally $\mu$-null}\Big\}<\epsilon. $$ So, if we can construct $f_{\epsilon}$ such that $\{x\in X:|f(x)-f_{\epsilon}(x)|>\epsilon\}$ is locally $\mu$-null, then we are done.
I can see that in the proof, if $x\in A_i$ for some $i$, then $f(x)\in(a_{i-1},a_i]$ and $f_{\epsilon}(x)=a_i$, and so $|f(x)-f_{\epsilon}(x)|<\epsilon$. But I don't understand why we need to let the intervals $(a_{i-1},a_i]$ cover the interval $[-\|f\|_{\infty},\|f\|_{\infty}]$. I don't think I understand how $f_{\epsilon}$ is constructed either.
Could someone please help me out? Thanks a lot in advance!
Reference:$\quad$ Proposition 3.4.2 from Measure Theory by Donald Cohn.