If a function is differentiable almost everywhere, can it be written as an integral? Consider a function $f:\mathbb{R}^n \to \mathbb{R}$. If $f$ is differentiable with Lebesgue integrable derivative, we may write
$$
f(x+y) - f(x) = \sum_{i=1}^p \int_0^1 y_i \nabla f_i(x+ty)dt
$$
by the fundamental theorem of calculus. If it only holds that $f$ is differentiable on a set $A\subseteq\mathbb{R}^n$ such that the complement $A^c$ has Lebesgue measure zero (that is, $f$ is differentiable Lebesgue almost everywhere), does the same formula hold? If yes, how can this be proven rigorously?

Consider the function $f:\mathbb{R}\to\mathbb{R}$ defined
$$f(x) = \begin{cases}1 & x\geq 0\\ 0 & x<0\end{cases}$$
Does your premise hold? Does the proposition?
