Here is Prob. 6, Chap. 6, in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:
Let $P$ be the Cantor set . . . Let $f$ be a bounded real function on $[ 0, 1]$ which is continuous at every point outside $P$. Prove that $f \in \mathscr{R}$ on $[ 0, 1]$. Hint: $P$ can be covered by finitely many segments whose total length can be made as small as desired. Proceed as in Theorem 6.10.
Here is the link to my post here on Math SE on Theorem 6.10 in Baby Rudin, 3rd edition:
My Attempt:
Let $\varepsilon > 0$ be given. Let $M \colon= \sup \left\{ \ f(x) \ \colon \ 0 \leq x \leq 1 \ \right\}$.
As $P$ is compact (see Sec. 2.44 in Baby Rudin), so we can cover $P$ by a finite collection of open intervals $\left( a_k, b_k \right)$, for $k=1, \ldots, N$, such that $$ \sum_{k=1}^N \left( b_k - a_k \right) < \frac{\varepsilon}{4M+1}. \tag{0} $$
Is what I've stated in the preceding paragraph correct? And if so, then how to show this rigorously? Is this what Rudin is referring to in his hint?
Let $S \colon= \bigcup_{k=1}^N \left( a_k, b_k \right)$. Then $S$ is an open subset of $\mathbb{R}^1$ and therefore $$ [0, 1] - S = [0, 1] \cap \left( \mathbb{R}^1 - S \right)$$ is closed.
Then the set $[0, 1] - S$, being a closed subset of $[0, 1]$, is itself a closed and bounded set in $\mathbb{R}^1$ and is therefore compact, by Theorem 2.41 in Baby Rudin.
As $f$ is continuous at every point of $[0, 1] - P$ and as $P \subset S$, so $$ [0, 1] - S \subset [0, 1] - P $$ and $f$ is continuous at every point of $[0, 1] - S$ also.
Now as $[0, 1] - S$ is compact and as $f$ is continuous on $[0, 1] - S$, so $f$ is uniformly continuous on $[0, 1] - S$.
So we can find a real number $\delta > 0$ such that $$ \lvert f(x) - f(y) \rvert < \frac{\varepsilon}{4} \tag{1} $$ for all $x, y \in [0, 1] - S$ for which $\lvert x-y \rvert < \delta$.
Now let $Q = \left\{ \ x_0, x_1, \ldots, x_n \ \right\}$ be a partition of $[0, 1]$ such that each $a_k \in [0, 1]$ occurs in $Q$, each $b_k \in [0, 1]$ occurs in $Q$, no point of $S \cap (0, 1)$ occurs in $Q$, and each $\Delta x_i < \delta$ unless $x_i$ is one of the $a_k$, where $\Delta x_i \colon= x_i - x_{i-1}$, for each $i = 1, \ldots, n$.
For each $i = 1, \ldots, n$, let us put $$ m_i \colon= \inf \left\{ \ f(x) \ \colon \ x_{i-1} \leq x \leq x_i \ \right\} \ \mbox{ and } \ M_i \colon= \sup \left\{ \ f(x) \ \colon \ x_{i-1} \leq x \leq x_i \ \right\}. \tag{A} $$
For each $i = 1, \ldots, n$, if $u, v \in \left[ x_{i-1}, x_i \right]$, then we have $$ \lvert f(u) - f(v) \rvert \leq \lvert f(u) \rvert + \lvert f(v) \rvert \leq 2M, $$ by virtue of (0) above, and so we can conclude that then $$ M_i - m_i \leq 2M. \tag{2} $$
In particular, if $\left[ x_{i-1}, x_i \right] \subset [0, 1] - S$, then as $\Delta x_i < \delta$, so we have $$ \lvert f(u) - f(v) \rvert < \frac{\varepsilon}{4} $$ for all $u, v \in \left[ x_{i-1}, x_i \right]$, by virtue of (1) above, and in that case we can conclude that $$ M_i - m_i \leq \frac{\varepsilon}{4}. \tag{3}$$
From (2) and (3), we have $$ \begin{align} U(Q, f) - L(Q, f) &= \sum_{i-1}^n \left( M_i - m_i \right) \Delta x_i \\ &= \sum_{i \in \{ \ 1, \ldots, n \ \} \ \colon \ \left[x_{i-1}, x_i \right] \subset [0,1]-S } \left( M_i - m_i \right) \Delta x_i \\ & \qquad + \ \sum_{i \in \{ \ 1, \ldots, n \ \} \ \colon \ \left[x_{i-1}, x_i \right] \not\subset [0,1]-S} \left( M_i - m_i \right) \Delta x_i \\ &\leq \sum_{i \in \{ \ 1, \ldots, n \ \} \ \colon \ \left[x_{i-1}, x_i \right] \subset [0,1]-S } \frac{\varepsilon}{4} \Delta x_i \\ & \qquad + \ \sum_{i \in \{ \ 1, \ldots, n \ \} \ \colon \ \left[x_{i-1}, x_i \right] \not\subset [0,1]-S} 2M \Delta x_i \qquad \mbox{ using (2) and (3) above } \\ &\leq \frac{\varepsilon}{4} (1-0) + 2M \frac{\varepsilon}{4M+1} \qquad \mbox{ using (0) above } \\ &< \frac{\varepsilon}{4} + \frac{\varepsilon}{2} \\ &< \varepsilon. \end{align} $$
Thus, for every real number $\varepsilon > 0$, we can find a partition $Q$ of $[0, 1]$ for which $$ U(Q, f) - L(Q, f) < \varepsilon. $$ Hence by Theorem 6.6 in Baby Rudin $f \in \mathscr{R}$ on $[0, 1]$.
Is my proof correct (in each and every one of its steps)? If so, then is my presentation rigorous and lucid enough? If not, then where has it gone awry?