TITLE: Conditional Expectation of function of two RVs, one measurable, one independent
QUESTION [5 upvotes]: Let $\mathcal{A}$ be a $\sigma$-sub-algebra in the probability space $(\Omega, \mathcal{F}, P)$. Let $X$ be a $\mathcal{A}$-measurable function and $Z$ independent on $\mathcal{A}$. Why can I write $$E(f(X,Z) \mid \mathcal{A})=\int_{\Omega} f(X,Z(\omega)) P(d\omega) \text{?}$$
(Note that $X$ does not depend on is not a function of $\omega$. The background was that I want to have $E(f(X,Z) \mid \mathcal{A})=E(f(X,Z))$)
EDIT Like @Did said, the question should be formulated a bit differently:
Why is $$E(f(X,Z) \mid \mathcal{A}) = g(X)$$ with $g(x)=E(f(x,Z))$?
(The integral in the original expression would be more $U(\omega)=\int f(X(\omega),z)\,\mathrm dP_Z(z)$ and I asked myself why $X$ in the integrand is not integrated as well, which I expressed as "is not a function of")

REPLY [6 votes]: As often with conditional expectations, to come back to the definition yields the solution. To check that $U=\mathrm E(f(X,Z)\mid \mathcal A)$ is to check that two conditions hold simultaneously: (1) $U$ is $\mathcal A$-measurable; (2) for every bounded and $\mathcal A$-measurable $Y$, one has $\mathrm E(UY)=\mathrm E(f(X,Z)Y)$.
Let us check (1) and (2) for $U=g(X)$ where $g$ is defined by $g(x)=\mathrm E(f(x,Z))$. 
Since $U=g(X)$ is a measurable function of $X$ and $X$ is $\mathcal A$-measurable, $U$ is $\mathcal A$-measurable. 
Now, $X$ and $Y$ are $\mathcal A$-measurable and $Z$ is independent on $\mathcal A$ hence $(X,Y)$ and $Z$ are independent. Calling $\mu$ the distribution of $(X,Y)$ and $\nu$ the distribution of $Z$, one gets
$$
\mathrm E(f(X,Z)Y)=\iint f(x,z)\,y\,\mathrm d\mu(x,y)\,\mathrm d\nu(z).
$$
On the other hand,
$$
g(x)=\int f(x,z)\,\mathrm d\nu(z),
$$
hence
$$
\mathrm E(UY)=\mathrm E(g(X)Y)=\int g(x)\,y\,\mathrm d\mu(x,y)=\iint f(x,z)\,y\,\mathrm d\nu(z)\,\mathrm d\mu(x,y),
$$
hence $\mathrm E(UY)=\mathrm E(f(X,Z)Y)$ by Fubini theorem. Finally, (1) and (2) hold for $U=g(X)$ hence
$$
\mathrm E(f(X,Z)\mid \mathcal A)=g(X)=\int f(X,z)\,\mathrm dP_Z(z).
$$
This means that $\mathrm E(f(X,Z)\mid \mathcal A)=U$ almost surely, where, for every $\omega$ in $\Omega$,
$$
U(\omega)=\int f(X(\omega),z)\,\mathrm dP_Z(z).
$$
Note: All this, and much more, is explained in a gem of a small book, highly accessible, titled Probability with martingales.