Given $X,Y \in L^2(\Omega,\mathscr{F},\Bbb{P})$ such that
$\mathbb{E}[X|Y] = Y$ a.s.
$\mathbb{E}[Y|X] = X$ a.s.
show that $\Bbb{P}(X = Y ) = 1.$
$Attempt: $
I can see that $\mathbb{E}[X|Y] = Y$ means
$$ \int_{\{Y\in{A}\}}X \, d\Bbb{P} = \int_{\{Y\in{A}\}}Y \, d\Bbb{P} $$ for any $A \subset{\Bbb{R}} $ Borel, so
$$ \int_{\{Y\in{A}\}}X - Y \, d\Bbb{P} = 0 $$ over any such sets. Similarly for sets of the form $\{X \in A \}$.
Now if I could show that $ \int_U X - Y \, d\Bbb{P} = 0$ for any set $U \subset \Omega$ of the form $\{X \lt a, Y \lt b\}$ for $a,b \in \Bbb{R}$ then I'd be done, because sets of that form are a $\pi$-system that generates $\sigma(X,Y)$, so I'd have (by a lemma) that the integral of $X-Y$ vanishes on all $\sigma(X,Y)$ sets - so of course, it would be zero. But I can't work out how to do that.
I'm given the hint that $$ \int_{ \{ X \gt c, Y \le c \} } X - Y \, d\Bbb{P} + \int_{ \{ X \le c, Y \le c \} } X - Y \, d\Bbb{P} = 0 \; \text{for all} \; c $$
because that's the integral over $\{Y\le c\}$, a set of the above form. With the condition that $X$ and $Y$ are integrable, this is exercise 9.2 in Williams' "Probability with Martingales". Driving me up the wall to get so stuck on what seems such a simple exercise!