If $X$ is measurable space, $f : X\to [-\infty,+\infty]$, function such that $f^{-1}([-\infty,r))$ measurable for all rational numbers $r$,prove than $f$ is measurable
I know that $f$ is measurable iff set $\{x\in X : f(x)<a\}$ is measurable for all $a\in \mathbb{R}$ but for $a\in\mathbb{Q}$ I don't know how to proceed.
Hint: for any $a$, you can write $\{x\in X: f(x)<a\}$ as a countable union of (measurable) sets of the form $f^{-1}([-\infty,r))$. Then use your hypothesis and the fact that a countable union of measurable sets is measurable to conclude.