I've been casually reading about optimal transport, and I was intrigued by the Wasserstein metric, in which we define the distance between two measures $\mu$ and $\nu$ on a metric space $X$ by
$$
W\_p(\mu, \nu) = \left(\inf\_\gamma \int\_{X\times X} \mathrm{dist}(x,y)^p \mathrm{d}\gamma(x,y)\right)^{1/p},
$$
where the infimum is taken over all measures $\gamma$ on $X\times X$ whose projections onto the respective factors give $\mu$ and $\nu$.


It occurred to me that this appears to provide a framework to generalize the notion of functions altogether. In particular, for a measure space $X,\mu$, we could define a generalized function from $X$ to $Y$ as a measure $\gamma$ on $X\times Y$ such that $\pi\_\* \gamma = \mu$, where $\pi:X\times Y\rightarrow X$ is the projection to the first factor.


We can then try to define all the usual operations on functions in this new framework. For instance, for generalized funcitons $\gamma\_1$ from $X$ to $Y$ and $\gamma\_2$ from $Y$ to $Z$, we could try to define $\gamma\_2\circ \gamma\_1$ by
$$
\gamma\_2\circ \gamma\_1 (A\times C) = \sum\_{y\in Y}\gamma\_1(A\times \{y\})\gamma\_2(\{y\}\times C).$$
Of course, this only works if $Y$ is finite (or countable). I believe there should be a generalization of this to arbitrary $Y$ using integrals, but I am having trouble coming up with a good formulation. [Apparently you can use Markov chains](https://mathoverflow.net/questions/351214/composition-of-couplings-as-a-pullback-construction), but I am still trying to understand how to write this down cleanly.


In any case, I am interested in whether this notion provides a useful way to generalize functions. How much of the usual theory carries over? Could this be used e.g. to study weak solutions to PDEs, to study the monodromy of solutions to algebraic equations, or to study backwards iteration in otherwise non-invertible dynamical systems?



Couplings as generalized functions
Since you refer to transportation metrics, it seems to be fair to assume that your probability spaces are Lebesgue (=standard). Then it is the same to talk either about "lifting" your measure $\mu$ to $\gamma$ or about the **family of the conditional measures** of the projection $\gamma\to\mu$ (or, which is also the same, about the corresponding **Markov kernel**). Ordinary functions from $X$ to $Y$ correspond then to the situation when all transition measures are delta-measures.


This construction is known as **mutivalued maps with invariant measure** or **polymorphisms** (the term introduced by [Vershik](https://mathscinet.ams.org/mathscinet-getitem?mr=2166671), also see [Schmidt - Vershik](https://mathscinet.ams.org/mathscinet-getitem?mr=2408396) or [Neretin](https://mathscinet.ams.org/mathscinet-getitem?mr=1944085)).


