Conditional expectation $E[f(X,Y)|\mathcal F]$ with $Y$ $\mathcal F$-measurable Let $X,Y$ be real random variables on a probability space $(\Omega,\mathcal A,P)$. Let $\mathcal F$ be a sub-$\sigma$-algebra of $\mathcal A$ and $f:\mathbb R^2\to \mathbb R$ be Borel measurable. If $f(X,Y)$ is $P$-integrable and $Y$ is $\mathcal F$-measurable , is it true that
$$E[f(X,Y)|\mathcal F](\omega)=\int f(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx) \quad \quad (1)$$
for $P$-almost all $\omega\in\Omega$? Here $\kappa_{X,\mathcal F}$ is a regular conditional distribution of $X$ given $\mathcal F$.
 A: For my own understanding I will try to write down the details of the proof, following Theorem 5.4 on page 85 of Kallenberg's Foundations of Modern Probability.
For greater generality assume that $X$ is $(E_X,\mathcal E_X)$-valued  and $Y$ is $(E_Y,\mathcal E_Y)$-valued, and that  a regular conditional distribution $ \kappa_{X,\mathcal F}$ from $(\Omega,\mathcal F)$ to $(E_X,\mathcal E_X)$ exists.

The first step is to show that for all $D\in \mathcal E_X\otimes \mathcal E_Y$ we have

*

*The map $\omega\mapsto \int 1_D(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$ is $\mathcal F$-measurable  and

*$E[1_D(X,Y)]=E[\int 1_D(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)]$
Let $\mathcal D$ denote the class of all  $D\in \mathcal E_X\otimes \mathcal E_Y$ satisfying 1. and 2.
Lemma. $\mathcal D$ is a Dynkin system in $E_X \times E_Y$.
Proof. Clearly $E_X \times E_Y\in \mathcal D$.  Suppose $D \in \mathcal D$ and let $D^c$ denote the complement of $D$ in $E_X \times E_Y$.  Then
$$\omega\mapsto \int 1_{D^c}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=1-\int 1_{D}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
is $\mathcal F$-measurable and
$$E[1_{D^c}(X,Y)]=1-E[1_{D}(X,Y)]=1-E\bigg[\int 1_D(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg]=E\bigg[\int 1_{D^c}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg]$$
so $D^c\in\mathcal D$. Suppose $(D_n$) is a sequence of disjoints sets in $\mathcal D$. Since $1_{\cup_{i=1}^n D_i}\to 1_{\cup_{i=1}^\infty D_i}$ pointwise  as $n\to \infty$ the DCT gives that
$$\omega\mapsto \int 1_{\cup_{i=1}^\infty D_i}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)= \lim_{n\to \infty} \int 1_{\cup_{i=1}^n D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)$$$$= \lim_{n\to \infty} \sum_{i=1}^n \int 1_{D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)$$
is $\mathcal F$-measurable and
$$E[1_{\cup_{i=1}^\infty D_i}(X,Y)]=\lim_{n\to\infty} E[1_{\cup_{i=1}^n D_i}(X,Y)]=\lim_{n\to\infty} \sum_{i=1}^n E[1_{D_i}(X,Y)]$$$$=\lim_{n\to \infty} \sum_{i=1}^n E\bigg[\int 1_{D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)\bigg]=\lim_{n\to \infty}  E\bigg[\sum_{i=1}^n \int 1_{D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)\bigg]$$
$$=\lim_{n\to \infty}  E\bigg[ \int 1_{\cup_{i=1}^n D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)\bigg]= E\bigg[ \int 1_{\cup_{i=1}^\infty D_i}(x,Y(\omega))\kappa_{X,\mathcal F}(\omega,dx)\bigg]$$
Hence $\cup_{i=1}^n D_i\in\mathcal D$, and $\mathcal D$ is a Dynkin system.
Now, by the Dynkin theorem, it suffices to prove the claim for all sets in an intersection stable generator of $\mathcal E_X\otimes \mathcal E_Y$. The generator we have in mind is the collection of all sets of the form $A \times B$ with $A\in \mathcal E_X$ and $B\in\mathcal E_Y$. For such set we have
$$\omega\mapsto \int 1_{A\times B}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=1_{Y^{-1}(B)}(\omega) \int 1_{A}(x) \kappa_{X,\mathcal F}(\omega,dx)=1_{Y^{-1}(B)}(\omega) \kappa_{X,\mathcal F}(\omega,A)$$
which is $\mathcal F$-measurable since $Y$ is assumed to be $\mathcal F$-measurable. Moreover, from the properties of conditional expectations we have
$$E[1_{A\times B}(X,Y)]=E[1_{X^{-1}(A)} 1_{Y^{-1}(B)}]=E[P[ X \in A|\mathcal F]  1_{Y^{-1}(B)}]=E[\kappa_{X,\mathcal F}(\cdot,A)  1_{Y^{-1}(B)}] = E\bigg[\int 1_{A\times B}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg]$$
We conclude that 1. and 2. hold for all $D\in \mathcal E_X\otimes \mathcal E_Y$.

The second step is to show that for all nonnegative and measurable $f:(E_X\times E_Y, \mathcal E_X\otimes \mathcal E_Y)\to [0,\infty)$ with $E[f(X,Y)]<\infty$ we have

*

*The map $\omega\mapsto \int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$ is $\mathcal F$-measurable  and

*$E[f(X,Y)]=E[\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)]$
For this we follow the standard procedure. If $f=\sum_{i=1}^n c_i 1_{C_i}$ with $c_i\geq 0$ and $C_i\in \mathcal E_X\otimes \mathcal E_Y$ for each $i$ then
$$\omega\mapsto \int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=\sum_{i=1}^n c_i  \int 1_{C_i}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
is $\mathcal F$-measurable and
$$E[f(X,Y)]=\sum_{i=1}^n c_i E[1_{C_i}(X,Y)]=\sum_{i=1}^n c_i  E\bigg[ \int 1_{C_i}(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg]= E\bigg[\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg] $$
Otherwise let $(f_n)$ be an increasing sequence of simple functions as above converging pointwise to $f$. Then from the MCT we get that
$$\omega\mapsto \int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=\lim_{n\to\infty} \int f_n(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
is $\mathcal F$-measurable and
$$E[f(X,Y)]=\lim_{n\to\infty}E[f_n(X,Y)]=\lim_{n\to\infty}E\bigg[\int f_n(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg ]= E\bigg[\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)\bigg ]$$
Note that we can have $\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=\infty$, but only for some $\omega$ in a null set.

Now we can prove the theorem for measurable $f\geq 0$ such that $E[f(X,Y)]<\infty$. Fix $C\in\mathcal F$.  Consider the $\mathcal F$- measurable random variable $Z=(Y,1_C)$ taking values in  $(E_Z,\mathcal E_Z):=(E_Y\times \mathbb R, \mathcal E_Y \otimes \mathcal B (\mathbb R))$ and the function $g:E_X\times E_Z\to [0,\infty)$ defined by $g(x,(y,t))=f(x,y)t$. This function is $\mathcal E_X \otimes \mathcal E_Z  $ measurable, and so applying the previous results with $X,Z$ and $g$ we get
$$\omega\mapsto\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx) 1_C(\omega) \quad \mathcal F\text{-measurable}$$
$$E[f(X,Y)1_C]=E\bigg[\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx) 1_C(\omega)\bigg ]$$
Since $C\in\mathcal F$ was arbitrary we conclude that $E[f(X,Y)|\mathcal F](\omega)=\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$ for $P$-almost all $\omega\in\Omega$. Again $\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)=\infty$ is possible on a null set .
Finally let $f$ be measurable, signed, and such that $E[f(X,Y)]<\infty$. Then outside the union of two null sets we have
$$E[f^+(X,Y)|\mathcal F](\omega)=\int f^+(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
$$E[f^-(X,Y)|\mathcal F](\omega)=\int f^-(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
and so taking differences we get that, for $P$-almost all $\omega$, $f(\cdot ,Y(\omega))$ is $\kappa_{X,\mathcal F} (\omega,\cdot)$ integrable  and
$$E[f(X,Y)|\mathcal F](\omega)=\int f(x,Y(\omega)) \kappa_{X,\mathcal F}(\omega,dx)$$
