Suppose that $f\in C[a,b]$, $f(x)\leqslant \int_a^x f(t)dt$ over $[a,b]$, how to prove that $f(x)\leqslant 0$? I've tried as follows:
Write that $F(x)=\int_a^x f(t)dt$, then $f(a)\leqslant F(a)=0$, let 
$$ S=\{x\in[a,b]\mid f(x)>0\},$$
and write $x_0=\inf{S}$, I want to show that $x_0=b$. 
If $x_0<b$, then according to the continunity of $f$, $f(x_0)=0$, and $f(x)\leqslant 0, \forall x\in [a,x_0]$, thus $F(x_0)=\int_0^{x_0} f(t)dt\leqslant 0$, but we also have $F(x_0)\geqslant f(x_0)=0$. Then $f(x)\equiv 0$, ...... 
I cannot continue my proof. 
 A: A different approach using differential inequalities: Put $g(x):=F(x) e^{-x}$. Then $g'(x)=(F'(x)-F(x))e^{-x}\leq0$ by assumption. Thus $g$ is decreasing. Moreover $g(0)=0$ which implies $g(x)\leq g(0)=0$ for all $a\leq x\leq b$. This implies $F(x)\leq 0$ for all $x$. The assertion follows from $f(x)=F'(x)\leq F(x)\leq0$.
Reference: Gronwall's lemma
A: Strictly speaking, $S$ might be empty. It it better to define $x_0 = \sup R$, where $R = \{x \in [a,b]: f(x) \leq 0$ on $[a, x]\}$, and since you showed that $f(a) = 0$, $R$ is not empty and bounded by $b$.
You showed that $x_0 \not \in S$. So, it is the case that there are $x_n \in (x_0, b)$, $x_n \to x$ such that $F(x_n) > 0$.
Show that $f = 0$ identically for $x < x_0$. Now, $F(x) = \int_{x_0}^x f(t) dt$.
Let $M$ be the maximum of $f$ on $[x_0, x_0 + \epsilon]$ for $\epsilon < \min(1, b-x_0)$? What does the inequality tell you about that maximum?
A hint for an easier solution: Since $f$ is continuous, it is bounded by some $M > 0 $. Plug $f(x) \leq M$ into the inequality. What do you get? Plug it in again. 
A: Suppose $x_0 <b$. Then there exists a sequence $x_n$ such that $x_n \in S$ and $x_n >x_0$ and $x_n \to x_0$. Since $f(x_n) >0$ for all $n$,  continuity gives  $f(x_0) \geq 0$. So $0\leq f(x_0) \leq \int_a^{x_0} f(t) \, dt \leq 0$ because $f(t) \leq0$ for all $t \in [a,x_0)$. We are assuming that $x_0 >a$. This gives $f\equiv 0$ in $[0,x_0]$. Now apply this argument with the interval $[a,b]$ replaced by $[z,c]$ where $z=\inf \{x\in [a,b]: f(u)$ is not identically $0$ for $a\leq u \leq x\}$. Since $f\equiv 0$ in $[a,z]$ the hypothesis holds for this new interval and we get a  contradiction to $x_0 <b$ in this case (by repeating the previous argument; note that (by definition of $z$) $f$ cannot vanish in a neighborhood of $z$). To handle the case when $x_0=a$ we do the following: let $g(x)=f(x)-\epsilon e^{x}$. Then the hypothesis is satisfied by $g$ in place of $f$. Further, $g(a)<0$. Hence, the point $x_0$ corresponding to this function is greater than $a$ and we get $g(x)=f(x)-\epsilon e^{x}\leq 0$. Letting $\epsilon \to 0$ we get $f(x) \leq 0$ for all $x$. 
