$ \int_0^af = 0, \forall a \in \mathbb{R} \Rightarrow f=0$ almost everywhere 
Let $f: \mathbb{R} \rightarrow \mathbb{R}$ a Lebesgue integrable function and $\int_0^af=0, \forall a \in \mathbb{R}$.Prove that $f=0$ almost everywhere.

Here is my solution:
Let $0<a<b$, then $(0,b)=(0,a) \cup [a,b)$ thus $$\int_a^bf= \int_0^bf - \int_0^af \Rightarrow \int_a^bf=0$$
Now we have that $ \mathbb{R}= \bigcup_{n \in \mathbb{Z}}[n,n+1)$ which is a disjoint union, thus $$ \int_{\mathbb{R}}f=\sum_{n \in \mathbb{Z}} \int_n^{n+1}f=0$$.
Also we know that$$\{x:f(x)\neq 0\}= \{x:f(x)>0\} \cup \{x:f(x)<0\}=\{x:f(x)>0\} \cup \{x:-f(x)>0\}$$.
Now $\{x:f(x)>0\}=\{x:f(x)> \frac{1}{n}\})$ thus $m(\{x:f(x)> \frac{1}{n}\})\leqslant n \int_{\mathbb{R}}f=0$ therefore $m(\{x:f(x)> \frac{1}{n}\})=0 \Rightarrow m(\{x:f(x)>0\})=0$, from the subadditivity of the Lebesgue measure and from the Markov inequality.
With the same argument we can prove that $m(\{x:-f(x)>0\})=0$
Combining these we have that $$m(\{x:f(x) \neq 0\}) \leqslant m(\{x:f(x)>0\})+m(\{x:-f(x)>0\})=0$$
$\therefore$ $m(\{x:f(x) \neq 0\})=0$
$$Second-solution$$
Now $ \forall x \in \mathbb{R}$ we have in the same way as above that $\frac{1}{2 \delta}\int_{x-\delta}^{x+\delta}f(y)dy=0 ,\forall \delta>0$.
From Lebesgue's differentation theorem we have that $\lim_{\delta \rightarrow 0}\frac{1}{2\delta}\int_{x-\delta}^{x+\delta}f(y)dy =f(x)$ almost everywhere.
Thus $f(x)=0$ almost everywhere.
Are my solutions correct?
This is an exercise I found in a final exam, in undergraduate measure theory.
Although it is a final exam exercise, it seemed to me enough simple,that's why I want to verify my thoughts.
In case I am wrong I would appreciate any help to guide me to a correct solution.
Thank you in advance.
 A: Following @Mario Gretsas 's thoughts. Please help me check if it's correct.
Suppose otherwise then $m\{f>0\}>0\ or\ m\{f<0\}>0$. Without loss of generality, we assume $m\{f>0\}>0$. Since $\{f>0\}=\lim_{n\to\infty}\{f\geq1/n\}$, and due to continuity of measurement and integrality of the function we have
$$\exists n_0\in\mathbb{N}\quad s.t.\quad 0<m\{f\geq1/n_0\}<\infty$$
For the measurablity of $\{f\geq1/n_0\},\exists\ an\ open\ set\ sequence\ \{G'_n\}_n\ $ such that
$$\bigcap_{n=1}^\infty G_n' \triangleq G\supset\{f\geq1/n_0\}\ \ \&\ \ m(G-\{f\geq 1/n_0\})=0\ \ \&\ \ \forall n,\ m(G_n')<\infty$$
Let $G_n=\bigcap_{k=1}^nG'_k$. Then we get a open set sequence $\{G_n\}$ monotonically decresing to $\{G_\delta\}$. Then $\lim_{n\to\infty}m(G_n-G)=0.$
Because of the uniform continuity of integrals, there is a real number $\delta>0$ such that for all measurable set $A$ satisfies $m(A)<\delta$ we have $|\int_Afdx|<\frac{m(G)}{2n_0}(>0)$.
Since $\lim_{n\to\infty}m(G_n-G)=0$, there is a $N$ such that $m(G_N-G)<\delta$.
$G_N$ is open, so it can be expressed as a countable union of open intervals, then $$\int_{G_N} fdx=0$$
But meanwhile, we have $$\int_G fdx=\int_{A_{n_0}}fdx\geq\frac{m\{f\geq1/n_0\}}{n_0}=\frac{m(G)}{n_0}>0$$
Thus $$\frac{m(G)}{2n_0}\geq|\int_{G_N-G}fdx|=|\int_G fdx-\int_{G_N} fdx|\geq\frac{m(G)}{n_0}$$
In contradiction to our hypothesis.
A: Take the contrapositive, if $f(x)\neq 0$ a.e. then $\int_{0}^{a} f\neq 0$.
Define the set $E=[0,a]$ (this is the domain of integration), note that we have $\mu(E)$ is non-empty and $\mu(E)=a$, as intervals have measure $b-a$. Now define $F=\{x\in E: f(x)\neq 0\}$. Clearly $F$ has positive measure. Now just use the definition of the Lebesgue integral to conclude: $\int_{E}f d\mu>0$. We have proven the contrapositive of the original statement, so indeed, we can conclude if $\int_{0}^{a} f=0$ $\forall a\in \mathbb{R}$ then $f=0$ a.e. 
You can also try proving it by taking $\int_{0}^{a}f=\int_{0}^{b} f + \int_{b}^{a} f$ by choosing any arbitrary $b$ in $[0,a]$ and arguing by contradiction: if $f\neq 0$ a.e. then the sum of the integrals would not be zero. I haven't worked out the details but I think the argument carries through. 
