Disintegration theorem: how to prove that for $\nu$-a.e. $y \in Y$, we have $g\circ \pi=g(y)$ $\mu_y$-a.e. Theorem 4 of this blog entry of Terrence Tao states that:

Let $X$ be a compact metric space, $\mathcal X$ its Borel $\sigma$-algebra, and $\mu$ a Borel probability measure on $X$. Let $(Y, \mathcal Y)$ a measurable space, $\pi:X\to Y$ a measurable map, and $\nu := f_\sharp \mu$. Then there is a collection $(\mu_y)_{y\in Y}$ of Borel probability measures on $X$, such that

*

*for all bounded measurable maps $f:X\to \mathbb C$ and $g:Y\to \mathbb C$,
$$
\int_X f\cdot (g\circ \pi) \mathrm d\mu = \int_Y \left(\int_X f\mathrm d\mu_y\right)g(y)\mathrm d\nu(y) \quad (\star)
$$

*for $\nu$-a.e. $y \in Y$,
$$
g\circ \pi=g(y) \quad \mu_y\text{-a.e.} \quad (\star\star)
$$

At the end of the proof, the author proves $(\star\star)$ by applying $(\star)$ twice, i.e.,

Finally, we prove $(\star\star)$. From two applications of $(\star)$ we have
$$
\int_Y\left(\int_X f(g \circ \pi) \mathrm d \mu_y\right) h(y) \mathrm d \nu(y) = \int_Y\left(\int_X f g(y) \mathrm d \mu_y\right) h(y) \mathrm d \nu(y)
$$
for all bounded measurable $f: X \rightarrow \mathbb{C}$ and $h: Y \rightarrow \mathbb{C}$. The claim follows (using the separability of the space of all $f$).

My question: I could not follow his reasoning here. Could you elaborate on how he obtain $(\star\star)$? Thank you so much!

Proof: We have the pullback map
$$
\pi^\sharp:L^2(Y, \mathcal Y, \nu)\to L^2(X, \mathcal X, \mu), g \mapsto g \circ \pi.
$$
We take its adjoint $\pi_\sharp:L^2(X, \mathcal X, \mu)\to L^2(Y, \mathcal Y, \nu)$, and have the duality
$$
\int_X f(\pi^\sharp g) \mathrm d \mu = \int_Y\left(\pi_{\sharp} f\right) g \mathrm d \nu \quad \forall f \in L^2(X, \mathcal X, \mu), \forall g \in L^2(Y, \mathcal Y, \nu).
$$
From duality that, we have $\|\pi_\sharp f\|_{L^\infty(Y)}\le \|f\|_\infty$ for all $f\in C(X)$. Since $C(X)$ is separable, we find a measurable representative $\tilde{\pi}_{\sharp} f$ of $\pi_{\sharp} f$ to every $f \in C(X)$ which varies linearly with $f$, and is such that $|\tilde{\pi}_{\sharp} f(y)| \le \|f\|_{\infty}$ for all $y$ outside of a set $E$ of $\nu$-measure zero and for all $f \in C(X)$.
We can then apply the Riesz representation theorem to obtain a Radon probability measure $\mu_y$ such that
$$
\tilde{\pi}_{\sharp} f(y)=\int_X f \mathrm d \mu_y
$$
for all such $y$. We set $\mu_y$ equal to some arbitrarily fixed Radon probability measure for $y \in E$. We then observe that the required properties (including the measurability of $y \mapsto \int_X f \mathrm d \mu_y$ are already obeyed for $f \in C(X)$.
To generalise this to bounded measurable $f$, observe that the class $\mathcal{C}$ of $f$ obeying the required properties is closed under dominated pointwise convergence, and so contains the indicator functions of open or compact sets (by Urysohn's lemma). Applying dominated pointwise convergence again and inner and outer regularity, we see that the indicator functions of any Borel set lies in $C$. Thus all simple measurable functions lie in $\mathcal{C}$, and on taking uniform limits we obtain the claim.
Finally, we prove $(\star\star)$. From two applications of $(\star)$ we have
$$
\int_Y\left(\int_X f(g \circ \pi) \mathrm d \mu_y\right) h(y) \mathrm d \nu(y) = \int_Y\left(\int_X f g(y) \mathrm d \mu_y\right) h(y) \mathrm d \nu(y)
$$
for all bounded measurable $f: X \rightarrow \mathbb{C}$ and $h: Y \rightarrow \mathbb{C}$. The claim follows (using the separability of the space of all $f$).
 A: Applying $(\star)$ with $f(g\circ\pi)$ in place of $f$ and $h$ in place of $g$, $$\int_Y\left(\int_X f(g \circ \pi)\, d\mu_y\right) h(y)\, d \nu(y)=\int_X f(g\circ \pi)(h\circ\pi)\, d\mu = \int_X f((gh)\circ \pi)\, d\mu.$$  Applying $(\star)$ again, this time to $f$ and $gh$, this also is equal to $$\int_Y\left(\int_X f\, d\mu_y\right) g(y)h(y)\, d \nu(y)=\int_Y\left(\int_X fg(y)\, d\mu_y\right) h(y)\, d \nu(y).$$ Thus $$\int_Y\left(\int_X f(g \circ \pi)\, d\mu_y\right) h(y)\, d \nu(y)=\int_Y\left(\int_X fg(y)\, d\mu_y\right) h(y)\, d \nu(y).$$
Now since this holds for arbitrary $h$, $$\int_X f(g \circ \pi)\, d\mu_y=\int_X fg(y)\, d\mu_y$$ for $\nu$-a.e. $y$.  Now let $f$ vary over a countable dense subset $S\subseteq C(X)$.  Since $S$ is countable, the set $A\subseteq Y$ of $y$ such that the equation above holds simultaneously for all $f\in S$ still has $\nu$-measure $1$.  For all $y\in A$, then, it follows that the equation above actually holds for all $f\in C(X)$.  By uniqueness part of the Riesz representation theorem, this implies the measures $(g\circ \pi)\mu_y$ and $g(y)\mu_y$ are equal for all $y\in A$, which then implies $(g\circ\pi)=g(y)$ $\mu_y$-a.e.
A: Now let $f:X \to \mathbb C$ and $g,h:Y \to \mathbb C$ be bounded and measurable. We apply $(\star)$ with $(f(g\circ\pi), h)$ in place of $(f, g)$ and get
$$
\int_Y\left(\int_X f(g \circ \pi)\mathrm d\mu_y\right) h(y)\mathrm d \nu(y) = \int_X f((gh)\circ \pi)\mathrm d\mu.
$$
We apply $(\star)$ with $(f, gh)$ in place of $(f, g)$ and get
$$
\int_X f((gh)\circ \pi)\mathrm d\mu = \int_Y\left(\int_X f \mathrm d\mu_y\right) (gh)(y)\mathrm d \nu(y) = \int_Y\left(\int_X f g(y)\mathrm d\mu_y\right) h(y)\mathrm d \nu(y).
$$
Thus
$$
\int_Y\left(\int_X f(g \circ \pi)\mathrm d\mu_y\right) h(y)\mathrm d \nu(y) = \int_Y\left(\int_X f g(y)\mathrm d\mu_y\right) h(y)\mathrm d \nu(y).
$$
So
$$
\int_Y\left(\int_X f(g \circ \pi)\mathrm d\mu_y - \int_X f g(y)\mathrm d\mu_y\right) h(y)\mathrm d \nu(y) = 0.
$$
We pick a particular $\bar h$ by
$$
\bar h (y ) := \int_X f(g \circ \pi)\mathrm d\mu_y - \int_X f g(y)\mathrm d\mu_y.
$$
Clearly, $\bar h:Y \to \mathbb C$ is bounded and measurable. So
$$
\int_X f(g \circ \pi)\mathrm d\mu_y = \int_X f g(y)\mathrm d\mu_y  \quad \nu\text{-a.e.}
$$
As such, for $\nu$-a.e. $y \in Y$, we get
$$
\int_X f [g \circ \pi - g(y)] \mathrm d\mu_y=0.
$$
Again, we pick a particular $\bar f: X \to \mathbb C$ by
$$
\bar f := g \circ \pi - g(y).
$$
Clearly, $\bar f$ is measurable and bounded. Then
$$
g \circ \pi - g(y) = 0 \quad \mu_y\text{-a.e.}
$$
