TITLE: If $f$ is a measurable random field, then $(ω,x)↦E[f(x)\mid F](ω)$ has a measurable version $g$ and $E[f(X)\mid F]=g(X)$ for all $F$-measurable $X$
QUESTION [6 upvotes]: Let

$(\Omega,\mathcal A,\operatorname P)$ be a probability space
$\mathcal F\subseteq\mathcal A$ be a $\sigma$-algebra on $(\Omega,\mathcal A)$
$(E,\mathcal E)$ be a measurable space
$f:\Omega\times E\to\mathbb R$ be $\mathcal A\otimes\mathcal E$-measurable

I'll write $f(x)$ instead of $f(\;\cdot\;,x)$ for $x\in E$ and $f(X)$ instead of $f(\;\cdot\;,X(\;\cdot\;))$ for $X:\Omega\to E$. Assume $$\operatorname E\left[\left|f(x)\right|\right]<\infty\;\;\;\text{for all }x\in E.\tag1$$ By a monotone class argument, it's easy to show that there is a $\mathcal F\otimes\mathcal E$-measurable $g:\Omega\times E\to\mathbb R$ with $$\operatorname E\left[f(x)\mid\mathcal F\right]=g(x)\;\;\;\text{almost surely for all }x\in E.\tag2$$

I've found the following exercise in the book Stochastic Flows and Stochastic Differential Equations (Exercise 1.4.11): Let $X:\Omega\to E$ be $\mathcal F$-measurable with $$\operatorname E\left[\left|f(X)\right|\right]<\infty.\tag3$$ Show that $$\operatorname E\left[f(X)\mid\mathcal F\right]=g(X)\;\;\;\text{almost surely}.\tag4$$ How can we prove that?

Unfortunately, I don't have any idea for an argument. I don't think that the author has forgotten to add a crucial assumption, but nevertheless I've tried to consider the case where $E$ is a separable metric space, $\mathcal E$ is the Borel $\sigma$-algebra on $E$ and $f(\omega,\;\cdot\;)$ is continuous for allmost all $\omega\in\Omega$.
With that assumption it's easy to see that $(4)$ is at least satisfied if $X$ has finite range. Now, since $E$ is separable, we can find a sequence $(X_n)_{n\in\mathbb N}$ of $\mathcal F$-measurable functions $X_n:\Omega\to E$ with finite range such that $$d(X_n,X)\le d(X_{n+1},X)\;\;\;\text{for all }n\in\mathbb N\tag5$$ and $$d(X_n,X)\xrightarrow{n\to\infty}0.\tag6$$ However, I don't know how we need to proceed from here.

So, the question is: How can we prove the claim in the general case and, if that's not possible, how do we need to proceed in the described special case?

REPLY [2 votes]: Firstly, we notice that $g$ is not unique, so we denote any valid
candidate by $g_{f}$. 
Consider the following ``formula'' with free variable $f$: 
$\varphi(f):$ If $f:\Omega\times E\rightarrow\mathbb{R}$ is $\mathcal{A\otimes\mathcal{E}}$-measurable
and $E\left[|f(x)|\right]<\infty$ for all $x\in E$, then for any
$\mathcal{F}/\mathcal{E}$-measurable map $X:\Omega\rightarrow E$
with $E\left[|f(X)|\right]<\infty$, we have that $E\left[f(X)\mid\mathcal{F}\right]=g_{f}(X)$
$P$-a.e. for some valid candidate $g_{f}$.
We go to prove that $\varphi(f)$ is true for all $\mathcal{A}\otimes\mathcal{E}$-measurable
map $f:\Omega\times E\rightarrow\mathbb{R}$ that satisfies $\forall x\in E$,
$E\left[|f(x)|\right]<\infty$ by considering the following cases.
Case 1: $f=1_{A\times B}$, where $A\in\mathcal{A}$ and $B\in\mathcal{E}$.
By direct verification, $g_{f}(x)=1_{B}(x)E\left[1_{A}\mid\mathcal{F}\right]$
is a valid candidate. (Here, we fix a choice for the conditional expectation
$E\left[1_{A}\mid\mathcal{F}\right]$. Let $X$ be such a map, then
\begin{eqnarray*}
E\left[f(X)\mid\mathcal{F}\right] & = & E\left[1_{A}1_{B}\circ X\mid\mathcal{F}\right]\\
 & = & 1_{B}\circ X\cdot E\left[1_{A}\mid\mathcal{F}\right]\\
 & = & g_{f}(X) (a.e.)
\end{eqnarray*}
by observing that $1_{B}\circ X:\Omega\rightarrow\mathbb{R}$ is $\mathcal{F}$-measurable.
This shows that $\varphi(f)$ is true whenever $f$ is of the form
$f=1_{A\times B},$ where $A\in\mathcal{A}$ and $B\in\mathcal{E}$.
Case 2: $f=1_{C}$, where $C\in\mathcal{A}\otimes\mathcal{E}$. Define
$\mathcal{P=}\{A\times B\mid A\in\mathcal{A}\mbox{ and }B\in\mathcal{E}$}
and $\mathcal{D}=\{C\in\mathcal{A}\otimes\mathcal{E}\mid\varphi(1_{C})\mbox{ is true.}\}$.
Clearly $\mathcal{P}$ is a $\pi$-class (i.e., $\mathcal{P}$ is
closed under finite intersection.) It is routine to check that $\mathcal{D}$
is a $\lambda$-class (in the sense that: $\emptyset\in\mathcal{D}$,
$C^{c}\in\mathcal{D}$ whenever $C\in\mathcal{D}$, and $\cup_{i=1}^{\infty}C_{i}\in\mathcal{D}$
whenever $C_{i}\in\mathcal{D}$ with $C_{i}\cap C_{j}=\emptyset$
whenever $i\neq j$.). By Case 1, $\mathcal{P}\subseteq\mathcal{D}$.
By Dynkin Theorem, we have $\sigma(\mathcal{P})\subseteq\mathcal{D}$.
Note that $\mathcal{D}\subseteq\mathcal{A}\otimes\mathcal{E}=\sigma(\mathcal{P})$.
Therefore $\mathcal{D}=\mathcal{A}\otimes\mathcal{E}$.
Case 3: $f$ is a simple $\mathcal{A}\otimes\mathcal{E}$-measurable
function. Argue by linearity and by the result of Case 2.
Case 4: $f:\mathcal{A}\otimes\mathcal{E}\rightarrow[0,\infty)$ is
a non-negative $\mathcal{A}\otimes\mathcal{E}$-measurable function.
Argue by monotone convergence theorem (Here, we also need monotone
convergence theorem, conditional expectation version).
Case 5: $f:\mathcal{A}\otimes\mathcal{E}\rightarrow\mathbb{R}$. Write
$f=f^{+}-f^{-}$.