# Density of subalgebras of Lipschitz functions
in metric Sobolev spaces and
applications to Wasserstein Sobolev spaces

Massimo Fornasier  Massimo Fornasier: TUM Fakultät für Mathematik,
Boltzmannstrasse 3, 85748 Garching bei München (Germany)
<EMAIL_ADDRESS>,  Giuseppe Savaré  Giuseppe Savaré: Bocconi
University, Department of Decision Sciences and BIDSA, Via Roentgen 1, 20136
Milano (Italy<EMAIL_ADDRESS>and  Giacomo Enrico Sodini
Giacomo Enrico Sodini: TUM Fakultät für Mathematik, Boltzmannstrasse 3, 85748
Garching bei München (Germany<EMAIL_ADDRESS>
###### Abstract.

We prove a general criterion for the density in energy of suitable subalgebras
of Lipschitz functions in the metric-Sobolev space $H^{1,p}(X,{\sf
d},\mathfrak{m})$ associated with a positive and finite Borel measure
$\mathfrak{m}$ in a separable and complete metric space $(X,{\sf d})$.

We then provide a relevant application to the case of the algebra of cylinder
functions in the Wasserstein Sobolev space
$H^{1,2}(\mathcal{P}_{2}(\mathbb{M}),W_{2},\mathfrak{m})$ arising from a
positive and finite Borel measure $\mathfrak{m}$ on the Kantorovich-
Rubinstein-Wasserstein space $(\mathcal{P}_{2}(\mathbb{M}),W_{2})$ of
probability measures in a finite dimensional Euclidean space, a complete
Riemannian manifold, or a separable Hilbert space $\mathbb{M}$. We will show
that such a Sobolev space is always Hilbertian, independently of the choice of
the reference measure $\mathfrak{m}$ so that the resulting Cheeger energy is a
Dirichlet form.

We will eventually provide an explicit characterization for the corresponding
notion of $\mathfrak{m}$-Wasserstein gradient, showing useful calculus rules
and its consistency with the tangent bundle and the $\Gamma$-calculus
inherited from the Dirichlet form.

###### Key words and phrases:

Metric Sobolev spaces, Dirichlet forms, Cheeger energy, Kantorovich-
Wasserstein distance, Optimal transport, Moreau-Yosida regularization

###### 1991 Mathematics Subject Classification:

Primary: 46E36, 31C25 ; Secondary: 49Q20, 28A33, 35F21, 58J65

###### Contents

  1. 1 Introduction
  2. 2 Metric Sobolev spaces and density of unital algebras
    1. 2.1 Sobolev functions and minimal relaxed gradients
    2. 2.2 A density result
    3. 2.3 Applications
    4. 2.4 Intrinsic distances
  3. 3 Wasserstein spaces
    1. 3.1 Kantorovich duality and estimates for Kantorovich potentials
  4. 4 The Wasserstein Sobolev space $H^{1,2}(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2},\mathfrak{m})$
    1. 4.1 The algebra of ${\mathrm{C}}^{1}$-cylinder functions
    2. 4.2 The density result
  5. 5 Calculus rules
    1. 5.1 Tangent bundle, residual differentials and relaxation
    2. 5.2 Examples
  6. 6 Extensions to Riemannian manifolds and Hilbert spaces
    1. 6.1 Intrinsic Wasserstein spaces on closed subsets of $\mathbb{R}^{d}$
    2. 6.2 Wasserstein Sobolev space on complete Riemannian manifolds
    3. 6.3 Wasserstein Sobolev space on Hilbert spaces

##  1\. Introduction

The theory of Sobolev spaces associated to a metric measure space $(X,{\sf
d},\mathfrak{m})$ has been much developed in recent years. One of the most
important approaches (we refer to the monographs [11, 27] and to the lecture
notes [25, 42]) is based on the notion of upper gradient [26, 28] of a map
$f:X\to\mathbb{R}$: it is a Borel map $g:X\to[0,+\infty]$ satisfying

$|f(\gamma(b))-f(\gamma(a))|\leq\int_{\gamma}g$ (1.1)

along every ${\sf d}$-Lipschitz (or even rectifiable) curve $\gamma:[a,b]\to
X$. The Dirichlet space $D^{1,p}(X,{\sf d},\mathfrak{m})$, $p\in(1,+\infty)$
can then be defined as the class of measurable functions $f:X\to\mathbb{R}$
that possess a $p$-integrable upper gradient, thus resulting in a finite
Newtonian energy

$\mathsf{N\kern-2.5ptE}_{p}(f):=\inf\Big{\\{}\int_{X}g^{p}\,{\mathrm{d}}\mathfrak{m}:\text{$g$
is an upper gradient of $f$}\Big{\\}}.$ (1.2)

A crucial and nontrivial fact is that $\mathsf{N\kern-2.5ptE}_{p}$ admits a
local representation

$\mathsf{N\kern-2.5ptE}_{p}(f)=\int_{X}|{\mathrm{D}}f|_{N}^{p}\,{\mathrm{d}}\mathfrak{m}$
(1.3)

in terms of the _minimal $p$-weak upper gradient_ $|{\mathrm{D}}f|_{N}^{p}$ of
$f$, which can be characterized in terms of the upper gradient property (1.1)
along $\mathrm{\operatorname{Mod}}_{p}$-a.e. curve and enjoys many nice
metric-nonsmooth calculus rules. When $f$ is Lipschitz, then the pointwise and
asymptotic Lipschitz constants

$|{\mathrm{D}}f|(x):=\limsup_{y\to x}\frac{|f(y)-f(x)|}{{\sf
d}(x,y)},\quad\mathop{\rm lip}\nolimits f(x):=\limsup_{y,z\to x,\ y\neq
z}\frac{|f(y)-f(z)|}{{\sf d}(y,z)}$ (1.4)

are upper gradients, so that

$\text{if $f\in\mathop{\rm Lip}\nolimits_{b}(X)$
then}\quad|{\mathrm{D}}f|_{N}\leq|{\mathrm{D}}f|\leq\mathop{\rm lip}\nolimits
f\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in $X$}.$ (1.5)

Functions in $L^{p}(X,\mathfrak{m})$ which admit a good representative (in the
usual Lebesgue class defined up to $\mathfrak{m}$-negligible sets) in
$D^{1,p}(X,{\sf d},\mathfrak{m})$ give raise to the Newtonian spaces
$\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$ [43] [11, Def. 1.19], which is a
Banach space with the norm
$\|f\|_{\hat{N}^{1,p}}:=\big{(}\|f\|_{L^{p}}^{p}+\mathsf{N\kern-2.5ptE}_{p}(f)\big{)}^{1/p}$.
$\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$ can also be identified with the domain
of the $L^{p}$-relaxation of $\mathsf{N\kern-2.5ptE}_{p}$ [14].

##### Density of Lipschitz functions: the case of doubling spaces supporting a
Poincaré inequality

It is a natural question if $\mathsf{N\kern-2.5ptE}_{p}$ can be recovered
starting from the distinguished class of upper gradients given by the
pointwise or asymptotic Lipschitz constants (1.4) of Lipschitz functions. When
$(X,{\sf d},\mathfrak{m})$ satisfies a doubling condition and supports a
$p$-Poincaré inequality, then Lipschitz functions are dense in
$\hat{N}^{1,p}(X{\sf d},\mathfrak{m})$ [43, Theorem 4.1] and for Lipschitz
functions the minimal $p$-weak upper gradient $|{\mathrm{D}}f|_{N}$ coincides
with the pointwise Lipschitz constant $|{\mathrm{D}}f|$ [14, Theorem 6.1]. In
particular for every $f\in\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$ there exists
a sequence $f_{n}\in\mathop{\rm Lip}\nolimits_{b}(X)$ such that

$f_{n}\to f,\quad|{\mathrm{D}}f_{n}|\to|{\mathrm{D}}f|_{N}\quad\text{strongly
in }L^{p}(X,\mathfrak{m}).$ (1.6)

It is worth noticing that in this case $\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$
is a reflexive space [14, Theorem 4.48].

##### Density in energy of subalgebras of Lipschitz functions

The strong approximation property (1.6) holds in fact for arbitrary complete
and separable metric spaces, a result obtained in [6] (when $p=2$) and [5],
where also the approximation by the asymptotic Lipschitz constant is
considered.

The first aim of the present paper is to discuss the extension of this result
when the sequence $f_{n}$ in (1.6) is chosen in a suitable unital subalgebra
$\mathscr{A}\subset\mathop{\rm Lip}\nolimits_{b}(X)$ separating the points of
$X$, i.e.

$1\in\mathscr{A},\quad\text{for every $x_{0},x_{1}\in X$ there exists
$f\in\mathscr{A}$:\quad$f(x_{0})\neq f(x_{1})$}.$ (1.7)

The use of a subalgebra is not a formal exercise with no implications. In
fact, in relevant examples such as Wasserstein Sobolev spaces, which we shall
introduce and discuss below, and the related subalgebra of cylinder functions,
it is possible to recover the Cheeger energy as suitable relaxation of an
explicitly computable Dirichlet form. Namely, from the so-called pre-Cheeger
energy

$\mathsf{pC\kern-1.0ptE}_{p}(f):=\int_{X}(\mathop{\rm lip}\nolimits
f)^{p}\,{\mathrm{d}}\mathfrak{m},\quad f\in\mathop{\rm Lip}\nolimits_{b}(X),$
(1.8)

we recover the Cheeger energy as its relaxation starting from $\mathscr{A}$:

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\inf\left\\{\liminf_{n\to+\infty}\mathsf{pC\kern-1.0ptE}_{p}(f_{n}):f_{n}\in\mathscr{A},\,f_{n}\to
f\text{ in }L^{0}(X,\mathfrak{m})\right\\}.$ (1.9)

Thanks to the algebraic properties of $\mathscr{A}$ and (1.7) it is possible
to prove [42, Sec. 3] that $\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}$ admits a
local representation of the form

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\int_{X}|{\mathrm{D}}f|_{\star,\mathscr{A}}^{p}(x)\,{\mathrm{d}}\mathfrak{m}(x)\quad\text{whenever
}\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)<+\infty,$ (1.10)

in terms of a minimal $(p,\mathscr{A})$-relaxed gradient
$|{\mathrm{D}}f|_{\star,\mathscr{A}}$, enjoying the same calculus rules as
$|{\mathrm{D}}f|_{N}$, see Theorem 2.2 below. We denote by $H^{1,p}(X,{\sf
d},\mathfrak{m};\mathscr{A})$ the class of functions in
$L^{p}(X,\mathfrak{m})$ with finite $(p,\mathscr{A})$-Cheeger energy.

It is easy to check that $H^{1,p}(X,{\sf
d},\mathfrak{m};\mathscr{A})\subset\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$ with
$|{\mathrm{D}}f|_{N}\leq|{\mathrm{D}}f|_{\star,\mathscr{A}}$
$\mathfrak{m}$-a.e. It turns out that the strong approximation property

$\text{for every }f\in\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})\ \text{there exist
}f_{n}\in\mathscr{A}:\ \ f_{n}\to f,\ \mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{N}\text{ in }L^{p}(X,\mathfrak{m})$ (1.11)

is equivalent to the identification

$H^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})=\hat{N}^{1,p}(X,{\sf
d},\mathfrak{m}),\quad|{\mathrm{D}}f|_{N}=|{\mathrm{D}}f|_{\star,\mathscr{A}}\quad\text{for
every }f\in\hat{N}^{1,p}(X,{\sf d},\mathfrak{m}).$ (1.12)

The density results of [6, 5] show that (1.12) always hold if
$\mathscr{A}=\mathop{\rm Lip}\nolimits_{b}(X)$. When $\mathscr{A}$ is a proper
subalgebra of $\mathop{\rm Lip}\nolimits_{b}(X)$, a first sufficient condition
for the validity of (1.12), in the more general framework of extended
topological metric measure spaces, is provided by the compatibility condition
between ${\sf d}$ and $\mathscr{A}$ [42, Theorems 3.2.7, 5.3.1]

${\sf d}(x,y)=\sup\Big{\\{}f(x)-f(y):f\in\mathscr{A},\ \mathop{\rm
Lip}\nolimits(f,X)\leq 1\Big{\\}}.$ (1.13)

We are able to improve (1.13) and to show (Theorem 2.12) that a necessary and
sufficient condition for (1.12) is that for every $y\in X$ (or in a dense
subset of $X$) the distance function ${\sf d}_{y}:x\mapsto{\sf d}(x,y)$
satisfies

$|{\mathrm{D}}{\sf d}_{y}|_{\star,\mathscr{A}}(x)\leq 1\quad\text{for
$\mathfrak{m}$-a.e.\leavevmode\nobreak\ $x\in X$}.$ (1.14)

As mentioned above, the density of distinguished subalgebras of Lipschitz
functions can provide valuable information on the structure of the metric-
Sobolev space $\hat{N}^{1,p}(X,{\sf d},\mathfrak{m})$, in particular when the
asymptotic Lipschitz constant $\mathop{\rm lip}\nolimits f$ exhibits a more
regular behaviour when restricted to $\mathscr{A}$. A relevant example arises
when an algebra $\mathscr{A}$ exists for which the pre-Cheeger energy (1.8) is
induced by a bilinear form and one wants to study its closure as it is typical
in the theory of Dirichlet forms. In this case our result shows that this
construction is intrinsically linked to the metric structure, so that it is
independent of the particular choice of $\mathscr{A}$ and it is invariant with
respect to measure-preserving isometries. As a byproduct, we will recover in a
simple way previous Hilbertianity results of [20, 29, 42].

##### The Wasserstein Sobolev space

An important application, which has been one of the inspiring motivations of
our investigation, concerns functional analysis over spaces of probability
measures. In fact, smooth functions do appear recently as solutions of new
types of partial differential equations over spaces of probability measures
defined by diverse forms of differentiation, namely nonlinear transport
equations [2, 3] for describing population evolutionary games, Kolmogorov
equations [32, 33] in nonlinear filtering, and Hamilton-Jacobi-Bellman
equations [10, 22, 37, 13] as appearing, e.g., in the theory of mean-field
games and mean-field optimal control. In some of these instances, the
solutions are considered in classical sense, because of the lack of weak
formulations and variational descriptions. Moreover, while the expression of
these equations is in most cases of foundational interest, their relevance in
terms of providing insights about solutions and their explicit computation
remained so far rather unclear. Hence, a proper definition of function spaces
of regular functions, rules of calculus, and density properties are
fundamental for developing a more systematic framework for the analysis of
such novel forms of infinite dimensional PDEs and explaining their practical
use and impact.

Moreover, thanks to significant advances in computational optimal transport
that made its numerical realization feasible also for problems of relatively
high dimension, in the past decade there has been an increasing and more
accepted adoption of probability measures to model data points in image and
shape processing and other machine learning applications. While the first
applications were about discriminating data encoded as distributions available
in the form of bags-of-features or descriptors, more recent developments
explored geometric interpolation of data provided by optimal transport, for
instance in the form of Wasserstein barycenters. In the meanwhile the
literature on the subject has grown significantly to be really able to offer a
complete account and we may more simply refer to the recent survey [36] for
insights and references.

Building upon these advances, approximating or interpolating efficiently
functions over data points modeled as (probability) measures can also provide
a novel framework for machine learning tasks, such as classification and
regression. Also for such developments a proper foundation of functional
analysis is necessary.

These are relevant motivations for us to focus on the study of Sobolev spaces
generated by a finite measure $\mathfrak{m}$ on the Wasserstein space
$\mathcal{P}_{2}(\mathbb{M})$ of Borel probability measures in a complete
Riemannian manifold $(\mathbb{M},{\sf d}_{\mathbb{M}})$ with finite quadratic
moment

$\int_{\mathbb{M}}{\sf
d}^{2}(x,x_{o})\,{\mathrm{d}}\mu(x)<+\infty\quad\text{for some, and thus any,
$x_{o}\in\mathbb{M}$},$ (1.15)

endowed with the $L^{2}$-Kantorovich-Rubinstein-Wasserstein distance $W_{2}$

$W_{2,{\sf
d}_{\mathbb{M}}}^{2}(\mu,\nu):=\min\left\\{\int_{\mathbb{M}\times\mathbb{M}}{\sf
d}^{2}_{\mathbb{M}}(x,y)\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}(x,y)\mid{\mbox{\boldmath$\mu$}}\in\Gamma(\mu,\nu)\right\\};$
(1.16)

here $\Gamma(\mu,\nu)$ is the set of couplings between $\mu$ and $\nu$, i.e.
probability measures $\mu$ in $\mathbb{M}\times\mathbb{M}$ whose marginals are
$\mu$ and $\nu$.

The space of probability measures $(\mathcal{P}_{2}(\mathbb{M}),W_{2,{\sf
d}_{\mathbb{M}}})$ may be considered a model class for the above mentioned
applications and it is an example of complete and separable metric space,
which exhibits a non-smooth, infinite dimensional pseudo-Riemannian character
[35, 4, 47]. In particular, it is not isometric to a finite dimensional
Riemannian manifold or a $\mathrm{Cat}(\kappa)$ space [19]; when $\mathbb{M}$
has nonnegative sectional curvature as in the case of the Euclidean space
$\mathbb{R}^{d}$, then $(\mathcal{P}_{2}(\mathbb{M}),W_{2,{\sf
d}_{\mathbb{M}}})$ has nonnegative curvature in the sense of Aleksandrov [47];
for a general Riemannian manifold $\mathbb{M}$,
$(\mathcal{P}_{2}(\mathbb{M}),W_{2,{\sf d}_{\mathbb{M}}})$ is not an
Aleksandrov space and lacks of any lower or upper curvature bound.

When $\mathbb{M}$ is compact, Sobolev spaces on
$(\mathcal{P}_{2}(\mathbb{M}),W_{2})$ have been constructed in [16] starting
from measures $\mathfrak{m}$ which have full support and satisfy an
integration-by-parts formula (see Section 5.2 below) on the unital algebra of
cylinder maps
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$,
generated by linear functionals of the form

$\mathsf{L}_{\phi}:\mu\mapsto\int_{\mathbb{M}}\phi\,{\mathrm{d}}\mu,\quad\phi\in{\mathrm{C}}^{\infty}_{c}(\mathbb{M}).$
(1.17)

It turns out that the restriction of the pre-Cheeger energy
$\mathsf{pC\kern-1.0ptE}_{2}$ (1.8) to
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$
is induced by a bilinear form so that one can study the Dirichlet form arising
by its closure.

Our main result is that for every separable and complete Riemannian manifold
$\mathbb{M}$ and for every

positive and finite Borel measure $\mathfrak{m}$ on
$\mathcal{P}_{2}(\mathbb{M})$ (so, full support and integration-by-parts
properties are not required) the algebra
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$
satisfies property (1.14) and therefore it is dense in the metric Sobolev
space $H^{1,2}(\mathcal{P}_{2}(\mathbb{M}),W_{2,{\sf
d}_{\mathbb{M}}},\mathfrak{m})$, which is therefore a Hilbert space. Due to
the non-smooth character of $W_{2}$ such a Hilbertianity property was far from
obvious even in the flat case $\mathbb{M}=\mathbb{R}^{d}$. We will also show
that this result holds when $\mathbb{M}$ is an infinite-dimensional,
separable, Hilbert space.

Our metric analysis is also supplemented with a detailed discussion of the
structure of the Cheeger energy and of the minimal relaxed gradient, in the
case when $\mathbb{M}$ is the Euclidean space $\mathbb{R}^{d}$. Introducing
the measure
$\displaystyle\boldsymbol{\mathfrak{m}}=\int\big{(}\delta_{\mu}\otimes\mu\big{)}\,{\mathrm{d}}\mathfrak{m}(\mu)$
in $\mathcal{P}\big{(}\mathcal{P}_{2}(\mathbb{R}^{d})\times\mathbb{R}^{d})$,
we will show that there is a linear continuous Wasserstein-gradient operator
${\mathrm{D}}_{\mathfrak{m}}:H^{1,2}(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2},\mathfrak{m})\to
L^{2}(\mathcal{P}_{2}(\mathbb{R}^{d})\times\mathbb{R}^{d},\boldsymbol{\mathfrak{m}};\mathbb{R}^{d})$
representing the bilinear form associated to the Cheeger energy as

$\mathsf{C\kern-1.0ptE}_{2}(F,G)=\int{\mathrm{D}}_{\mathfrak{m}}F(\mu,x)\cdot{\mathrm{D}}_{\mathfrak{m}}G(\mu,x)\,{\mathrm{d}}\boldsymbol{\mathfrak{m}}(\mu,x),$
(1.18)

and satisfying useful calculus rules which are typical of $\Gamma$-calculus
for Dirichlet form. ${\mathrm{D}}_{\mathfrak{m}}$ also allows for an explicit
characterization of the tangent bundle
$L^{2}\big{(}{\mathrm{T}}\mathcal{P}_{2}(\mathbb{R}^{d})\big{)}$ in the sense
of Gigli [24, 25].

We are also able to study the relaxation effect occurring in the construction
of the Cheeger energy starting from (1.8). We claim that our results are
sufficiently strong and provide useful tools to pave the way for further
studies on the structure and the promising applications of Wasserstein Sobolev
spaces. In particular, the techniques developed in the present paper can also
be applied to study the general class of Wasserstein Sobolev spaces
$H^{1,q}(\mathcal{P}_{p}(\mathbb{M}),W_{p},\mathfrak{m})$, with
$p,q\in(1,+\infty)$, a topic that will be addressed in the forthcoming paper
[44].

Moreover, as a direct consequence of our results, the recovery of the Cheeger
energy in terms of relaxation of the explicitly computable pre-Cheeger energy
$\mathsf{pC\kern-1.0ptE}_{2}$ (1.8) on
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$
does allow the equally explicit formulation of Euler-Lagrange equations of
properly formulated variational problems defined on
$H^{1,2}(\mathcal{P}_{2}(\mathbb{M}),W_{2,{\sf
d}_{\mathbb{M}}},\mathfrak{m})$, which can be solved numerically over finite
dimensional suitably graduated approximations of
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$,
as a sort of (nonlinear) Galerkin approximation. Hence, as a concluding
remark, perhaps surprisingly, the use of the subalgebra of cylindric functions
$\operatorname{FC}^{\infty}_{c}\\!\\!\left(\mathcal{P}_{2}(\mathbb{M})\right)$
instead of $\mathop{\rm
Lip}\nolimits_{b}\big{(}\mathcal{P}_{2}(\mathbb{M})\big{)}$ as a fundamental
nucleus to define Wasserstein Sobolev spaces allows to bring the theory from
its foundational level to rather concrete applicability. In particular, we
have in mind the above mentioned applications to the solutions of PDEs over
$\mathcal{P}_{2}(\mathbb{M})$ and machine learning.

##### Plan of the paper

After a quick review of the construction of the Cheeger energy starting from a
subalgebra $\mathscr{A}$, Section 2 is devoted to prove our main density
result under condition (1.14) (Section 2.2). The last part 2.4 extends the
applicability of the results to a larger class of distances: one of its quite
useful applications will concern the extension of the results for the
Wasserstein Sobolev spaces modeled on $\mathcal{P}_{2}(\mathbb{R}^{d})$ to the
general case of $\mathcal{P}_{2}(\mathbb{M})$ for a complete Riemannian
manifold $\mathbb{M}$, which will be carried out in Sections 6.1 and 6.2.

We will recap a few properties of the Wasserstein distance in Section 3.
Section 4 contains a collection of some properties of cylinder functions, of
their asymptotic Lipschitz constants (Section 4.1), and our main density and
Hilbertianity result for the Wasserstein Sobolev space
$H^{1,2}(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2},\mathfrak{m})$ (Theorem 4.10).

Calculus rules for the $\mathfrak{m}$-differential are presented in Section 5;
the structure of the tangent bundle, the properties of the residual
differentials, and the study of the relaxation effect are discussed in Section
5.1, together with a few examples in Section 5.2.

The last Section 6 shows how to extend the result of Section 4 from
$\mathbb{R}^{d}$ to an arbitrary complete Riemannian manifold $\mathbb{M}$ and
to a separable Hilbert space $\mathbb{H}$.

##### Acknowledgments

The authors warmly thank N. Gigli, E. Pasqualetto, G. Peyré for their comments
and L. Dello Schiavo for the careful reading and his valuable remarks on a
first draft of the present paper.

The authors gratefully acknowledge the support of the Institute for Advanced
Study of the Technical University of Munich, funded by the German Excellence
Initiative.
G.S. has also been supported by IMATI-CNR, Pavia and by the MIUR-PRIN 2017
project _Gradient flows, Optimal Transport and Metric Measure Structures._

##  2\. Metric Sobolev spaces and density of unital algebras

In this section we will briefly recap the construction of metric Sobolev
spaces adapting the relaxation viewpoint of the Cheeger energy to the presence
of a distinguished algebra of Lipschitz functions [6, 5, 42].

###  2.1. Sobolev functions and minimal relaxed gradients

Let $(X,\mathsf{d})$ be a complete and separable metric space. We will denote
by $\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$ the space of bounded and
Lipschitz real functions $f:X\to\mathbb{R}$. The asymptotic Lipschitz constant
of $f\in\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$ is defined as

$\mathop{\rm lip}\nolimits_{\sf d}f(x):=\lim_{r\downarrow 0}\mathop{\rm
Lip}\nolimits(f,{\mathrm{B}}(x,r),{\sf d})=\limsup_{y,z\to x,\ y\neq
z}\frac{|f(y)-f(z)|}{{\sf d}(y,z)},$ (2.1)

where ${\mathrm{B}}(x,r)$ denotes the open ball centered at $x$ with radius
$r$ and, for $A\subset X$, the quantity $\mathop{\rm Lip}\nolimits(f,A,{\sf
d})$ is defined as

$\mathop{\rm Lip}\nolimits(f,A,{\sf d}):=\sup_{x,y\in A,\,x\neq
y}\frac{|f(x)-f(y)|}{{\sf d}(x,y)}.$

We will simply write $\mathop{\rm Lip}_{b}\nolimits(X),\mathop{\rm
lip}\nolimits f,\mathop{\rm Lip}\nolimits(f,A)$, omitting to explicitly
mention ${\sf d}$, when the choice of the metric ${\sf d}$ is clear from the
context.

We will also deal with a unital algebra $\mathscr{A}\subset\mathop{\rm
Lip}\nolimits_{b}(X)$ separating the points of $X$, i.e.

$1\in\mathscr{A},\quad\text{for every $x_{0},x_{1}\in X$ there exists
$f\in\mathscr{A}$:\quad$f(x_{0})\neq f(x_{1})$}.$ (2.2)

The initial Hausdorff topology $\tau_{\mathscr{A}}$ induced on $X$ by
$\mathscr{A}$ is clearly coarser than the metric topology of $X$.

Let $\mathfrak{m}$ be a finite and positive and finite Borel measure on $X$
(being $X$ a Polish space, $\mathfrak{m}$ is also a Radon measure). We will
denote by ${\mathcal{L}}^{0}(X,\mathfrak{m})$ the set of
$\mathfrak{m}$-measurable real functions defined in $X$;
$L^{0}(X,\mathfrak{m})$ is the usual quotient of
${\mathcal{L}}^{0}(X,\mathfrak{m})$ obtained by identifying two functions
which coincide $\mathfrak{m}$-a.e. in $X$. In a similar way,
${\mathcal{L}}^{p}(X,\mathfrak{m})$ and $L^{p}(X,\mathfrak{m})$ are the usual
Lebesgue spaces of $p$-summable $\mathfrak{m}$-measurable (equivalence classes
of) real functions, $p\in[1,+\infty]$. It is worth noticing that by [42, Lemma
2.1.27] we have that

$\mathscr{A}\text{ is dense in }L^{p}(X,\mathfrak{m})\text{ for every
}p\in[1,\infty).$ (2.3)

We will endow $L^{0}(X,\mathfrak{m})$ with the topology of the convergence in
measure, which is induced by the metric

$\mathrm{d}_{L^{0}}(f_{1},f_{2}):=\int_{X}\vartheta(|f_{1}-f_{2}|)\,{\mathrm{d}}\mathfrak{m},\quad
f_{1},f_{2}\in L^{0}(X,\mathfrak{m}),\normalcolor$ (2.4)

where $\vartheta:[0,+\infty)\to[0,+\infty)$ is any increasing, concave,
bounded function with $\vartheta(0)=\lim_{r\downarrow 0}\vartheta(r)=0$. In
the following we fix an exponent $p\in(1,+\infty)$.

######  Definition 2.1 ($(p,\mathscr{A})$-relaxed gradient).

We say that $G\in L^{p}(X,\mathfrak{m})$ is a $(p,\mathscr{A})$-relaxed
gradient of a $\mathfrak{m}$-measurable function $f\in L^{0}(X,\mathfrak{m})$
if there exists a sequence $(f_{n})_{n\in\mathbb{N}}\in\mathscr{A}$ such that:

  1. (1)

$f_{n}\to f$ in $\mathfrak{m}$-measure and $\mathop{\rm lip}\nolimits
f_{n}\to\tilde{G}$ weakly in $L^{p}(X,\mathfrak{m})$;

  2. (2)

$\tilde{G}\leq G$ $\mathfrak{m}$-a.e. in $X$.

The minimal $(p,\mathscr{A})$-relaxed gradient of $f$ (denoted by
$|{\mathrm{D}}f|_{\star,\mathscr{A}}$) is the element of minimal $L^{p}$-norm
among all the $(p,\mathscr{A})$-relaxed gradient of $f$. We will just write
$|{\mathrm{D}}f|_{\star}$ if $\mathscr{A}=\mathop{\rm Lip}\nolimits_{b}(X)$.

We collect in the following Theorem the main properties of
$|{\mathrm{D}}f|_{\star,\mathscr{A}}$ we will extensively use.

######  Theorem 2.2.

  1. (1)

The set

$S:=\Big{\\{}(f,G)\in L^{0}(X,\mathfrak{m})\times
L^{p}(X,\mathfrak{m}):\text{$G$ is a $(p,\mathscr{A})$-relaxed gradient of
$f$}\Big{\\}}$

is convex and it is closed with respect to to the product topology of the
convergence in $\mathfrak{m}$-measure and the weak convergence in
$L^{p}(X,\mathfrak{m})$. In particular, the restriction $S_{q}:=S\cap
L^{q}(X,\mathfrak{m})\times L^{p}(X,\mathfrak{m})$ is weakly closed in
$L^{q}(X,\mathfrak{m})\times L^{p}(X,\mathfrak{m})$ for every
$q\in(1,+\infty)$.

  2. (2)

(Strong approximation) If $f\in L^{0}(X,\mathfrak{m})$ has a
$(p,\mathscr{A})$-relaxed gradient then $|{\mathrm{D}}f|_{\star,\mathscr{A}}$
is well defined. If $f$ takes values in a closed (possibly unbounded) interval
$I\subset\mathbb{R}$ then there exists a sequence $f_{n}\in\mathscr{A}$ with
values in $I$ such that

$f_{n}\to f\text{ $\mathfrak{m}$-a.e.\leavevmode\nobreak\ in
$X$},\quad\mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{\star,\mathscr{A}}\text{ strongly in
}L^{p}(X,\mathfrak{m}).$ (2.5)

If moreover $f\in L^{q}(X,\mathfrak{m})$ for some $q\in[1,+\infty)$ then we
can also find a sequence as in (2.5) converging strongly to $f$ in
$L^{q}(X,\mathfrak{m})$.

  3. (3)

(Pointwise minimality) If $G$ is a $(p,\mathscr{A})$-relaxed gradient of $f\in
L^{0}(X,\mathfrak{m})$ then $|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq G$
$\mathfrak{m}$-a.e. in $X$.

  4. (4)

(Leibniz rule) If $f,g\in L^{\infty}(X,\mathfrak{m})$ have
$(p,\mathscr{A})$-relaxed gradient, then $h:=fg$ has $(p,\mathscr{A})$-relaxed
gradient and

$|{\mathrm{D}}(fg)|_{\star,\mathscr{A}}\leq|f|\,|{\mathrm{D}}g|_{\star,\mathscr{A}}+|g|\,|{\mathrm{D}}f|_{\star,\mathscr{A}}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in }X.$ (2.6)

  5. (5)

(Sub-linearity) If $f,g\in L^{0}(X,\mathfrak{m})$ have
$(p,\mathscr{A})$-relaxed gradient then

$|{\mathrm{D}}(\alpha f+\beta
g)|_{\star,\mathscr{A}}\leq|\alpha|\,|{\mathrm{D}}f|_{\star,\mathscr{A}}+|\beta|\,|{\mathrm{D}}g|_{\star,\mathscr{A}}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in }X.$ (2.7)

  6. (6)

(Locality) If $f\in L^{0}(X,\mathfrak{m})$ has a $(p,\mathscr{A})$-relaxed
gradient, then for any $\mathscr{L}^{1}$-negligible Borel subset
$N\subset\mathbb{R}$ we have

$|{\mathrm{D}}f|_{\star,\mathscr{A}}=0\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
on $f^{-1}(N)$}.$ (2.8)

  7. (7)

(Chain rule) If $f\in L^{0}(X,\mathfrak{m})$ has a $(p,\mathscr{A})$-relaxed
gradient and $\phi\in\mathop{\rm Lip}\nolimits(\mathbb{R})$ then $\phi\circ f$
has $(p,\mathscr{A})$-relaxed gradient and

$|{\mathrm{D}}(\phi\circ
f)|_{\star,\mathscr{A}}\leq|\phi^{\prime}(f)|\,|{\mathrm{D}}f|_{\star,\mathscr{A}}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in }X,$ (2.9)

and equality holds in (2.9) if $\phi$ is monotone or ${\mathrm{C}}^{1}$.

  8. (8)

(Truncations) If $f_{j}\in L^{0}(X,\mathfrak{m})$ has
$(p,\mathscr{A})$-relaxed gradient, $j=1,\cdots,J$, then also the functions
$f_{+}:=\max(f_{1},\cdots,f_{J})$ and $f_{-}:=\min(f_{1},\cdots,f_{J})$ have
$(p,\mathscr{A})$-relaxed gradient and

$\displaystyle|{\mathrm{D}}f_{+}|_{\star,\mathscr{A}}=|{\mathrm{D}}f_{j}|_{\star,\mathscr{A}}$
$\displaystyle\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ on }\\{x\in
X:f_{+}=f_{j}\\},$ (2.10)
$\displaystyle|{\mathrm{D}}f_{-}|_{\star,\mathscr{A}}=|{\mathrm{D}}f_{j}|_{\star,\mathscr{A}}$
$\displaystyle\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ on }\\{x\in
X:f_{-}=f_{j}\\}.$ (2.11)

###### Proof.

We give a few references for the proofs. The case when $p=2$,
$\mathscr{A}=\mathop{\rm Lip}\nolimits_{b}(X)$ and the local slope of $f$ is
used to define relaxed gradients have been considered in [6, Sec. 4], whose
proof generalizes easily to the case $p\in(1,\infty)$ and the asymptotic
Lipschitz constant (2.1), see also [5].

The definition and the properties involving a general unital subalgebra
$\mathscr{A}$ have been discussed in [42, Sec. 3]: points (1,2) correspond to
Lemma 3.1.6 and Corollary 3.1.9, (3) has been stated in Lemma 3.1.11, (4)
refers to Corollary 3.1.10, (5,6,7,8) are proved in Theorem 3.1.12 and its
Corollary 3.1.13.

Let us make three further technical comments:

  * •

both [6, 42] involve an auxiliary topology $\tau$: in the present case, being
$X$ complete and separable and ${\sf d}$ a canonical metric (thus ${\sf d}$
only take finite values), we can select $\tau$ as the (Polish) topology
induced by ${\sf d}$.

  * •

In order to deal with _extended_ distances, in [42] has also been assumed that
the unital algebra $\mathscr{A}$ satisfies the _stronger_ compatibility
condition

${\sf d}(x,y)=\sup\Big{\\{}f(x)-f(y):f\in\mathscr{A},\ \mathop{\rm
Lip}\nolimits(f,X)\leq 1\Big{\\}},$ (2.12)

which clearly implies that $\mathscr{A}$ separates the points of $X$ as in
(2.2). However, such a property is not needed in the construction and the
proofs of Section 3.1.1 of [42]. The only point where (2.12) explicitly occurs
is in the proof of Locality [42, Lemma 3.1.11], to ensure that the restriction
of $\mathscr{A}$ to each compact set $K\subset X$ is uniformly dense in
${\mathrm{C}}(K)$, a property which is guaranteed in the present setting by
(2.2) thanks to Stone-Weierstrass Theorem.

  * •

The standard approach of [6, 42] considers first functions $f$ belonging to
$L^{p}(X,\mathfrak{m})$ instead of general $\mathfrak{m}$-measurable
functions. However, the compatibility with truncations showing that for every
$k>0$

$|{\mathrm{D}}\,T_{k}(f)|_{\star,\mathscr{A}}(x)=\begin{cases}|{\mathrm{D}}f|_{\star,\mathscr{A}}(x)&\text{if
}|f(x)|<k,\\\ 0&\text{if }|f(x)|\geq k,\end{cases}\qquad T_{k}(f):=-k\lor
f\land k,$ (2.13)

and the possibility to find strong approximations of $T_{k}(f)$ satisfying
(2.5) and taking values in $[-k,k]$ (see [42, Cor. 3.1.9]) allow for a
standard extension of the theory from $L^{p}(X,\mathfrak{m})$ to
$L^{0}(X,\mathfrak{m})$, see also the discussion related to (4.16) of [6]. ∎

Starting from Definition 2.1 and using the properties of Theorem 2.2 it is
natural to introduce the following notions.

######  Definition 2.3 (Cheeger energy and Sobolev space).

We call $D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})$ the set of functions in
$L^{0}(X,\mathfrak{m})$ with a $(p,\mathscr{A})$-relaxed gradient and we set

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f):=\int_{X}|{\mathrm{D}}f|_{\star,\mathscr{A}}^{p}(x)\,{\mathrm{d}}\mathfrak{m}(x)\quad\text{for
every $f\in D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})$},$ (2.14)

with $\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f):=+\infty$ if $f\not\in
D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A}).$ The Sobolev space
$H^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})$ is defined as
$L^{p}(X,\mathfrak{m})\cap D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})$ and it
is a Banach space with the norm
$\|f\|_{H^{1,p}(X,d,\mathfrak{m};\mathscr{A})}^{p}:=\|f\|_{L^{p}}^{p}+\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)$.
As usual, we will write $D^{1,p}(X,{\sf
d},\mathfrak{m}),\mathsf{C\kern-1.0ptE}_{p}(f)$, $H^{1,p}(X,{\sf
d},\mathfrak{m})$ and $\|f\|_{H^{1,p}}$ when $\mathscr{A}=\mathop{\rm
Lip}\nolimits_{b}(X)$.

######  Remark 2.4 (Cheeger energy as relaxation of the pre-Cheeger energy).

We can equivalently define the Cheeger energy
$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}$ as the $L^{0}$-lower semicontinuous
relaxation of the restriction to $\mathscr{A}$ of the _pre-Cheeger energy_
$\mathsf{pC\kern-1.0ptE}_{p}$, the latter being defined as

$\mathsf{pC\kern-1.0ptE}_{p}(f):=\int_{X}(\mathop{\rm lip}\nolimits
f)^{p}\,{\mathrm{d}}\mathfrak{m},\quad f\in\mathop{\rm Lip}\nolimits_{b}(X).$
(2.15)

In other words, for every $f\in L^{0}(X,\mathfrak{m})$ it holds ([42,
Corollary 3.1.7])

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\inf\left\\{\liminf_{n\to+\infty}\mathsf{pC\kern-1.0ptE}_{p}(f_{n}):f_{n}\in\mathscr{A},\,f_{n}\to
f\text{ in }L^{0}(X,\mathfrak{m})\right\\}.$ (2.16)

In particular the functional $\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}$ is lower
semicontinuous in $L^{0}(X,\mathfrak{m})$. Here the choice of the
$L^{0}$-topology does not play a crucial role, since, by Theorem 2.2(2), the
restriction of $\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}$ to
$L^{q}(X,\mathfrak{m})$, $q\in[1,\infty)$, can be equivalently obtained as
$L^{q}$-relaxation:

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\inf\left\\{\liminf_{n\to+\infty}\mathsf{pC\kern-1.0ptE}_{p}(f_{n}):f_{n}\in\mathscr{A},\,f_{n}\to
f\text{ in }L^{q}(X,\mathfrak{m})\right\\},\quad f\in L^{q}(X,\mathfrak{m}).$
(2.17)

It is clear that we have the obvious implication for $f\in
L^{0}(X,\mathfrak{m})$:

$\text{$f$ has a $(p,\mathscr{A})$-relaxed
gradient}\quad\Rightarrow\quad\left\\{\begin{aligned} &\text{$f$ has a
$(p,\mathop{\rm Lip}\nolimits_{b}(X))$-relaxed gradient and}\\\
&|{\mathrm{D}}f|_{\star}\leq|{\mathrm{D}}f|_{\star,\mathscr{A}}\text{
$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in $X$}.\end{aligned}\right.$ (2.18)

The converse implication together with the identity
$|{\mathrm{D}}f|_{\star}=|{\mathrm{D}}f|_{\star,\mathscr{A}}$ is an important
density property for an algebra $\mathscr{A}$: by Theorem 2.2(2), it is
equivalent to the following property.

######  Definition 2.5 (Density in energy of a subalgebra of Lipschitz
functions).

We say that a subalgebra $\mathscr{A}\subset\mathop{\rm Lip}\nolimits_{b}(X)$
is _dense in $p$-energy_ if for every $f\in L^{0}(X,\mathfrak{m})$ with a
$p$-relaxed gradient there exists a sequence $(f_{n})_{n\in\mathbb{N}}$
satisfying

$f_{n}\in\mathscr{A},\quad f_{n}\to f\text{
$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in $X$},\quad\mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{\star}\text{ strongly in }L^{p}(X,\mathfrak{m}).$
(2.19)

When $\mathscr{A}$ is unital and separating, this is equivalent to the fact
that $f$ has a $(p,\mathscr{A})$-relaxed gradient and

$|{\mathrm{D}}f|_{\star,\mathscr{A}}=|{\mathrm{D}}f|_{\star}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in $X$}.$ (2.20)

In particular $D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})=D^{1,p}(X,{\sf
d},\mathfrak{m})$.

######  Remark 2.6 (Comparison with the Newtonian approach).

By the identification (1.12) when $\mathscr{A}=\mathop{\rm
Lip}\nolimits_{b}(X)$ we always have

$H^{1,p}(X,{\sf d},\mathfrak{m})=\hat{N}^{1,p}(X,{\sf
d},\mathfrak{m}),\quad|{\mathrm{D}}f|_{N}=|{\mathrm{D}}f|_{*}\quad\text{for
every }f\in\hat{N}^{1,p}(X,{\sf d},\mathfrak{m}).$ (2.21)

If $\mathscr{A}$ is dense in $p$-energy and $f\in\hat{N}^{1,p}(X,{\sf
d},\mathfrak{m})$ we thus obtain

$|{\mathrm{D}}f|_{\star,\mathscr{A}}=|{\mathrm{D}}f|_{\star}=|{\mathrm{D}}f|_{N}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in $X$}.$ (2.22)

Notice that (2.22) and (1.5) immediately yield the uniform upper bound in
terms of the pointwise Lipschitz constant

$\text{if $f$ is Lipschitz
then}\quad|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq|{\mathrm{D}}f|\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in $X$}.$ (2.23)

######  Remark 2.7.

As we already mentioned in Remark 2.4, the choice of arbitrary measurable maps
$f\in L^{0}(X,\mathfrak{m})$ in Definition 2.5 and of the pointwise
$\mathfrak{m}$-a.e. convergence in (2.19) is not restrictive: a simple
truncation argument (which can be implemented by using odd polynomials, see
[42, Corollary 2.1.24]) shows that $\mathscr{A}$ is dense in $p$-energy if and
only if for every $f\in L^{p}(X,\mathfrak{m})$ with a $p$-relaxed gradient
there exists a sequence $(f_{n})_{n\in\mathbb{N}}$ satisfying

$f_{n}\in\mathscr{A},\quad f_{n}\to f\text{ in
$L^{p}(X,\mathfrak{m})$},\quad\mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{\star}\text{ strongly in }L^{p}(X,\mathfrak{m}).$
(2.24)

If $\mathscr{A}$ is unital and separating this is equivalent to
$H^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A})=H^{1,p}(X,{\sf d},\mathfrak{m})$
with equal norms.

A first sufficient condition to obtain the density in energy of a subalgebra
$\mathscr{A}$, in the more general framework of extended topological metric
measure spaces, is provided by the compatibility condition (2.12) [42,
Theorems 3.2.7, 5.3.1] (see also [8] for the algebra generated by truncated
distance functions).

In the present Polish setting, we notice that (2.19) (and, a fortiori, (2.12))
implies the weaker condition

for every $y\in X$ the function ${\sf d}_{y}:x\mapsto{\sf d}(x,y)$ has
$(p,\mathscr{A})$-relaxed gradient $1$, (2.25)

which is equivalent, thanks to Theorem 2.2(2), to

$|{\mathrm{D}}{\sf d}_{y}|_{\star,\mathscr{A}}\leq
1\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in $X$}.$ (2.26)

In fact, using the truncations (2.13), each function ${\sf d}_{y}$ can be
approximated by the increasing sequence $f_{k}:=T_{k}{\sf d}_{y}$ of
$1$-Lipschitz maps, so that

$|{\mathrm{D}}{\sf d}_{y}|_{\star}\leq
1\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in $X$ for every $y\in
X$},$ (2.27)

and therefore (2.19) yields (2.26).

######  Remark 2.8 (The effect of truncations).

The $(p,\mathscr{A})$-relaxed gradient is not affected by truncations of the
distance functions, in particular it is not restrictive to assume ${\sf d}$
bounded above by a constant, e.g. $1$__. In fact, if we introduce a parameter
$a>0$ and the truncated distance

${\sf d}_{a}(x_{1},x_{2}):={\sf d}(x_{1},x_{2})\land a\quad\text{for every
}x_{1},x_{2}\in X,$ (2.28)

$(X,{\sf d}_{a})$ is still a complete and separable metric space, the sets
$\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$ and $\mathop{\rm
Lip}\nolimits_{b}(X,{\sf d}_{a})$ coincide, and it is easy to check that

$\mathop{\rm lip}\nolimits_{{\sf d}}f=\mathop{\rm lip}\nolimits_{{\sf
d}_{a}}f\quad\text{for every bounded and Lipschitz function $f$}.$ (2.29)

We deduce that ${\sf d}$ and ${\sf d}_{a}$ induce the same
$(p,\mathscr{A})$-relaxed gradient. Notice moreover that using (2.28) we can
also easily cover the case of extended distances (i.e. possibly assuming the
value $+\infty$), _provided $(X,{\sf d}_{a})$ is a separable metric space_.
The case when $(X,{\sf d}_{a})$ is not separable requires a more refined
setting involving an auxiliary topology $\tau$ [42].

######  Remark 2.9.

Using the above truncation argument, one can easily see that if ${\sf d},{\sf
d}^{\prime}$ are two metrics satisfying

${\sf d}(x_{1},x_{2})={\sf d}^{\prime}(x_{1},x_{2})\quad\text{whenever }{\sf
d}(x_{1},x_{2})\land{\sf d}^{\prime}(x_{1},x_{2})<a$ (2.30)

then the sets $\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$ and $\mathop{\rm
Lip}\nolimits_{b}(X,{\sf d}^{\prime})$ coincide,

$\mathop{\rm lip}\nolimits_{{\sf d}}f=\mathop{\rm lip}\nolimits_{{\sf
d}^{\prime}}f\quad\text{for every bounded and Lipschitz function $f$}$ (2.31)

and ${\sf d}$ and ${\sf d}^{\prime}$ induce the same $(p,\mathscr{A})$-relaxed
gradient.

It is possible to express (2.26) in a more flexible way, by using suitable
nonlinear functions of ${\sf d}_{y}$. We state a general result.

######  Lemma 2.10.

Let $I=(a,b)$ be an interval (possibly unbounded) of $\mathbb{R}$ and let
$\zeta:\mathbb{R}\to\mathbb{R}$ be a Lipschitz and nondecreasing map
satisfying

the restriction of $\zeta$ to $I$ is of class ${\mathrm{C}}^{1}$ with
$\zeta^{\prime}(s)>0$ if $s\in I$. (2.32)

If $f:X\to\overline{I}$ is a Borel function, then the condition

$f\in
D^{1,p}(\mathbb{X},\mathscr{A}),\quad|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq
1$ (2.33)

is equivalent to

$\zeta\circ f\in
D^{1,p}(\mathbb{X},\mathscr{A}),\quad\big{|}{\mathrm{D}}(\zeta\circ
f)\big{|}_{\star,\mathscr{A}}(x)\leq\zeta^{\prime}(f(x))\quad\text{for
$\mathfrak{m}$-a.e.\leavevmode\nobreak\ $x\in X$}.$ (2.34)

###### Proof.

It is clear that if $|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq 1$ then (2.34)
holds, thanks to (2.9). In order to prove the converse implication, we
consider a strictly decreasing sequence $a_{n}\downarrow a$, a strictly
increasing sequence $b_{n}\uparrow b$ and nondecreasing and bounded Lipschitz
functions $\psi_{n}:\mathbb{R}\to\mathbb{R}$ such that

$\psi_{n}(z)=a_{n}\ \text{if }z<\zeta(a_{n}),\quad\psi_{n}(\zeta(s))=s\
\text{for every }s\in[a_{n},b_{n}],\quad\psi_{n}(z)=b_{n}\ \text{if
}z>\zeta(b_{n}).$

The restriction of $\psi_{n}$ to the interval $[\zeta(a_{n}),\zeta(b_{n})]$ is
of class ${\mathrm{C}}^{1}$.

Setting $h(x):=\zeta(f(x))$, the Chain rule (2.9) yields

$|{\mathrm{D}}(\psi_{n}\circ
h)|_{\star,\mathscr{A}}(x)\leq(\psi_{n}^{\prime}\circ
h)\,|{\mathrm{D}}h|_{\star,\mathscr{A}}(x)\leq(\psi_{n}^{\prime}\circ\zeta(f(x)))\zeta^{\prime}(f(x)).$

Since $\psi_{n}(h(x))=a_{n}\lor f(x)\land b_{n}$, the locality property (2.8),
the truncation property 2.2(8), and the fact that
$\psi^{\prime}(\zeta(s))\zeta^{\prime}(s)=1$ if $s\in[a_{n},b_{n}]$ yield

$|{\mathrm{D}}(\psi_{n}\circ h)|_{\star,\mathscr{A}}\leq
1\quad\text{$\mathfrak{m}$-a.e.}$ (2.35)

Since $\psi_{n}\circ h\to f$ pointwise in $X$ as $n\to\infty$, passing to the
limit in (2.35) we get $|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq 1$. ∎

######  Remark 2.11.

Thanks to Lemma 2.10, if ${\sf d}$ is a bounded metric and $q>1$, (2.26) is
equivalent to

$|{\mathrm{D}}{\sf d}^{q}_{y}|_{\star,\mathscr{A}}(x)\leq q\,{\sf
d}_{y}^{q-1}(x)\quad\text{for $\mathfrak{m}$-a.e.\leavevmode\nobreak\ $x\in
X$}.$ (2.36)

In particular, if (2.36) holds form some $q\geq 1$, it holds for any $q\geq
1$.

###  2.2. A density result

We have seen that in the present setting of Polish spaces, condition (2.26)
(or, equivalently, (2.34) for some admissible truncation satisfying (2.32)) is
a necessary condition for the validity of the approximation property (2.19)
and of the identification
$|{\mathrm{D}}f|_{\star}=|{\mathrm{D}}f|_{\star,\mathscr{A}}$. We want to show
that (2.26) or (2.34) are also _sufficient_ conditions.

######  Theorem 2.12.

Let $(X,{\sf d},\mathfrak{m})$ be a Polish metric measure space, let $Y\subset
X$ be a dense subset, and let $\mathscr{A}$ be a unital separating subalgebra
of $\mathop{\rm Lip}_{b}\nolimits(X)$ as in (2.2). If

$\text{for every }y\in{Y}\text{ it holds}\quad{\sf d}_{y}\in
D^{1,p}(\mathbb{X},\mathscr{A}),\quad\big{|}{\mathrm{D}}{\sf
d}_{y}\big{|}_{\star,\mathscr{A}}\leq 1$ (2.37)

then $\mathscr{A}$ is dense in $p$-energy according to Definition 2.5.

###### Proof.

We split the proof in various steps. Notice that by (2.18) it is sufficient to
prove that

$|{\mathrm{D}}f|_{\star,\mathscr{A}}\leq|{\mathrm{D}}f|_{\star}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in $X$}.$ (2.38)

(1) _It is not restrictive to assume ${\sf d}$ bounded above by $1$ _: see
Remark 2.8.

By Lemma 2.10 and Remark 2.11 we know that (2.36) holds for every $y\in Y$ and
every $q\geq 1$ .

(2) _It is sufficient to prove that_

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)\leq\int_{X}(\mathop{\rm
lip}\nolimits
f)^{p}\,{\mathrm{d}}\mathfrak{m}=\mathsf{pC\kern-1.0ptE}_{p}(f)\quad\text{\em
for every $f\in\mathop{\rm Lip}\nolimits_{b}(X)$}.$ (2.39)

In fact, if $f$ has ($p,\mathop{\rm Lip}\nolimits_{b}(X)$)-relaxed gradient,
by (2.5) we can find a sequence $f_{n}\in\mathop{\rm Lip}\nolimits_{b}(X)$
such that $f_{n}\to f$ $\mathfrak{m}$-a.e. and $\mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{\star}$ strongly in $L^{p}(X,\mathfrak{m})$ as
$n\to\infty.$ By the $L^{0}$-lower semicontinuity of the
$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}$-energy, passing to the limit in
(2.39) written for $f_{n}$ we get

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\int_{X}|{\mathrm{D}}f|_{\star,\mathscr{A}}^{p}\,{\mathrm{d}}\mathfrak{m}\leq\int_{X}|{\mathrm{D}}f|_{\star}^{p}\,{\mathrm{d}}\mathfrak{m}=\mathsf{C\kern-1.0ptE}_{p}(f)<\infty.$

We deduce that $f$ has a $(p,\mathscr{A})$-relaxed gradient and that (2.20)
holds, since $|{\mathrm{D}}f|_{\star}\leq|{\mathrm{D}}f|_{\star,\mathscr{A}}$
$\mathfrak{m}$-a.e.

(3) For every $f\in\mathop{\rm Lip}\nolimits_{b}(X)$ and $t>0$ we introduce
the Hopf-Lax regularization ${\mathsf{Q}}_{t}f:X\to\mathbb{R}$ defined by

$\displaystyle{\mathsf{Q}}_{t}f(x):={}$ $\displaystyle\inf_{y\in
X}\frac{1}{2t}{\sf d}^{2}(x,y)+f(y),\quad x\in X.$ (2.40)

It is clear that ${\mathsf{Q}}_{t}f$ is bounded (it takes values in the
interval $[\inf_{X}f,\sup_{X}f]$) and Lipschitz, being the infimum of a family
of $t^{-1}$-Lipschitz functions. We consider the upper semicontinuous function
[6, (3.4) and Prop. 3.2]

$\displaystyle{\sf D}_{t}^{+}f(x):=$
$\displaystyle\sup_{(y_{n})}\limsup_{n\to\infty}{\sf d}(x,y_{n}),$ (2.41)

where the $(y_{n})_{n}$’s vary among all the minimizing sequences of (2.40).
${\sf D}_{t}^{+}f$ is also uniformly bounded and satisfies (see e.g. [42,
Lemma 3.2.1])

$\frac{{\sf D}_{t}f^{+}(x)}{t}\leq 2\mathop{\rm Lip}\nolimits(f,X).$ (2.42)

In fact, if $y_{n}$ is a minimizing sequence of (2.40), for every
$\varepsilon>0$ we eventually have

$\frac{1}{2t}{\sf
d}^{2}(x,y_{n})+f(y_{n})\leq{\mathsf{Q}}_{t}f(x)+\varepsilon\leq
f(x)+\varepsilon$

i.e., setting $L:=\mathop{\rm Lip}\nolimits(f,X)$,

$\frac{1}{2t}{\sf
d}^{2}(x,y_{n})\leq\varepsilon+f(x)-f(y_{n})\leq\varepsilon+L{\sf
d}(x,y_{n})\leq\varepsilon+\frac{1}{4t}{\sf d}(x,y_{n})^{2}+tL^{2}.$

We thus get

$\limsup_{n\to\infty}\frac{1}{4t}{\sf d}^{2}(x,y_{n})\leq\varepsilon+tL^{2}$

which yields (2.42) since $\varepsilon>0$ is arbitrary.

(4) _For every $f\in\mathop{\rm Lip}\nolimits_{b}(X)$ and for every $t>0$_

$|{\mathrm{D}}{\mathsf{Q}}_{t}f|_{\star,\mathscr{A}}(x)\leq t^{-1}{\sf
D}_{t}^{+}f(x)\quad\text{for $\mathfrak{m}$-a.e.\leavevmode\nobreak\ $x\in
X$}.$ (2.43)

Let $Y^{\prime}=\\{y_{n}\\}_{n\in\mathbb{N}}$ be a countable set dense in $Y$;
since $f\in\mathop{\rm Lip}\nolimits_{b}(X)$ it is easy to check that

${\mathsf{Q}}_{t}f(x)=\inf_{y\in Y}\frac{1}{2t}{\sf
d}^{2}(x,y)+f(y)=\lim_{n\to\infty}{\mathsf{Q}}^{n}_{t}f(x),\quad{\mathsf{Q}}^{n}_{t}f(x):=\min_{1\leq
k\leq n}\frac{1}{2t}{\sf d}^{2}(x,y_{k})+f(y_{k}).$ (2.44)

We can now use obtain that the upper semicontinuous (see[42, Lemma 3.2.2 (b)])
function

${\sf D}^{n}_{t}(x):=\frac{1}{t}\max\Big{\\{}{\sf d}(x,y_{k}):1\leq k\leq n,\
{\mathsf{Q}}_{t}^{n}(x)=\frac{1}{2t}{\sf d}^{2}(x,y_{k})+f(y_{k})\Big{\\}},$
(2.45)

is a $(p,\mathscr{A})$-relaxed gradient of ${\mathsf{Q}}^{n}_{t}f$. It is then
clear that for every $x$ there exists a sequence $n\mapsto y^{\prime}(n;x)$
with $y^{\prime}(n;x)\in\\{y_{1},\cdots,y_{n}\\}$ such that ${\sf
D}^{n}_{t}(x)=\frac{1}{t}{\sf d}(x,y^{\prime}(n;x))$ and
${\mathsf{Q}}^{n}_{t}f(x)=\frac{1}{2t}{\sf
d}^{2}(x,y^{\prime}(n;x))+f(y^{\prime}(n;x))\to{\mathsf{Q}}_{t}f(x)$ as
$n\to\infty$, i.e. $y^{\prime}(n;x)$ is a minimizing sequence of (2.40). We
deduce that

$\limsup_{n\to\infty}{\sf D}^{n}_{t}(x)=\limsup_{n\to\infty}{\sf
d}(x,y^{\prime}(n;x))\leq{\sf D}_{t}^{+}f(x)\text{ for every }x\in X.$ (2.46)

Since ${\sf D}^{n}_{t}$ are uniformly bounded, up to extracting a suitable
subsequence we can suppose that $t^{-1}{\sf D}^{n}_{t}\rightharpoonup G$ in
$L^{p}(X,\mathfrak{m})$, $G$ is a $(p,\mathscr{A})$-relaxed gradient of
${\mathsf{Q}}_{t}f$, and $G\leq t^{-1}{\sf D}^{+}_{t}$ thanks to Fatou’s
Lemma.

(5) _For every $x\in X,\ t>0,$ and $f\in\mathop{\rm Lip}\nolimits_{b}(X)$ we
have_

$\displaystyle\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}$
$\displaystyle=\frac{1}{2}\int_{0}^{1}\Big{(}\frac{{\mathrm{D}}_{rt}^{+}f(x)}{rt}\Big{)}^{2}\,{\mathrm{d}}r,$
(2.47) $\displaystyle\limsup_{t\downarrow
0}\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}$
$\displaystyle\leq\frac{1}{2}\big{(}\mathop{\rm lip}\nolimits
f(x)\big{)}^{2}.$ (2.48)

This follows by [42, Thm. 3.2.4] (see also [4, Thm. 3.1.4, Lemma 3.1.5]).

(5) _Conclusion._ We argue as [42, Theorem 3.2.7]: (2.47) and (2.42) yield the
uniform bound

$\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}\leq 2\big{(}\mathop{\rm
Lip}\nolimits(f,X)\big{)}^{2}\quad\text{for every }x\in X,\ t>0.$ (2.49)

Integrating (2.48) in $X$ and applying Fatou’s Lemma we get

$\limsup_{t\downarrow
0}\int_{X}\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}\,{\mathrm{d}}\mathfrak{m}(x)\leq\frac{1}{2}\int_{X}\big{(}\mathop{\rm
lip}\nolimits f(x)\big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x).$ (2.50)

On the other hand, (2.47) and Fubini’s Theorem yield

$\int_{X}\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}\,{\mathrm{d}}\mathfrak{m}(x)=\frac{1}{2}\int_{0}^{1}\int_{X}\Big{(}\frac{{\sf
D}_{rt}^{+}f(x)}{rt}\Big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x)\,{\mathrm{d}}r.$
(2.51)

A further application of Fatou’s Lemma yields

$\liminf_{t\downarrow
0}\int_{X}\frac{f(x)-{\mathsf{Q}}_{t}f(x)}{t}\,{\mathrm{d}}\mathfrak{m}(x)\geq\frac{1}{2}\liminf_{t\downarrow
0}\int_{X}\Big{(}\frac{{\sf
D}_{t}^{+}f(x)}{t}\Big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x).$ (2.52)

Using the fact that $t^{-1}{\sf D}_{t}^{+}f$ is uniformly bounded by (2.42),
we can find a decreasing and vanishing sequence $n\mapsto t(n)$ and a limit
function $G\in L^{\infty}(X,\mathfrak{m})$ such that

$\displaystyle t(n)^{-1}{\sf
D}_{t(n)}^{+}f\rightharpoonup^{*}G\quad\text{weakly${}^{*}$ in
$L^{\infty}(X,\mathfrak{m})$}\quad\text{as }n\to\infty,$
$\displaystyle\lim_{n\to\infty}\int_{X}\Big{(}\frac{{\sf
D}_{t(n)}^{+}f(x)}{t(n)}\Big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x)=\liminf_{t\downarrow
0}\int_{X}\Big{(}\frac{{\sf
D}_{t}^{+}f(x)}{t}\Big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x).$ (2.53)

Since $t^{-1}{\sf D}_{t}^{+}f$ it is a $(p,\mathscr{A})$-relaxed gradient of
${\mathsf{Q}}_{t}f$ by claim (4) and ${\mathsf{Q}}_{t}f\to f$ pointwise
everywhere, using Theorem 2.2(1) we get that $G$ is a
$(p,\mathscr{A})$-relaxed gradient of $f$.
Using the lower semicontinuity of the $L^{2}$-norm w.r.t. the weak∗
$L^{\infty}(X,\mathfrak{m})$ convergence, we get that

$\lim_{n\to\infty}\int_{X}\Big{(}\frac{{\sf
D}_{t(n)}^{+}f(x)}{t(n)}\Big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x)\geq\int_{X}G^{2}\,{\mathrm{d}}\mathfrak{m}(x)\geq\int_{X}|{\mathrm{D}}f|_{\star,\mathscr{A}}^{2}(x)\,{\mathrm{d}}\mathfrak{m}(x),$
(2.54)

where we also used the pointwise minimality of
$|{\mathrm{D}}f|_{\star,\mathscr{A}}^{2}$ given by Theorem 2.2(3). Combining
(2.54), (2.53), (2.52) and (2.50) we deduce that

$\int_{X}|{\mathrm{D}}f|_{\star,\mathscr{A}}^{2}(x)\,{\mathrm{d}}\mathfrak{m}(x)\leq\int_{X}\big{(}\mathop{\rm
lip}\nolimits f(x)\big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(x)$

so that (2.39) holds. ∎

######  Corollary 2.13 (Density in energy of $\mathscr{A}$ in $H^{1,p}$).

If $\mathscr{A}$ is a separating unital subalgebra of $\mathop{\rm
Lip}\nolimits_{b}(X)$ satisfying (2.37) then

$\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\mathsf{C\kern-1.0ptE}_{p}(f)=\mathsf{N\kern-2.5ptE}_{p}(f)\quad\text{for
every $\mathfrak{m}$-measurable function $f:X\to\mathbb{R}$.}$ (2.55)

In particular, $H^{1,p}(X,{\sf d},\mathfrak{m})=H^{1,p}(X,{\sf
d},\mathfrak{m};\mathscr{A})$.

As we have already said, (2.55) can be interpreted as a density result in
$H^{1,p}(X,{\sf d},\mathfrak{m})$: for every $f\in H^{1,p}(X,{\sf
d},\mathfrak{m})$ there exists a sequence $f_{n}\in\mathscr{A}$,
$n\in\mathbb{N}$, such that

$f_{n}\to f,\ \mathop{\rm lip}\nolimits
f_{n}\to|{\mathrm{D}}f|_{*}\quad\text{strongly in
}L^{p}(X,\mathfrak{m}),\quad\int_{X}|\mathop{\rm lip}\nolimits
f_{n}|^{p}\,{\mathrm{d}}\mathfrak{m}\to\mathsf{C\kern-1.0ptE}_{p}(f)\quad\text{as
}n\to\infty.$ (2.56)

###  2.3. Applications

We first recall a useful result showing that it is possible to remove the
assumption that $\mathscr{A}$ is unital, if $\mathscr{A}$ satisfies a suitable
tightness condition. We will denote by $\mathbbm{1}$ the unit constant
function.

######  Proposition 2.14.

Let $\mathscr{A}\subset\mathop{\rm Lip}\nolimits_{b}(X)$ be a separating
subalgebra of Lipschitz functions and let

$\mathscr{A}_{1}:=\mathscr{A}\oplus\\{c\mathbbm{1}\\}=\Big{\\{}f+c\mathbbm{1}:f\in\mathscr{A},\,c\in\mathbb{R}\Big{\\}}$
(2.57)

be the minimal unital subalgebra containing $\mathscr{A}$. If
$\mathscr{A}_{1}$ is dense in $p$-energy and there exist a sequences of
compact sets $K_{n}\subset X$ and functions $f_{n}\in\mathscr{A}$ such that

$f_{n}(x)\geq 1\ \text{for every $x\in
K_{n}$},\quad\lim_{n\to\infty}\int_{X\setminus K_{n}}\Big{(}1+|\mathop{\rm
lip}\nolimits f_{n}(x)|^{p}\Big{)}\,{\mathrm{d}}\mathfrak{m}(x)=0,$ (2.58)

then $\mathscr{A}$ is dense in $p$-energy as well.

The _proof_ is a simple adaptation of [42, Proposition 5.3.2]. The next result
shows that the algebra generated by (suitable compositions/truncations of)
distance functions is always sufficient to generate the Sobolev space
$H^{1,2}(X,{\sf d},\mathfrak{m})$.

######  Theorem 2.15.

Let $Y$ be a dense subset of $X$ and let $\zeta:[0,+\infty)\to[0,+\infty)$ be
a Lipschitz nondecreasing function such that $\zeta^{\prime}>0$ in an interval
$I=(0,r)\subset(0,+\infty)$. Then the unital algebra $\mathscr{A}$ generated
by the functions $x\mapsto\zeta({\sf d}(x,y))$ is dense in $p$-energy.

###### Proof.

Thanks to Remark 2.8, we can assume that ${\sf d}$ is bounded above by $r$. It
is not difficult to check that $\mathscr{A}$ separates the points of $X$, so
that in order to apply Theorem 2.12, it is enough to check that (2.34) with
$f:={\sf d}_{y}$ (recall the notation (2.25)) holds.

Such a property follows immediately from the corresponding estimate on the
asymptotic Lipschitz constant: for every $y\in Y$ and $g(x):=\zeta({\sf
d}_{y}(x))$, a simple direct computation shows that

$\mathop{\rm lip}\nolimits g(x)\leq\zeta^{\prime}({\sf
d}_{y}(x))\quad\text{for every }x\in{\mathrm{B}}(y,r).$

Since $g\in\mathscr{A}$ we have
$|{\mathrm{D}}g|_{\star,\mathscr{A}}\leq\mathop{\rm lip}\nolimits
g\leq\zeta^{\prime}(f)$, so that (2.34) holds and we conclude by applying
Lemma 2.10. ∎

We now consider a simple application of Theorem 2.12 to the case when $p=2$
and $\mathop{\rm lip}\nolimits f$ has good properties for functions of
$\mathscr{A}$.

######  Theorem 2.16 (A Hilbertianity condition).

Let $p=2$ and let $\mathscr{A}$ be a separating unital subalgebra of
$\mathop{\rm Lip}\nolimits_{b}(X)$ satisfying (2.37). If for every
$f,g\in\mathscr{A}$

$\int_{X}\Big{(}|\mathop{\rm lip}\nolimits(f+g)|^{2}+|\mathop{\rm
lip}\nolimits(f-g)|^{2}\Big{)}\,{\mathrm{d}}\mathfrak{m}=2\int_{X}\Big{(}|\mathop{\rm
lip}\nolimits f|^{2}+|\mathop{\rm lip}\nolimits
g|^{2}\Big{)}\,{\mathrm{d}}\mathfrak{m},$ (2.59)

then $H^{1,2}(X,{\sf d},\mathfrak{m})$ is a Hilbert space,
$\mathsf{C\kern-1.0ptE}_{2}$ is a Dirichlet (thus quadratic) form, and
$\mathscr{A}$ is strongly dense.

###### Proof.

It is sufficient to prove that the Cheeger energy is a quadratic form in its
domain. Thanks to [15, Prop. 11.9] and the $2$-homogeneity of
$\mathsf{C\kern-1.0ptE}_{2}$, this property is equivalent to

$\mathsf{C\kern-1.0ptE}_{2}(f+g)+\mathsf{C\kern-1.0ptE}_{2}(f-g)\leq
2\mathsf{C\kern-1.0ptE}_{2}(f)+2\mathsf{C\kern-1.0ptE}_{2}(g)\quad\text{for
every }f,g\in H^{1,p}(X,{\sf d},\mathfrak{m}).$ (2.60)

We can find two sequences $f_{n},g_{n}\in\mathscr{A}$ such that $f_{n}\to f,\
g_{n}\to g$ in $\mathfrak{m}$-measure as $n\to\infty$ and $\mathop{\rm
lip}\nolimits f_{n}\to|{\mathrm{D}}f|_{\star}$, $\mathop{\rm lip}\nolimits
g_{n}\to|{\mathrm{D}}g|_{\star}$ in $L^{2}(X,\mathfrak{m})$. Clearly we have
$f_{n}+g_{n}\to f+g$, $f_{n}-g_{n}\to f-g$ in $\mathfrak{m}$-measure and
(2.59) shows that $\mathop{\rm lip}\nolimits(f_{n}+g_{n})$ and $\mathop{\rm
lip}\nolimits(f_{n}-g_{n})$ are uniformly bounded in $L^{2}(X,\mathfrak{m})$.
Up to extracting a suitable sequence, it is not restrictive to assume that
$\mathop{\rm lip}\nolimits(f_{n}+g_{n})\rightharpoonup
G_{+}\geq|{\mathrm{D}}(f+g)|_{\star}$ and $\mathop{\rm
lip}\nolimits(f_{n}-g_{n})\rightharpoonup
G_{-}\geq|{\mathrm{D}}(f-g)|_{\star}$ $\mathfrak{m}$-a.e. in $X$. (2.59) then
yields

$\displaystyle\mathsf{C\kern-1.0ptE}_{2}(f+g)+\mathsf{C\kern-1.0ptE}_{2}(f-g)$
$\displaystyle=\int_{X}|{\mathrm{D}}(f+g)|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}+\int_{X}|{\mathrm{D}}(f-g)|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}$
$\displaystyle\leq\liminf_{n\to\infty}\int_{X}|\mathop{\rm
lip}\nolimits(f_{n}+g_{n})|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}+\int_{X}|\mathop{\rm
lip}\nolimits(f_{n}-g_{n})|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}$
$\displaystyle=\liminf_{n\to\infty}2\int_{X}|\mathop{\rm lip}\nolimits
f_{n}|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}+2\int_{X}|\mathop{\rm
lip}\nolimits
g_{n}|_{\star}^{2}\,{\mathrm{d}}\mathfrak{m}=2\mathsf{C\kern-1.0ptE}_{2}(f)+\mathsf{C\kern-1.0ptE}_{2}(g).$

Since $H^{1,2}(X,{\sf d},\mathfrak{m})$ is Banach space, we deduce that
$H^{1,2}(X,{\sf d},\mathfrak{m})$ is a Hilbert space, so it is reflexive. This
also shows that $\mathscr{A}$ is strongly dense. ∎

######  Remark 2.17.

In the framework of Theorem 2.16, there exists a scalar product
${\langle}\cdot,\cdot{\rangle}_{H^{1,2}}$ on $H^{1,2}(X,{\sf d},\mathfrak{m})$
inducing the norm $\|\cdot\|_{H^{1,2}}$ and satisfying

${\langle}f,g{\rangle}_{H^{1,2}}=\int_{X}fg\,{\mathrm{d}}\mathfrak{m}+\mathsf{C\kern-1.0ptE}_{2}(f,g)\text{
for every }f,g\in H^{1,p}(X,{\sf d},\mathfrak{m}),$ (2.61)

where $\mathsf{C\kern-1.0ptE}_{2}(\cdot,\cdot)$ denotes the bilinear form
associated to $\mathsf{C\kern-1.0ptE}_{2}(\cdot)$.

######  Remark 2.18.

If (2.59) holds then the restriction
$(\mathsf{pC\kern-1.0ptE}_{2},\mathscr{A})$ of $\mathsf{pC\kern-1.0ptE}_{2}$
to $\mathscr{A}$ is a quadratic form which is induced by a corresponding
bilinear form $\mathsf{pC\kern-1.0ptE}_{2}(\cdot,\cdot)$ defined by the
parallelogram rule. We recall that such a form is _closable_ (see e.g. [12,
§1.3], [30, Chapter I, §.3]) if for any sequence $(f_{n})_{n\in\mathbb{N}}$ in
$\mathscr{A}$

$f_{n}\to 0\quad\text{in
}L^{2}(X,\mathfrak{m}),\quad\limsup_{m,n\to\infty}\mathsf{pC\kern-1.0ptE}_{2}(f_{n}-f_{m})=0\quad\Rightarrow\quad\lim_{n\to\infty}\mathsf{pC\kern-1.0ptE}_{2}(f_{n})=0.$
(2.62)

Theorem 2.16 shows in particular that if
$(\mathsf{pC\kern-1.0ptE}_{2},\mathscr{A})$ is quadratic and closable, then
the Cheeger energy $(\mathsf{C\kern-1.0ptE}_{2},H^{1,2}(X,{\sf
d},\mathfrak{m}))$ coincides with the smallest closed extension of
$(\mathsf{pC\kern-1.0ptE}_{2},\mathscr{A})$. In this case, trivially, the
restriction of $\mathsf{C\kern-1.0ptE}_{2}$ to $\mathscr{A}$ coincides with
$\mathsf{pC\kern-1.0ptE}_{2}$. Since the Cheeger energy
$\mathsf{C\kern-1.0ptE}_{2}$ is quasi-regular (see [7, Lemma 6.7], [41, Thm.
4.1], [18, Prop. 3.21], [40]), as a by-product we obtain the quasi-regularity
of the closure of $(\mathsf{pC\kern-1.0ptE}_{2},\mathscr{A})$.

An immediate consequence is the Hilbertianity of $H^{1,2}(\mathbb{H},{\sf
d}_{\mathbb{H}},\mathfrak{m})$ in the case when $(\mathbb{H},{\sf
d}_{\mathbb{H}})$ is a separable Hilbert space (in particular
$\mathbb{R}^{d}$) endowed with the distance induced by its Hilbertian norm
[20, 42].

######  Corollary 2.19.

Let $(\mathbb{H},{\sf d}_{\mathbb{H}})$ be a separable Hilbert space and let
$\mathfrak{m}$ be a finite and positive Borel measure on $\mathbb{H}$. Then
$H^{1,2}(\mathbb{H},{\sf d}_{\mathbb{H}},\mathfrak{m})$ is a Hilbert space.

###### Proof.

Let $\mathscr{A}$ be the algebra ${\mathrm{C}}^{1}_{b}(\mathbb{H})$ of bounded
${\mathrm{C}}^{1}$ functions with bounded continuous gradient. It is immediate
to check that for every $\phi\in{\mathrm{C}}^{1}_{b}(\mathbb{H})$ we have
$\mathop{\rm lip}\nolimits\phi(x)=\|\nabla\phi(x)\|_{\mathbb{H}}$ so that
$\mathsf{pC\kern-1.0ptE}_{2}$ is a quadratic form on $\mathscr{A}$, thus
satisfying (2.59).

On the other hand $\mathscr{A}$ contains the functions $x\mapsto\tanh({\sf
d}^{2}(x,y))$, $y\in\mathbb{H}$, so that we can apply Theorem 2.15. ∎

######  Remark 2.20 (Density of ${\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})$ in
$H^{1,2}(\mathbb{R}^{d},{\sf d},\mathfrak{m})$).

When $\mathbb{H}=\mathbb{R}^{d}$ is finite dimensional, we can also prove that
the algebra $\mathscr{A}={\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})$ is
strongly dense in $H^{1,2}(\mathbb{R}^{d},{\sf d},\mathfrak{m})$. In fact, if
$\zeta$ is the restriction to $[0,\infty)$ of a smooth nondecreasing
transition function $\tilde{\zeta}\in{\mathrm{C}}^{\infty}(\mathbb{R})$
satisfying $\tilde{\zeta}(s)=0$ if $s\leq 0$, $\tilde{\zeta}(s)=1$ is $s>1$
and $\tilde{\zeta}^{\prime}(s)>0$ if $s\in(0,1)$, it is immediate to check
that for every $y\in\mathbb{R}^{d}$ the functions $\tilde{\zeta}({\sf d}_{y})$
belong to $\mathscr{A}_{1}$, so that $\mathscr{A}_{1}$ is dense in $2$-energy
by Theorem 2.15.

On the other hand, being $\mathfrak{m}$ tight, it is easy to check that
$\mathscr{A}$ satisfies (2.58), so that we can apply Proposition 2.14.

###  2.4. Intrinsic distances

By using the general properties of metric Sobolev spaces and the equivalence
with the Newtonian viewpoint based on the notion of upper gradient [11, 27] it
is possible to improve considerably the density result of Corollary 2.13. Let
us first recall the notion of _metric velocity_

$|\dot{\gamma}|_{\sf d}(t):=\limsup_{h\to 0}\frac{{\sf
d}(\gamma(t+h),\gamma(t))}{|h|}$ (2.63)

and _length_

$\displaystyle\ell_{{\sf d}}(\gamma,[\alpha,\beta]):={}$
$\displaystyle\sup\Big{\\{}\sum_{n=1}^{N}{\sf
d}(\gamma(t_{n-1}),\gamma(t_{n})):t_{0}=\alpha<t_{1}<\cdots<t_{N-1}<t_{N}=\beta\Big{\\}}$
(2.64) $\displaystyle=\int_{\alpha}^{\beta}|\dot{\gamma}|_{\sf
d}(t)\,{\mathrm{d}}t$

of a ${\sf d}$-Lipschitz curve $\gamma:[a,b]\to X$; here
$[\alpha,\beta]\subset[a,b]$ and we just write $\ell_{\sf d}(\gamma)$ for
$\ell_{\sf d}(\gamma,[a,b])$.

If $Y\subset X$ is a given set, we can introduce the _length (or intrinsic)
extended distance_ ${\sf d}_{Y,\ell}$ induced by ${\sf d}$ on $Y$, as the
infimum of the length of $Y$-valued Lipschitz curves connecting two given
points $y_{0},y_{1}\in Y$:

$\displaystyle{\sf d}_{Y,\ell}(y_{0},y_{1}):={}$
$\displaystyle\inf\Big{\\{}\ell_{\sf d}(\gamma):\gamma\in\mathop{\rm
Lip}\nolimits([0,1];(Y,{\sf d})),\ \gamma(0)=y_{0},\ \gamma(1)=y_{1}\Big{\\}}$
(2.65) $\displaystyle={}$
$\displaystyle\inf\Big{\\{}\ell>0:\gamma\in\mathop{\rm
Lip}\nolimits([0,\ell];(Y,{\sf d})),\ \gamma(0)=y_{0},\ \gamma(\ell)=y_{1},\
|\dot{\gamma}|_{\sf d}\leq 1\text{ a.e.}\Big{\\}}.$ (2.66)

Clearly we have

${\sf d}(y_{0},y_{1})\leq{\sf d}_{X,\ell}(y_{0},y_{1})\leq{\sf
d}_{Y,\ell}(y_{0},y_{1})\quad\text{for every }y_{0},y_{1}\in Y.$ (2.67)

If $g:X\to[0,+\infty]$ is a Borel function, the integral of $g$ along $\gamma$
is defined by

$\int_{\gamma}g:=\int_{a}^{b}g(\gamma(t))|\dot{\gamma}|_{\sf
d}(t)\,{\mathrm{d}}t.$ (2.68)

It is well known that length and integral are invariant with respect to arc-
length reparametrization of $\gamma$ and it is always possible to find a
$1$-Lipschitz curve $R_{\gamma}:[0,\ell_{\sf d}(\gamma)]\to X$ such that

$R_{\gamma}(\ell_{\sf d}(\gamma,[a,t])=\gamma(t)\text{ for every
}t\in[a,b],\quad|\dot{R}_{\gamma}|(s)=1\text{ a.e.\leavevmode\nobreak\ in
$[0,\ell_{\sf d}(\gamma)]$},\quad\int_{R_{\gamma}}g=\int_{\gamma}g$ (2.69)

for every nonnegative Borel function $g$ (see e.g. [42, Section 3.3]). A Borel
function $g:X\to[0,+\infty]$ is an upper gradient of $f:X\to\mathbb{R}$ if

$|f(\gamma(b))-f(\gamma(a))|\leq\int_{\gamma}g\quad\text{for every
$\gamma\in\mathop{\rm Lip}\nolimits([a,b];(X,{\sf d}))$.}$ (2.70)

Functions in $\mathcal{L}^{p}(X,\mathfrak{m})$ which admits an upper gradient
in $\mathcal{L}^{p}(X,\mathfrak{m})$ characterize the Newtonian Sobolev space
$N^{1,p}(X,{\sf d},\mathfrak{m})$ [11, 27]. We state here a useful consequence
of the main equivalence results [6, Theorem 6.2] [5, Theorem 7.4].

######  Theorem 2.21.

Let $Y$ be a Borel subset of $X$ of full $\mathfrak{m}$-measure (i.e.
$\mathfrak{m}(X\setminus Y)=0$) satisfying

$\gamma\in\mathop{\rm Lip}\nolimits([a,b];(X,{\sf d})),\quad R_{\gamma}(s)\in
Y\ \text{for ${\mathscr{L}}^{1}$-a.e.\leavevmode\nobreak\ $s\in[0,\ell_{\sf
d}(\gamma)]$}\quad\Rightarrow\quad\gamma([a,b])\subset Y,$ (2.71)

let $f:X\to\mathbb{R}$ be a $\mathfrak{m}$-measurable function and let
$g:Y\to[0,+\infty]$ be a Borel function satisfying

$|f(\gamma(b))-f(\gamma(a))|\leq\int_{\gamma}g\quad\text{for every
$\gamma\in\mathop{\rm Lip}\nolimits([a,b];(Y,{\sf d}))$}.$ (2.72)

If $\displaystyle\int_{Y}|g|^{p}\,{\mathrm{d}}\mathfrak{m}<\infty$ then $f$
has a $p$-relaxed gradient and

$|{\mathrm{D}}f|_{\star}\leq
g\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in }Y.$ (2.73)

Notice that condition (2.72) is weaker than (2.70), since the upper gradient
condition is imposed only along curves taking values in $Y$; however, starting
from any function $g\in\mathcal{L}^{p}(Y,\mathfrak{m})$ satisfying (2.72) we
can define a new Borel function $\tilde{g}:X\to[0,+\infty]$ whose restriction
to $Y$ coincides with $g$ such that $\tilde{g}\lower 3.0pt\hbox{$|_{X\setminus
Y}$}\equiv+\infty$. Clearly

$\int_{X}\tilde{g}^{p}\,{\mathrm{d}}\mathfrak{m}=\int_{Y}g^{p}\,{\mathrm{d}}\mathfrak{m}<+\infty\quad\text{since
}\mathfrak{m}(X\setminus Y)=0.$

Moreover $\tilde{g}$ is an upper gradient for $f$ according to (2.70): in fact
it is sufficient to check (2.70) for those curves $\gamma$ with
$\gamma=R_{\gamma}$ and $\displaystyle\int_{\gamma}\tilde{g}<+\infty$; since
$\tilde{g}(\gamma(s))=+\infty$ if $\gamma(s)\not\in Y$, we deduce that
$\gamma(s)\in Y$ for $\mathfrak{m}$-a.e. $s\in[0,\ell_{\sf d}(\gamma)]$ so
that $\gamma\in\mathop{\rm Lip}\nolimits([0,\ell_{\sf d}(\gamma)];(Y,{\sf
d}))$ by (2.71), and (2.70) then follows by (2.72).

It is also immediate to check that (2.71) holds if $Y$ is closed.

We consider the situation where

  1. (A)

$Y\subset X$ is a Borel set with full $\mathfrak{m}$-measure satisfying
(2.71);

  2. (B)

a metric ${\delta}:Y\times Y\to[0,+\infty)$ is given on $Y$ such that
$(Y,{\delta})$ is complete and separable and (recall Remark 2.8)

${\sf d}_{1}(y_{1},y_{2})\leq{\delta}(y_{1},y_{2})\leq{\sf
d}_{Y,\ell}(y_{1},y_{2})\quad\text{for every }y_{1},y_{2}\in Y.$ (2.74)

######  Remark 2.22 ($Y$-intrinsic distance).

$\delta$ is intrinsically equivalent to ${\sf d}$ on $Y$, i.e. every ${\sf
d}$-Lipschitz curve $\gamma:[0,1]\to Y$ is also ${\delta}$-Lipschitz, its
${\delta}$-length coincides with the corresponding ${\sf d}$-length, and
integration along $\gamma$ does not depend on the choice of the distance. In
particular condition (2.72) can be equivalently stated in terms of ${\delta}$.
To see that these conditions are implied by (2.74), let us fix a ${\sf
d}$-Lipschitz curve $\gamma:[0,1]\to Y$ with Lipschitz constant bounded by
$L\geq 0$; then

${\sf d}_{Y,\ell}(\gamma(s),\gamma(t))\leq\ell_{\sf
d}\left(\gamma|_{[s,t]}\right)=\int_{s}^{t}|\dot{\gamma}|_{\sf
d}(r)\,{\mathrm{d}}r\leq L|t-s|\quad 0\leq s\leq t\leq 1,$

so that $\gamma$ is ${\sf d}_{Y,\ell}$-Lipschitz continuous and thus, by
(2.74), also ${\delta}$-Lipschitz continuous. To see that the ${\delta}$ and
the ${\sf d}$-lengths of $\gamma$ coincide, it is enough to show that
$\ell_{\delta}(\gamma)\leq\ell_{\sf d}(\gamma)$, since (2.74) and the trivial
equality $\ell_{{\sf d}_{1}}(\gamma)=\ell_{{\sf d}}(\gamma)$ already give the
other inequality; by $\eqref{eq:39}$ we immediately have
$\ell_{{\delta}}(\gamma)\leq\ell_{{\sf d}_{Y,\ell}}(\gamma)$ and by the very
definition of ${\sf d}_{Y,\ell}$ we see that $\ell_{{\sf
d}_{Y,\ell}}(\gamma)\leq\ell_{{\sf d}}(\gamma)$. Finally, to see that the
integral along $\gamma$ does not depend on the choice of the distance, it is
enough to see that $|\dot{\gamma}|_{\sf d}=|\dot{\gamma}|_{\delta}$ a.e. in
$[0,1]$. The $\leq$ inequality is an immediate consequence of (2.74) and
(2.63), while the $\geq$ follows by

$\frac{\delta(\gamma(s),\gamma(t))}{t-s}\leq\frac{\ell_{\delta}(\gamma|_{[s,t]})}{t-s}=\frac{\ell_{\sf
d}(\gamma|_{[s,t]})}{t-s}=\frac{1}{t-s}\int_{s}^{t}|\dot{\gamma}|_{\sf
d}(r)\,{\mathrm{d}}r\quad 0\leq s<t\leq 1,$

and passing to the limit as $s\to t$ for every Lebesgue point $t$ of
$|\dot{\gamma}|_{\sf d}$.

Since $\mathfrak{m}(X\setminus Y)=0$ we can identify $L^{p}(Y,\mathfrak{m})$
with $L^{p}(X,\mathfrak{m})$. In general, the topology induced by ${\delta}$
is finer than the ${\sf d}$ topology on $Y$, and they coincide if ${\delta}$
is continuous w.r.t. ${\sf d}$. It is also clear from property (B) that the
restriction to $Y$ of every bounded ${\sf d}$-Lipschitz function
$f:X\to\mathbb{R}$ is also ${\delta}$-Lipschitz. Thanks to (2.74) (which in
particular implies that $\delta$-balls of radius $r<1$ centered at some point
$y\in Y$ are included in ${\sf d}$-balls of the same radius and with the same
center) it is also clear that

$\mathop{\rm lip}\nolimits_{{\delta}}f(y)\leq\mathop{\rm lip}\nolimits_{\sf
d}f(y)\quad\text{for every }y\in Y,\ f\in\mathop{\rm Lip}\nolimits_{b}(X,{\sf
d}).$ (2.75)

Since $\mathop{\rm lip}\nolimits_{{\delta}}f$ is bounded and $\delta$-u.s.c.
in $Y$, it is $\mathfrak{m}$-measurable and we can define the ${\delta}$ pre-
Cheeger energy

$\mathsf{pC\kern-1.0ptE}_{p,{\delta}}(f):=\int_{Y}|\mathop{\rm
lip}\nolimits_{{\delta}}f(y)|^{p}\,{\mathrm{d}}\mathfrak{m}(y)$ (2.76)

and we can still consider its l.s.c. envelope in $L^{0}(Y,\mathfrak{m})$

$\mathsf{C\kern-1.0ptE}_{p,{\delta},\mathscr{A}}(f):=\inf\Big{\\{}\liminf_{n\to\infty}\mathsf{pC\kern-1.0ptE}_{p,{\delta}}(f_{n}):f_{n}\in\mathscr{A},\
f_{n}\to f\ \text{in }L^{0}(X,\mathfrak{m})\Big{\\}}.$ (2.77)

When $\mathscr{A}=\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$ we simply write
$\mathsf{C\kern-1.0ptE}_{p,{\delta}}(f)$.

######  Theorem 2.23.

If $\mathscr{A}$ is a separating unital subalgebra of $\mathop{\rm
Lip}\nolimits_{b}(X,{\sf d})$ satisfying (2.37) and $(Y,\delta)$ satisfies the
conditions (A), (B) above, we have

$\mathsf{C\kern-1.0ptE}_{p,{\delta}}(f)=\mathsf{C\kern-1.0ptE}_{p,{\delta},\mathscr{A}}(f)=\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\mathsf{C\kern-1.0ptE}_{p}(f)\quad\text{
for every }f\in L^{0}(X,\mathfrak{m}).$ (2.78)

In particular, the minimal $p$-relaxed gradients of $f\in
L^{0}(X,\mathfrak{m})$ computed w.r.t. $(\delta,\mathscr{A})$,
$(\delta,\mathop{\rm Lip}_{b}\nolimits(Y))$, $({\sf d},\mathscr{A})$ or $({\sf
d},\mathop{\rm Lip}_{b}\nolimits(X))$ coincide and we have
$D^{1,p}(Y,{\delta},\mathfrak{m})=D^{1,p}(Y,{\delta},\mathfrak{m};\mathscr{A})=D^{1,p}(X,{\sf
d},\mathfrak{m})=D^{1,p}(X,{\sf d},\mathfrak{m};\mathscr{A}).$

###### Proof.

Since $\mathsf{pC\kern-1.0ptE}_{p,{\delta}}(f)\leq\int_{X}\big{(}\mathop{\rm
lip}\nolimits_{\sf d}f(x)\big{)}^{p}\,{\mathrm{d}}\mathfrak{m}$ for every
$f\in\mathop{\rm Lip}\nolimits_{b}(X,{\sf d})$, we clearly have

$\mathsf{C\kern-1.0ptE}_{p,{\delta}}(f)\leq\mathsf{C\kern-1.0ptE}_{p,{\delta},\mathscr{A}}(f)\leq\mathsf{C\kern-1.0ptE}_{p,\mathscr{A}}(f)=\mathsf{C\kern-1.0ptE}_{p}(f)\quad\text{for
every $f\in L^{0}(X,\mathfrak{m})$},$

where the last equality follows from Corollary 2.13. It is then sufficient to
prove that
$\mathsf{C\kern-1.0ptE}_{p,{\delta}}(f)\geq\mathsf{C\kern-1.0ptE}_{p}(f)$ in
order to get (2.78). Using (2.77) and the $L^{0}(X,\mathfrak{m})$-lower
semicontinuity of $\mathsf{C\kern-1.0ptE}_{p}$ (see Remark 2.4), the latter
inequality will be a consequence of

$\int_{Y}|\mathop{\rm
lip}\nolimits_{{\delta}}f(y)|^{p}\,{\mathrm{d}}\mathfrak{m}(y)\geq\mathsf{C\kern-1.0ptE}_{p}(f)\quad\text{for
every }f\in\mathop{\rm Lip}\nolimits_{b}(X,{\sf d}).$ (2.79)

In order to prove (2.79) it is sufficient to apply Theorem 2.21 and prove that
the Borel function $g:=\mathop{\rm lip}\nolimits_{{\delta}}f$ satisfies
(2.72). Now we use the fact that the restriction to $Y$ of a function
$f\in\mathop{\rm Lip}\nolimits_{b}(X)$ belongs to $\mathop{\rm
Lip}\nolimits_{b}(Y,{\delta})$ and every ${\sf d}$-Lipschitz curve $\gamma$
with values in $Y$ is also ${\delta}$-Lipschitz, the respective length
coincide and therefore also the arc-length reparametrizations are the same.
Since $\mathop{\rm lip}\nolimits_{\delta}$ is an upper gradient we thus obtain

$|f(\gamma(b))-f(\gamma(a))|\leq\int_{\gamma}\mathop{\rm
lip}\nolimits_{\delta}f.\qed$

Combining Theorem 2.23 with Corollary 2.19 we recover the following result of
[29].

######  Corollary 2.24.

Let $(\mathbb{M},{\sf d}_{\mathbb{M}})$ be a complete Riemannian manifold
endowed with the canonical Riemannian distance and let $\mathfrak{m}$ be a
finite and positive Borel measure on $\mathbb{M}$. Then
$H^{1,2}(\mathbb{M},{\sf d}_{\mathbb{M}},\mathfrak{m})$ is a Hilbert space and
${\mathrm{C}}^{\infty}_{c}(\mathbb{M})$ is dense in $H^{1,2}(\mathbb{M},{\sf
d}_{\mathbb{M}},\mathfrak{m})$.

###### Proof.

By Nash isometric embedding Theorem [34] we can find a dimension $d$, and an
isometric embedding
$\jmath:\mathbb{M}\to\jmath(\mathbb{M})\subset\mathbb{R}^{d}$.

Since $\mathbb{M}$ is complete and $\jmath$ is an imbedding,
$M:=\jmath(\mathbb{M})$ is a closed subset of $\mathbb{R}^{d}$ and the
(Riemannian) metric ${\sf d}_{M}$ inherited by ${\sf d}_{\mathbb{M}}$ given by
${\sf d}_{M}(\jmath(x),\jmath(y)):={\sf d}_{\mathbb{M}}(x,y)$ is an isometry.
In particular ${\sf d}_{M}$ induces on $M$ the relative topology of
$\mathbb{R}^{d}$ and $(M,{\sf d}_{M})$ is a complete and separable metric
space. Setting $\tilde{\mathfrak{m}}:=\jmath_{\sharp}\mathfrak{m}$, it is
clear that the map $\jmath^{*}:f\to f\circ\jmath$ is a linear isometric
isomorphism between $H^{1,2}(M,{\sf d}_{M},\tilde{\mathfrak{m}})$ and
$H^{1,2}(\mathbb{M},{\sf d}_{\mathbb{M}},\mathfrak{m})$. It is then sufficient
to prove the statement for $H^{1,2}(M,{\sf d}_{M},\tilde{\mathfrak{m}})$.

We can now apply Theorem 2.23 with the choices $(Y,{\delta}):=(M,{\sf d}_{M})$
and $X=\mathbb{R}^{d}$ endowed with the Euclidean distance ${\sf d}$.
Condition (A) clearly holds since $M$ is closed in $\mathbb{R}^{d}$.
Similarly, also (B) holds since $\jmath$ is an isometric immersion.

Remark 2.20 shows that ${\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})$ is dense in
$H^{1,2}(\mathbb{R}^{d},{\sf d}_{\mathbb{R}^{d}},\tilde{\mathfrak{m}})$ so
that
$\jmath^{*}\big{(}{\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})\big{)}\subset{\mathrm{C}}_{c}^{\infty}(\mathbb{M})$
is dense in $H^{1,2}(\mathbb{M},{\sf d}_{\mathbb{M}},\mathfrak{m}).$ ∎

##  3\. Wasserstein spaces

In this section we list some properties of Wasserstein spaces we will use in
the sequel. A complete account of this matter can be found e.g. in [47, 4].
If $(X,{\sf d})$ is a complete and separable metric space, we denote by
$\mathcal{P}(X)$ the space of Borel probability measures on $X$ and by
$\mathcal{P}_{2}(X)$, the set

$\mathcal{P}_{2}(X):=\left\\{\mu\in\mathcal{P}(X)\mid\int_{X}{\sf
d}^{2}(x,x_{0}){\mathrm{d}}\mu(x)<+\infty\text{ for some }x_{0}\in
X\right\\}.$

Given $\mu,\nu\in\mathcal{P}(X)$ the set of transport plans between $\mu$ and
$\nu$ is denoted by $\Gamma(\mu,\nu)$ and defined as

$\Gamma(\mu,\nu):=\left\\{{\mbox{\boldmath$\mu$}}\in\mathcal{P}(X\times
X)\mid\pi^{1}_{\sharp}{\mbox{\boldmath$\mu$}}=\mu,\,\pi^{2}_{\sharp}{\mbox{\boldmath$\mu$}}=\nu\right\\},$

where $\pi^{i}(x_{1},x_{2})=x_{i}$ for every $(x_{1},x_{2})\in X\times X$ and
$\sharp$ denotes the push forward operator. The $L^{2}$-Wasserstein distance
$W_{2}$ between $\mu,\nu\in\mathcal{P}_{2}(X)$ is defined as

$W_{2}^{2}(\mu,\nu):=\inf\left\\{\int_{X\times X}{\sf
d}^{2}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}\mid{\mbox{\boldmath$\mu$}}\in\Gamma(\mu,\nu)\right\\}.$

It is well known that the infimum above is attained in a non-empty and convex
set $\Gamma_{o}(\mu,\nu)\subset\Gamma(\mu,\nu)$; elements of
$\Gamma_{o}(\mu,\nu)$ are called optimal transport plans.

The space $(\mathcal{P}_{2}(X),W_{2})$ is complete and separable and its
topology is stronger than the narrow topology, the latter being defined as the
coarsest topology on $\mathcal{P}(X)$ making the maps

$\mu\mapsto\int_{X}\varphi\,{\mathrm{d}}\mu$

continuous for every $\varphi\in{\mathrm{C}}_{b}(X)$, the space of continuous
and bounded functions on $X$. In particular, for a sequence
$(\mu_{n})_{n}\subset\mathcal{P}_{2}(X)$ and a point
$\mu\in\mathcal{P}_{2}(X)$, we have

$W_{2}(\mu_{n},\mu)\to 0\Leftrightarrow\begin{cases}&\displaystyle\int_{X}{\sf
d}^{2}(x,x_{0}){\mathrm{d}}\mu_{n}(x)\to\int_{\mathbb{R}^{d}}{\sf
d}^{2}(x,x_{0}){\mathrm{d}}\mu(x)\quad\text{ for some }x_{0}\in X,\\\
&\mu_{n}\to\mu\quad\text{narrowly in }\mathcal{P}(X).\end{cases}$ (3.1)

where we denoted by $\mu_{n}\rightharpoonup\mu$ the narrow convergence of
$\mu_{n}$ to $\mu$. Moreover, the Wasserstein distance is narrowly lower
semicontinuous, meaning that, if $(\mu_{n})_{n}$ and $(\mu^{\prime}_{n})_{n}$
are two sequences in $\mathcal{P}_{2}(X)$,
$\mu,,\mu^{\prime}\in\mathcal{P}_{2}(X)$ and $\mu_{n}\to\mu$,
$\mu^{\prime}_{n}\to\mu^{\prime}$ narrowly in $\mathcal{P}(X)$, then we have

$\liminf_{n\to\infty}W_{2}(\mu_{n},\mu^{\prime}_{n})\geq
W_{2}(\mu,\mu^{\prime}).$

The following Theorem is [4, Theorem 8.3.1, Proposition 8.4.5 and Proposition
8.4.6] in case $X=\mathbb{R}^{d}$. Recall that for every
$\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$

$\operatorname{Tan}_{\mu}\mathcal{P}_{2}(\mathbb{R}^{d}):={}\overline{\\{\nabla\varphi\mid\varphi\in{\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})\\}}^{L^{2}(\mathbb{R}^{d},\mu;\mathbb{R}^{d})}.$
(3.2)

######  Theorem 3.1 (Wasserstein velocity field).

Let $\mu:\mathcal{J}\to\mathcal{P}_{2}(\mathbb{R}^{d})$ be a locally
absolutely continuous curve defined in an open interval
$\mathcal{J}\subset\mathbb{R}$. There exists a Borel vector field
$v:\mathcal{J}\times\mathbb{R}^{d}\to\mathbb{R}^{d}$ and a set
$A(\mu)\subset\mathcal{J}$ with $\mathcal{L}(\mathcal{J}\setminus A(\mu))=0$
such that for every $t\in A(\mu)$

$\begin{gathered}v_{t}\in\operatorname{Tan}_{\mu_{t}}\mathcal{P}_{2}(\mathbb{R}^{d}),\quad\int_{\mathbb{R}^{d}}|v_{t}|^{2}\,{\mathrm{d}}\mu_{t}=|\dot{\mu}_{t}|^{2}=\lim_{h\to
0}\frac{W_{2}^{2}(\mu_{t+h},\mu_{t})}{h^{2}},\end{gathered}$

and the continuity equation

$\partial_{t}\mu_{t}+\nabla\cdot(v_{t}\mu_{t})=0$

holds in the sense of distributions in $\mathcal{J}\times\mathbb{R}^{d}$.
Moreover, $v_{t}$ is uniquely determined in
$L^{2}(\mathbb{R}^{d},\mu_{t};\mathbb{R}^{d})$ for $t\in A(\mu)$ and

$\lim_{h\to
0}\frac{W_{2}(({\mbox{\boldmath$i$}}_{\mathbb{R}^{d}}+hv_{t})_{\sharp}\mu_{t},\mu_{t+h})}{|h|}=0\quad\text{for
every }t\in A(\mu).$ (3.3)

###  3.1. Kantorovich duality and estimates for Kantorovich potentials

The Kantorovich duality for the Wasserstein distance states that

$W_{2}^{2}(\mu,\nu)=\sup\left\\{\int_{X}u\,{\mathrm{d}}\mu+\int_{X}v\,{\mathrm{d}}\nu\mid(\varphi,\psi)\in\text{Adm}_{2}(X)\right\\}\quad\text{
for every }\mu,\nu\in\mathcal{P}_{2}(X),$ (3.4)

where $\text{Adm}_{2}(X)$ is the set of pairs
$(u,v)\in{\mathrm{C}}_{b}(X)\times{\mathrm{C}}_{b}(X)$ such that

$u(x)+v(y)\leq{\sf d}^{2}(x,y)\quad\text{ for every }x,y\in X.$

It is easy to check that for every $f\in\mathop{\rm Lip}\nolimits(X,{\sf d})$

$\int_{X}f\,{\mathrm{d}}(\mu-\nu)\leq\mathop{\rm
Lip}\nolimits(f,X)W_{2}(\mu,\nu),$ (3.5)

since choosing ${\mbox{\boldmath$\mu$}}\in\Gamma_{o}(\mu,\nu)$ and setting
$L:=\mathop{\rm Lip}\nolimits(f,X)$,

$\displaystyle\int_{X}f\,{\mathrm{d}}(\mu-\nu)=\int(f(x)-f(y))\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}(x,y)\leq
L\int{\sf d}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}\leq L\Big{(}\int{\sf
d}^{2}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}\Big{)}^{1/2}=LW_{2}(\mu,\nu).$

When $X=\mathbb{R}^{d}$, we denote by $\mathcal{P}_{2}^{r}(\mathbb{R}^{d})$
the subset of $\mathcal{P}_{2}(\mathbb{R}^{d})$ of probability measures that
are absolutely continuous w.r.t. the $d$-dimensional Lebesgue measure. We also
set

$\mathsf{m}_{2}^{2}(\mu):=\int_{\mathbb{R}^{d}}|x|^{2}\,{\mathrm{d}}\mu(x)=W_{2}^{2}(\mu,\delta_{0}).$
(3.6)

The next result uses the celebrated Brenier-Knott-Smith Theorem [46, Section
3] to collect various useful properties of the optimal potentials realizing
the supremum in (3.4) in a particular geometric situation. We will use the
elementary property that

$\text{if $u:\overline{B(0,R)}\to[-\infty,+\infty)$ is concave with
$u(0)>-\infty$
then}\quad\sup_{\overline{{\mathrm{B}}(0,R)}}u=\sup_{{\mathrm{B}}(0,R)}u,$
(3.7)

which follows by the fact that for every $y_{0}\in\partial{\mathrm{B}}(0,R)$
the concavity of $t\mapsto u(ty_{0})$ in $[0,1]$ yields
$u(y_{0})\leq\sup_{0\leq t<1}u(ty_{0})$.

######  Theorem 3.2.

Let $\mu,\nu\in\mathcal{P}_{2}^{r}(\mathbb{R}^{d})$ with $\mathop{\rm
supp}\nolimits{\nu}=\overline{{\mathrm{B}}(0,R)}$ for some $R>0$. Then there
exists a unique pair of continuous and convex functions

$\varphi=\Phi(\nu,\mu):{\mathrm{B}}(0,R)\to\mathbb{R},\quad\varphi^{*}=\Phi^{*}(\nu,\mu):\mathbb{R}^{d}\to\mathbb{R}$
(3.8)

such that

  1. (i)

$\varphi^{*}$ is $R$-Lipschitz and

$\displaystyle\displaystyle\varphi^{*}(y)$
$\displaystyle=\sup_{x\in{\mathrm{B}}(0,R)}{\langle}x,y{\rangle}-\varphi(x)$
$\displaystyle\text{for every $y\in\mathbb{R}^{d}$},$ (3.9)
$\displaystyle\varphi(x)$
$\displaystyle=\sup_{y\in\mathbb{R}^{d}}{\langle}y,x{\rangle}-\varphi^{*}(y)$
$\displaystyle\text{for every }x\in{\mathrm{B}}(0,R),$ (3.10)

  2. (ii)

$\displaystyle\varphi^{*}(0)=\inf_{{\mathrm{B}}(0,R)}\varphi=0$,

  3. (iii)

$\displaystyle\int_{{\mathrm{B}}(0,R)}\varphi\,{\mathrm{d}}\nu+\int_{\mathbb{R}^{d}}\varphi^{*}\,{\mathrm{d}}\mu=\frac{1}{2}\mathsf{m}_{2}^{2}(\nu)+\frac{1}{2}\mathsf{m}_{2}^{2}(\mu)-\frac{1}{2}W_{2}^{2}(\nu,\mu)$.

Moreover the pair $(\varphi,\varphi^{*})$ satisfies

$\displaystyle
W_{2}^{2}(\mu,\nu)=\int_{{\mathrm{B}}(0,R)}\left|x-\nabla\varphi(x)\right|^{2}{\mathrm{d}}\nu(x)=\int_{\mathbb{R}^{d}}\left|y-\nabla\varphi^{*}(y)\right|^{2}{\mathrm{d}}\mu(y).$
(3.11)

###### Proof.

Let us set $D:={\mathrm{B}}(0,R)$. We know (see e.g. [46, Theorem 2.9, Lemma
2.10]) that there exists a convex and lower semicontinuous function
$\phi:\overline{D}\to(-\infty,+\infty]$ such that the pair $(\phi,\phi^{*})$
satisfies

$\int_{\overline{D}}\phi\,{\mathrm{d}}\nu+\int_{\mathbb{R}^{d}}\phi^{*}\,{\mathrm{d}}\mu=\frac{1}{2}\mathsf{m}_{2}^{2}(\nu)+\frac{1}{2}\mathsf{m}_{2}^{2}(\mu)-\frac{1}{2}W_{2}^{2}(\nu,\mu),$
(3.12)

where

$\phi^{*}(y):=\sup_{x\in\overline{D}}{\langle}x,y{\rangle}-\phi(x)=\max_{x\in\overline{D}}{\langle}x,y{\rangle}-\phi(x).$
(3.13)

Recalling that $\phi$ is bounded from below by an affine mapping (and thus it
is uniformly bounded from below in $\overline{D}$) we immediately see that
$\phi^{*}$ takes values in $\mathbb{R}$ and it is $R$-Lipschitz. Up to adding
a suitable constant to $\phi$ we can also suppose that $\phi^{*}(0)=0$.

We want to show that the restriction $\varphi$ of $\phi$ to
${\mathrm{B}}(0,R)$ combined with $\phi^{*}$ satisfies conditions (i), (ii),
and (iii).

(i): Since $\int_{\overline{D}}\phi\,{\mathrm{d}}\nu<+\infty$ and $\nu$ has
full support, we deduce that the proper domain of $\phi$
$\\{x\in\overline{D}:\phi(x)<+\infty\\}$ is dense in $\overline{D}$; since the
proper domain of a l.s.c. and convex function is convex and contains the
interior of its closure, we deduce that $\phi(x)<+\infty$ for every $x\in D$
and $\varphi:=\phi\lower 3.0pt\hbox{$|_{D}$}$ is continuous in $D$.

(3.7) shows that the supremum defining $\phi^{*}$ in (3.13) can be restricted
to $D$

$\phi^{*}(y)=\sup_{x\in D}{\langle}x,y{\rangle}-\varphi(x),$ (3.14)

so that (3.9) holds. (3.10) is just an application of Fenchel-Moreau Theorem
$\phi=\phi^{**}$.

(ii): simply follows by (3.9) and the fact that $-\phi^{*}(0)=0$.

(iii) It is sufficient to notice that the first integral in (3.12) can be
restricted to $D$ since $\nu(\partial D)=0$. The equality (3.11) follows by
[46, Theorem 2.12].

Let us show that points (i)-(iii) are also sufficient to get uniqueness. If
$(\varphi_{0},\varphi_{0}^{*})$ is another pair as in the statement satisfying
points (i)-(iii), then [46, Theorem 2.12] yields that both $\nabla\varphi$ and
$\nabla\varphi_{0}$ are optimal transport maps from $\nu$ to $\mu$, implying
that $\nabla\varphi_{0}=\nabla\varphi$ $\mathcal{L}^{d}$-a.e. in
${\mathrm{B}}(0,R)$ by the a.e. uniqueness of the optimal transport map. Since
$\inf_{{\mathrm{B}}(0,R)}\varphi=\inf_{{\mathrm{B}}(0,R)}\varphi_{0}=0$ by
$(ii)$, we get that $\varphi=\varphi_{0}$ in ${\mathrm{B}}(0,R)$ and therefore
$\varphi^{*}=\varphi^{*}_{0}$ in $\mathbb{R}^{d}$ by (3.9). ∎

The next Lemma collects useful estimates on convex functions; we set
$\omega_{d}:={\mathscr{L}}^{d}\big{(}{\mathrm{B}}(0,1)\big{)}$.

######  Lemma 3.3.

Let $R,I>0$ and let $\varphi:{\mathrm{B}}(0,R)\to\mathbb{R}$,
$\psi:\mathbb{R}^{d}\to\mathbb{R}$, be two (continuous and) convex functions
satisfying

$\begin{gathered}|\psi(y)|\leq R|y|\quad\text{for every
}y\in\mathbb{R}^{d},\\\
\varphi(x)=\sup_{y\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-\psi(y)\ \text{for
every
}x\in{\mathrm{B}}(0,R),\quad\int_{{\mathrm{B}}(0,R)}\varphi(x)\,{\mathrm{d}}x\leq
I.\end{gathered}$ (3.15)

Then $\varphi$ is nonnegative and satisfy the uniform bounds

$\sup_{|x|\leq r}\varphi(x)\leq\frac{I}{\omega_{d}(R-r)^{d}},\quad\mathop{\rm
Lip}\nolimits\big{(}\varphi,\overline{{\mathrm{B}}(0,r)}\big{)}\leq\frac{2^{d+1}I}{\omega_{d}(R-r)^{d+1}}\quad
0<r<R,$ (3.16)

and

$\text{$\psi$ is
$R$-Lipschitz,}\quad\psi(y)=\sup_{x\in{\mathrm{B}}(0,R)}{\langle}y,x{\rangle}-\varphi(x)\quad\text{for
every }y\in\mathbb{R}^{d}.$ (3.17)

###### Proof.

Notice that $\psi(0)=0$ yields $\varphi\geq 0$; the integral estimate of
(3.15) and Jensen inequality yield for every $x\in{\mathrm{B}}(0,R)$ with
$\varrho:=R-|x|$

$\varphi(x)\leq\frac{1}{\omega_{d}\varrho^{d}}\int_{{\mathrm{B}}(x,\varrho)}\varphi(z)\,{\mathrm{d}}z\leq\frac{I}{\omega_{d}\varrho^{d}},\quad\text{so
that}\quad\max_{|x|\leq
r_{0}}\varphi(x)\leq\frac{I}{\omega_{d}(R-r_{0})^{d}}\,$ (3.18)

for every $0<r_{0}<R$. Still using the fact that $\varphi$ is nonnegative,
(3.18) with $r_{0}:=\frac{1}{2}R+\frac{1}{2}r$ and the estimate of [21,
Corollary 2.4] yield the Lipschitz bound of (3.16).

The Legendre transform of $\psi$ defined by
$\psi^{*}(x):=\sup_{y\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-\psi(y)$
coincides with $\varphi$ in ${\mathrm{B}}(0,R)$ (in particular it is finite in
${\mathrm{B}}(0,R)$) and takes the value $+\infty$ for every
$x\in\mathbb{R}^{d}$ with $|x|>R$, since

$\psi^{*}(x)\geq\sup_{y\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-R|y|=+\infty\quad\text{if
$|x|>R$}.$

Fenchel-Moreau Theorem and (3.7) then yield

$\psi(y)=\sup_{x\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-\psi^{*}(x)=\sup_{x\in\overline{{\mathrm{B}}(0,R)}}{\langle}x,y{\rangle}-\psi^{*}(x)=\sup_{x\in{\mathrm{B}}(0,R)}{\langle}x,y{\rangle}-\psi^{*}(x)=\sup_{x\in{\mathrm{B}}(0,R)}{\langle}x,y{\rangle}-\varphi(x)$

thus showing (3.17); in particular we get that that $\psi$ is $R$-Lipschitz. ∎

We conclude this part with the study of the stability properties of pairs of
potentials.

######  Lemma 3.4.

Let $R,I>0$ and let $\varphi_{n}:{\mathrm{B}}(0,R)\to\mathbb{R}$,
$\psi_{n}:\mathbb{R}^{d}\to\mathbb{R}$, $n\in\mathbb{N}$, be two sequences of
(continuous and) convex functions satisfying for every $n\in\mathbb{N}$:

$\begin{gathered}|\psi_{n}(y)|\leq R|y|\quad\text{for every
}y\in\mathbb{R}^{d},\\\
\varphi_{n}(x)=\sup_{y\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-\psi_{n}(y)\
\text{for every
}x\in{\mathrm{B}}(0,R),\quad\int_{{\mathrm{B}}(0,R)}\varphi_{n}(x)\,{\mathrm{d}}x\leq
I.\end{gathered}$ (3.19)

Then there exist a subsequence $j\mapsto n(j)$ and two convex and continuous
functions $\varphi:{\mathrm{B}}(0,R)\to\mathbb{R}$ and
$\psi:\mathbb{R}^{d}\to\mathbb{R}$ such that

  * (i)

$\varphi_{n(j)}\to\varphi$ locally uniformly on ${\mathrm{B}}(0,R)$;

  * (ii)

$\psi_{n(j)}\to\psi$ locally uniformly in $\mathbb{R}^{d}$;

  * (iii)

$\psi$ is $R$-Lipschitz and $\nabla\psi_{n(j)}\to\nabla\psi$
$\mathcal{L}^{d}$-a.e. on $\mathbb{R}^{d}$.

Moreover the pair $(\varphi,\psi)$ satisfies (3.15), (3.16), and (3.17).

###### Proof.

Thanks to (3.19) and Lemma 3.3, the sequence of pairs $(\varphi_{n},\psi_{n})$
satisfies the equicontinuity estimates (3.16) and (3.17) with constants $R,I$
independent of $n$.

By Arzelà-Ascoli Theorem, we can find a subsequence $j\mapsto n(j)$ and convex
and continuous functions $\varphi:{\mathrm{B}}(0,R)\to\mathbb{R}$ and
$\psi:\mathbb{R}^{d}\to\mathbb{R}$ such that $\varphi_{n(j)}\to\varphi$ and
$\psi_{n(j)}\to\psi$ locally uniformly in their respective domains.

In particular, $\psi_{n(j)}$ Mosco converges (see e.g. [9, Definition 3.17,
Proposition 3.19]) to $\psi$ and therefore the sequence of its Legendre
transforms $\psi_{n(j)}^{*}$ Mosco converges to $\psi^{*}$ ([9, Theorem
3.18]). Since $\psi_{n}^{*}$ coincides with $\varphi_{n}$ in
${\mathrm{B}}(0,R)$ and $\varphi_{n(j)}$ converge locally uniformly to
$\varphi$, we deduce that $\varphi$ coincides with $\psi^{*}$ in
${\mathrm{B}}(0,R)$:

$\varphi(x)=\sup_{y\in\mathbb{R}^{d}}{\langle}x,y{\rangle}-\psi(y)\quad\text{for
every }x\in{\mathrm{B}}(0,R).$

By Fatou’s Lemma $\varphi$ also satisfies the integral bound of (3.15). A
further application of Lemma 3.3 yields (3.16) and (3.17).

Finally, the local uniform convergence of $\psi_{n(j)}$ to $\psi$ gives [38,
Theorem 24.5] the pointwise convergence of $\nabla\psi_{n(j)}(x)$ to
$\nabla\psi(x)$ at every point $x\in\mathbb{R}^{d}$ where all the
$\psi_{n(j)}$ and $\psi$ are differentiable. This proves (iii) and concludes
the proof of the Lemma. ∎

##  4\. The Wasserstein Sobolev space
$H^{1,2}(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2},\mathfrak{m})$

In this section we consider the metric space
${\mathcal{P}_{2}(\mathbb{R}^{d})}$, endowed with the $L^{2}$-Wasserstein
distance ${\sf d}=W_{2}$ and a finite positive Borel measure $\mathfrak{m}$.
We will denote by $\mathbb{W}_{2}=\mathbb{W}_{2}(\mathbb{R}^{d},\mathfrak{m})$
the metric-measure space
$(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2},\mathfrak{m})$ and we want to study
the Wasserstein Sobolev space $H^{1,2}(\mathbb{W}_{2})$.

We will show that $H^{1,2}(\mathbb{W}_{2})$ is Hilbertian (and therefore the
metric space $(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2})$ is infinitesimally
Hilbertian) and its functions admit a nice approximation in terms of the
distinguished algebra of cylinder functions.

###  4.1. The algebra of ${\mathrm{C}}^{1}$-cylinder functions

We denote by ${\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})$ the space of bounded and
Lipschitz ${\mathrm{C}}^{1}$ functions $\phi:\mathbb{R}^{d}\to\mathbb{R}$.
Every $\phi\in{\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})$ induces the function
$\mathsf{L}_{\phi}$ on $\mathcal{P}(\mathbb{R}^{d})$

$\mathsf{L}_{\phi}:\mu\to\int_{\mathbb{R}^{d}}\phi\,{\mathrm{d}}\mu$ (4.1)

which clearly belongs to $\mathop{\rm
Lip}\nolimits_{b}(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2})$ thanks to (3.5).
More generally, if
${\boldsymbol{\phi}}=(\phi_{1},\cdots,\phi_{N})\in\big{(}{\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})\big{)}^{N}$,
we denote by
$\mathsf{L}_{{\boldsymbol{\phi}}}:=(\mathsf{L}_{\phi_{1}},\cdots,\mathsf{L}_{\phi_{N}})$
the corresponding map from $\mathcal{P}_{2}(\mathbb{R}^{d})$ to
$\mathbb{R}^{N}$.

Our construction is based on the algebra of ${\mathrm{C}}^{1}$ cylinder
functions generated by (4.1) via composition with ${\mathrm{C}}^{1}$ functions
and it is quite similar to the one of [16, Section 2] (see also [48]). Working
in the flat space $\mathbb{R}^{d}$ allows for a further simplification in the
structure of the tangent bundle and of corresponding vector fields.

######  Definition 4.1 (${\mathrm{C}}^{1}$-Cylinder functions).

We say that a function $F:\mathcal{P}_{2}(\mathbb{R}^{d})\to\mathbb{R}$ is a
${\mathrm{C}}^{1}$-_cylinder function_ if there exist $N\in\mathbb{N}$,
$\psi\in{\mathrm{C}}_{b}^{1}(\mathbb{R}^{N})$ and
${\boldsymbol{\phi}}=(\phi_{1},\dots,\phi_{N})\in({\mathrm{C}}_{b}^{1}(\mathbb{R}^{d}))^{N}$
such that

$F(\mu)=\psi(\mathsf{L}_{{\boldsymbol{\phi}}}(\mu))=\psi\big{(}\mathsf{L}_{\phi_{1}}(\mu),\cdots,\mathsf{L}_{\phi_{N}}(\mu)\big{)}\quad\text{for
every }\mu\in\mathcal{P}_{2}(\mathbb{R}^{d}).$ (4.2)

We denote the set of such functions by
$\mathfrak{C}^{1}_{b}\big{(}\mathcal{P}_{2}(\mathbb{R}^{d})\big{)}$.

######  Remark 4.2.

Notice that
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$ is a
unital subalgebra of $\mathop{\rm
Lip}_{b}\nolimits(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2})$. One could also
consider the smaller algebra
$\operatorname{FC}^{1}_{b}\\!\\!\left({\mathcal{P}_{2}(\mathbb{R}^{d})}\right)$
(resp.
$\operatorname{FC}^{\infty}_{c}\\!\\!\left({\mathcal{P}_{2}(\mathbb{R}^{d})}\right)$)
generated by functions as in (4.1) (resp. by functionals as in (4.1) where
$\phi\in{\mathrm{C}}^{\infty}_{c}(\mathbb{R}^{d})$), thus restricting $\psi$
to be a polynomial in (4.2). We prefer at this stage the choice of
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$, since
it simplifies some technical points. However, the next Proposition 4.19 shows
that using
$\operatorname{FC}^{1}_{b}\\!\\!\left({\mathcal{P}_{2}(\mathbb{R}^{d})}\right)$
or
$\operatorname{FC}^{\infty}_{c}\\!\\!\left({\mathcal{P}_{2}(\mathbb{R}^{d})}\right)$
will lead to the same conclusions.

######  Remark 4.3.

Since for every
${\boldsymbol{\phi}}\in\big{(}{\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})\big{)}^{N}$
the range of $\mathsf{L}_{{\boldsymbol{\phi}}}$ is always contained in the
bounded set $[-M,M]^{N}$ where $M:=\max_{i=1,\dots,d}\|\phi_{i}\|_{\infty}$,
also functions $F=\psi\circ\mathsf{L}_{{\boldsymbol{\phi}}}$ with
$\psi\in{\mathrm{C}}^{1}(\mathbb{R}^{N})$ belong to
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$. Indeed
it is enough to consider a function
$\tilde{\psi}\in{\mathrm{C}}_{b}^{1}(\mathbb{R}^{N})$ coinciding with $\psi$
on $[-M,M]^{N}$ and equal to $0$ outside $[-M-1,M+1]^{N}$ so that
$F=\tilde{\psi}\circ\mathsf{L}_{{\boldsymbol{\phi}}}$. In particular every
function of the form $\mathsf{L}_{\phi}$,
$\phi\in{\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})$, belongs to
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$.

Let us consider the set

$\mathcal{D}:=\Big{\\{}(\mu,x)\in{\mathcal{P}_{2}(\mathbb{R}^{d})}\times\mathbb{R}^{d}:x\in\mathop{\rm
supp}\nolimits(\mu)\Big{\\}}.$ (4.3)

The set $\mathcal{D}$ is a Borel set (in fact it is a $G_{\delta}$): if
$(r_{n})_{n}=\mathbb{Q}\cap(0,+\infty)$ we have that
$\mathcal{D}=\cap_{n}\mathcal{D}_{n}$, where

$\mathcal{D}_{n}:=\left\\{(\mu,x)\in{\mathcal{P}_{2}(\mathbb{R}^{d})}\times\mathbb{R}^{d}:\mu({\mathrm{B}}(x,r_{n}))>0\right\\},$

and each $\mathcal{D}_{n}$ is open in
${\mathcal{P}_{2}(\mathbb{R}^{d})}\times\mathbb{R}^{d}$, being the inverse
image of $(0,+\infty)$ through the lower semicontinuous map
$(\mu,x)\mapsto\mu({\mathrm{B}}(x,r))$.

######  Definition 4.4.

If
$F=\psi\circ\mathsf{L}_{{\boldsymbol{\phi}}}\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$
as in (4.2) for some $N\in\mathbb{N}$,
$\psi\in{\mathrm{C}}_{b}^{1}(\mathbb{R}^{N})$ and
${\boldsymbol{\phi}}\in({\mathrm{C}}_{b}^{1}(\mathbb{R}^{d}))^{N}$, then the
Wasserstein differential of $F$,
${\mathrm{D}}F:\overline{\mathcal{D}}\to\mathbb{R}^{d}$, is defined by

$\displaystyle{\mathrm{D}}F(\mu,x)$
$\displaystyle:=\sum_{n=1}^{N}\partial_{n}\psi\left(\mathsf{L}_{{\boldsymbol{\phi}}}(\mu)\right)\nabla\phi_{n}(x),\quad(\mu,x)\in\overline{\mathcal{D}}.$
(4.4) We will also denote by ${\mathrm{D}}F[\mu]$ the function
$x\mapsto{\mathrm{D}}F(\mu,x)$ and we will set
$\displaystyle\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}^{2}$
$\displaystyle:=\int_{\mathbb{R}^{d}}|{\mathrm{D}}F[\mu](x)|^{2}{\mathrm{d}}\mu(x),\quad\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$
(4.5)

######  Remark 4.5.

It is not difficult to check that

${\mathrm{D}}F\text{ is continuous in }\overline{\mathcal{D}}$ (4.6)

with respect to the natural product (narrow and euclidean) topology of
$\mathcal{P}(\mathbb{R}^{d})\times\mathbb{R}^{d}$.

In principle ${\mathrm{D}}F$ (and thus
$\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}$) may depend on the choice
of $N\in\mathbb{N}$, $\psi\in{\mathrm{C}}_{b}^{1}(\mathbb{R}^{N})$ and
${\boldsymbol{\phi}}\in({\mathrm{C}}_{b}^{1}(\mathbb{R}^{d}))^{N}$ used to
represent $F$. In Proposition 4.9 we show that for every
$\mu\in\mathcal{P}_{2}(\mathbb{R}^{d})$ the function ${\mathrm{D}}F[\mu]$ is
uniquely characterized in $\mathop{\rm supp}\nolimits(\mu)$ and
$\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}$ is well defined, so that
${\mathrm{D}}F$ is uniquely characterized by $F$ in $\mathcal{D}$. By (4.6),
${\mathrm{D}}F$ is also uniquely characterized by $F$ on
$\overline{\mathcal{D}}$.

We have seen that the Wasserstein differential ${\mathrm{D}}F$ can be
considered as a map from $\overline{\mathcal{D}}$ with values in
$\mathbb{R}^{d}$. It is natural to introduce the measure
$\boldsymbol{\mathfrak{m}}=\int\delta_{\mu}\otimes\mu\,{\mathrm{d}}\mathfrak{m}(\mu)\in\mathcal{P}(\mathcal{P}_{2}(\mathbb{R}^{d})\times\mathbb{R}^{d})$
obtained integrating the measures $\mu$ w.r.t. $\mathfrak{m}$: for every
bounded Borel function
$H:\mathcal{P}_{2}(\mathbb{R}^{d})\times\mathbb{R}^{d}\to\mathbb{R}$ we have

$\int
H(\mu,x)\,{\mathrm{d}}\boldsymbol{\mathfrak{m}}(\mu,x)=\int_{\mathcal{P}_{2}(\mathbb{R}^{d})}\Big{(}\int_{\mathbb{R}^{d}}H(\mu,x)\,{\mathrm{d}}\mu(x)\Big{)}\,{\mathrm{d}}\mathfrak{m}(\mu).$
(4.7)

Since $\mathop{\rm
supp}\nolimits(\boldsymbol{\mathfrak{m}})\subset\overline{\mathcal{D}}$, it is
then clear that ${\mathrm{D}}F$ belongs to
$L^{2}(\mathcal{P}_{2}(\mathbb{R}^{d})\times\mathbb{R}^{d},\boldsymbol{\mathfrak{m}};\mathbb{R}^{d})$
and

$\int_{\mathcal{P}_{2}(\mathbb{R}^{d})}\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}^{2}\,{\mathrm{d}}\mathfrak{m}(\mu)=\int_{\overline{\mathcal{D}}}|{\mathrm{D}}F(\mu,x)|^{2}\,{\mathrm{d}}\boldsymbol{\mathfrak{m}}(\mu,x).$
(4.8)

######  Lemma 4.6.

Let $Y$ be a Polish space and let $G:\mathcal{P}(Y)\times Y\to[0,+\infty)$ be
a bounded and continuous function. If $(\mu_{n})_{n\in\mathbb{N}}$ is a
sequence in $\mathcal{P}(Y)$ narrowly converging to $\mu$ as $n\to+\infty$,
then

$\lim_{n\to\infty}\int_{Y}G(\mu_{n},y){\mathrm{d}}\mu_{n}(y)=\int_{Y}G(\mu,y){\mathrm{d}}\mu(y).$

###### Proof.

We set $g_{n}(x):=G(\mu_{n},x),\ g(x):=G(\mu,x)$. Since $G$ is continuous,
$g_{n}$ converge uniformly to $g$ on compact subsets of $Y$ as $n\to\infty$.
Thanks to [4, Lemma 5.2.1] $(g_{n})_{\sharp}\mu_{n}$ converge narrowly to
$g_{\sharp}\mu$ in $\mathcal{P}(\mathbb{R})$. On the other hand, the support
of $(g_{n})_{\sharp}\mu$ is uniformly bounded so that

$\lim_{n\to\infty}\int_{Y}G(\mu_{n},y){\mathrm{d}}\mu_{n}(y)=\lim_{n\to\infty}\int_{\mathbb{R}}r\,{\mathrm{d}}((g_{n})_{\sharp}\mu_{n})(r)=\int_{\mathbb{R}}r\,{\mathrm{d}}(g_{\sharp}\mu)(r)=\int_{Y}G(\mu,y)\,{\mathrm{d}}\mu(y).\qed$

######  Lemma 4.7.

Let
$F=\psi\circ\mathsf{L}_{{\boldsymbol{\phi}}}\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$
as in (4.2) and let $(\mu_{t})_{t\in[0,1]}$ be an absolutely continuous curve
in $\mathcal{P}_{2}(\mathbb{R}^{d})$. Then

$F(\mu_{1})-F(\mu_{0})=\int_{0}^{1}\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F[\mu_{t}](x),v_{t}(x){\rangle}{\mathrm{d}}\mu_{t}(x)\,{\mathrm{d}}t,$
(4.9)

where $v_{t}\in L^{2}(\mathbb{R}^{d},\mu_{t};\mathbb{R}^{d})$ is the
Wasserstein velocity field (cf. Theorem 3.1) of $(\mu_{t})_{t\in[0,1]}$ at
time $t$ and ${\mathrm{D}}F$ is as in (4.4).

In case the curve $(\mu_{t})_{t\in[0,1]}$ admits the parametrization

$\mu_{t}:=\big{(}\boldsymbol{x}_{t}\big{)}_{\sharp}\mu,\quad t\in[0,1],$

for some Borel probability measure $\mu$ in a Polish space $\Omega$ and some
map
$\boldsymbol{x}\in{\mathrm{C}}^{1}([0,1];L^{2}(\Omega,\mu;\mathbb{R}^{d}))$,
then $F\circ\mu\in{\mathrm{C}}^{1}([0,1])$ and

$\frac{{\mathrm{d}}}{{\mathrm{d}}t}F(\mu_{t})=\int_{\Omega}{\langle}{\mathrm{D}}F(\mu_{t},\boldsymbol{x}_{t}(\omega)),\dot{\boldsymbol{x}}_{t}(\omega)){\rangle}\,{\mathrm{d}}\mu(\omega)\quad\text{for
every }t\in[0,1].$ (4.10)

###### Proof.

Observe that, since $F$ is Lipschitz continuous and $t\mapsto\mu_{t}$ is
absolutely continuous, the map $t\mapsto F(\mu_{t})$ is absolutely continuous
and thus it holds

$F(\mu_{1})-F(\mu_{0})=\int_{0}^{1}\frac{{\mathrm{d}}}{{\mathrm{d}}t}F(\mu_{t}){\mathrm{d}}t.$

It is then enough to prove that

$\frac{{\mathrm{d}}}{{\mathrm{d}}t}F(\mu_{t})=\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F(\mu_{t},x),v_{t}(x){\rangle}\,{\mathrm{d}}\mu_{t}(x)\quad\text{for
a.e. }t\in(0,1).$ (4.11)

We have, for every $t\in A((\mu_{t})_{t\in[0,1]})\subset(0,1)$ (cf. Theorem
3.1), that

$\displaystyle\frac{{\mathrm{d}}}{{\mathrm{d}}t}F(\mu_{t})$
$\displaystyle=\sum_{i=1}^{N}\partial_{i}\psi(\mathsf{L}_{{\boldsymbol{\phi}}}(\mu_{t}))\frac{{\mathrm{d}}}{{\mathrm{d}}t}\int_{\mathbb{R}^{d}}\phi_{i}\,{\mathrm{d}}\mu_{t}$
$\displaystyle=\sum_{i=1}^{N}\partial_{i}\psi(\mathsf{L}_{{\boldsymbol{\phi}}}(\mu_{t}))\int_{\mathbb{R}^{d}}{\langle}\nabla\phi_{i},v_{t}(x){\rangle}\,{\mathrm{d}}\mu_{t}(x)$
$\displaystyle=\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F(\mu_{t},x),v_{t}(x){\rangle}\,{\mathrm{d}}\mu_{t}(x),$

where we used Theorem 3.1. A completely analogous argument yields (4.10). ∎

######  Remark 4.8.

In case the curve $(\mu_{t})_{t\in[0,1]}$ has the simple form

$\mu_{t}:=({\mbox{\boldmath$i$}}_{\mathbb{R}^{d}}+tu)_{\sharp}\mu,\quad
t\in[0,1]$

for some map $u\in L^{2}(\mathbb{R}^{d},\mu;\mathbb{R}^{d})$, (4.10) yields

$\frac{{\mathrm{d}}}{{\mathrm{d}}t}F(\mu_{t})=\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F(\mu_{t},x),u(x){\rangle}\,{\mathrm{d}}\mu_{t}(x)\quad\text{for
every }t\in[0,1],$

and, in particular, we get

$\lim_{t\downarrow
0}\frac{F(\mu_{t})-F(\mu)}{t}=\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F(\mu,x),u(x)){\rangle}\,{\mathrm{d}}\mu(x).$
(4.12)

######  Proposition 4.9.

Let
$F=\psi\circ\mathsf{L}_{{\boldsymbol{\phi}}}\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$
as in (4.2). Then

$\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}=\mathop{\rm lip}\nolimits
F(\mu)\quad\text{ for every }\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$

In particular $\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}$ does not
depend on the choice of the representation of $F$ and ${\mathrm{D}}F$ just
depends on $F$ on $\overline{\mathcal{D}}$.

###### Proof.

Let $\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$ and let
$(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})\in{\mathcal{P}_{2}(\mathbb{R}^{d})}^{2}$
with $\mu^{\prime}_{n}\neq\mu^{\prime\prime}_{n}$ be such that
$(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})\to(\mu,\mu)$ in $W_{2}$ and

$\lim_{n}\frac{\left|F(\mu^{\prime}_{n})-F(\mu^{\prime\prime}_{n})\right|}{W_{2}(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})}=\mathop{\rm
lip}\nolimits F(\mu).$

Let us define, for every $t\in[0,1]$, the map ${\sf
x}^{t}:\mathbb{R}^{d}\times\mathbb{R}^{d}\to\mathbb{R}^{d}$ as

${\sf
x}^{t}(x_{0},x_{1}):=(1-t)x_{0}+tx_{1},\quad(x_{0},x_{1})\in\mathbb{R}^{d}\times\mathbb{R}^{d}.$

Using (4.10) along $\mu_{n}^{t}:={\sf
x}^{t}_{\sharp}{\mbox{\boldmath$\mu$}}_{n}$ for plans
${\mbox{\boldmath$\mu$}}_{n}\in\Gamma_{o}(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})$
(it is easy to check that $(\mu_{t})_{t\in[0,1]}$ is Lipschitz continuous), we
get

$\displaystyle\left|F(\mu^{\prime}_{n})-F(\mu^{\prime\prime}_{n})\right|=\left|\int_{0}^{1}\int_{\mathbb{R}^{d}\times
R^{d}}{\langle}{\mathrm{D}}F(\mu_{n}^{t},{\sf
x}^{t}(x_{0},x_{1})),x_{1}-x_{0}{\rangle}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}_{n}(x_{0},x_{1})\,{\mathrm{d}}t\right|$
$\displaystyle\leq\left(\int_{0}^{1}\int_{\mathbb{R}^{d}\times
R^{d}}\left|{\mathrm{D}}F(\mu_{n}^{t},{\sf
x}^{t}(x_{0},x_{1})))\right|^{2}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}_{n}\,{\mathrm{d}}t\right)^{\frac{1}{2}}\left(\int_{0}^{1}\int_{\mathbb{R}^{d}\times\mathbb{R}^{d}}\left|x_{1}-x_{0}\right|^{2}\,{\mathrm{d}}{\mbox{\boldmath$\mu$}}_{n}\,{\mathrm{d}}t\right)^{\frac{1}{2}}$
$\displaystyle=W_{2}(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})\left(\int_{0}^{1}\int_{\mathbb{R}^{d}}\left|{\mathrm{D}}F(\mu_{n}^{t},\mu_{n}^{t})\right|^{2}\,{\mathrm{d}}\mu^{t}_{n}\,{\mathrm{d}}t\right)^{\frac{1}{2}},$

where we used Theorem 3.1. Dividing both sides by
$W_{2}(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})$, we obtain

$\frac{\left|F(\mu^{\prime}_{n})-F(\mu^{\prime\prime}_{n})\right|}{W_{2}(\mu^{\prime}_{n},\mu^{\prime\prime}_{n})}\leq\left(\int_{0}^{1}\int_{\mathbb{R}^{d}}\left|{\mathrm{D}}F(\mu_{n}^{t},x)\right|^{2}\,{\mathrm{d}}\mu^{t}_{n}\,{\mathrm{d}}t\right)^{\frac{1}{2}}.$

Observe that
${\mbox{\boldmath$\mu$}}_{n}\to{\mbox{\boldmath$\mu$}}:=({\mbox{\boldmath$i$}}_{\mathbb{R}^{d}},{\mbox{\boldmath$i$}}_{\mathbb{R}^{d}})_{\sharp}\mu$
in $\mathcal{P}(\mathbb{R}^{d}\times\mathbb{R}^{d})$ so that
$\mu_{n}^{t}\to\mu$ in $\mathcal{P}(\mathbb{R}^{d})$ for every $t\in[0,1]$. We
can pass to the limit as $n\to+\infty$ the above inequality using the
dominated convergence Theorem and Lemma 4.6 with

$G(\mu,x):=\left|{\mathrm{D}}F(\mu,x)\right|^{2},\quad\mu\in\mathcal{P}(\mathbb{R}^{d}),\,x\in\mathbb{R}^{d}.$

We hence get

$\displaystyle\mathop{\rm lip}\nolimits F(\mu)$
$\displaystyle\leq\left(\int_{0}^{1}\int_{\mathbb{R}^{d}}\left|{\mathrm{D}}F(\mu,x)\right|^{2}\,{\mathrm{d}}\mu(x)\,{\mathrm{d}}t\right)^{\frac{1}{2}}=\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}.$

This proves one inequality. In order to prove the opposite one, it is not
restrictive to assume $\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}>0$.
Let us now consider the map $T:\mathbb{R}^{d}\to\mathbb{R}^{d}$ defined as

$T(x):={\mathrm{D}}F[\mu](x),\quad x\in\mathbb{R}^{d}.$

By definition of $\operatorname{Tan}_{\mu}(\mathcal{P}_{2}(\mathbb{R}^{d}))$,
we have that $T\in\operatorname{Tan}_{\mu}(\mathcal{P}_{2}(\mathbb{R}^{d}))$
so that, by [4, Propsition 8.5.6], we have

$\lim_{\varepsilon\downarrow
0}\frac{W_{2}(\mu,({\mbox{\boldmath$i$}}_{\mathbb{R}^{d}}+\varepsilon
T)_{\sharp}\mu)}{\varepsilon}=\|T\|_{L^{2}(\mathbb{R}^{d},\mu;\mathbb{R}^{d})}=\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}.$

Moreover, if we apply (4.12) to the curve
$\mu_{\varepsilon}:=({\mbox{\boldmath$i$}}_{\mathbb{R}^{d}}+\varepsilon
T)_{\sharp}\mu$, $\varepsilon\in[0,1]$, we get

$\lim_{\varepsilon\downarrow
0}\frac{F(\mu_{\varepsilon})-F(\mu)}{\varepsilon}=\int_{\mathbb{R}^{d}}{\langle}{\mathrm{D}}F(\mu,x),T(x)){\rangle}\,{\mathrm{d}}\mu(x)=\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}^{2},$

thus

$\mathop{\rm lip}\nolimits F(\mu)\geq\lim_{\varepsilon\downarrow
0}\frac{F(\mu_{\varepsilon})-F(\mu)}{W_{2}(\mu_{\varepsilon},\mu)}=\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}.$

This shows the other inequality and concludes the proof. ∎

###  4.2. The density result

Recall that for a bounded Lipschitz function
$F:\mathcal{P}_{2}(\mathbb{R}^{d})\to\mathbb{R}$ the pre-Cheeger energy (cf.
(2.15)) associated to $\mathfrak{m}$ is defined by

$\mathsf{pC\kern-1.0ptE}_{2}(F)=\int_{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{(}\mathop{\rm
lip}\nolimits F(\mu)\big{)}^{2}\,{\mathrm{d}}\mathfrak{m}(\mu).$ (4.13)

Thanks to Proposition 4.9, if $F$ is a cylinder function in
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$, we have
a nice equivalent expression

$\mathsf{pC\kern-1.0ptE}_{2}(F)=\int_{\mathcal{P}_{2}(\mathbb{R}^{d})}\left\|{\mathrm{D}}F\left[\mu\right]\right\|_{\mu}^{2}\,{\mathrm{d}}\mathfrak{m}(\mu)=\int|{\mathrm{D}}F(\mu,x)|^{2}\,{\mathrm{d}}\boldsymbol{\mathfrak{m}}(\mu,x),$
(4.14)

which shows that the restriction of $\mathsf{pC\kern-1.0ptE}_{2}$ to
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$ is a
quadratic form (thus satisfying (2.59)) induced by the bilinear form

$\mathsf{pC\kern-1.0ptE}_{2}(F,G):=\int{\mathrm{D}}F(\mu,x)\cdot{\mathrm{D}}G(\mu,x)\,{\mathrm{d}}\boldsymbol{\mathfrak{m}}(\mu,x),\quad
F,G\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$
(4.15)

and coincides with the typical bilinear forms on cylinder functions used in
[48, 45, 16, 17]. It is therefore important to prove that
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$ is dense
in energy and therefore $H^{1,2}(\mathbb{W}_{2})$ is a Hilbert space: this is
precisely the object of our main result.

######  Theorem 4.10.

The algebra
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$ is dense
in $2$-energy: for every $F\in D^{1,2}(\mathbb{W}_{2})$ there exists a
sequence
$F_{n}\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$,
$n\in\mathbb{N},$ such that

$F_{n}\to F\ \text{ $\mathfrak{m}$-a.e.,}\quad\mathop{\rm
lip}\nolimits(F_{n})\to|{\mathrm{D}}F|_{\star}\text{ in
}L^{2}(X,\mathfrak{m});$ (4.16)

if moreover $F\in L^{p}(X,\mathfrak{m})$, $p\in[1,+\infty)$, then we can find
a sequence
$F_{n}\in\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$
as in (4.16) and converging to $F$ in $L^{p}(X,\mathfrak{m})$.

######  Corollary 4.11.

$H^{1,2}(\mathbb{W}_{2})$ is a separable Hilbert space and
$\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$ is
strongly dense in $H^{1,2}(\mathbb{W}_{2})$. If
$\big{(}\mathsf{pC\kern-1.0ptE}_{2},\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}\big{)}$
is closable (recall Remark 2.18) then its smallest closed extension coincides
with $(\mathsf{C\kern-1.0ptE}_{2},H^{1,2}(\mathbb{W}_{2}))$.

According to the terminology introduced in [23] (see also [6]) we can say that
$({\mathcal{P}_{2}(\mathbb{R}^{d})},W_{2},\mathfrak{m})$ is infinitesimally
Hilbertian for every positive Borel measure $\mathfrak{m}$.
We devote the remaining part of this subsection to the proof this result,
using Theorem 2.12.

We adopt the notation
$\mathscr{A}:=\mathfrak{C}^{1}_{b}\big{(}{\mathcal{P}_{2}(\mathbb{R}^{d})}\big{)}$.

We start with a preliminary lemma, which provides a simple gradient estimate
for the distance from the Dirac mass centered at 0, i.e. the quadratic moment
of a measure.

######  Lemma 4.12.

Let $\vartheta\in\mathop{\rm Lip}\nolimits(\mathbb{R}^{d})$ be a $L$-Lipschitz
function which is continuously differentiable in the open set
$\Omega_{\vartheta}:=\big{\\{}x\in\mathbb{R}^{d}:\vartheta(x)\neq 0\big{\\}}$.
Then the map

$F:\mu\to\big{(}\mathsf{L}_{\vartheta^{2}}\big{)}^{1/2}=\Big{(}\int_{\mathbb{R}^{d}}\vartheta^{2}(x)\,{\mathrm{d}}\mu(x)\Big{)}^{1/2}$
(4.17)

is $L$-Lipschitz and belongs to $D^{1,2}(\mathbb{W}_{2},\mathscr{A})$, in
particular its $(2,\mathscr{A})$-relaxed gradient is bounded above by $L$ and
satisfies

$|{\mathrm{D}}F|_{\star,\mathscr{A}}^{2}(\mu)\leq\frac{1}{F^{2}(\mu)}\int_{\mathbb{R}^{d}}\vartheta^{2}|\nabla\vartheta|^{2}\,{\mathrm{d}}\mu\quad\text{for
$\mathfrak{m}$-a.e.\leavevmode\nobreak\
$\mu\in\mathcal{P}_{2}(\mathbb{R}^{d})$ with $F(\mu)>0$}.$ (4.18)

###### Proof.

Let $T\in{\mathrm{C}}^{\infty}(\mathbb{R})$ be an odd, nondecreasing
truncation function satisfying

$T(x)=x\quad\text{if }|x|\leq 1/2,\quad|T(x)|=1\quad\text{if }|x|\geq
2,\quad|T^{\prime}(x)|\leq 1,$ (4.19)

and let us set $T_{n}(x):=nT(x/n)$, $\vartheta_{n}:=T_{n}\circ\vartheta$, so
that $\vartheta_{n}$ is $L$-Lipschitz and continuously differentiable in
$\Omega_{\vartheta}$, so that
$\vartheta_{n}^{2}\in{\mathrm{C}}^{1}_{b}(\mathbb{R}^{d})$.

We define $\psi_{n}(r):=(r+1/n)^{1/2}$ and
$F_{n}:=\psi_{n}\circ\mathsf{L}_{\vartheta_{n}^{2}}$. By construction
$F_{n}\in\mathscr{A}$ with

$\displaystyle{\mathrm{D}}F_{n}(\mu,x)$
$\displaystyle=\frac{1}{F_{n}(\mu)}\vartheta_{n}(x)\nabla\vartheta_{n}(x),$
$\displaystyle\big{(}\mathop{\rm lip}\nolimits
F_{n}(\mu)\big{)}^{2}=\|{\mathrm{D}}F_{n}[\mu]\|^{2}$
$\displaystyle=\frac{1}{F^{2}_{n}(\mu)}\int_{\mathbb{R}^{d}}\vartheta_{n}^{2}(x)|\nabla\vartheta_{n}(x)|^{2}\,{\mathrm{d}}\mu(x)\leq
L^{2}.$ (4.20)

Since $(\mathcal{P}_{2}(\mathbb{R}^{d}),W_{2})$ is a length space we deduce
that $F_{n}$ is $L$-Lipschitz. On the other hand
$\lim_{n\to\infty}F_{n}(\mu)=F(\mu)$ pointwise everywhere, so that $F$ is
$L$-Lipschitz as well, it belongs to $D^{1,2}(\mathbb{W}_{2},\mathscr{A})$ and
$|{\mathrm{D}}F|_{\star,\mathscr{A}}\leq L$. Passing eventually to the limit
as $n\to\infty$ in (4.20) for $\mu$ in the open set
$\\{\mu\in\mathcal{P}_{2}(\mathbb{R}^{d}):F(\mu)>0\\}$ we get (4.18). ∎

Selecting $\vartheta(x):=|x|$ we immediately get

######  Corollary 4.13.

The function $\mathsf{m}_{2}(\cdot)$ as in (3.6) belongs to
$D^{1,2}(\mathbb{W}_{2},\mathscr{A})$ with

$|{\mathrm{D}}\mathsf{m}_{2}|_{\star,\mathscr{A}}(\mu)\leq 1\quad\text{for
$\mathfrak{m}$-a.e.\leavevmode\nobreak\
$\mu\in\mathcal{P}_{2}(\mathbb{R}^{d})$}.$ (4.21)

We now use ${\sf m}_{2}$ for localizing gradient estimates in
$\mathcal{P}_{2}(\mathbb{R}^{d})$.

######  Lemma 4.14.

Let $F_{n}$ be a sequence of functions in
$D^{1,2}(\mathbb{W}_{2},\mathscr{A})\cap
L^{\infty}(\mathcal{P}_{2}(\mathbb{R}^{d}),\mathfrak{m})$ such that $F_{n}$
and $|{\mathrm{D}}F_{n}|_{\star,\mathscr{A}}$ are uniformly bounded in every
bounded set of $\mathcal{P}_{2}(\mathbb{R}^{d})$ and let $F,G$ be Borel
functions in $L^{2}(\mathcal{P}_{2}(\mathbb{R}^{d}),\mathfrak{m})$, $G$
nonnegative. If

$\lim_{n\to\infty}F_{n}(\mu)=F(\mu),\quad\limsup_{n\to\infty}|{\mathrm{D}}F_{n}|_{\star,\mathscr{A}}(\mu)\leq
G(\mu)\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\ in
$\mathcal{P}_{2}(\mathbb{R}^{d})$},$ (4.22)

then $F\in H^{1,2}(\mathbb{W}_{2},\mathscr{A})$ and
$|{\mathrm{D}}F|_{\star,\mathscr{A}}\leq G$.

###### Proof.

Let us consider a smooth nonincreasing function
$\theta\in{\mathrm{C}}^{\infty}[0,+\infty)$ such that

$\theta(r)=1\quad\text{if }0\leq r\leq 1,\quad\theta(r)=0\quad\text{if }r\geq
2,\quad|\theta^{\prime}(r)|\leq 2$ (4.23)

and set

${\raise 1.29167pt\hbox{$\chi$}}_{n}(\mu):=\theta\big{(}{\sf
m}_{2}(\mu)/n\big{)}.$ (4.24)

By Corollary 4.13 we have

${\raise 1.29167pt\hbox{$\chi$}}_{n}\in
H^{1,2}(\mathbb{W}_{2},\mathscr{A}),\quad|{\mathrm{D}}{\raise
1.29167pt\hbox{$\chi$}}_{n}|_{\star,\mathscr{A}}\leq
2/n,\quad|{\mathrm{D}}{\raise
1.29167pt\hbox{$\chi$}}_{n}|_{\star,\mathscr{A}}(\mu)=0\text{ if
}\mathsf{m}_{2}(\mu)\leq n\text{ or }\mathsf{m}_{2}(\mu)\geq 2n.\normalcolor$
(4.25)

Thanks to the Leibniz rule, setting $F_{n,m}(\mu):=F_{n}(\mu){\raise
1.29167pt\hbox{$\chi$}}^{2}_{m}(\mu)$ and
$G_{n}:=|{\mathrm{D}}F_{n}|_{\star,\mathscr{A}}$, we have

$F_{n,m}\in{\mathrm{D}}^{1,2}(\mathbb{W}_{2},\mathscr{A}),\quad|{\mathrm{D}}F_{n,m}|_{\star,\mathscr{A}}(\mu)\leq
G_{n}(\mu){\raise 1.29167pt\hbox{$\chi$}}^{2}_{m}(\mu)+4/mF_{n}(\mu){\raise
1.29167pt\hbox{$\chi$}}_{m}(\mu).$ (4.26)

Since for every $m\in\mathbb{N}$ the sequence $n\mapsto G_{n}{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}$ is uniformly bounded, we can find an
increasing subsequence $k\mapsto n(k)$ such that $k\mapsto G_{n(k)}{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}$ is weakly∗ convergent in
$L^{\infty}(\mathcal{P}_{2}(\mathbb{R}^{d}),\mathfrak{m})$ and we denote by
$\tilde{G}_{m}$ is weak∗ limit. By Fatou’s lemma, for every Borel set
$B\subset\mathcal{P}_{2}(\mathbb{R}^{d})$ we get

$\displaystyle\int_{B}\tilde{G}_{m}\,{\mathrm{d}}\mathfrak{m}$
$\displaystyle=\lim_{k\to\infty}\int_{B}G_{n(k)}(\mu){\raise
1.29167pt\hbox{$\chi$}}^{2}_{m}(\mu)\,{\mathrm{d}}\mathfrak{m}(\mu)$
$\displaystyle\leq\int_{B}\limsup_{k\to\infty}\Big{(}G_{n(k)}(\mu){\raise
1.29167pt\hbox{$\chi$}}^{2}_{m}(\mu)\Big{)}\,{\mathrm{d}}\mathfrak{m}(\mu)$
$\displaystyle\leq\int_{B}G^{2}{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}\,{\mathrm{d}}\mathfrak{m}$

so that we deduce

$\tilde{G}_{m}\leq G^{2}{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}\quad\text{$\mathfrak{m}$-a.e.\leavevmode\nobreak\
in $\mathcal{P}_{2}(\mathbb{R}^{d})$, for every $m\in\mathbb{N}$.}$ (4.27)

On the other hand, passing to the limit in (4.26) along the subsequence $n(k)$
and recalling that $\lim_{k\to\infty}F_{n(k),m}=F{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}$ $\mathfrak{m}$-a.e. we get

$|{\mathrm{D}}(F{\raise
1.29167pt\hbox{$\chi$}}_{m}^{2})|_{\star,\mathscr{A}}(\mu)\leq\tilde{G}_{m}(\mu)+\frac{4}{m}F(\mu){\raise
1.29167pt\hbox{$\chi$}}_{m}(\mu)\leq G(\mu){\raise
1.29167pt\hbox{$\chi$}}_{m}^{2}(\mu)+\frac{4}{m}F(\mu){\raise
1.29167pt\hbox{$\chi$}}_{m}(\mu)\quad\text{for
$\mathfrak{m}$-a.e.\leavevmode\nobreak\
$\mu\in\mathcal{P}_{2}(\mathbb{R}^{d})$.}$ (4.28)

We eventually pass to the limit as $m\to\infty$ concluding the proof of the
Lemma. ∎

We now derive a natural estimate, extending (4.4) to the case of quadratically
coercive functions whose gradient has a linear growth.

######  Lemma 4.15.

Let $\phi\in{\mathrm{C}}^{1}(\mathbb{R}^{d})$ be satisfying the growth
conditions

$\phi(x)\geq A|x|^{2}-B,\quad|\nabla\phi(x)|\leq C(|x|+1)\quad\text{for every
}x\in\mathbb{R}^{d}$ (4.29)

for given positive constants $A,B,C>0$ and let $\zeta:\mathbb{R}\to\mathbb{R}$
be a ${\mathrm{C}}^{1}$ nondecreasing function whose derivative has compact
support. Then the function $F(\mu):=\zeta\circ\mathsf{L}_{\phi}$ is Lipschitz
in $\mathcal{P}_{2}(\mathbb{R}^{d})$, it belongs to
$H^{1,2}(\mathbb{W}_{2},\mathscr{A})$, and

$|{\mathrm{D}}F|_{\star,\mathscr{A}}(\mu)\leq\zeta^{\prime}(\mathsf{L}_{\phi}(\mu))\Big{(}\int_{\mathbb{R}^{d}}|\nabla\phi(x)|^{2}\,{\mathrm{d}}\mu(x)\Big{)}^{1/2}.$
(4.30)

###### Proof.

We set $\zeta_{a}(z):=(z+a)^{1/2}$ and $\vartheta_{a}:=\zeta_{a}\circ\phi$,
with $a:=A+B$, so that

$\vartheta_{a}\in{\mathrm{C}}^{1}(\mathbb{R}^{d}),\quad\vartheta_{a}\geq\big{(}A(|x|^{2}+1)\big{)}^{1/2},\quad|\nabla\vartheta_{a}(x)|=\frac{|\nabla\phi(x)|}{2(\phi(x)+a)^{1/2}}\leq
L,\quad L:=A^{-1/2}C$

for every $x\in\mathbb{R}^{d}$.

We can then apply Lemma 4.12, observing that

$\big{(}\mathsf{L}_{\vartheta_{a}^{2}}(\mu)\big{)}^{1/2}=\zeta_{a}\big{(}\mathsf{L}_{\phi}(\mu)\big{)};$

we deduce that $F_{a}=\zeta_{a}\circ\mathsf{L}_{\phi}$ is $L$-Lipschitz, it
belongs to $D^{1,2}(\mathbb{W}_{2},\mathscr{A})$ and satisfies (recall (4.18))

$|{\mathrm{D}}F_{a}|_{\star,\mathscr{A}}(\mu)\leq\frac{1}{2F_{a}(\mu)}\Big{(}\int_{\mathbb{R}^{d}}|\nabla(\vartheta_{a}^{2})|^{2}\,{\mathrm{d}}\mu\Big{)}^{1/2}=\zeta_{a}^{\prime}(\mathsf{L}_{\phi}(\mu))\Big{(}\int_{\mathbb{R}^{d}}|\nabla\phi|^{2}\,{\mathrm{d}}\mu\Big{)}^{1/2}.$
(4.31)

We eventually observe that $F=\psi_{a}\circ F_{a}$ where
$\psi_{a}(z)=\zeta(z^{2}-a)$ which is still ${\mathrm{C}}^{1}$ with derivative
with compact support. Then (4.31) yields (4.30). ∎

We collect in the following definition some useful tools and notation we will
extensively use.

######  Definition 4.16.

We denote by $\kappa\in{\mathrm{C}}_{c}^{\infty}(\mathbb{R}^{d})$ a smooth
function satisfying $\mathop{\rm
supp}\nolimits{\kappa}=\overline{{\mathrm{B}}(0,1)}$, $\kappa(x)\geq 0$ for
every $x\in\mathbb{R}^{d}$ and $\kappa(x)>0$ for every
$x\in{\mathrm{B}}(0,1)$,
$\int_{\mathbb{R}^{d}}\kappa{\mathrm{d}}\mathcal{L}^{d}=1$ and
$\kappa(-x)=\kappa(x)$ for every $x\in\mathbb{R}^{d}$.

For every $0<\varepsilon<1$ we define the family of associated mollifiers

$\kappa_{\varepsilon}(x):=\frac{1}{\varepsilon^{d}}\kappa(x/\varepsilon)\quad
x\in\mathbb{R}^{d},$ (4.32)

and for every $\sigma\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$ we define

$\displaystyle\sigma_{\varepsilon}$
$\displaystyle:=\sigma\ast\kappa_{\varepsilon},$ (4.33)
$\displaystyle\hat{\sigma}_{\varepsilon}$
$\displaystyle:=\frac{\sigma_{\varepsilon}\mathbin{\vrule
height=6.88889pt,depth=0.0pt,width=0.55974pt\vrule
height=0.55974pt,depth=0.0pt,width=5.59721pt}{\mathrm{B}}(0,1/\varepsilon)+\varepsilon^{d+3}\mathcal{L}^{d}\mathbin{\vrule
height=6.88889pt,depth=0.0pt,width=0.55974pt\vrule
height=0.55974pt,depth=0.0pt,width=5.59721pt}{\mathrm{B}}(0,1/\varepsilon)}{\sigma_{\varepsilon}({\mathrm{B}}(0,1/\varepsilon))+\varepsilon^{d+3}\mathcal{L}^{d}({\mathrm{B}}(0,1/\varepsilon))}.$
(4.34)

For every $\nu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$ we eventually define the
continuous functions
$W_{\nu},W_{\nu}^{\varepsilon},F_{\nu}^{\varepsilon}:{\mathcal{P}_{2}(\mathbb{R}^{d})}\to\mathbb{R}$
as

$W_{\nu}(\mu):=W_{2}(\mu,\nu),\quad
W_{\nu}^{\varepsilon}(\mu):=W_{\hat{\nu}_{\varepsilon}}(\mu_{\varepsilon}),\quad
F^{\varepsilon}_{\nu}(\mu):=\frac{1}{2}(W_{\nu}^{\varepsilon}(\mu))^{2},\quad\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$
(4.35)

Notice that
$\sigma_{\varepsilon},\hat{\sigma}_{\varepsilon}\in\mathcal{P}_{2}^{r}(\mathbb{R}^{d})$,
$\mathop{\rm
supp}\nolimits{\hat{\sigma}_{\varepsilon}}=\overline{{\mathrm{B}}(0,1/\varepsilon)}$
and $W_{2}(\sigma_{\varepsilon},\sigma)\to 0$,
$W_{2}(\hat{\sigma}_{\varepsilon},\sigma)\to 0$ as $\varepsilon\downarrow 0$.
Moreover, if $\sigma,\sigma^{\prime}\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$, we
have

$W_{2}(\sigma_{\varepsilon},\sigma^{\prime}_{\varepsilon})\leq
W_{2}(\sigma,\sigma^{\prime})\quad\text{ for every }0<\varepsilon<1$ (4.36)

and it is easy to check that, if we set

$C_{\varepsilon}:=\mathsf{m}_{2}(\kappa_{\varepsilon}\mathcal{L}^{d}),$ (4.37)

then we have

$\mathsf{m}_{2}(\mu_{\varepsilon})\leq\mathsf{m}_{2}(\mu)+C_{\varepsilon}\quad\text{
for every }0<\varepsilon<1.$ (4.38)

######  Proposition 4.17.

Let $\nu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$, $\varepsilon\in(0,1)$ and let
$\zeta:\mathbb{R}\to\mathbb{R}$ be a ${\mathrm{C}}^{1}$ nondecreasing function
whose derivative has compact support. With the notation of Definition 4.16 we
have

$|{\mathrm{D}}(\zeta\circ
F_{\nu}^{\varepsilon})|_{\star,{\scriptscriptstyle\mathscr{A}}}(\mu)\leq\zeta^{\prime}(F^{\varepsilon}_{\nu}(\mu))\Big{(}\int_{\mathbb{R}^{d}}\left|x-\nabla(\varphi_{\varepsilon}^{*}\ast\kappa_{\varepsilon})(x)\right|^{2}{\mathrm{d}}\mu(x)\Big{)}^{1/2}\quad\text{
for }\mathfrak{m}\text{-a.e. }\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})},$ (4.39)

where
$\varphi_{\varepsilon}^{*}=\Phi^{*}(\hat{\nu}_{\varepsilon},\mu_{\varepsilon})$
as in Theorem 3.2.

###### Proof.

Let $\mathcal{G}:=\\{\mu^{h}\\}_{h\in\mathbb{N}}$ be a dense and countable set
in ${\mathcal{P}_{2}(\mathbb{R}^{d})}$ and let us set, for every
$h\in\mathbb{N}$,
$\varphi_{h}:=\Phi(\hat{\nu}_{\varepsilon},\mu^{h}_{\varepsilon})$,
$\varphi_{h}^{*}:=\Phi^{*}(\hat{\nu}_{\varepsilon},\mu^{h}_{\varepsilon})$
(see Theorem 3.2),

$a_{h}:=\int_{{\mathrm{B}}(0,1/\varepsilon)}\left(\frac{1}{2}|y|^{2}-\varphi_{h}(y)\right){\mathrm{d}}\hat{\nu}_{\varepsilon}(y),\quad
u_{h}(x):=\frac{1}{2}|x|^{2}-\varphi_{h}^{*}(x)+a_{h},\quad
x\in\mathbb{R}^{d}$

and

$G_{k}(\mu):=\max_{1\leq h\leq
k}\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu_{\varepsilon},\quad\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$

We first observe that $\varphi^{*}_{h}(x)$ is $1/\varepsilon$-Lipschitz, so
that $|\varphi^{*}_{h}(x)|\leq|x|/\varepsilon$ and

$\displaystyle u_{h}(x)$
$\displaystyle\geq\frac{1}{2}|x|^{2}-\frac{1}{\varepsilon}|x|+a_{h}\geq\frac{1}{4}|x|^{2}-\frac{1}{\varepsilon^{2}}+a_{h},$
(4.40) $\displaystyle u_{h}(x)$
$\displaystyle\leq|x|^{2}+\frac{1}{\varepsilon^{2}}+a_{h}.$ (4.41)

_Claim 1_. It holds

$\lim_{k\to+\infty}G_{k}(\mu)=F_{\nu}^{\varepsilon}(\mu)\quad\text{ for every
}\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$

_Proof of claim 1_. Since $G_{k+1}(\mu)\geq G_{k}(\mu)$ for every
$\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$, we have that

$\lim_{k\to+\infty}G_{k}(\mu)=\sup_{k}G_{k}(\mu)=\sup_{h}\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu_{\varepsilon}\quad\text{
for every }\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$

By the definition of $\varphi_{h}$ and $\varphi_{h}^{*}$ we have, for every
$\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$ and $h\in\mathbb{N}$, that

$\displaystyle\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu_{\varepsilon}$
$\displaystyle=\int_{\mathbb{R}^{d}}\left(\frac{1}{2}|x|^{2}-\varphi_{h}^{*}(x)\right){\mathrm{d}}\mu_{\varepsilon}+\int_{{\mathrm{B}}(0,1/\varepsilon)}\left(\frac{1}{2}|y|^{2}-\varphi_{h}(y)\right){\mathrm{d}}\hat{\nu}_{\varepsilon}(y)$
$\displaystyle\leq\frac{1}{2}W_{2}^{2}(\mu_{\varepsilon},\hat{\nu}_{\varepsilon})=F_{\nu}^{\varepsilon}(\mu).$

This proves that $\sup_{k}G_{k}(\mu)\leq F_{\nu}^{\varepsilon}(\mu)$ for every
$\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$. Clearly, if $\mu\in\mathcal{G}$,
this is an equality. Let now
$\mu,\mu^{\prime}\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$ and $h\in\mathbb{N}$
and observe that

$\displaystyle\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu_{\varepsilon}-\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu^{\prime}_{\varepsilon}$
$\displaystyle=\frac{1}{2}\mathsf{m}_{2}^{2}(\mu_{\varepsilon})-\frac{1}{2}\mathsf{m}_{2}^{2}(\mu^{\prime}_{\varepsilon})-\int_{\mathbb{R}^{d}}\varphi_{h}^{*}{\mathrm{d}}(\mu_{\varepsilon}-\mu^{\prime}_{\varepsilon})$
$\displaystyle\leq\frac{1}{2}\Big{(}\mathsf{m}_{2}(\mu_{\varepsilon})+\mathsf{m}_{2}(\mu^{\prime}_{\varepsilon})\Big{)}W_{2}(\mu_{\varepsilon},\mu^{\prime}_{\varepsilon})+\frac{1}{\varepsilon}W_{2}(\mu_{\varepsilon},\mu^{\prime}_{\varepsilon})$
$\displaystyle\leq\frac{1}{2}\Big{(}\mathsf{m}_{2}(\mu)+\mathsf{m}_{2}(\mu^{\prime})+2C_{\varepsilon}\Big{)}W_{2}(\mu,\mu^{\prime})+\frac{1}{\varepsilon}W_{2}(\mu,\mu^{\prime})$
$\displaystyle\leq\Big{(}\mathsf{m}_{2}(\mu)+\mathsf{m}_{2}(\mu^{\prime})+C_{\varepsilon}+\frac{1}{\varepsilon}\Big{)}W_{2}(\mu,\mu^{\prime}),$

where we used (4.36), (4.38), the fact that $\varphi^{*}_{h}$ is
$1/\varepsilon$-Lipschitz continuous and (3.5). We hence deduce that for every
$k\in\mathbb{N}$

$\left|G_{k}(\mu)-G_{k}(\mu^{\prime})\right|\leq\left(\mathsf{m}_{2}(\mu)+\mathsf{m}_{2}(\mu^{\prime})+\frac{1}{\varepsilon}+C_{\varepsilon}\right)W_{2}(\mu,\mu^{\prime})\quad\text{
for every }\mu,\mu^{\prime}\in{\mathcal{P}_{2}(\mathbb{R}^{d})}.$ (4.42)

Choosing $\mu^{\prime}\in\mathcal{G}$ and passing to the limit as
$k\to+\infty$ we get from (4.42)

$\left|\lim_{k\to+\infty}G_{k}(\mu)-F_{\nu}^{\varepsilon}(\mu^{\prime})\right|\leq\left(\mathsf{m}_{2}(\mu)+\mathsf{m}_{2}(\mu^{\prime})+C_{\varepsilon}+\frac{1}{\varepsilon}\right)W_{2}(\mu,\mu^{\prime})\quad\text{
for every
}\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})},\,\mu^{\prime}\in\mathcal{G}.$

Using the density of $\mathcal{G}$ and the continuity of $\mu^{\prime}\mapsto
F_{\nu}^{\varepsilon}(\mu^{\prime})$ we deduce that

$\lim_{k\to+\infty}G_{k}(\mu)=F_{\nu}^{\varepsilon}(\mu)\quad\text{ for every
}\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}$

proving the first claim.
_Claim 2_. If $H_{k}:=\zeta\circ G_{k}$ and
$u_{h,\varepsilon}:=u_{h}\ast\kappa_{\varepsilon}$ it holds

$|{\mathrm{D}}H_{k}|_{\star,{\scriptscriptstyle\mathscr{A}}}^{2}(\mu)\leq\big{(}\zeta^{\prime}(G_{k}(\mu))\big{)}^{2}\int_{\mathbb{R}^{d}}\left|\nabla
u_{h,\varepsilon}\right|^{2}{\mathrm{d}}\mu(x)=\big{(}\zeta^{\prime}(G_{k}(\mu))\big{)}^{2}\int_{\mathbb{R}^{d}}\left|x-\nabla(\varphi_{h}^{*}\ast\kappa_{\varepsilon})(x)\right|^{2}{\mathrm{d}}\mu(x),$

for $\mathfrak{m}$-a.e. $\mu\in B_{h}^{k}$, where
$B_{h}^{k}:=\\{\mu\in{\mathcal{P}_{2}(\mathbb{R}^{d})}\mid
G_{k}(\mu)=\int_{\mathbb{R}^{d}}u_{h}{\mathrm{d}}\mu_{\varepsilon}\\}$,
$h\in\\{1,\dots,k\\}$.
_Proof of claim 2_. For every $h\in\mathbb{N}$, (4.40) yields

$u_{h,\varepsilon}(x)\geq\frac{1}{4}|x|^{2}-\frac{1}{\varepsilon^{2}}+a_{h},\quad|\nabla