Let $f:[a, b] \rightarrow \mathbb{R}$ and define $g:[a, b] \to \mathbb R$ by $$ g(x) := \begin{cases} f^{\prime}(x) & \text{if } f \text { Fréchet differentiable at } x, \\ 0 & \text {otherwise }. \end{cases} \quad \forall x \in (a, b), $$ and $g(a)=g(b)=0$.
I'm trying to make sense of integrating the derivative (defined a.e.) by proving below result.
Theorem If $f$ is Borel measurable, then so is $g$.
Could you have a check on my below attempt?
Proof Let $D := \{x \in (a, b) : f \text{ Fréchet differentiable at }x \}$. Then $D$ is a Borel subset of $\mathbb R$. This can be proved by extending $f$ to the whole $\mathbb R$ (for example, we set $f$ to be $0$ outside $[a, b]$), and then applying Section 3.5 of the book Fréchet Differentiability of Lipschitz Functions and Porous Sets in Banach Spaces by Lindenstrauss/Preiss/Tišer, i.e.,
"In this short section we show that for an arbitrary map between Banach spaces the set of its points of Fréchet differentiability is Borel; in fact it has type $F_{\sigma \delta}$.
Let $$ g_n(x) := \begin{cases} \frac{f\left(x+\frac{1}{n}\right)-f(x)}{\frac{1}{n}} & \text{if } x \in D, \\ 0 & \text{otherwise}. \end{cases} \quad \forall n\in \mathbb N, x \in [a, b]. $$
It follows from $f$ and $D$ are Borel measurable that $g_n$ is Borel measurable. Moreover, $g_n \to g$ everywhere. The everywhere limit of a sequence of Borel measurable functions is again Borel measurable. So $g$ is Borel measurable. This completes the proof.