Suppose $f$ is non negative and Lebesgue measurable on $\left[0,1\right]$. If $\int_a^b f(x)dx=b-a$ for all $\left[,\right]\subset \left[0,1\right]$. Show that $f=1$ a.e. on $\left[0,1\right]$.
I tried to break the function in two parts using the indicator function, but someone told me it wasn't the right approach. Instead, he suggested that I should use another function $g=f-1$ and prove it to be zero. My question is, how do we prove it a.e.?