After several hours of struggling, I've been unable to solve the following problem
Let $X,Y: (\Omega, \mathcal{S}) \rightarrow (\mathbb{R}, \mathcal{R})$ where $\mathcal{R}$ are the Borel Sets for the Reals. Show that $Y$ is measurable with respect to $\sigma(X) = \{ X^{-1}(B) : B \in \mathcal{R} \}$ if and only if there exists a function $f: \mathbb{R} \rightarrow \mathbb{R}$ such that $Y(\omega) = f(X(\omega))$ for all $\omega \in \Omega$.
Firstly, I am assuming that for $Y$ to be measurable with respect to $\sigma(X)$ means that $\forall B \in \mathcal{R} \quad Y^{-1}(B) \in \sigma(X)$. The text (Probability: Theory and Examples) failed to define the phrase.
The problem following it begins describing a constructive proof where we split $Y$'s range into segments of increasingly fine granularity ( i.e. $\left [\frac{m}{2^{n}}, \frac{m+1}{2^{n}}\right)$ for each $m \in \mathbb{N}$ ) and define a function between $X$'s range and $Y$'s for each level of granularity ( i.e. by noting that $Y^{-1}\left(\left[\frac{m}{2^{n}}, \frac{m+1}{2^{n}}\right)\right)$ = $X^{-1}(B_{n,m})$ for some $B_{n,m} \in \mathcal{R}$ and defining $f_{n}(x) = \frac{m}{2^{n}}$ when $x \in B_{n,m}$ ), then need to show that $Y$ is equal to this function in the limit.
Unfortunately I can't even make sense of how each of these functions are defined, much less use them. In particular, I don't see how each $x \in \mathbb{R}$ maps to a single $B_{n,m}$, which would mean we would need to define $f_{n}$ via the infimum of all available values. Take the example that $X(\omega) = 0$ for all $\omega$.
As this constructive proof is a separate problem, there must then exist a non-constructive one as well which is perhaps more concise. I have been unable to make any headway in that respect.