If $f \in \mathcal{R}[a, b]$ and $f(x) \geq 0$ almost everywhere, prove that $\int^b_a f\geq 0$

If $f(x) \ge 0$, almost everywhere, then in every subinterval $[s,t]\subset [a,b]$, there exist a $\xi$, such that $f(\xi)\ge 0$, and in particular, $$ \sup_{x\in [s,t]}f(x)\ge 0. $$

Hence, for every partition $P=\{a=t_0<t_1<\cdots<t_n=b\}$ of $[a,b]$, if $$M_i=\sup_{x\in [t_{i-1},t_i]}f(x),$$ then $M_i\ge 0$, and thus the corresponding upper sum $$U(f,P)=\sum_{i=1}^nM(t_i-t_{i-1}),$$ is non-negative. Since $f$ is Riemann integrable over $[a,b]$, then $$ \int_a^b f(x)\,dx=\inf_P U(f,P)\ge 0. $$ The infimum above is taken over all partitions of $[a,b]$.