How to show that measurable functions preserve mean independence? Let $X$ and $Y$ be continuous random variables such that 
$$\mathbb{E}(X\mid Y=y)=\mathbb{E}(X) $$
 for all $y\in \operatorname{Supp}(Y)$. How can I show that for any measurable function $f$ we have  $$\mathbb{E}(X\mid f(Y)=f_y)=\mathbb{E}(X)$$ for all $f_y\in \operatorname{Supp}(f(Y))$? Seems very intuitive but I havent been able to come up with a formal proof. 
 A: The conditional expectation $\mathbb E(X\mid Y=y)$ in general depends on $y$, so call it $g(y)$.  Then the expression $\mathbb E(X\mid Y)$ denotes the random variable $g(Y)$.  So $g(Y)$ is a constant random variable, equal to one particular number with probability $1$.  Therefore for any measurable set $A$, we have $\mathbb E(X\mid Y\in A)$ is that same number.  Now let $A=\{w : f(y)=w\}$.
Maybe I'll add a more measure-theoretic point of view later.
A: I don't really think the general result is completely obvious, but here's at least a result for the case where $f$ is injective. I'll assume that the variables $X$ and $Y$ take their values in the real numbers. Let $(\nu_y)_{y\in\mathbb{R}}$ be the conditional distribution of $X$ given $Y$. Formally, this means that
$$
  P(X\in A,Y\in B) = \int 1_B(y) \nu_y(A) dY(P)(y)
$$
for all Borel sets $A$ and $B$. It then also holds that
$$
  E(X | Y = y) = \int w d\nu_y(w).
$$
The above might in fact conveniently be taken as the definition of conditional expectations. Now let $(\mu_z)_{z\in \mathbb{R}}$ be the conditional distribution of $X$ given $f(Y)$. This means that
$$
  P(X\in A,f(Y)\in f(B)) = \int 1_B(z) \mu_z(A) df(Y)(P)(z),
$$
and
$$
  E(X | f(Y) = z) = \int w d\mu_z(w).
$$
Now note that
$$
  P(X\in A, f(Y) \in B)
  =P(X\in A, Y\in f^{-1}(B))\\
  =\int 1_{f^{-1}(B)}(y) \nu_y(A) dY(P)(y)
  =\int 1_{B}(f(y)) \nu_{f^{-1}(f(y))}(A) dY(P)(y) \\
  =\int 1_{B}(y) \nu_{f^{-1}(y)}(A) df(Y)(P)(y).
$$
By uniqueness of conditional distributions, $\mu_z = \nu_{f^{-1}(z)}$. This essentially states that the conditional distribution of $X$ given $f(Y) = z$ is the same as the conditional distribution of $X$ given $Y = f^{-1}(z)$. It then follows that
$$
  E(X | f(Y) = f(y)) = E(X | Y = y).
$$
In particular, the result for the case where the conditional expectation is constant follows from this. However, the above arguments are only valid for when $f$ is injective...
