Let $f:[a,b] \rightarrow \mathbb{R}$ be a continuous function such that it is differentiable everywhere unless in a null set $S$. Suppose that there is a function $g$, which is bounded and Riemann integrable in $[a,b]$, such that $g(x) = f'(x)$ for every $x\in [a,b] -S$. Then,
$$ f(b)-f(a) = \int^b_a g $$
is true? If it is false, provide a counterexample and consider the case in which we switch "null set" by "countable set". In this case, it will be true? If not, provides a counterexample. I know that it would be true if we have finite set instead of null set.
Remark: I am asking this question because I am studying a Brazilian book about Fourier Analysis ("Análise de fourier e equações diferenciais parcias" whose author is Djairo), in which he just uses Riemann integral and uses many times integration by parts. However, he just say "let $f$ be continuous in a closed and bounded interval such that $f'$ is integrable in the same interval" and then he uses integration by parts (the other function is $\cos$ or $\sin$ usually). And he doesn't define which he means by the "derivative" of a function, because if $f$ is differentiable everywhere, it would redundant to say that it is continuous. Would it be differentiable everywhere unless in a null set, countable set, finite set? Idk. This is why i am asking how far I can push the fundamental theorem of calculus, which is used to prove integration by parts.
Edits: Thanks for the comments, the case in which $S$ is a null set is already solved. It's false. The counterexample is the Cantor function. It remains the case in which $S$ is countable.
Here: "A Fundamental Theorem of Calculus" there's a similar problem, but I m not sure if it is equivalent. Anyway, I would really appreciate if my problem were solved not using Lebesgue theory, which i haven't studied yet.
I had to fix the statement of the problem because it was wrong, as pointed out in the comments. Originally, i thought that it was enough that $f$ was differentiable in $[a,b]-S$ and one can extend $f'$ in any way, but then $\int_a^b f'$ will not exist necessarily, and we won't obviously have $ f(b)-f(a) = \int^b_a f'$.
Yes, if $f'$ is Riemann integrable then $\int_a^bf'=f(b)-f(a)$. I've posted a proof of this before, but it's simple enough that giving the proof again seems easier than trying to find that post:
Say $a=x_0<\dots<x_n=b$ is a partition of $[a,b]$. The Mean Value Theorem shows that there exists $\xi_j\in(x_{j-1},x_j)$ such that $$f(x_j)-f(x_{j-1})=f'(\xi_j)(x_j-x_{j-1}).$$So $$f(b)-f(a)=\sum_j(f(x_j)-f(x_{j-1}))=\sum_jf'(\xi_j)(x_j-x_{j-1}).$$But that last sum is precisely a Riemann sum for $\int_a^b f'$, so for any $\epsilon>0$ the last sum above is within $\epsilon$ of $\int_a^bf'$ if $\max_j(x_j-x_{j-1})$ is small enough.
So $$\left|f(b)-f(a)-\int_a^b f'\right|<\epsilon$$for every $\epsilon>0$.
Now what if $f$ is just differentiable on $[a,b]\setminus S$? No if we assume just that $S$ is a null set. I don't know the answer if $S$ is countable, but I suspect it's no. Yes if $S$ is finite (and $f$ is globally continuous):
Say $S=(a_j)$, where $a_1<\dots<a_n$. The case proved above shows that $$f(a_{j+1})-f(a_j)=\lim_{\epsilon\to0}(f(a_{j+1}-\epsilon)-f(a_j+\epsilon))=\lim_{\epsilon\to0}\int_{a_j+\epsilon}^{a_{j+1}-\epsilon}f'=\int_{a_j}^{a_{j+1}}f';$$now take the sum over $j$.