For an arbitrary continuous $\mathbb{R}\to\mathbb{R}$, how to show that a certain Borel set is contained in the set of finite differentiability? I am working on a more detailed version of a proof that has appeared on Math Stack before. Requests for a proof of the following theorem have been posted several times, but I am asking about the specific strategy suggested in (1) below.

Theorem.
Let $f$ be any real-valued, continuous function with domain $\mathbb{R}$. Then $\Delta(f) := \{x\in \mathbb{R}: f'(x) \in \mathbb{R}\}$ is Borel measurable.
In other words, the set of points of finite differentiability belongs to the sigma-algebra generated by the closed sets.

I am trying to flesh out the proof given in (1) Show that $\Delta(f)$ is a $F_{\sigma\delta}$-set, where it is suggested that $\Delta(f)$ is exactly $$S\,=\,\bigcap_{k=1}^{\infty} \;\bigcup_{n=1}^{\infty} \;\; \bigcap_{0 < |\eta| < \frac{1}{n}} \;\; \bigcap_{0 < |\delta| < \frac{1}{n}} \; \left\{x:\;\; \left| \frac{f(x + \eta) - f(x)}{\eta} \; - \;  \frac{f(x + \delta) - f(x)}{\delta} \right| \; \leq \frac{1}{k}\right\}.$$
I have showed that $\Delta(f)$ is a subset of the above set; I outline the reasoning below. For any fixed and non-zero $\eta$ and $\delta$, the function $$x \mapsto \left| \frac{f(x + \eta) - f(x)}{\eta} \; - \;  \frac{f(x + \delta) - f(x)}{\delta} \right|$$ is continuous, so that the set $\{x: \cdots\}$ appearing above is closed, being a continuous pre-image of a closed set. So if $S=\Delta(f)$ the theorem is proved.
What I am stuck on is showing $S\subset \Delta(f)$. Set $S$ doesn't "know" about the value of the derivative, which is why I think it is harder. It seems (from looking at other approaches posted) that we need to pass to the rationals (maybe something like this: https://math.stackexchange.com/a/1395360), or build a Cauchy sequence, or a sequence of nested compacts. It makes me wonder, more generally, about sufficient conditions for differentiability at $x_0$ that do not involve pre-knowledge of $f'(x_0)$. What is a good way to rigorously show the inclusion $S\subset \Delta(f)\,$?

Sketch of proof that $\Delta(f)\subset S$:
Let $x \in \Delta(f)$, and let $k\geqslant 1$ be fixed. Let $\epsilon = 1/k>0.$ Let $t=f'(x)$.
$\exists n\geqslant 1,$ $$\left| \frac{f(x + \eta) - f(x)}{\eta} -t \right| \; \leqslant \; \frac{\epsilon}{2} \;\text{ whenever }\; 0 \lt |\eta|\lt \frac1n.$$
From here it is just a matter of applying the triangle inequality:
$$\left| \frac{f(x + \eta) - f(x)}{\eta} -  \frac{f(x + \delta) - f(x)}{\delta} \right|  $$
$$\leqslant \left| \frac{f(x + \eta) - f(x)}{\eta} - t\right| + \left| \frac{f(x + \delta) - f(x)}{\delta} -t \right|  \leqslant \epsilon=\frac{1}{k}.$$

 A: I think you're overthinking this slightly. The thing to remember is that we can turn logical syntax inside the set-builder notation into boolean-algebraic semantics outside the set-builder notation. That is

*

*$\{ x \mid \phi(x) \land \psi(x) \} = \{ x \mid \phi(x) \} \cap \{ x \mid \psi(x) \}$

*$\{ x \mid \exists n . \phi_n(x) \} = \bigcup_n \{ x \mid \phi_n(x) \}$

*$\{ x \mid \forall n . \phi_n(x) \} = \bigcap_n \{ x \mid \phi_n(x) \}$

*etc.

You can read more about this (and other syntax/semantics theorems) at a blog post I wrote a while ago here, but you can already see the utility with this problem. Indeed, the plan will be to expand out the definition of "the derivative of $f$ exists at $x$", then move this definition "outside" the set-builder notation as above. However, since we want things to be measurable, we'll have to use some (standard) tricks to make sure we only ever work with countable conjunctions/disjunctions.
We start with
$$
\{ x \mid f' \in \mathbb{R} \} = \left \{ x \ \middle | \ \lim_{h \to 0} \frac{f(x+h) - f(x)}{h} \text{ exists} \right \}
$$
now if we expand out the definition of "this limit exists", we get $\exists L . \forall \epsilon . \exists \delta . |h| < \delta \to \left | \frac{f(x+h) - f(x)}{h} - L \right | < \epsilon$
Remember, we want to keep everything countable, but here we're already quantifying over uncountably many choices of $L$! Thankfully, there's a slick trick: we know that a sequence has a limit exactly when it's cauchy. So we can replace this formula with a formula saying that some sequence is cauchy!
$$
\left \{
x \ \middle | \ 
\forall \epsilon . \exists N . \forall m,n \geq N . 
\left | \frac{f(x + 1/n) - f(x)}{1/n} - \frac{f(x + 1/m) - f(x)}{1/m} \right | \leq \epsilon
\right \}
$$
(As a quick exercise, why is this OK? There are lots of sequences where $h \to 0$, but since $f$ is continuous at $x$ it doesn't matter which one we choose! If this isn't clear, it's worth working out the details carefully)
Now this still has a real-valued quantifier out front (the $\epsilon$) but of course, we can kill that quantifier too! If we know we can get $\leq \frac{1}{k}$ for any $k$ we like, then we can also get $\leq \epsilon$ for any $\epsilon$ we like! But the former is countable! This brings us to our final formula:
$$
\left \{
x \ \middle | \ 
\forall k . \exists N . \forall m,n \geq N . 
\left | \frac{f(x + 1/n) - f(x)}{1/n} - \frac{f(x + 1/m) - f(x)}{1/m} \right | \leq \frac{1}{k}
\right \}
$$
Now we cash out all the logic inside the set-builder for boolean operations outside the set-builder:
$$
\bigcap_k \bigcup_N \bigcap_{m,n \geq N} 
\left \{ 
x \ \middle | \ 
\left | \frac{f(x + 1/n) - f(x)}{1/n} - \frac{f(x + 1/m) - f(x)}{1/m} \right | \leq \frac{1}{k}
\right \}
$$
This is a sequence of countable unions and intersections applied to some sets. So if we can show that each
$\left \{ 
x \ \middle | \ 
\left | \frac{f(x + 1/n) - f(x)}{1/n} - \frac{f(x + 1/m) - f(x)}{1/m} \right | \leq \frac{1}{k}
\right \}$ is measurable, then we'll be done!
Of course, if we write
$g_{m,n}(x) = \left | \frac{f(x + 1/n) - f(x)}{1/n} - \frac{f(x + 1/m) - f(x)}{1/m} \right |$,
then this set is exactly $g_{m,n}^{-1} \left ( 0, \frac{1}{k} \right )$, which is definitely measurable (do you see why?)

I hope this helps ^_^
A: To finish the proof of the theorem, we need only show $S\subset \Delta(f)$, where   $$S\,=\,\bigcap_{k=1}^{\infty} \,\bigcup_{n=1}^{\infty} \; \bigcap_{0 < |\eta| < \frac{1}{n}} \; \bigcap_{0 < |\delta| < \frac{1}{n}}  \left\{x:\, \left| \frac{f(x + \eta) - f(x)}{\eta} \; - \;  \frac{f(x + \delta) - f(x)}{\delta} \right| \, \leq \frac{1}{k}\right\},$$
$$\Delta(f)\,=\,\bigcup_{t\in \mathbb{R}}\,\bigcap_{\epsilon>0}\,\bigcup_{\zeta>0} \; \bigcap_{0 < |h| < \zeta}    \left\{x:\, \left| \frac{f(x + h) - f(x)}{h} \; - \;  t\right| \, \leq \epsilon\right\}.$$
(I acknowledge the suggestion of HallaSurvivor, who indicated that the Cauchy sequence idea is one way to succeed here.)
Let $x\in S$ be fixed. Let $g_x(\theta):\mathbb{R}\setminus\{0\}\to\mathbb{R}$ be $$g_x(\theta)=\frac{f(x+\theta)-f(x)}{\theta}.$$ The sequence $g_x(1),g_x(\frac12),g_x(\frac13),\dots$ is Cauchy, because $x\in S$. Let $t$ be the limit of this sequence.
Let $\epsilon$ be given. Let $k>2/\epsilon,$ and let $n\geqslant1$ correspond to $k$ in the definition of $S$. Let $m>n$ be such that $$\left|g_x\left(\frac1m\right)-t\right|<\frac\epsilon2.$$ Let $\zeta$ be such that $0<\zeta<\frac1m,$ and let $0<|h|<\zeta.$ Now estimate
$$\left| \frac{f(x + h) - f(x)}{h} -t \right| \; = \; \left|g_x(h)  -t \right|$$ $$ \leqslant \left|g_x(h)- g_x\big(\frac1m\big)\right| + \left|g_x\big(\frac1m\big)-t\right| < \frac{1}{k}+\frac\epsilon2<\epsilon,$$ because $|\eta|=|h|<\zeta<\frac1n$ and $|\delta|=\frac1m<\frac1n.$
