How to construct a measurable map $\psi'$ such that $\psi' = \psi$ $\nu$-a.e.? 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)$ and $\nu \in \mathcal P(Y)$. Let $\gamma \in \Pi(\mu, \nu)$, i.e., $\gamma \in \mathcal P(X \times Y)$ whose marginal on $X$ is $\mu$ and that on $Y$ is $\nu$.
Let $c:X \times Y \to \mathbb R$ and $\varphi:X \to \mathbb R \cup\{-\infty\}$ be measurable. Let $\psi:Y \to \mathbb R \cup\{-\infty\}$ which is not necessarily measurable. We assume $\varphi (x) + \psi (y) = c(x, y)$ for $\gamma$-a.e. $(x, y) \in X \times Y$. This implies there is a $\sigma$-compact subset $S$ of $X \times Y$ such that

*

*$\gamma (S) = 1$,

*$\varphi (x), \psi(y) \neq -\infty$, and

*$\varphi (x) + \psi (y) = c(x, y)$ for all $(x, y) \in S$.

My goal is to construct a map $\psi': Y \to \mathbb R \cup\{-\infty\}$ such that

*

*$\psi' (y) = \psi (y)$ for $\nu$-a.e. $y\in Y$, and

*$\psi'$ is measurable.

My attempt: The map
$$
f: X \times Y \to \mathbb R \cup \{-\infty\} : c(x, y) - \varphi (x)
$$
is measurable. Let $S_1, S_2$ be the projections of $S$ into $X,Y$ respectively, then $S_1, S_2$ are measurable and $\mu(S_1) = \nu(S_2) = 1$. For each $y \in S_2$, we pick some $x_y \in S_1$ and define
$$
\psi' (y) =
\begin{cases}
&f(x_y, y) &&\text{if } y \in S_2 \\
&0 &&\text{otherwise}.
\end{cases}
$$
Then $\psi' = \psi$ $\nu$-a.e. but I'm not sure "my pick" assures that $\psi'$ is measurable.

Could you elaborate on a valid construction of $\psi'$?

 A: I will prove the following weaker result.
Theorem:
Let $X,Y$ be Polish spaces and $\gamma\in\mathcal P(X\times Y)$.
Let $\varphi:X\rightarrow\mathbb R\cup\{-\infty\}$ be measurable, let $c:X\times Y\rightarrow\mathbb R$ be measurable, let $\psi:Y\rightarrow\mathbb R\cup\{-\infty\}$ be a map, and let $S\subseteq X\times Y$ be open and such that $\gamma(S)=1$, $c(x,y)=\varphi(x)+\psi(y)$ for $(x,y)\in S$. Then there exists a measurable set $S^*\subseteq S$ such that $\gamma(S^*)=1$, such that $S^*_2=\{y:(x,y)\in S^*\}\subseteq Y$ is measurable and the map $\psi':Y\rightarrow\mathbb R$, $y\mapsto\unicode{120793}\{y\in S^*_2\}\psi(y)$, is measurable.
In particular, for $(x,y)\in S^*$ we have $c(x,y)=\varphi(x)+\psi'(y)$.
We start the proof with the following base case.
Proposition: Let $X,Y$ be measurable spaces and equip $X\times Y$ with the product $\sigma$-algebra and a probability measure $\gamma$. Let $\varphi:X\rightarrow\mathbb R\cup\{-\infty\}$ be measurable, let $\psi:Y\rightarrow\mathbb R\cup\{-\infty\}$, let $c:X\times Y\rightarrow\mathbb R$ be measurable and let $S\subseteq X\times Y$ be such that $c(x,y)=\varphi(x)+\psi(y)$ for $(x,y)\in S$, and there exist measurable $U_i\subseteq X$, $V_i\subseteq Y$, $i\in\mathbb N$, such that $S=\bigcup_i(U_i\times V_i)$. Then the map $\psi':Y\rightarrow\mathbb R$ given by $\psi'(y)=\psi(y)$ for $y\in\bigcup_iV_i$ and $\psi'(y)=0$ otherwise is measurable.
Proof:
Assume without loss of generality that for all $i$ either both $U_i,V_i=\emptyset$ are trivial or both $U_i,V_i\neq\emptyset$ are not.
Let $S_1=\{x:(x,y)\in S\}$ and notice that $S_1=\bigcup_iU_i$ is measurable.
Let $S_2=\{y:(x,y)\in S\}$ and notice that $S_2=\bigcup_iV_i$ is measurable.
For $x\in S_1$ there exists $i$ and $y$ with $(x,y)\in U_i\times V_i\subseteq S$, so $\varphi(x)+\psi(y)=c(x,y)>-\infty$ and hence $\varphi(x)>-\infty$. Similarly, we have $\psi(y)>-\infty$ for $y\in S_2$.
This shows that $\psi'$ is well-defined since $\psi(y)>-\infty$ for $y\in S_2$. For an event $\mathcal E\subseteq\mathbb R$ let $\psi'^{-1}(\mathcal E)=\mathcal Y_0\cup\mathcal Y_1$ with $\mathcal Y_0=\psi'^{-1}(\mathcal E)\cap(Y\setminus S_2)$ and $\mathcal Y_1=\psi'^{-1}(\mathcal E)\cap S_2$. Notice that $\mathcal Y_0=\emptyset$ if $0\not\in\mathcal E$ and $\mathcal Y_0=Y\setminus S_2$ otherwise, so $\mathcal Y_0$ is measurable. Further, let $\mathcal Y_1=\bigcup_i\mathcal Y_1(i)$ with $\mathcal Y_1(i)=\psi'^{-1}(\mathcal E)\cap V_i$.
Let $f:X\times Y\rightarrow\mathbb R$ be given by $f(x,y)=c(x,y)-\varphi(x)$ for $(x,y)\in S$ and $f(x,y)=0$ otherwise. Then $f$ is measurable and we further have $f^{-1}(\mathcal E)\cap(U_i\times V_i)=U_i\times\mathcal Y_1(i)$, but since this box is measurable, so are the sections $U_i$ and $\mathcal Y_1(i)$. This shows that the countable union $\mathcal Y_1$ is measurable and thereby the union $\psi'^{-1}(\mathcal E)$ is measurable. This shows that $\psi'$ is measurable.
Next, I'll briefly summarize a few properties of $\sigma$-compact spaces.
Fact: Let $K$ be $\sigma$-compact. Then there exists an increasing sequence $(K_n)_n$ with $\lim_{n\rightarrow\infty}K_n=K$.
Further, every cover of $K$ with open sets admits a countable subcover.
Proof: By definition we have $K=\bigcup_nK'_n$ for countably many compact sets $K'_n$. But then we have $K=\bigcup_nK_n$ for the compact sets $K_n=\bigcup_{i=1}^nK'_i$, which is increasing. Let $K=\bigcup_iU_i$ over $i\in\mathcal I$ with $U_i$ open, and for $n\in\mathbb Z_{>0}$ let $\mathcal I_n\subseteq\mathcal I$ be such that $|\mathcal I_n|<\infty$ and $K_n\subseteq\bigcup_{i}U_i$ over $i\in\mathcal I_n$, using that $K_n$ is compact. This shows that there exists a countable subcover of $K=\bigcup_n\bigcup_{i\in\mathcal I_n}U_i$.
Proof of the theorem:
Using that $S$ is open, that $X,Y$ are Polish and that $\gamma(S)=1$ we obtain a $\sigma$-compact subset $K$ of $S$ with $A=\pi^X(K)$, $B=\pi^Y(K)$ being $\sigma$-compact, where $\pi^X(x,y)=x$, $\pi^Y(x,y)=y$, and $\gamma(K)=\mu(A)=\nu(B)=1$, from the theorem here. Using the sup metric on $X\times Y$ for given metrics on $X,Y$, we can write the open set $S=\bigcup_{z\in S}(U_{z}\times V_z)$ as a union of (open) boxes.
Using the fact, we obtain a countable subcover $S^*=\bigcup_i(U_i\times V_i)$ of $K\subseteq S^*$. But now, the proposition applies to $S^*$ since $S^*\subseteq S$, so $c(x,y)=\varphi(x)+\psi(y)$ for $(x,y)\in S^*$, and $\gamma(S^*)\ge\gamma(K)=1$. This yields the desired map $\psi'$.
