Solution (source code)

= Solution

The <Kantorovich–Rubinstein theorem> concerns a <Polish space> $(X,\rho)$ and <probability measures> $\mu,\nu$ with finite first <moments>, meaning $\int\rho(x,x_0)\,d\mu(x)+\int\rho(x,x_0)\,d\nu(x)<\infty$ for one, hence every, $x_0\in X$. It states
$$
\boxed{W_1(\mu,\nu)=\inf_{\pi\in\Pi(\mu,\nu)}\int\rho(x,y)\,d\pi
=\sup_{\operatorname{Lip}(f)\leq1}\left\{\int f\,d\mu-\int f\,d\nu\right\}.}
$$
Here $\operatorname{Lip}(f)\leq1$ means $|f(x)-f(y)|\leq\rho(x,y)$ for every $x,y$. The <Wasserstein distance> with ground cost $\rho$ therefore equals a supremum over functions with <Lipschitz constant> at most one. One may normalize $f(x_0)=0$, since adding a constant does not change the difference of integrals. This normalization bounds $|f(x)|$ by $\rho(x,x_0)$, so finite first <moments> ensure integrability. The supremum is unchanged if an absolute value is placed around the difference, because $-f$ is admissible whenever $f$ is.