I am thinking of the following situation:


On a probability space $\left( \Omega, \mathscr{F}, \cal{P} \right)$ with **arbitrary** structure, suppose we are given a random function (as it is called in the Stochastic Programming literature) $g: \Omega \times \mathbb{R}^N \rightarrow \mathbb{R}$, which is additionally jointly measurable relative to the product $\mathscr{F} \times \mathscr{B}\left( \mathbb{R}^N \right)$.


Consider a sub $\sigma$-field $\mathscr{Y} \subset \mathscr{F}$. We are also given another random element $X: \Omega \rightarrow \mathbb{R}^N$, measurable relative to $\mathscr{Y}$.


Then, we know that $g\left(\cdot, X \right)$ is an $\mathscr{F}$-measurable random variable.


Now, suppose additionally that $\mathbb{E} \left[ g\left( \cdot, X \right) \right]$ exists.


Under this general setting, can I assert that the conditional expectation $\mathbb{E} \left[ g\left( \cdot, X \right) | \mathscr{Y} \right]$ obeys the substitution rule, that is, is it true that


\begin{equation}
\mathbb{E} \left[ g\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right) = \mathbb{E} \left[ g\left( \cdot, X \left( \omega \right) \right) | \mathscr{Y} \right] \left( \omega \right) \quad\quad?
\end{equation}


What I mean with this equation is that, if I want to evaluate this conditional expectation, I can do that first by fixing $X$, taking it as a parameter through the evaluation, and let it vary again in $\omega$ after the result has been determined.


For simplicity, we may also assume that $\mathscr{Y}$ is the $\sigma$-field generated by another random element $Y:\Omega \rightarrow \mathbb{R}^M$.


My guess is that, because $\left( \Omega, \mathscr{F}, \cal{P} \right)$ is "non-standard", further conditions on the structure of $g$ should be imposed, in order to assert that the substitution rule holds in this case.


Thanks!


EDIT: So, the answer is provided in the discussion below. The result holds generally; no conditions need to be imposed. The result may be proved by invoking Dynkin’s Multiplicative System Theorem and, in particular, Corollary 8.3 [in these notes](http://www.math.ucsd.edu/~bdriver/280_09-10/Lecture_Notes/2009-2010-Probability%20Lecture%20Notes.pdf). See also Exercise 14.7 also [in these notes](http://www.math.ucsd.edu/~bdriver/280_09-10/Lecture_Notes/2009-2010-Probability%20Lecture%20Notes.pdf), for a very related result, which makes use of the aforementioned Corollary.


Many Thanks to Nate Eldredge for pointing this out!



Conditional Expectation Relative to "Random Time" - Consistency of the Substitution Rule
**Please, Your Attention:**


I have taken my time to work out a proof based on Dynkin's Multiplicative System Theorem, in the fashion on Exercise 14.7 in [these notes](http://www.math.ucsd.edu/~bdriver/280_09-10/Lecture_Notes/2009-2010-Probability%20Lecture%20Notes.pdf). From the discussion that follows, I think that, unfortunately, the substitution rule cannot be proved for the general case, where the base probability space $\left( \Omega,\mathscr{F},\cal{P} \right)$ is arbitrary.


Here is why:


In order to use the Dynkin's Multiplicative System Theorem, we have to show that the class


\begin{equation}
\mathbb{F}\triangleq \left\{ g\in \left[ \mathscr{F}\times\mathscr{B}\left( \mathbb{R}^N\right) \right]\_b \left| \mathbb{E} \left[ g\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right) = \mathbb{E} \left[ g\left( \cdot, X \left( \omega \right) \right) | \mathscr{Y} \right] \left( \omega \right), \quad \cal{P}-a.e. \right. \right\},
\end{equation}


where $\left[ \mathscr{F}\times\mathscr{B}\left( \mathbb{R}^N\right) \right]\_b$ denotes the set of all bounded, jointly $\mathscr{F}\times\mathscr{B}\left( \mathbb{R}^N\right)$-measurable functions, is **closed under bounded convergence**, which means that, if $\left\{ g\_n \in \mathbb{F}\right\}\_{n\in\mathbb{N}}$ is a sequence of functions, such that


\begin{equation}
\sup\_{\left( \omega, x, n \right) \in \Omega \times \mathbb{R}^N \times \mathbb{N}} \left|g\_n\left( \omega, x \right)\right|=M<\infty,
\end{equation}


then


\begin{equation}
g\_n \left( \omega,x \right) \underset{n\rightarrow\infty}{\longrightarrow} g\left( \omega,x \right),\quad\forall\omega,x\in\Omega\times\mathbb{R}^N
\quad\Rightarrow \quad g\in\mathbb{F}.
\end{equation}


So, suppose that


\begin{equation}
g\_n \left( \omega,x \right) \underset{n\rightarrow\infty}{\longrightarrow} g\left( \omega,x \right),\quad\forall\omega,x\in\Omega\times\mathbb{R}^N.
\end{equation}


Since the convergence is pointwise, for every random element $X:\Omega \rightarrow\mathbb{R}^N$, it must be true that


\begin{equation}
g\_n \left( \omega,X\left(\omega\right) \right) \underset{n\rightarrow\infty}{\longrightarrow} g\left( \omega,X\left(\omega\right) \right),\quad\forall\omega\in\Omega.
\end{equation}


Now, since $g\_n\in\mathbb{F}$, for all $n\in\mathbb{N}$, the desired property holds, that is,


\begin{equation}
\mathbb{E} \left[ g\_n\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right) = \mathbb{E} \left[ g\_n\left( \cdot, X \left( \omega \right) \right) | \mathscr{Y} \right] \left( \omega \right)\equiv
\mathbb{E} \left[ g\_n\left( \cdot, x \right) | \mathscr{Y} \right] \left( \omega \right)|\_{x=X\left( \omega \right)},\quad\forall\omega\in\Omega\_{\Pi\_1},
\end{equation}


where ${\cal{P}} \left( \Omega\_{\Pi\_1} \right)=1$, with $\Omega\_{\Pi\_1}$ being independent of $n$. Note that such an $ \Omega\_{\Pi\_1}$ exists, since $\mathbb{N}$ is countable.


We would like to show that the desired property holds also for the limit $g$. On the one hand, since everything is bounded and $\cal{P}$ is finite, invoking the Dominated Convergence Theorem for conditional expectations, we get


\begin{equation}
\mathbb{E} \left[ g\_n\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right)
\underset{n\rightarrow\infty}{\longrightarrow} 
\mathbb{E} \left[ g\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right),\quad\forall\omega\in\Omega\_{\Pi\_2},
\end{equation}


where ${\cal{P}} \left( \Omega\_{\Pi\_1} \right)=1$. This in turn implies that


\begin{equation}
\mathbb{E} \left[ g\_n\left( \cdot, x \right) | \mathscr{Y} \right] \left( \omega \right)|\_{x=X\left( \omega \right)}
\underset{n\rightarrow\infty}{\longrightarrow} 
\mathbb{E} \left[ g\left( \cdot, X \right) | \mathscr{Y} \right] \left( \omega \right),\quad\forall\omega\in\Omega\_{\Pi\_1}\cap\Omega\_{\Pi\_2}\triangleq\Omega\_{\Pi\_3},
\end{equation}


where, of course, ${\cal{P}} \left( \Omega\_{\Pi\_3} \right)=1$. 


**And this is the point where the problems start.**


Again invoking the Dominated Convergence Theorem for conditional expectations, it is true that, **for each fixed** $x\in\mathbb{R}^N$, there exists an event $\Omega\_x$ with ${\cal{P}} \left( \Omega\_x \right)=1$, such that


\begin{equation}
\mathbb{E} \left[ g\_n\left( \cdot, x \right) | \mathscr{Y} \right] \left( \omega \right)
\underset{n\rightarrow\infty}{\longrightarrow} 
\mathbb{E} \left[ g\left( \cdot, x \right) | \mathscr{Y} \right] \left( \omega \right),\quad\forall\omega\in\Omega\_x,
\end{equation}


But $\mathbb{R}^N$ is uncountable! Therefore, in general, we may not be able to find a global, independent of the particular $x$ event of full measure, such that the above holds. As a result, the above cannot be guaranteed to hold if $x$ is replaced by $X\left(\omega\right)$.


Consequently, under this general setting, the class $\mathbb{F}$ cannot be guaranteed to be closed under bounded convergence. Maybe further assumptions are needed.


I really hope I am wrong...


But my conclusion is reinforced by Jason Swanson's Remark 3.11, in [these other notes](http://www.swansonsite.com/W/instructional/condexp.pdf).


Now, we now that the result is true if a regular conditional distribution of $\omega\triangleq Z\left(\omega\right) | \mathscr{Y}$ exists. 


But existence of such a regular conditional distribution cannot be guaranteed in general, when the structure of $\left( \Omega,\mathscr{F},\cal{P} \right)$ is arbitrary.


I would be glad to see your comments.


