Rudin’s PMA, Theorem 11.20 This is the definition which we need for the theorem: (source)

11.19 $\; \;$ Definition $\; \;$Let $s$ be a real-valued function defined on $X$. If the range of $s$ is finite, we say that $s$ is a simple function.
$\quad \quad$ Let $E \subset X$, and put
$$
K_{E}(x)= \begin{cases}1 & (x \in E), \\ 0 & (x \notin E).\end{cases}
$$
$K_{E}$ is called the characteristic function of $E$.
$\quad \quad$ Suppose the range of $s$ consists of the distinct numbers $c_{1}, \ldots, c_{n}$. Let
$$
E_{i}=\left\{x \mid s(x)=c_{i}\right\} \quad(i=1, \ldots, n) .
$$
$\quad \quad$ Then
$$
s=\sum_{n=1}^{n} c_{l} K_{E_{1}},
$$
that is, every simple function is a finite linear combination of characteristic functions. It is clear that $s$ is measurable if and only if the sets $E_{1}, \ldots, E_{n}$ are measurable.
$ \quad \quad$ It is of interest that every function can be approximated by simple functions:

Here is the theorem: (source)

11.20 $\; \;$ Theorem $\; \;$ Let $f$ be a real function on $X$. There exists a sequence $\left\{s_{n}\right\}$ of simple functions such that $s_{n}(x) \rightarrow f(x)$ as $n \rightarrow \infty$, for every $x \in X$. If $f$ is measurable, $\left\{s_{n}\right\}$ may be chosen to be a sequence of measurable functions. If $f \geq 0,\left\{s_{n}\right\}$ may be chosen to be a monotonically increasing sequence.
$\quad$Proof $\; \;$ If $f \geq 0$, define
$$
E_{n i}=\left\{x \mid \frac{i-1}{2^{n}} \leq f(x)<\frac{i}{2^{n}}\right\}, \quad F_{n}=\{x \mid f(x) \geq n\}
$$
for $n=1,2,3, \ldots, i=1,2, \ldots, n 2^{n}$. Put
$$
s_{n}=\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n l}}+n K_{F_{n}} .
 \quad \quad (50)$$
In the general case, let $f=f^{+}-f^{-}$, and apply the preceding construction to $f^{+}$and to $f^{-}$.
$\quad$ It may be noted that the sequence $\left\{s_{n}\right\}$ given by $(50)$ converges uniformly to $f$ if $f$ is bounded.

I couldn't understand that why does the sequence {$s_n$}, given by $(50)$ converge to $f$ .
Any help would be appreciated.
 A: $\lim_{n \to \infty} s_n(x)=f(x)$:
Suppose $f$ is $\mathbb{R}_{\geq 0}$-valued.
Let $x \in X$. Since $f(x) \in \mathbb{R}_{\geq 0}$, there is a positive integer $M$ so that $0 \leq f(x) <M$. This means we will have
\begin{aligned}s_{M}(x)=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x)+M K_{F_{M}}(x)&=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x)+M \cdot0\\&=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}(x).
\end{aligned}
Now we may repeat the proceeding corresponding argument for uniform convergence in the case that $f$ is bounded to similarly conclude that $\lim_{n \to \infty} |s_n(x)-f(x)|=\lim_{n \to \infty} \frac{1}{2^n}=0$.

$f$ bounded $\implies$ $s_n \to f$ uniformly:
Suppose $f$ is bounded. This means there is a positive integer $M$ so that $0 \leq f(x) <M$ (assuming $f$ nonnegative to spare some headache).
Notice we have
\begin{aligned}s_{M}=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}+M K_{F_{M}}=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}+M \cdot0=\sum_{i=1}^{M 2^{M}} \frac{i-1}{2^{M}} K_{E_{M i}}.
\end{aligned}
So if $n \geq M$ and $x \in X$, then we have
\begin{aligned}|s_{n}(x)-f(x)|&=\left|\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n i}}(x)-f(x)\right|
\\&=\left|\sum_{i=1}^{n 2^{n}} \frac{i-1}{2^{n}} K_{E_{n i}}(x)-\sum_{i=1}^{n 2^{n}}f(x)K_{E_{n i}}(x)\right|
\\&=\left|\sum_{i=1}^{n 2^{n}} \left(\frac{i-1}{2^{n}}-f(x)\right) K_{E_{n i}}(x)\right|
\\&=\sum_{i=1}^{n2^{n}}\left( f(x) -\frac{i-1}{2^{n}}\right)K_{E_{n i}}(x) \quad \quad \left(f(x) -\frac{i-1}{n} < 0 \implies  K_{E_{n i}}(x)=0 \right)
\\&< \sum_{i=1}^{n 2^{n}} \frac{1}{2^n}K_{E_{n i}}(x)
\\&=\frac{1}{2^n}\sum_{i=1}^{n 2^{n}} K_{E_{n i}}(x)
\\&=\frac{1}{2^n}.
\end{aligned}
Let $\varepsilon > 0$ be given.
By the Archimedean Principle, there is a positive integer $L$ so that $L\varepsilon>1$. Consider $N=\max\{M,L\}$. So if $n \geq N$, then we have
$$\sup_{x \in X} \left|s_n(x)-f(x) \right|< \varepsilon.$$
A: Suppose $f : X \to [0, \infty]$ is measurable. Realize that for $x \in X$, $$s_n(x) = \min(\lfloor\frac{f(x)}{2^{-n}}\rfloor 2^{-n}, n).$$
In words, if $f(x) \leq n$, we let $s_n(x)$ be the largest multiple of $2^{-n}$ that is $\leq f(x)$, and if $f(x) \geq n$, we let $s_n(x) = n$. Now it is clear that for $x \in X$, if $f(x) < \infty$, then for $n \geq f(x)$ we have $s_n(x) \leq f(x) < s_n(x) + 2^{-n}$. So for $n \geq f(x)$, $|s_n(x) - f(x)| \leq 2^{-n} \to 0$ as $n \to \infty$. This proves that $s_n \to f$ pointwise.
Now suppose $f$ is bounded. Then there is $M > 0$ such that $f(x) \leq M$ for all $x \in X$. So for $n \geq M$, for all $x \in X$, $|s_n(x) - f(x)| \leq 2^{-n}$. So for $n \geq M$, $\sup_{x \in X}|s_n(x) - f(x)| \leq 2^{-n} \to 0$. This shows that $s_n \to f$ uniformly.
