Let $X,Y$ be Polish spaces and $\mathcal P(X)$ the space of all Borel probability measures on $X$.

- Fix $\mu\in \mathcal P(X), \nu \in \mathcal P(Y)$. Let $\pi \in \Pi(\mu, \nu)$, i.e., $\pi \in \mathcal P(X \times Y)$ whose marginal on $X$ is $\mu$ and that on $Y$ is $\nu$.
- Let $c:X \times Y \to [0, \infty)$ and $\psi:X \to \mathbb R \cup\{-\infty\}$ be measurable. Let $\phi:Y \to \mathbb R \cup\{-\infty\}$ which is **not** necessarily measurable.

We assume there is a $\sigma$-compact subset $S$ of $X \times Y$ such that
- $\pi (S) = 1$,
- $\psi (x), \phi (y) \neq -\infty$, and
- $\phi (y) - \psi (x)  = c(x, y)$ for all $(x, y) \in S$.

At page 84 of Villani's *Optimal Transport: Old and New*, the author constructs a **measurable** $\widetilde \phi: Y \to \mathbb R \cup \{\pm\infty\}$ such that $\widetilde \phi (y) = \phi (y)$ for $\nu$-a.e. $y\in Y$ as follows.

>The measurability of $\phi$ is subtle also, and at the present level of generality it is not clear that this function is really Borel measurable. However, it can be modified on a $\nu$-negligible set so as to become measurable. Indeed, $\phi(y)-\psi(x)=c(x, y), \pi(d x d y)$-almost surely, so if one disintegrates $\pi(d x d y)$ as $\pi(d x | y) \nu(d y)$, then $\phi(y)$ will coincide, $\nu(d y)$-almost surely, with the Borel function $\widetilde{\phi}(y) :=$ $\int_{\mathcal{X}}[\psi(x)+c(x, y)] \pi(d x | y)$.

I understand how the disintegration theorem leads to the family $\{\pi(d x | y)  : y \in Y\}$. Let $f(x, y) := c(x, y) - \varphi (x)$. Then $f$ is measurable and finite on $S$. I think the author uses claim 1. of this version of [disintegration theorem](https://math.stackexchange.com/questions/4563738/disintegration-theorem-how-do-the-authors-prove-that-mu-y-is-supported-on?rq=1) to show that
- $\widetilde{\phi}(y)$ is well-defined, and
- $\widetilde{\phi}$ is measurable.

IMHO, disintegration theorem only applies to extended non-negative measurable and bounded measurable functions. We **don't** know if $f$ satisfies either conditions.

Could you elaborate on how the construction of $\widetilde{\phi}$ makes sense? Thank you so much.

---

I posted [this question](https://math.stackexchange.com/questions/4579945/how-does-the-use-of-disintegration-theorem-make-sense-here) on MSE, but have not received any answer so far. So I post it here.