Faulty application of the Fundamental Theorem of Calculus to $f(x) = 0$ for $x\ne 0$, $f(0)=1$ I think I have given a fallacious proof but I can't seem to find what is wrong with it.
Suppose $f : \mathbb{R} \rightarrow \mathbb{R}$ has the property that $\forall a,b \in \mathbb{R}. \int_a^b f(t)dt = b - a$. Consider the following "proof" that f(x) = 1. Define $g(x) = \int_0^x f(t)dt$. Then from above we know g(x) = x. Further by the fundamental theorem of calculus $g'(x) = f(x) = 1$.
But then consider $$f(x) = \begin{cases} 0 & \text{if $x=0$} \\ 1 & \text{if $ x \not = 0$}\end{cases}$$
Doesn't this function have the above property?
 A: The fundamental theorem of calculus states that:

If $f:[a,b]\to\mathbb R$ (say) is a continuous function, and we define:
$$
F(x)=\int_a^x f(t)dt
$$
then $F'(x)=f(x)$.  

I have put one of the words in the statement in bold, which is the clue to seeing why the FTC does not apply to your function.  Indeed, the example you provide show why the hypothesis in bold is necessary to derive the FTC.
A: The thing to keep in mind here is that Riemann integrals (and Lebesgue integrals) don't really operate on measurable functions, they operate on equivalence classes of functions, where the equivalence relation is "equal except on a set of measure zero."
This is a case of two functions which are not identical, but they differ on a set of measure zero. As such, the integral can't distinguish between them.
You can find the following theorem on page 126 of the 4th edition of Royden's Real Analysis:

Almost all needs to be included because your example shows a case where the left and right sides are not equal everywhere.
