[proofplan]
One direction is immediate from measurability because half-lines are Borel. For the converse, collect all Borel sets whose inverse images are measurable and show this sigma-algebra contains the half-lines that generate $\mathcal B(\mathbb R)$.
[/proofplan]
custom_env
admin
[step:Measurability implies the half-line condition]
If $X$ is measurable, then for each $a\in\mathbb R$ the set $(-\infty,a]$ is Borel, so
\begin{align*}
\{\omega:X(\omega)\le a\}=X^{-1}(( -\infty,a])\in\mathcal F.
\end{align*}
[/step]
custom_env
admin
[step:The half-line condition implies measurability]
Assume $X^{-1}(( -\infty,a])\in\mathcal F$ for every $a\in\mathbb R$. Let
\begin{align*}
\mathcal G=\{B\in\mathcal B(\mathbb R):X^{-1}(B)\in\mathcal F\}.
\end{align*}
The class $\mathcal G$ is a sigma-algebra on $\mathbb R$ because inverse images commute with complements and countable unions. By assumption, $(-\infty,a]\in\mathcal G$ for every $a$. The Borel sigma-algebra $\mathcal B(\mathbb R)$ is generated by these half-lines, so $\mathcal G=\mathcal B(\mathbb R)$. Hence $X^{-1}(B)\in\mathcal F$ for every Borel set $B$, which is measurability of $X$.
[/step]