Conditioning and substituting conditioned variable for unconditioned I am in the following situation. I have two independent discrete random variables $X,Y$ and I am looking at
$$
P(f(h_1(X),h_2(Y))=k~|~E_X \cap E_Y)
$$
where $E_X$ depends only on $X$ and $E_Y$ depends only on $Y$, and $E_X$ and $E_Y$ are independent.
I have calculated the conditional distributions of
$$
P(h_1(X)=i~|~E_X)=P(Z_X=i),~~~~ P(h_2(Y) = i ~|~E_Y)=P(Z_Y=i)
$$
for some nicer looking random variables $Z_X,Z_Y$ and would like to say
$$
P(f(h_1(X),h_2(Y))=k~|~E_X \cap E_Y)=P(f(Z_X,Z_Y)=k).
$$
Intuitively it seems obvious, but when I try to write I down I stumble on how to justify it. What do I need to say to make this rigorous?
 A: Using somewhat more systematic notations, one sees that the hypotheses are that $X$ and $Y$ are independent random variables, $B$ is some $X$-measurable event and $C$ some $Y$-measurable event such that, for every functions $u$ and $v$,
$$
\mathbb E(u(g(X))\mid B)=\mathbb E(u(Z)),\quad
\mathbb E(v(h(Y))\mid C)=\mathbb E(v(T)).
$$
(Note that the hypothesis that $B$ and $C$ are independent is always true since $X$ and $Y$ are independent, $B$ is $X$-measurable and $C$ is $Y$-measurable.)
One wants to prove that, for every function $w$,
$$
\mathbb E(w(g(X),h(Y))\mid B\cap C)=\mathbb E(w(Z,T)).\tag{$\ast$}
$$
The standard approach is to consider the set of functions $w$ such that $(\ast)$ holds and to decompose the proof into two steps:


*

*A specific step: show that $(\ast)$ holds for every $w=\mathbf 1_{U\times V}$.

*A non-specific step: deduce from the specific step that $(\ast)$ holds for every (properly integrable) function $w$.


Specific step: when $w=\mathbf 1_{U\times V}$, the LHS of $(\ast)$ is $\mathbb P(g(X)\in U,h(Y)\in V\mid B\cap C)$. Using $u=\mathbf 1_U$ and $v=\mathbf 1_V$, one knows that 
$$
\mathbb P(g(X)\in U\mid B)=\mathbb P(Z\in U),\qquad
\mathbb P(h(Y)\in V\mid C)=\mathbb P(T\in V).
$$
The independence assumptions yield $\mathbb P(B\cap C)=\mathbb P(B)\mathbb P(C)$ and
$$
[g(X)\in U,h(Y)\in V,B\cap C]=[g(X)\in U]\cap B\cap[h(Y)\in V]\cap C,
$$
yields
$$
\mathbb P(g(X)\in U,h(Y)\in V,B\cap C)=\mathbb P(g(X)\in U,B)\mathbb P(h(Y)\in V,C).
$$
Put all of these together, shake, and try to deduce the specific step. You will reach the formula
$$
\mathbb P(Z\in U)\mathbb P(T\in V),
$$
which you want to equal $\mathbb P(Z\in U,T\in V)$ for $(\ast)$ to hold for  $w=\mathbf 1_{U\times V}$. This is true if $Z$ and $T$ are independent, a hypothesis which is not made in the question and which should be made for the result to hold.
Non-specific step: note that $(\ast)$ is stable by linear combinations, by monotone convergence, and again by linear combinations. This yields that $(\ast)$ holds for nonnegative simple functions, then for nonnegative functions, then for real-valued functions. QED.
Finally:

The result holds adding the hypothesis that $Z$ and $T$ are independent (and forgetting the hypothesis that $B$ and $C$ are, since this is always true).

