TITLE: Corollary to Theorem 5.12 in Baby Rudin: The derivative of a function differentiable on an interval cannot have any simple discontinuities
QUESTION [6 upvotes]: Here is Theorem 5.12 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition: 

Suppose $f$ is a real differentiable function on $[a, b]$ and suppose $f^\prime(a) < \lambda < f^\prime(b)$. Then there is a point $x \in (a, b)$ such that $f^\prime(x) = \lambda$. 
A similar result holds of course if $f^\prime(a) > \lambda > f^\prime(b)$. 

And, here is the Corollary by Rudin to the above theorem. 

If $f$ is differentiable on $[a, b]$, then $f^\prime$ cannot have any simple discontinuities on $[a, b]$. 

Finally, here is Definition 4.26 in Baby Rudin, 3rd edition: 

Let $f$ be defined on $(a, b)$. If $f$ is discontinuous at a point $x$, and if $f(x+)$ and $f(x-)$ exist, then $f$ is said to have a discontinuity of the first kind, or a simple discontinuity, at $x$. Otherwise the discontinuity is said to be of the second kind.
There are two ways in which a function can have a simple discontinuity: either $f(x+) \neq f(x-)$ [in which case the value $f(x)$ is immaterial], or $f(x+) = f(x-) \neq f(x)$. 

I've just found out that this very question has an answer at the following link. 
Discontinuities of the derivative of a differentiable function on closed interval
However, I'm stuck on the following part of the answer. 

For the the second kind, say $f'(x-)<f'(x+)$ and pick $\lambda\in(f'(x-),f'(x+))$, and let $u<x<v$ with $u$, $v$ sufficiently close to $x$ so that $f'(z)<\lambda$ for $z\in[u,x)$, and $f'(z)>\lambda$ for $z\in(x,v]$.

Why can we not have $f^\prime(x) = \lambda$ in this case (and thus fail to get our desired contradiction)?
In order to demonstrate my understanding of the answer, I'll rephrase it, or rather expand upon it. 

Suppose $f$ is a real function which is differentiable on a closed interval $[a, b]$, and suppose $f^\prime$ has a simple discontinuity at a point $p \in [a, b]$. 
Then as both $f^\prime(p+)$ and $f^\prime(p-)$ exist, so we must have $p \in (a, b)$. Am I right? 
Now there are two possible cases, according to whether (i) $f^\prime(p-) = f^\prime(p+) \neq f^\prime(p)$ or (ii) $f^\prime(p-) \neq f^\prime(p+)$. 
Case (i): We can assume without loss of generality that $f^\prime(p-) = f^\prime(p+) < f^\prime(p)$. Let $\lambda$ be a real number such that 
  $$\lambda \in \left( \ \lim_{x \to p} f^\prime(x), \ f^\prime(p) \ \right);$$
  that is, 
  $$ \lim_{x \to p} f^\prime(x) < \lambda < f^\prime(p).$$
  Now let $\varepsilon$ be any real number such that 
  $$0 < \varepsilon <  \lambda - \lim_{x \to p} f^\prime(x).$$
  Then we can find a real number $\delta > 0$ such that 
  $$ (p-\delta, p+\delta) \subset (a, b), $$
  and 
  $$ \left\vert f^\prime(x) - \lim_{x \to p} f^\prime(x) \right\vert < \varepsilon$$
  for all $x \in (p-\delta, p+\delta) \setminus \left\{ p \right\}$; 
  that is, 
  $$ \lim_{x \to p} f^\prime(x)  - \varepsilon < f^\prime(x) < \lim_{x \to p} f^\prime(x) + \varepsilon $$
  for all $x \in (p-\delta, p+\delta) \setminus \left\{ p \right\}$. 
But 
  $$ \lim_{x \to p} f^\prime(x) + \varepsilon < \lambda.$$
  So we can conclude that 
  $$ f^\prime(x) < \lambda \ \mbox{ for all } \ x \in (p-\delta, p+\delta) \setminus \left\{ p \right\}.$$
  Let us put 
  $$y \colon= p - \frac{\delta}{2}, \ \mbox{ and } \ z \colon= p + \frac{\delta}{2}.$$
  Then we can conclude that 
  $$ f^\prime(x) <  \lambda \ \mbox{ for all } \ x \in [y, p). \tag{1} $$
  Thus in particular, 
  $$f^\prime(y) < \lambda.$$
  But we have assumed that 
  $$\lambda < f^\prime(p). $$ 
  So we must have a point $x \in (y, p)$ for which $f^\prime(x) = \lambda$, which contradicts (1) above. [We can of course take the argument forward with $z$ instead of $y$.] Am I right?
Case (ii): We can assume without loss of generality that $f^\prime(p-) < f^\prime(p+)$. Let $\lambda$ be a real number such that 
  $$ f^\prime(p-) < \lambda < f^\prime(p+).$$
  Let's choose a real number $\varepsilon$ such that 
  $$0 < \varepsilon < \min \left\{ \ f^\prime(p+) - \lambda, \ \lambda - f^\prime(p-) \ \right\}. \tag{2} $$ 
  For this $\varepsilon$, we can find positive real numbers $\delta_1$ and $\delta_2$ such that 
  $$(p, p+\delta_1) \subset (a, b), \ \mbox{ and }  \ (p-\delta_2, p) \subset (a, b),$$
  and also 
  $$ \left\vert f^\prime(x) - f^\prime(p+) \right\vert < \varepsilon \ \mbox{ whenever } \ x \in (p, p+\delta_1),$$
  and 
  $$ \left\vert f^\prime(x) - f^\prime(p-) \right\vert < \varepsilon \ \mbox{ whenever } \ x \in (p-\delta_2, p).$$
  That is, 
  $$ f^\prime(p+) - \varepsilon < f^\prime(x) < f^\prime(p+) + \varepsilon \ \mbox{ whenever } \ x \in (p, p+\delta_1), \tag{3} $$
  and 
  $$ f^\prime(p-) - \varepsilon < f^\prime(x) < f^\prime(p-) + \varepsilon \ \mbox{ whenever } \ x \in (p-\delta_2, p). \tag{4}$$
  But from (2), we note that 
  $$f^\prime(p-) + \varepsilon < \lambda < f^\prime(p+) - \varepsilon. \tag{5} $$ 
  From (3) and (5) we conclude that 
  $$ \lambda < f^\prime(x) \ \mbox{ whenever } \ x \in (p, p+\delta_1).$$
  And, from (4) and (5) we conclude that 
  $$f^\prime(x) < \lambda \ \mbox{ whenever} \ x \in (p - \delta_2, p). $$ 
  Then if we put 
  $$y \colon= p-\frac{\delta_2}{2} \ \mbox{ and } \ z \colon= p + \frac{\delta_1}{2},$$
  then we conclude that 
  $$ \lambda < f^\prime(x) \ \mbox{ whenever } \ x \in (p, z ], \tag{6} $$
  and 
  $$f^\prime(x) < \lambda \ \mbox{ whenever} \ x \in [y, p). \tag{7}$$ 
  In particular, 
  $$f^\prime(y) < \lambda < f^\prime(z).$$
  So there is some point $x \in (y, z)$ such that $$f^\prime(x) = \lambda, $$ 
  which in the light of (6) and (7) implies that $$f^\prime(p) = \lambda.$$

Is my argument up to this point correct? If so, then where do we get our desired contradiction?

REPLY [2 votes]: I think you're right, the proof by Harald has a small gap.
It is easy to fix.  Suppose $f'(x-) < f'(x+)$.  Choose $\lambda_1, \lambda_2$ with $f'(x-) < \lambda_1 < \lambda_2 < f'(x+)$.  Then we can find some $\lambda \in (\lambda_1, \lambda_2)$ such that $\lambda \ne f'(x)$.  
Now there exist $u < x < v$ such that $f'(z) < \lambda_1$ on $[u,x)$ and $f'(z) > \lambda_2$ on $(x, v]$.  In particular, taking any $a \in [u,x)$ and any $b \in (x,v]$, we have $f(a) < \lambda_1 < \lambda < \lambda_2 < f(b)$, yet by construction there is no $z \in [a,b]$ with $f(z) = \lambda$.