I came across this lovely problem in my self-study:
For $(X, \mathcal{M})$ a measurable space, if $f: X \rightarrow \overline{\mathbb{R}}$ and $f^{-1}((r, \infty]) \in \mathcal{M}$ for all $r \in \mathbb{Q}$, then $f$ is measurable.
I want to tackle this problem by using the following related result:
For $(X, \mathcal{M})$ a measurable space, if $f: X \rightarrow \overline{\mathbb{R}}$ and $f^{-1}(\mathbb{R}) = Y$ then $f$ is measurable $\iff$ $f^{-1}(-\infty) \in \mathcal{M}$, $f^{-1}(\infty) \in \mathcal{M}$, and $f$ is measurable on $Y$.
Using countable intersections and complements, confirming that $f^{-1}(-\infty) \in \mathcal{M}$, $f^{-1}(\infty) \in \mathcal{M}$ is pretty easy. I am not as sure how to verify the last item! However, I think the fact that $\mathbb{Q}$ is dense in $\mathbb{R}$ will be important.
I am interested to see if anyone has any ideas on how to prove this last part, or alternative strategies for proof of the exercise.