Proving a Function $X \to \mathbb{R}$ Measurable Let $(X,\mathcal{R},\mu)$ be a measure space and let $f : X \to \mathbb{R}$ be a function. If $f^{-1}([a,\infty))$ is measurable for all $a \in \mathbb{R}$, then $f$ is measurable. But say all I can show is that $f^{-1}([a,\infty))$ is measurable for almost all $a \in \mathbb{R}$. Is that enough to prove that $f$ is measurable?
 A: This answer explains why my comment is true. I will divide the argument in two parts. Here $A \in \mathcal B (\mathbb R)$.

*

*If $\lambda(A^c)=0$ then $A$ is dense in $\mathbb{R}$. Indeed, assume by contradiction that $\lambda(A^c)=0$ but $A$ is not dense in $\mathbb R$. Then there exists $x_0 \in \mathbb R$ and $\epsilon > 0$ such that $A \cap ]x_0-\epsilon,x_0+\epsilon[ = \emptyset$. But then $]x_0-\epsilon,x_0+\epsilon[ \subset A^c$ and $\lambda(A^c) \geq 2\epsilon > 0$.



*If $A$ is dense, then $\mathcal C :=\{[a,\infty)  \}_{a \in A}$ generates $\mathcal B (\mathbb R)$. You know that $\mathcal B (\mathbb R)$ is generated by the open bounded intervalls and $\mathcal C \subset \mathcal B (\mathbb R)$ so I just need to show that forall $-\infty<a<b<\infty$, $(a,b) \in \sigma(\mathcal C)$. Fix those $a,b$, see that
$$
(a,b) = (a,\infty)\setminus [b,\infty)
$$
so we just need to show that $(a,\infty),[b,\infty) \in \sigma(\mathcal C)$. Take $(a_n)$ a sequence of $A$ with limit $a$. As a fact, we can assume that $(a_n)$ is decreasing. Then
$$
(a,\infty) = \cup_{n \geq 0} [a_n,\infty) \in \sigma(\mathcal C).
$$
For the second set, take $(b_n)$ a sequence of $A$ that increases to $b$ :
$$
[b,\infty) = \cap _{n\geq 0} [b_n,\infty) \in \sigma(\mathcal C).
$$
A: Yes, it's enough. For arbitrary $a\in\mathbb R$ and positive integer $n$, there is an element $a_n$ in $[a+1/n, a+2/n]$ such that $f^{-1}([a_n, \infty))$ is measurable since $[a+1/n, a+2/n]$ has nonzero measure. Therefore $f^{-1}((a, \infty))=\cup_{n} f^{-1}([a_n, \infty)$ is measurable.
