Let $(\Omega,\mathcal{F},\mathbb{P})$ be a probability space. Let $(\mathcal{X},d)$ be a complete and separable metric space. Let $\mathcal{F}_{\mathcal{X}}$ be the Borel $\sigma$-algebra of $(\mathcal{X},d)$. Let $X:\Omega\to \mathcal{X}$ be a measurable function from $(\Omega,\mathcal{F})$ into $(\mathcal{X},\mathcal{F}_{\mathcal{X}})$. Denote by $\mathcal{M}$ the set of probability measures on $(\Omega,\mathcal{F})$. Denote by $\mathcal{B}_{\mathbb{R}}$ the Borel $\sigma$-algebra of $\mathbb{R}$. Then there exists a regular probability measure of $\mathbb{P}$ given $X$, i.e. a function $\mathbb{Q}:\mathcal{X}\to\mathcal{M}$ such that
- $\forall F\in \mathcal{F}, x\mapsto\mathbb{Q}(x)(F)$ is measurable from $(\mathcal{X},\mathcal{F}_{\mathcal{X}})$ into $(\mathbb{R},\mathcal{B}_{\mathbb{R}})$;
- $\forall F\in\mathcal{F}, \forall A \in \mathcal{F}_{\mathcal{X}}, \mathbb{P}(F\cap \{X\in A\}) = \int_A\mathbb{Q}(x)(F)\operatorname{d}\mathbb{P}_X(x)$.
In literature $\mathbb{Q}(x)(F)$ is better known as $\mathbb{P}(F|X=x)$.
Now, let $(\mathcal{Y},\mathcal{F}_{\mathcal{Y}})$ be a measurable space, $Y:\Omega\to \mathcal{Y}$ be a measurable function from $(\Omega,\mathcal{F})$ into $(\mathcal{Y},\mathcal{F}_{\mathcal{Y}})$ and $f:\mathcal {X}\times \mathcal{Y}\to \mathbb{R}$ be a bounded measurable function from $(\mathcal {X}\times \mathcal{Y}, \mathcal{F}_{\mathcal{X}}\otimes \mathcal{F}_{\mathcal{Y}})$ into $(\mathbb{R},\mathcal{B}_{\mathbb{R}})$. Define
- $g:\mathcal{X}\to\mathbb{R}, x\mapsto\int_\Omega f(X(\omega),Y(\omega))\operatorname{d}(\mathbb{Q}(x))(\omega)$;
- $h:\mathcal{X}\to\mathbb{R}, x\mapsto\int_\Omega f(x,Y(\omega))\operatorname{d}(\mathbb{Q}(x))(\omega)$;
Intuitively it seems plausible that $g=h, \mathbb{P}_X\text{-a.e.}$, since we're just replacing $X(\omega)$ with $x$ knowing that we are integrating on $X=x$, as suggested by the notation $\mathbb{P}(\cdot|X=x)$. However, this is just handwaving, so I tried to prove it formally. It comes to me that we can obtain the conclusion if we can prove that both $g\circ X$ and $h \circ X$ are versions of $\mathbb{E}_{\mathbb{P}}(f(X,Y)|X)$ and so I tried to prove that $$\forall A \in \mathcal{F}_{\mathcal{X}}, \int_{\{X\in A\}}(g\circ X)\operatorname{d}{\mathbb{P}} =\int_{\{X\in A\}}f(X,Y)\operatorname{d}{\mathbb{P}}= \int_{\{X\in A\}}(h\circ X)\operatorname{d}{\mathbb{P}}.$$ However I'm a bit lost in manipulating such integrals to obtain these equalities (and however, do these integrals actually make sense? I'm a bit confused also on how to prove the measurability of $g$ and $h$). Any help?
To avoid misunderstanding define $\forall x\in\mathcal{X}, \forall F\in\mathcal{F}, \mathbb{Q}_x(F)=\mathbb{Q}(x)(F)$. Suppose first that $$f(x,y)=\chi_B(x)\chi_C(y)$$ for some $B\in\mathcal{F}_{\mathcal{X}}$ and $C\in\mathcal{F}_{\mathcal{Y}}$. Get $A\in\mathcal{F}_{\mathcal{X}}$. Then $$\int_{\{X\in A\}}(g\circ X)\operatorname{d}{\mathbb{P}} = \int_A\int_\Omega f(X,Y)\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x) = \int_A\int_\Omega \chi_{B}(X)\chi_C(Y)\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x)\\ =\int_A\int_\Omega \chi_{\{X\in B\}}\chi_{\{Y\in C\}}\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x) = \int_A \mathbb{Q}_x(\{X\in B\}\cap\{Y\in C\})\operatorname{d}\mathbb{P}_X(x) \\ = \mathbb{P}(\{X\in B\}\cap\{Y\in C\}\cap\{X\in A\}) = \int_{\{X\in A\}} \chi_{\{X\in B\}}\chi_{\{Y\in C\}}\operatorname{d}\mathbb{P} = \int_{\{X\in A\}} f(X,Y)\operatorname{d}\mathbb{P}.$$ So the claim holds if $f(x,y)=\chi_B(x)\chi_C(y)$. By linearity, the claim holds for $f(x,y)=\sum_{k=1}^m a_k \chi_{B_k}(x)\chi_{C_k}(y)$ and since every non-negative bounded measurable function from $(\mathcal{X}\times\mathcal{Y},\mathcal{F}_{\mathcal{X}}\otimes \mathcal{F}_{\mathcal{Y}})$ into $(\mathbb{R},\mathcal{B}_{\mathbb{R}})$ is a monotone limit of non-negative functions of this form, the claim also holds for every bounded non-negative $f$ by monotone convergence theorem. The general case is obtained decomposing $f$ into the positive and negative part and using linearity. With the very same technique, we also obtain the same for $h$ in place of $g$. In fact, starting with $$f(x,y)=\chi_B(x)\chi_C(y)$$ for some $B\in\mathcal{F}_{\mathcal{X}}$ and $C\in\mathcal{F}_{\mathcal{Y}}$, if $A\in\mathcal{F}_{\mathcal{X}}$ we get $$\int_{\{X\in A\}}(h\circ X)\operatorname{d}{\mathbb{P}} = \int_A\int_\Omega f(x,Y)\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x) = \int_A\int_\Omega \chi_{B}(x)\chi_C(Y)\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x)\\ =\int_{A\cap B}\int_\Omega \chi_{\{Y\in C\}}\operatorname{d}\mathbb{Q}_x\operatorname{d}\mathbb{P}_X(x) = \int_{A\cap B} \mathbb{Q}_x(\{Y\in C\})\operatorname{d}\mathbb{P}_X(x) \\ = \mathbb{P}(\{Y\in C\}\cap\{X\in A\cap B\}) = \int_{\{X\in A\}} \chi_{\{X\in B\}}\chi_{\{Y\in C\}}\operatorname{d}\mathbb{P} = \int_{\{X\in A\}} f(X,Y)\operatorname{d}\mathbb{P},$$ and we can proceed in the same way as before. The measurability problem should be addressed in the same way, since the pointwise limit of measurable functions is measurable.