# Density of continuous functions in Sobolev spaces with applications to
capacity

Sylvester Eriksson-Bique  Department of Mathematics and Statistics, University
of Jyväskylä, Seminaarinkatu 15, PO Box 35, FI-40014 University of Jyväskylä,
Finland<EMAIL_ADDRESS>and  Pietro Poggi-Corradini  Kansas
State University, Department of Mathematics, 138 Cardwell Hall, Manhattan, KS
66506<EMAIL_ADDRESS>
###### Abstract.

We show that capacity can be computed with locally Lipschitz functions in
locally complete and separable metric spaces. Further, we show that if
$(X,d,\mu)$ is a locally complete and separable metric measure space, then
continuous functions are dense in the Newtonian space $N^{1,p}(X)$. Here the
measure $\mu$ is Borel and is finite and positive on all metric balls. In
particular, we don’t assume properness of $X$, doubling of $\mu$ or any
Poincaré inequalities. These resolve, partially or fully, questions posed by a
number of authors, including J. Heinonen, A. Björn and J. Björn. In contrast
to much of the past work, our results apply to _locally complete_ spaces $X$
and dispenses with the frequently used regularity assumptions: doubling,
properness, Poincaré inequality, Loewner property or quasiconvexity.

The first author was partially supported by Finnish Academy Grants n. 345005
and n. 356861. The second author is partially supported by NSF DMS n. 2154032.
The authors thank Nages Shanmugalingam, and Anders and Jana
Bj$\ddot{\text{o}}$rn for useful conversations on these topics. The paper
benefited from helpful comments by an anonymous referee.

##  1\. Introduction

Solutions to variational problems on metric measure spaces $(X,d,\mu)$, such
as $p$-harmonic functions, may fail to be continuous or Lipschitz in a fully
general setting. However, a useful tool is to approximate such minimizers by
continuous or Lipschitz functions. In many works, see for instance [12, 25,
22, 6], one places assumptions such as, the doubling property, the Poincaré
inequality, or properness, to prove density of Lipschitz functions. Doubling
and Poincaré inequalities are natural in certain settings, such as
$A_{p}$-weighted spaces [20], Carnot groups [26], boundaries of certain
hyperbolic groups [9] and manifolds with Ricci bounds [13, 36]. However, there
are many important settings where these assumptions are overly restrictive,
and we name just a handful of such: studying generalized notions of scalar
curvature and intrinsic limits of manifolds with scalar curvature bounds [19,
35], studying integral currents in metric spaces [2], metric manifolds and
uniformization of metric surfaces [29, 4, 28], the study of analysis on
fractals [10], Sobolev spaces on infinite dimensinal spaces such as the
Wasserstein space [34], spaces equipped with more general weights [3], or
complete and rectifiable spaces [5]. In all these cases Sobolev spaces, and
associated differential structures, still play a crucial role.

Our contribution in this paper is to remove the assumptions of doubling and
Poincaré and to replace these with a much weaker local completeness
assumption, and to still prove three fundamental properties: the density of
continuous functions in the Sobolev space, equivalence of different notions of
capacity and the property that the Sobolev capacity is a Choquet capacity.
This clarifies substantially the methods and dependence on assumptions.
Further, it requires the use of new approximation and extension methods.

The variational problems we consider are classical in metric measure spaces,
and arise from the definition of an _upper gradient_. A Borel function
$g:X\to[0,\infty]$ is said to be an upper gradient for a function
$u:X\to[-\infty,\infty]$ if for all rectifiable curves $\gamma:[0,1]\to X$, we
have

(1.1) $|u(\gamma(0))-u(\gamma(1))|\leq\int gds,$

where we interpret $|\infty-\infty|=\infty$.

Next, if $1\leq p<\infty$, consider the condenser $p$-capacity problem

(1.2) ${\rm Cap}_{p}(E,F):=\inf_{\stackrel{{\scriptstyle
u|_{E}=0}}{{u|_{F}=1}}}\int g^{p}~{}d\mu,$

where $E$ and $F$ are disjoint closed sets in $X$, and where $u$ is taken to
be a function on $X$ and $g$ is an upper gradient for $u$. Heinonen and
Koskela asked in [21, Remark 2.13], if the infimum in this definition could be
taken over functions $u$ that are continuous or locally Lipschitz. In general,
we may consider a collection $W$ of pairs $(u,g)$, where $u$ is a function on
$X$ and $g$ is an upper gradient for $u$, and define

${\rm Cap}_{p}^{W}(E,F):=\inf_{\stackrel{{\scriptstyle
u|_{E}=0,u|_{F}=1}}{{(u,g)\in W}}}\int g^{p}~{}d\mu.$

By varying $W$, we obtain different versions of capacity considered in the
literature. We focus on three variants which have appeared in the literature:
i) $W={\rm lip}$ corresponds to all pairs $(u,g)$ where $u$ is locally
Lipschitz, ii) $W={\rm cont}$ is the collection of all pairs $(u,g)$ where $u$
is continuous, iii) and $W=(\operatorname{lip},\operatorname{lip})$ is the
collection of all pairs $(u,g)$ where $u$ and $g$ are locally Lipschitz. It is
trivial, that restricting to the collections to
$(\operatorname{lip},\operatorname{lip}),{\rm lip}$ or ${\rm cont}$ produces a
capacity, which is larger than the unrestricted capacity in (1.2). The
problem, which bears a close affinity to approximation, is to show that these
restricted capacities are still equal to the unrestricted capacity.
Throughout, we will assume that $\mu$ is a Borel measure on $X$, which is
positive and finite on all balls, that is $0<\mu(B)<\infty$ for each
$B=B(x,r)$, with $x\in X$ and $r>0$.

Our first main result is the following.

######  Theorem 1.3.

Let $(X,d,\mu)$ be a locally complete and separable metric measure space and
let $E,F\subset X$ be two closed, non-empty disjoint sets with $d(E,F)>0$.
Then, for $p\in[1,\infty)$,

(1.4) ${\rm Cap}_{p}(E,F)={\rm Cap}_{p}^{\rm cont}(E,F)={\rm
Cap}_{p}^{\operatorname{lip}}(E,F)={\rm
Cap}_{p}^{(\operatorname{lip},\operatorname{lip})}(E,F).$

######  Remark 1.5.

If $\Gamma(E,F)$ is the family of rectifiable curves connecting $E$ to $F$,
then one has the equality between modulus and capacity ${\rm
Cap}_{p}(E,F)={\rm Mod}_{p}(E,F)$. Whenever $(u,g)$ is admissible for the
capacity, $g$ is admissible for the modulus. Conversely, if $g$ is admissible
for the modulus, then there exists a $u$ which is admissible for the capacity
so that $g$ is an upper gradient of $u$. Indeed, such a $u$ is obtained by
“integrating” $g$. See Section 2.1 for the definition of modulus, and [21,
Proposition 2.17] for a proof of this claim. Consequently, we obtain a
stronger version of [21, Proposition 2.17], which states that ${\rm
Mod}_{p}(E,F)={\rm Mod}_{p}^{c}(E,F)$, where ${\rm Mod}_{p}^{c}(E,F)$ is the
modulus computed with only continuous admissible functions. Specifically, our
proof shows that ${\rm Mod}_{p}(E,F)={\rm Mod}_{p}^{c}(E,F)$ whenever $X,E,F$
satisfy the assumptions of Theorem 1.3 and $p\in[1,\infty)$. With the more
restrictive assumptions that the space $X$ is proper and geodesic, this
equality was known [23, Proposition 7].

The strongest previous result on this problem is due to Keith [23, Proposition
7]. He showed (1.4) under the assumption that $X$ is proper and geodesic (i.e.
that each pair of points $x,y\in X$ can be connected by a rectifiable curve
$\gamma$ with ${\rm Len}(\gamma)=d(x,y)$). Our result weakens properness to
local completeness and separability and removes any geodesic assumption.

The capacity problem gives rise to the definition of a Sobolev space. The
Sobolev spaces which we consider are those introduced by Cheeger in [12].
However, we take the perspective of precise representatives which were studied
and introduced by Shanmugalingam in [32]. The space of these functions is
denoted $N^{1,p}(X)$ with $p\in[1,\infty)$, and consists of all functions
$u\in L^{p}(X)$ that have an upper gradient $g\in L^{p}(X)$. For $p>1$, the
space $N^{1,p}(X)$ is equivalent to variants defined using plans, see [1]. The
(semi)norm on this space is denoted $\|\cdot\|_{N^{1,p}(X)}$ which equals the
usual Sobolev norm in the case of Euclidean spaces equipped with Lebesgue
measure. These notions will be precisely defined below in Section 2.

Our second main result shows the density of continuous functions in the
Sobolev space and that all Sobolev functions are quasicontinuous. We say that
a function $f:X\to{\mathbb{R}}\cup\\{\infty,-\infty\\}$ is quasicontinuous if
for every $\epsilon>0$ there exists an open set $O$ with ${\rm
Cap}_{p}(O)<\epsilon$ and so that $f|_{X\setminus O}$ is continuous. Recall
that the notion of having zero capacity is a finer notion than having zero
measure. Indeed, a set of capacity zero must be of measure zero. However, a
set of capacity zero will usually be of smaller Hausdorff dimension.

######  Theorem 1.6.

Let $(X,d,\mu)$ be a locally complete and separable metric measure space. Then
$C(X)\cap N^{1,p}(X)$ is dense in $N^{1,p}(X)$ for $p\in[1,\infty)$, and every
function $f\in N^{1,p}(X)$ is quasicontinuous.

Note that, if $\Omega$ is a domain in a locally complete space, then $\Omega$
is itself locally complete. Thus, the theorem directly applies to domains.
This strengthens the main result in [7, Theorem 1.1] in two ways: first, one
does not need to switch representatives of $f$, and second, the assumptions
are much weaker.

A similar conclusion is contained in [32, Theorem 4.1], under the additional
hypothesis that $X$ is complete and measure doubling, while also satisfying a
Poincaré inequality. On the other hand, by just assuming completeness and
separability and measure doubling, it was shown in [1] that Lipschitz
functions are dense when $p>1$. In [18], this result was slightly extended to
complete and separable metric spaces with finite Hausdorff dimension, and for
all $p\in[1,\infty)$. These three results prove density of _Lipschitz
functions_ , but with more restrictive assumptions - all of them require the
space to have finite Hausdorff dimension. In contrast, our theorem removes any
assumption on the dimension of $X$, but a price for this is paid in the weaker
conclusion: the density of _continuous_ functions. Thus, Theorem 1.6
substantially answers a question from [7] on whether continuous functions are
dense in Sobolev spaces without any further assumptions.

######  Remark 1.7.

We note that Theorem 1.6 and Theorem 1.3 are related, but neither is implied
directly by the other. In particular, we can not prove Theorem 1.3 directly by
approximation, since _a priori_ Cauchy sequences of Sobolev functions only
converge almost everywhere, and the sets $E,F$ in Theorem 1.3 may have measure
zero.

Further, it is worth noting, that it is an interesting open problem to
determine if Lipschitz functions are also dense in the Sobolev space for any
complete and separable metric space equipped with a Radon measure, which is
finite on balls.

Next, consider the capacity of a set $E\subset X$ defined as

${\rm Cap}_{p}(E):=\inf\\{\|u\|_{N^{1,p}(X)}^{p}:u|_{E}\geq 1\\}.$

We first establish a crucial technical result, which allows us to strengthen
the results on Sobolev spaces from [7]. Namely, we prove the outer regularity
of ${\rm Cap}_{p}(E)$ in locally complete spaces.

######  Theorem 1.8.

Suppose that $(X,d,\mu)$ is locally complete and separable metric measure
space. Let $E\subset X$ be any set. Then

${\rm Cap}_{p}(E)=\inf_{E\subset O}{\rm Cap}_{p}(O),$

where the infimum is taken over open subsets of $X$ containing $E$.

This improves on prior work by removing the assumption of properness and
density used in [7, Corollary 1.3]. The proof involves both Theorem 1.6 and an
observation in Proposition 2.15 on lower semicontinuity involving certain
“good” functions. (These are used to handle the case when ${\rm
Cap}_{p}(E)=0$; see Proposition 3.2.)

As a corollary, we show that Sobolev Capacity is a Choquet capacity, under
very weak assumptions. See Section 5.1 for a definition of a Choquet capacity.

######  Corollary 1.9.

If $(X,d,\mu)$ is a locally complete and seperable metric measure space and
$p\in(1,\infty)$, then the map $E\mapsto{\rm Cap}_{p}(E)$, for $E\subset X$,
is a Choquet capacity.

######  Remark 1.10.

In much of the literature, see e.g. [24, 20], a neighbourhood capacity is
defined:

$\overline{{\rm Cap}_{p}}(E):=\inf\\{\|u\|_{N^{1,p}(X)}^{p}:u|_{O}\geq
1,\text{ for an open set }O\text{ with }E\subset O\\}.$

An advantage of this definition is that it is automatically outer regular and
a Choquet capacity without further assumptions, see [24]. Using Theorem 1.8 it
is easy to show that ${\rm Cap}_{p}(E)=\overline{{\rm Cap}_{p}}(E)$ for
locally complete and separable metric measure spaces. This gives another way
of proving Corollary 1.9.

Much of the literature is split on which definition, ${\rm Cap}$ or
$\overline{{\rm Cap}_{p}}$, they employ. Theorem 1.8 shows that very generally
the two coincide, and one can use either definition and obtain an equivalent
theory.

In conclusion, we discuss the ways in which we improve on prior work, such as
[7], and how we execute this technically. First, Theorem 1.6 rests on a new
approximation inspired by the authors’ prior work in [16, 17]. This
approximation is built by solving an extension problem. Let $K\subset X$ be
compact such that $f|_{K}$ is continuous. Theorem 3.8 describes how, and under
which assumptions, we are able to extend $f|_{K}$ to a continuous function
$\tilde{f}\in N^{1,p}(X)$. See Equation (3.21) for the precise formulation of
this extension. This construction ought to be thought of as a discretized and
adapted version of the more familiar construction used in Proposition 2.15,
see in particular Proposition 2.25. The discretization is our main new
contribution and yields continuity without assuming the existence of curves.
It plays a crucial role in allowing us to dispense with the geodesic
assumption employed in [23], and the quasiconvexity assumption employed in
[21]. This approach to approximating Sobolev functions by discretizations is
novel. Indeed, prior methods fell short from being able to handle the case of
complete and separable metric spaces.

A second technical contribution of this paper concerns removing the properness
assumption in [7]. This is somewhat subtle, and involves the inner-regularity
of the measure $\mu$, i.e. that for any bounded Borel set $A\subset X$ and
$\epsilon>0$ there is a compact set $K\subset A$ with $\mu(A\setminus
K)<\epsilon$. The main argument here is in Proposition 2.15, where a slight
modification of the notion of “good function” allows for the usual arguments
in [7, Section 3] to go through. Indeed, this yields Proposition 3.2 and the
more general capacity results. A refinement of this notion, “a good sequence
of functions”, plays a role in the proof of Theorem 1.6.

In Section 2 we set the notation and prove some useful lemmas about good
functions, discrete paths and almost upper gradients. The results in that
section are new and have been written in a way that they may be useful in
future work. In Section 3, we establish our main results in the complete
setting. In Section 4, we extend these results to the locally complete setting
using partition of units and localization. Finally, in Section 5, we discuss
the Choquet property and the equivalence of different definitions of capacity.

##  2\. Notation and preliminaries

###  2.1. Modulus and Sobolev spaces

Throughout the paper $X$ will be a separable metric space and $\mu$ any Borel
measure on $X$ which is finite and positive on each ball, that is
$\mu(B(x,r))\in(0,\infty)$ for each ball $B(x,r)\subset X$. Such measures are
Radon when $X$ is (locally) complete and separable, see[8, Theorem 7.1.7,
Definition 7.1.1]. (In the reference, the claim is stated only for complete
metric spaces. However, by an extension of the measure to the completion,
following [31], we obtain the claim for locally complete spaces.). In
particular, the measures $\mu$ in this paper are inner and outer regular.

By convention, we denote open balls by $B(x,r)=\\{y\in X:d(x,y)<r\\}$. The
value $r$ is called the radius of the ball (which may be non-unique), and any
ball of radius $r$ is referred to as an _$r$ -ball_. The distance between two
sets $A,B\subset X$ is defined as $d(A,B)=\inf_{a\in A,b\in B}d(a,b)$. For a
single point $x\in X$, we adopt the convention $d(x,A)=d(\\{x\\},A)$. The
characteristic function of a set $A\subset X$ is denoted ${\mathbbm{1}}_{A}$.

Generally, we will assume that either $X$ is complete or locally complete. In
the latter case, we will also consider its completion $\hat{X}$. If $X$ is
locally complete, then $X$ is an open subset in $\hat{X}$. The spaces of
$L_{p}$-integrable functions with respect to $\mu$ for $p\in[1,\infty)$ will
be denoted by $L^{p}(X)$. The $L^{p}$-norm of a function $f$ is denoted
$\|f\|_{L^{p}(X)}$. The space of continuous functions on $X$ is denoted
$C(X)$. We do not need a topology on this space, and thus consider it only as
a set.

To discuss Newtonian spaces and capacities we next recall some classical
terminology. These are covered in more detail in [22], as well as [32, 7].

A curve $\gamma$ is a continuous map $\gamma:[0,1]\to X$ (or, in specific
instances any continuous map $\gamma:I\to X$, where
$I=[a,b]\subset{\mathbb{R}}$ is a bounded interval). The length of a
rectifiable curve is denoted ${\rm Len}(\gamma)$. The speed of an absolutely
continuous curve, which exists for a.e. $t\in[0,1]$, is defined as

(2.1) $|\gamma^{\prime}(t)|=\lim_{h\to 0}\frac{d(\gamma(t+h),\gamma(t))}{h}.$

Every rectifiable curve has a unique constant-speed parametrization, where
$|\gamma^{\prime}(t)|={\rm Len}(\gamma)$ for a.e. $t\in[0,1]$, [22, Sec. 5.1].
If $\tilde{\gamma}:[0,1]\to X$ is the constant-speed parametrization of
$\gamma$, we define the path integral with respect to $\gamma$ as:

(2.2)
$\int_{\gamma}g\,ds:=\int_{0}^{1}g(\tilde{\gamma}(t))|\tilde{\gamma}^{\prime}(t)|\,dt={\rm
Len}(\gamma)\int_{0}^{1}g(\tilde{\gamma}(t))\,dt$

when $g$ is any Borel function for which the right hand-side is defined.

We will mostly only consider rectifiable curves and, unless otherwise
specified, allow constant curves. We write $\gamma\subset A$ for a subset
$A\subset X$ if $\gamma([0,1])\subset A$. If $x\in X$ is any point, we write
$\gamma:A\leadsto x$ to denote that $\gamma(0)\in A$ and $\gamma(1)=x$, i.e.
that $\gamma$ connects $A$ to $x$. The diameter of a curve is denoted
$\operatorname{diam}(\gamma):=\operatorname{diam}({\rm
Image}(\gamma))=\sup_{s,t\in[0,1]}d(\gamma(s),\gamma(t)).$

Let $\Gamma$ be a collection of rectifiable curves. A non-negative Borel
function $\rho:X\to[0,\infty]$ is called admissible for $\Gamma$, denoted
$\rho\in{\rm Adm}(\Gamma)$, if $\int_{\gamma}\rho\,ds\geq 1$ for each
$\gamma\in\Gamma.$ Here, $\int_{\gamma}g\,ds$ is the path integral defined in
(2.2). Modulus is defined by

${\rm Mod}_{p}(\Gamma)=\inf_{\rho\in{\rm
Adm}(\Gamma)}\|\rho\|_{L^{p}(X)}^{p}.$

A property is said to hold for $p$-a.e. curve $\gamma$ if it holds for each
rectifiable $\gamma\not\in\Gamma$ for some collection $\Gamma$ with ${\rm
Mod}_{p}(\Gamma)=0$. Given two sets $E,F\subset X$ we will denote by
$\Gamma(E,F)$ the family of all rectifiable curves $\gamma$ in $X$ with
$\gamma(0)\in E$ and $\gamma(1)\in F$.

Recall, that a non-negative Borel function $g:X\to[0,\infty]$ is called an
upper gradient for $f:X\to[-\infty,\infty]$, if for every rectifiable
$\gamma:[0,1]\to X$, we have

(2.3) $|f(\gamma(1))-f(\gamma(0))|\leq\int_{\gamma}g~{}ds.$

Here, the left hand side is interpreted to be infinity if the expression gives
$|\infty-\infty|$ or $|-\infty-(-\infty)|$. The collection of upper gradients
for $f$ is denoted by $\mathcal{D}(f)$.

We define the Newtonian space $N^{1,p}(X)$ as the collection of all functions
$f\in L^{p}(X)$ that admit an upper gradient $g\in L^{p}(X)$. A seminorm on
$N^{1,p}(X)$ is given by

$\|f\|_{N^{1,p}(X)}=\left(\|f\|_{L^{p}(X)}^{p}+\inf_{g\in\mathcal{D}(f)}\|g\|_{L^{p}(X)}^{p}\right)^{1/p}.$

Then, if we identify $f\sim g$ for $f,g\in N^{1,p}(X)$ whenever
$\|f-g\|_{N^{1,p}(X)}=0$, we obtain a Banach space; see [32]. Thus, while
formally $N^{1,p}(X)$ consists of equivalence classes of functions, we will
always consider pointwise representatives for a given class.

A function $g$ is a ($p$-)weak upper gradient, if Inequality (1.1) holds for
$p$-a.e. rectifiable curve $\gamma:[0,1]\to X$. A function $f\in L^{p}(X)$
always admits a minimal $p$-weak upper gradient $g_{f}$ for which
$\|g_{f}\|_{L^{p}(X)}=\inf_{g\in\mathcal{D}(f)}\|g\|_{L^{p}(X)}$. See [22,
Theorem 6.3.20] for further details. The following is a classical statement
following from the Vitali–Carathéodory theorem.

######  Lemma 2.4.

If $g\in L^{p}(X)$ is any $p$-weak upper gradient for $f$, then for any
$\epsilon>0$, there exists a lower semicontinuous $g_{\epsilon}\geq g$ so that
$g_{\epsilon}$ is an upper gradient for $f$ and
$\int_{X}g_{\epsilon}^{p}d\mu\leq\int_{X}g^{p}d\mu+\epsilon$.

###### Proof.

Let $g\in L^{p}(X)$ be a weak upper gradient. If $\Gamma$ is the family of
rectifiable curves so that Inequality (1.1) does not hold, then ${\rm
Mod}_{p}(\Gamma)=0.$ Hence, by [22, Lemma 5.2.8], for any $\epsilon>0$, there
is a $h$ so that $\int_{X}h^{p}d\mu\leq\epsilon/2$ and
$\int_{\gamma}hds=\infty$ for each $\gamma\in\Gamma$. Applying [22,
Vitali–Carathéodory theorem, p. 108] to $\max(g,h)$ we obtain a function
$g_{\epsilon}$ such that $g_{\epsilon}\geq\max(g,h)$, with
$\int_{X}g_{\epsilon}^{p}d\mu\leq\int_{X}g^{p}d\mu+\epsilon$. Finally, we
verify that Inequality (1.1) holds for $g_{\epsilon}$ and for every
rectifiable path $\gamma$. Indeed, if $\gamma\in\Gamma$, then (1.1) follows
from $\infty=\int_{\gamma}hds\leq\int_{\gamma}g_{\epsilon}ds$. While, for
$\gamma\not\in\Gamma$, Inequality (1.1) is satisfied since it holds for $g$
and $g\leq g_{\epsilon}$. ∎

If $E\subset X$, denote by $\Gamma_{E}$ the set of non-constant rectifiable
curves that intersect $E$. A set $E$ is called $p$-exceptional if ${\rm
Mod}_{p}(\Gamma_{E})=0$.

We will need a version of [32, Lemma 4.3], see also [22, Lemma 6.3.14] and
[12, Proposition 2.22.] which we state next.

######  Lemma 2.5.

Suppose that $f\in N^{1,p}(X)$ has $g\in L^{p}(X)$ as upper gradient, and
suppose $f|_{A}=c$ for some $c\in{\mathbb{R}}$, and for some Borel set
$A\subset X$. Then, the function $g_{A}=g{\mathbbm{1}}_{X\setminus A}$ is a
$p$-weak upper gradient for $f$. In particular, the minimal $p$-weak upper
gradient $g_{f}$ satisfies $g_{f}(x)=0$ for $\mu$-almost every $x\in A$.

Proposition 2.6 is useful when extending Sobolev functions. It differs from
Lemma 2.5 in a crucial way, that we do not need to assume that a given
function $\tilde{f}$ is _a priori_ a Sobolev function. Our starting point is a
Sobolev function $f$ and its upper gradient $g$. Another function $\tilde{f}$
agrees with $f$ on a set $K$, and we _a priori_ know that $g$ is also an upper
gradient for $\tilde{f}$ in $X\setminus K$. Here, we say that $g$ is an upper
gradient for $f$ in a set $A$, if Inequality (1.1) holds for every curve
$\gamma$ with $\gamma\subset A$. When $\tilde{f}$ is continuous this
information can be patched together to conclude that $g$ is an upper gradient
for $\tilde{f}$ in all of $X$. As a consequence, this shows that $\tilde{f}$
is Sobolev. The proposition has a proof which is quite similar in spirit to
[32, Lemma 4.3]. However, given the differences in the statements and some
details of the arguments, we provide a complete proof.

######  Proposition 2.6.

Let $f\in N^{1,p}(X)$ and let $g\in L^{p}(X)$ be an upper gradient for $f$.
Let $\tilde{f}\in L^{p}(X)$ be a continuous function so that that
$f|_{K}=\tilde{f}|_{K}$ for some closed set $K$. If $g$ is an upper gradient
for $\tilde{f}$ in $X\setminus K$, then $g$ is also an upper gradient for
$\tilde{f}$ in all of $X$. In particular, $\tilde{f}\in N^{1,p}(X)$.

###### Proof.

Let $\gamma:[0,1]\to X$ be any non-constant rectifiable curve. The upper
gradient inequality (1.1) is invariant under reparametrizations. Hence, for
convenience, we will assume that $\gamma$ has the constant-speed
parametrization. There are essentially three cases to consider, when verifying
Inequality (1.1) for $\tilde{f}$ in place of $f$. Since (1.1) is clear when
$\int_{\gamma}g\,ds=\infty$, we can assume that $\int_{\gamma}g\,ds<\infty$.

1\. Assume $\gamma(0),\gamma(1)\in K$. Since $g$ is an upper gradient for $f$
and $f|_{K}=\tilde{f}|_{K}$ the Inequality (1.1) for $\gamma$ and $\tilde{f}$
is identical to that for $f$.

2\. Assume $\gamma(0)\in K$ but $\gamma(1)\not\in K$ (or the reverse). The
reverse case of $\gamma(1)\in K$ and $\gamma(0)\not\in K$ is symmetrical and
can be reduced to this by considering the curve
$\tilde{\gamma}(t)=\gamma(1-t)$. Thus take $\gamma(0)\in K$ and
$\gamma(1)\not\in K$.

Let $t=\sup\gamma^{-1}(K)$. We have $t<1$ since $K$ is closed. Consider
$\gamma_{1}=\gamma|_{[0,t]}$ (which may be constant) and
$\gamma_{2,\epsilon}=\gamma|_{[t+\epsilon,1]}$ for $\epsilon\in[0,1-t)$. By
case 1., we have
$\int_{\gamma_{1}}gds\geq|\tilde{f}(\gamma_{1}(0))-\tilde{f}(\gamma_{1}(t))|.$

For $0<\epsilon<1-t$, we have that $\gamma_{2,\epsilon}\subset X\setminus K$
and since $g$ is an upper gradient for $\tilde{f}$ in $X\setminus K$ we have

(2.7)
$|\tilde{f}(\gamma_{2,\epsilon}(t+\epsilon))-\tilde{f}(\gamma_{2,\epsilon}(1))|\leq\int_{\gamma_{2,\epsilon}}g\,ds$

Thus, we get

$\displaystyle|\tilde{f}(\gamma(0))-\tilde{f}(\gamma(1))|$
$\displaystyle\leq|\tilde{f}(\gamma(0))-\tilde{f}(\gamma(t))|+|\tilde{f}(\gamma(t))-\tilde{f}(\gamma(1))|$
$\displaystyle\leq\int_{\gamma_{1}}g\,ds+\lim_{\epsilon\to
0}|\tilde{f}(\gamma_{2,\epsilon}(t+\epsilon))-\tilde{f}(\gamma_{2,\epsilon}(1))|$
(by item 1. and continuity)
$\displaystyle\leq\int_{\gamma_{1}}g\,ds+\lim_{\epsilon\to
0}\int_{\gamma_{2,\epsilon}}g\,ds$ (by (2.7))
$\displaystyle=\int_{\gamma}g\,ds.$

In the second to last line, we rewrite the integrals using $g(\gamma(t))$
multiplied by the characteristic function of $[0,t]\cup[t+\epsilon,1]$, and
then we conclude using monotone convergence.

3\. Assume $\gamma(0),\gamma(1)\not\in K$. If $\gamma\subset X\setminus K$,
then the claim follows since $\tilde{g}$ is an upper gradient for $\tilde{f}$
in $X\setminus K$. Otherwise there is some $t\in[0,1]$ so that $\gamma(t)\in
K$. Now, apply the second case to $\gamma|_{[0,t]}$ and to $\gamma|_{[t,1]}$
together with the triangle inequality to get Inequality (1.1). ∎

Let $N^{1,p}_{b}(X)\subset N^{1,p}(X)$ consist of those functions $f\in
N^{1,p}(X)$ with bounded support which are bounded in $X$. More precisely,
$N^{1,p}_{b}(X)$ consists of those $f\in N^{1,p}(X)$ for which there are
constants $M,R>0$ and a point $x_{0}\in X$, so that $f|_{X\setminus
B(x_{0},R)}=0$ almost everywhere and $f(x)\in[-M,M]$ for almost every $x\in
X$. An important first step will be to reduce the approximation to such
functions. This result is very standard, and can be found in many references,
see e.g. [33, Lemma 2.14]. We provide a proof for the sake of completeness.

######  Lemma 2.8.

$N^{1,p}_{b}(X)$ is dense in $N^{1,p}(X)$.

###### Proof.

Fix $x_{0}\in X$ and consider $M>0$. Let
$\psi_{M}(x)=\max(\min(2-d(x_{0},x)/M,1),0)$, which can be seen to be
$1/M$-Lipschitz. Define

$f_{M}=\psi_{M}(x)\min(\max(f,-M),M).$

We have $|f_{M}|\leq\min(|f|,M)$, and $\lim_{M\to\infty}f_{M}=f$ pointwise and
in $L^{p}(X)$. Further, using the Leibniz rule for Sobolev functions (see [22,
Proposition 6.3.28]) one can show that $g_{f_{M}}\leq\frac{|f|}{M}+g_{f}$ is
an upper gradient for $f_{M}$. So, $f_{M}\in N^{1,p}(X)$. Also $f_{M}-f=0$ on
the set $A_{M}=B(x_{0},M)\cap\\{|f|\leq M\\}$. By Lemma 2.5, the function
$f_{M}-f$ has a weak upper gradient $g_{f_{M}-f}\leq{\mathbbm{1}}_{X\setminus
A_{M}}(2g_{f}+\frac{|f|}{R})$. So $g_{f_{M}-f}\to 0$ in $L^{p}$ by dominated
convergence, since $\mu(X\setminus\bigcup_{M\in{\mathbb{N}}}A_{M})=0$. Thus

$\lim_{M\to\infty}\|f_{M}-f\|_{N^{1,p}(X)}^{p}=\lim_{M\to\infty}\|f-f_{M}\|_{L^{p}(X)}^{p}+\|g_{f-f_{M}}\|_{L^{p}(X)}^{p}=0.$

∎

###  2.2. Good functions

We will mostly consider curve families $\Gamma$ which are invariant under re-
parametrization. That is, if $\gamma\in\Gamma$, then any reparametrization of
the curve is in $\Gamma$ as well. With this in mind, we say that a collection
$\Gamma$ of curves is pre-compact, if every sequence
$\\{\gamma_{i}\\}_{i=1}^{\infty}\subset\Gamma$, where $\gamma_{i}:[0,1]\to X$
is parametrized by constant-speed, has a uniformly convergent subsequence.
Many arguments regarding modulus rely on extracting convergent subsequences.
The basic requirement is some form of compactness, and the following
formulation of Arzelà-Ascoli captures this.

######  Lemma 2.9.

(Arzelà-Ascoli) Suppose that $X$ is complete and that $L\geq 1$. A collection
$\Gamma$ of curves of length at most $L$ is pre-compact, if given the
constant-speed parametrizations $\gamma:[0,1]\to X,$ the set

$A_{t}=\\{\gamma(t):\gamma\in\Gamma,\gamma\text{ parametrized by constant
speed}\\}$

is pre-compact in $X$, for every $t\in[0,1]$.

The proof is standard, see for instance the argument in [30, Theorem 4.25].
When $X$ is a proper space, pre-compactness is the same as a boundedness.
However, to work in the case when $X$ is simply a complete space, we introduce
a notion of “good function”, which allows us to circumvent the lack of
properness.

Given a collection $\Gamma$ of curves and a set $A$, the collection of curves
$\Gamma^{A}$ contained in $A$ is defined by
$\Gamma^{A}=\\{\gamma\in\Gamma:\gamma\subset A\\}$. If further $\delta,L>0$
and $g\in L^{p}(X)$, we define a subcollection by

(2.10) $\Gamma_{\delta,L}^{A}(g)=\\{\gamma\in\Gamma^{A}:\int_{\gamma}g\leq
L,\operatorname{diam}(\gamma)\geq\delta\\}.$

######  Definition 2.11.

A Borel function $g:X\to[0,\infty]$ is called a _good function_ , if the set
of curves $\Gamma_{\delta,L}^{A}(g)$ defined in (2.10) is pre-compact, for any
family $\Gamma$ of rectifiable curves, any bounded Borel set $A$, and for all
$\delta,L>0$.

######  Example 2.12.

Suppose that $X$ is compact. For any $\epsilon>0$ the function
$g:X\to[\epsilon,\infty]$ is a good function. Indeed, let $\Gamma$ be an
arbitrary family of rectifiable curves and let $A\subset X$ be a bounded Borel
set. In this case, for any $\delta,L>0$ we have
$\Gamma^{A}_{\delta,L}(g)\subset\\{\gamma\subset A:{\rm Len}(\gamma)\leq
L/\epsilon\\}$. Then, $A_{t}\subset X$, and $A_{t}$ is automatically pre-
compact as a subset of a compact space $X.$ Therefore, by Lemma 2.9 the
collection $\Gamma^{A}_{\delta,L}(g)$ is pre-compact.

The next lemma strenghtens the Vitali-Carathéodory Lemma 2.4 by showing that
any $L^{p}$-function can be slightly modified to become a lower semicontinuous
good function.

######  Lemma 2.13.

Assume $X$ is complete. If $g\in L^{p}(X)$ is non-negative, then for any
$\epsilon>0$ there exists a lower semicontinuous good function
$g_{\epsilon}\geq g$ so that
$\|g_{\epsilon}\|_{L^{p}(X)}\leq\|g\|_{L^{p}(X)}+\epsilon$.

###### Proof.

Fix $g,\epsilon$ as in the statement. By an application of Lemma 2.4, we can
take $g$ to be lower semicontinuous. Fix any point $x_{0}\in X$.

Choose compact sets $\tilde{K}_{i}\subset B(x_{0},i)$, so that
$\mu(B(x_{0},i)\setminus\tilde{K}_{i})\leq\epsilon^{p}2^{-(i+1)p}$. This is
possible since $\mu(B(x_{0},i))<\infty$ and since the measure is Radon. Define
$K_{i}=\bigcup_{j=1}^{i}\tilde{K}_{j}$, so that $K_{n}\subset K_{m}$ for
$n\leq m$ and so that $\mu(B(x_{0},i)\setminus
K_{i})\leq\epsilon^{p}2^{-(i+1)p}$. Define

$g_{\epsilon}=g+\sum_{i=1}^{\infty}\left({\mathbbm{1}}_{B(x_{0},i)\setminus
K_{i}}+\frac{\epsilon}{2^{i+1}\mu(B(x_{0},i))^{1/p}}{\mathbbm{1}}_{B(x_{0},i)}\right).$

This function is lower semi continuous, since it is a sum of lower
semicontinuous functions. Moreover,

$\|g_{\epsilon}\|_{L^{p}(X)}\leq\|g\|_{L^{p}(X)}+\sum_{i=1}^{\infty}\left(\left\|{\mathbbm{1}}_{B(x_{0},i)\setminus
K_{i}}\right\|_{L^{p}(X)}+\left\|\frac{\epsilon}{2^{i+1}\mu(B(x_{0},i))^{\frac{1}{p}}}{\mathbbm{1}}_{B(x_{0},i)}\right\|_{L^{p}(X)}\right)\leq\|g\|_{L^{p}(X)}+\epsilon.$

We show that $g_{\epsilon}$ is a good function. Let $\Gamma$ be any family of
rectifiable curves and let $A$ be any bounded Borel set. There exists some
$j\in{\mathbb{N}}$ so that $A\subset B(x_{0},j)$. By increasing the set $A$,
we get a larger collection of curves, and thus it suffices to consider
$A=B(x_{0},j)$. The idea is to use Arzela-̀Ascoli Lemma 2.9 to show that the
collection $\Gamma^{A}_{\delta,L}(g_{\epsilon})$ defined in (2.10), for given
$\delta,L>0$, is pre-compact. First note that, if
$\gamma\in\Gamma^{A}_{\delta,L}(g_{\epsilon})$, then
$L\geq\int_{\gamma}g_{\epsilon}ds$. Since $A=B(x_{0},j)$, we get
$g_{\epsilon}>\frac{\epsilon}{2^{j+1}\mu(B(x_{0},j))^{\frac{1}{p}}}{\mathbbm{1}}_{A}$.
Thus, since $\gamma\subset A$,

${\rm
Len}(\gamma)\leq\frac{2^{j+1}\mu(B(x_{0},j))^{\frac{1}{p}}}{\epsilon}\int_{\gamma}g_{\epsilon}\,ds\leq\frac{2^{j+1}\mu(B(x_{0},j))^{\frac{1}{p}}L}{\epsilon}=:L^{\prime}.$

Therefore all the curves in $\Gamma^{A}_{\delta,L}(g_{\epsilon})$ have length
at most $L^{\prime}$.

Now, consider curves $\gamma\in\Gamma_{\delta,L}^{A}(g_{\epsilon})$ which are
parametrized by constant-speed. It is enough to show that for each $t\in[0,1]$
the set

$A_{t}:=\\{\gamma(t):\gamma\in\Gamma_{\delta,L}^{A}(g_{\epsilon})\text{ is
parametrized by constant speed}\\}$

is pre-compact in $X$. Since $X$ is complete, it suffices to show that $A_{t}$
is totally bounded. Fix $\eta\in(0,\delta/2)$ for this purpose. Choose
$N=j+\lfloor 4L/\eta\rfloor+1$. We claim that $A_{t}\subset\\{y\in
X:d(y,K_{N})<\eta/4\\}$. Assume, for the sake of contradiction, that
$d(\gamma(t),K_{N})\geq\eta/4$ for some
$\gamma\in\Gamma_{\delta,L}^{A}(g_{\epsilon})$. Since
$\operatorname{diam}(\gamma)\geq\delta>2\eta$, we must have a segment of
$\gamma$ of length at least $\eta/4$ contained in $A\setminus K_{N}\subset
B(x_{0},j)\setminus K_{N}$. Thus, since $K_{i}\subset K_{N}$ for each $i$ with
$1\leq i\leq N$, and $A\subset B(x_{0},i)$ for each $j\leq i\leq N$, we get

$\int_{\gamma}g_{\epsilon}\,ds\geq\sum_{i=j}^{N}\int_{\gamma}{\mathbbm{1}}_{B(x_{0},i)\setminus
K_{i}}\,ds\geq(N-j)\int_{\gamma}{\mathbbm{1}}_{B(x_{0},j)\setminus
K_{N}}\,ds\geq\left(\lfloor 4L/\eta\rfloor+1\right)\frac{\eta}{4}>L,$

which is a contradiction. Thus, $A_{t}\subset\\{y\in X:d(y,K_{N})<\eta/4\\}$.
By covering $K_{N}$ by $\eta/2$ balls and inflating these balls by $2$ we get
a finite covering of $A_{t}$ by $\eta$-balls. This shows that the set $A_{t}$
is totally bounded and thus pre-compact. ∎

We will need the following lower semicontinuity of curve integrals. The result
is classical, and its proof has appeared in many places, such as [23,
Proposition 4]. For the reader’s convenience we give a short proof.

######  Lemma 2.14.

Let $\gamma_{i}:[0,1]\to X$ be a sequence of rectifiable curves parametrized
by constant speed, with ${\rm Len}(\gamma_{i})\leq L$ for some
$L\in[0,\infty]$ and all $i\in{\mathbb{N}}$, and suppose that $\gamma_{i}$
converges uniformly to a curve $\gamma:[0,1]\to X$. If $g:X\to[0,\infty]$ is a
lower semicontinuous function, then

$\int_{\gamma}g\,ds\leq\liminf_{i\to\infty}\int_{\gamma_{i}}g\,ds.$

###### Proof.

By passing to a subsequence, we can assume that
$\lim_{i\to\infty}\int_{\gamma_{i}}g\,ds$ exists, and that ${\rm
Len}(\gamma_{i})\to L^{\prime}$ for some $L^{\prime}$. Since $\gamma_{i}$ are
parametrized by constant speed, see (2.1), $|\gamma_{i}^{\prime}|(t)={\rm
Len}(\gamma_{i})=:L_{i}$ for each $i\in{\mathbb{N}}$ and every $t\in[0,1]$,
and $\gamma_{i}$ is $L_{i}$-Lipschitz. Therefore, $\gamma$ is $L$-Lipschitz,
and $|\gamma^{\prime}|(t)\leq L$ for a.e. $t\in[0,1]$.

$\displaystyle\int_{\gamma}g\,ds=\int_{0}^{1}g(\gamma(t))|\gamma^{\prime}|(t)dt$
$\displaystyle\leq\int_{0}^{1}g(\gamma(t))Ldt$
$\displaystyle\leq\lim_{i\to\infty}\int_{0}^{1}g(\gamma_{i}(t))L_{i}dt$ (by
l.s.c. and Fatou’s Lemma)
$\displaystyle=\lim_{i\to\infty}\int_{\gamma_{i}}g\,ds.$

∎

The next result is a a generalization of a well-known method to construct a
function with a given upper gradient [22, Lemma 7.2.13]. However, the proof
there that $u$ is lower-semicontinuous requires that $X$ is proper. In our
generality of locally complete and complete spaces, this does not suffice. In
this generality the crucial idea is to use the notion of a good function. The
proof changes slightly as a consequence of this, and we provide full detail
for the sake of completeness.

######  Proposition 2.15.

Let $X$ be complete. Assume that $V\subset X$ is a bounded open set and that
$g:X\to[0,\infty]$ is a good function. Then, the function $u:X\to{\mathbb{R}}$
given by

$u(x):=\min\left(\inf_{\gamma:X\setminus V\leadsto
x}\int_{\gamma}g\,ds,1\right)$

is in $L^{p}(X)$ for $1\leq p\leq\infty$, and has $g$ as upper gradient.
Moreover, $u$ is lower semicontinuous.

######  Remark 2.16.

We adopt the usual conventions for the infimum. If $x\in X\setminus V$, then
the constant curve is allowed, hence $u(x)=0$. If there are no curves
$\gamma:X\setminus V\mapsto x$, then $u(x)=1$ since the infimum over an
emptyset is $\infty$.

###### Proof of Proposition 2.15.

If we show that $u$ is lower semicontinuous, then measurability will follow
and we will have $u\in L^{p}(X)$, because, by Remark 2.16,
$u\leq{\mathbbm{1}}_{V}$. Proving that $g$ is an upper gradient for $u$ is
classical argument, see [7, Lemma 3.1]. We recall this argument now. If
$\gamma:[0,1]\to X$ and $\gamma_{0}:X\setminus V\leadsto\gamma(0)$ are any
rectifiable curves, then we can form a curve $\gamma_{1}:X\setminus
V\leadsto\gamma(1)$ by concatenating them. Thus,
$\int_{\gamma_{1}}g\,ds=\int_{\gamma_{0}}g\,ds+\int_{\gamma}g\,ds$. By the
definition of $u$, we get
$u(\gamma(1))\leq\int_{\gamma_{1}}g\,ds\leq\int_{\gamma_{0}}g\,ds+\int_{\gamma}g\,ds$.
Infimizing over $\gamma_{0}$ yields
$u(\gamma(1))\leq\inf_{\gamma_{0}}\int_{\gamma_{0}}g\,ds+\int_{\gamma}g\,ds.$
Since $u(\gamma(1))\leq 1$, we have $u(\gamma(1))\leq
u(\gamma(0))+\int_{\gamma}g\,ds$. By reversing the curve, we obtain
$u(\gamma(0))\leq u(\gamma(1))+\int_{\gamma}g\,ds$. From these two
inequalities, we get inequality (1.1).

Thus the more important part of the proof is to show that $u$ is lower
semicontinuous. Arguing by contradiction, assume that we can find some
sequence $x_{i}$ converging to $x$ in $X$, with the property
$\lim_{i\to\infty}u(x_{i})<u(x)-\Delta$ for some $\Delta>0$. Since $u$ is non-
negative, we must have that $u(x)>\Delta$, hence $x\in V$. Since $V$ is open,
there is some ball $B(x,2\delta)\subset V$, with $\delta>0$. By convergence,
we can throw away finitely many terms and assume that $x_{i}\in B(x,\delta)$
for all $i\in{\mathbb{N}}$. We can also pass to a subsequence so that
$u(x_{i})<u(x)-\Delta$ for every $i\in{\mathbb{N}}$. In particular, we have
$u(x_{i})<1$. Hence, we can choose curves $\gamma_{i}:X\setminus V\leadsto
x_{i}$ with

(2.17) $\int_{\gamma_{i}}gds\leq u(x)-\Delta\leq 1.$

Assume $\gamma_{i}:[0,1]\rightarrow X$ has the constant-speed parametrization
and let

$t_{i}:=\sup\left\\{t\in[0,1]:d(\gamma_{i}(t),X\setminus
V)\leq\frac{\delta}{2i}\right\\},$

which is the last time $\gamma_{i}(t)$ is $\frac{\delta}{2i}$ away from
$X\setminus V$.

Let $\tilde{\gamma_{i}}$ be the constant speed parametrization of
$\gamma_{i}|_{[t_{i},1]}$ on $[0,1]$, so that $\tilde{\gamma_{i}}\subset V$,
for each $i\in{\mathbb{N}}$. By (2.17) and since $\tilde{\gamma_{i}}$ is a
subcurve of $\gamma_{i}$, we have $\int_{\tilde{\gamma_{i}}}g,ds\leq 1$.

Since $d(x_{i},X\setminus V)\geq\delta$, we have
$\operatorname{diam}(\tilde{\gamma_{i}})\geq\delta/2$. Thus
$\tilde{\gamma_{i}}\in\Gamma^{V}_{\delta/2,1}(g)$, where $\Gamma$ is the
collection of all rectifiable curves. Since $g$ is a good function, and since
$\tilde{\gamma_{i}}$ are parametrized by constant speed, there is a
subsequence $\\{\tilde{\gamma}_{i_{k}}\\}_{k\in{\mathbb{N}}}$ converging
uniformly to some continuous function $\gamma:[0,1]\to X$.

Next, by Lemma 2.14, we have

$\int_{\gamma}gds\leq\liminf_{k\to\infty}\int_{\tilde{\gamma}_{i_{k}}}gds\leq
u(x)-\Delta.$

By construction, $d(\tilde{\gamma}_{i_{k}}(0),X\setminus
V)\leq\frac{\delta}{2i_{k}}$, and $\tilde{\gamma}_{i_{k}}(1)=x$. Also,
$\lim_{k\rightarrow\infty}\tilde{\gamma}_{i_{k}}(0)=\gamma(0)$ and
$\lim_{k\rightarrow\infty}\tilde{\gamma}_{i_{k}}(1)=\gamma(1)$. Therefore,
sending $k\to\infty$, we get $\gamma(0)\in X\setminus V$ and $\gamma(1)=x$,
namely, $\gamma:X\setminus V\leadsto x$. This leads to

$u(x)\leq\int_{\gamma}gds\leq u(x)-\Delta,$

which is a contradiction. ∎

At this juncture, we note, that one of the crucial insights of the present
paper is that we can replace path integrals with discrete Riemann-type sums
over paths. We will next move to develop the language for such arguments. We
will also prove an analogue of Proposition 2.15 in Proposition 2.25 for such
constructions.

###  2.3. Discrete paths

We will be considering discrete path approximations to curves. A _(discrete)
path_ is a sequence $P=(p_{0},\dots,p_{n})$, with $n\geq 0$, and which does
not repeat. We identify $P$ sometimes with the image set, for example in
writing $p\in P$ to state that a point $p$ lies in the path. When $n\geq 1$
define its _mesh size_ by ${\rm Mesh}(P)=\max_{k=0,\dots n-1}d(p_{k},p_{k+1})$
and its _length_ by ${\rm Len}(P)=\sum_{k=0}^{n-1}d(p_{k},p_{k+1})$. The
_diameter_ , $\operatorname{diam}(P)$, is the diameter as a set of points.
Note that the path $P=(p_{0})$ consisting of only one point, and with
diameter, length and mesh equal to zero, is permitted. Given a function
$g:X\to{\mathbb{R}}$ we define the _discrete integral_ of $g$ along $P$ by

$\int_{P}g:=\sum_{k=0}^{n-1}g(p_{k})d(p_{k},p_{k+1}).$

Again, if $P$ is a single point, then $\int_{P}g=0$.

Discrete paths can be extended to curves after we pass to a larger super
space. For such arguments, we introduce an isometric Kuratowski embedding
$\iota:X\to\ell_{\infty}({\mathbb{N}})$ into the sequence space
$\ell_{\infty}({\mathbb{N}})$. We will fix such an embedding for the remainder
of this subsection.

Given a discrete path $P$ we call a curve
$\gamma:[0,1]\to\ell_{\infty}({\mathbb{N}})$ its _linearly interpolating
curve_ if it is constructed as follows. If ${\rm Len}(P)=0$, i.e. when
discrete path consists of only single point $P=(p_{0})$, then define
$\gamma(t)=p_{0}$ for all $t\in[0,1]$. Next, we define the interpolant when
${\rm Len}(P)>0$. Let $t_{0}=0$ and define

(2.18) $t_{l}:=\sum_{k=0}^{l-1}\frac{d(p_{k},p_{k+1})}{{\rm Len}(P)},$

for $l=1,\dots,n$. We refer to $t_{0},\dots,t_{n}$ as the time-partition
points associated to $P$, which are only defined if ${\rm Len}(P)>0$. Define
$\gamma(t_{l})=p_{l}$ and define

(2.19)
$\gamma(t)=\frac{t_{l+1}-t}{t_{l+1}-t_{l}}p_{l}+\frac{t-t_{l}}{t_{l+1}-t_{l}}p_{l+1},$

for $t\in(t_{l},t_{l+1})$. Note that since the path is simple, $p_{l}\neq
p_{l+1}$ and $t_{l}\neq t_{l+1}$ for all $l=0,\dots,n-1$.

With this construction, we have the following lemma.

######  Lemma 2.20.

Let $P$ be a discrete path and $\gamma$ its linearly interpolating curve. We
have the following.

  1. (1)

${\rm Len}(\gamma)={\rm Len}(P)$.

  2. (2)

$d(\gamma(t),X)\leq{\rm Mesh}(P)$ for every $t\in[0,1]$.

  3. (3)

$\gamma$ is parametrized by constant speed.

###### Proof.

Since $\gamma$ is piecewise linear, we can compute its length by adding up the
linear segments, and ${\rm Len}(\gamma)={\rm Len}(P)$ follows.

If ${\rm Len}(P)=0$, then $\gamma$ is a constant curve and $d(\gamma,X)=0={\rm
Mesh}(P)$. Further, $\gamma$ has constant (zero) speed. Suppose then that
${\rm Len}(P)>0$ and let $t_{l}$, for $l=0,\dots,n-1$, be the time-partition
points. For every $t\in[0,1]$, there is a $l=0,\dots,n-1$ for which
$t\in[t_{l},t_{l+1}]$. Hence, by (2.19),

$d(\gamma(t),X)\leq\min(d(\gamma(t),p_{l}),d(\gamma(t),p_{l+1}))\leq
d(p_{l},p_{l+1})\leq{\rm Mesh}(P),$

for each $t\in[0,1]$.

Next, if $t\in(t_{l},t_{l+1})$ for some $l=0,\dots,n-1$, then $\gamma$ is
linear in a neighborhood of $t$, and has speed
$d(p_{l},p_{l+1})/(t_{l+1}-t_{l})={\rm Len}(P)$, by (2.18) and (2.19).
Therefore, $\gamma$ has speed ${\rm Len}(P)$ at all points
$t\not\in\\{t_{0},\dots,t_{n}\\}$, in other words, it is parametrized by
constant speed. ∎

If $P_{i}=(p^{i}_{0},\dots p^{i}_{n(i)})$ is a sequence of discrete paths, we
say that it converges to a curve $\gamma:[0,1]\to X$, if
$\lim_{i\to\infty}{\rm Mesh}(P_{i})=0$ and the linear interpolation curves
$\gamma_{i}$ converge to $\gamma$ uniformly in $\ell_{\infty}({\mathbb{N}})$,
in the sense that:

(2.21)
$\lim_{i\rightarrow\infty}\sup_{t\in[0,1]}\|\gamma_{i}(t)-\gamma(t)\|_{\infty}=0.$

Moreover, one can show that this notion of convergence does not depend on the
embedding to $\ell_{\infty}({\mathbb{N}})$.

We will need the following variant of Lemma 2.14, in the context of discrete
paths.

######  Lemma 2.22.

Assume that $P_{i}=(p^{i}_{0},\dots p^{i}_{n(i)})$ is a sequence of discrete
paths converging to a rectifiable curve $\gamma:[0,1]\to X$, in the sense of
(2.21). Also, assume that $\liminf_{i\to\infty}{\rm Len}(P_{i})<\infty$. Then,
for any lower semicontinuous non-negative function $g:X\to[0,\infty]$ we have

$\int_{\gamma}g\,ds\leq\liminf_{i\to\infty}\int_{P_{i}}g.$

###### Proof.

If ${\rm Len}(\gamma)=0$, then the inequality is trivial. So we may assume
that ${\rm Len}(\gamma)>0$, which, by (2.21), implies that ${\rm
Len}(P_{i})>0$ for all but finitely many $i\in{\mathbb{N}}$. For convenience,
we pass to a subsequence so that ${\rm Len}(P_{i})>0$ for all
$i\in{\mathbb{N}}$.

We first show that if the Lemma has been proven for $g$ continuous, then it
follows for lower semicontinuous $g$. Indeed, we can find an increasing
sequence of functions $\\{g_{l}\\}_{l\in{\mathbb{N}}}$ of non-negative
continuous functions converging pointwise to $g$ (see [22, Corollary 4.2.3]).
For each $l$ we have

$\int_{\gamma}g_{l}\,ds\leq\liminf_{i\to\infty}\int_{P_{i}}g_{l}\leq\liminf_{i\to\infty}\int_{P_{i}}g.$

Send $l\to\infty$ and use monotone convergence then to conclude the lemma for
all $g$ lower semicontinuous.

Hence, assume that $g$ is continuous. Denote the interpolating paths for
$P_{i}$ by $\gamma_{i}$, and use superscripts of the form $t_{l}^{i}$ when
defining $\gamma_{i}$ as in (2.18) and (2.19).

Fix $\epsilon>0$. Extend $g$ to be continuous on $\ell_{\infty}({\mathbb{N}})$
using the Tietze extension theorem; see for example [27]. Since the image of
$\gamma$ is compact, and $g$ continuous, we can find for any $\epsilon>0$ a
$\delta>0$ so that if $x,y\in\ell_{\infty}({\mathbb{N}})$ and
$\max\left(d(x,\gamma),d(y,\gamma),d(x,y)\right)<\delta$ then
$|g(x)-g(y)|<\epsilon$. Choose an $N$ so that for $i\geq N$, we have ${\rm
Mesh}(P_{i})<\delta/2$, $d(\gamma_{i}(t),\gamma(t))<\delta/2$ for all
$t\in[0,1]$.

Next, let $i\geq N$ be arbitrary. For every $t\in[t_{l}^{i},t_{l+1}^{i}]$, we
have $d(\gamma_{i}(t),\gamma(t_{l}^{i}))\leq{\rm Mesh}(P_{i})<\delta$ and
$\gamma(t_{l}^{i})\in P_{i}\in X$. Thus, by the choice of $\delta$, we get
$g(\gamma_{i}(t))\leq g(\gamma_{i}(t_{l}^{i}))+\epsilon$. Integrating this
inequality and using (2.18) , we get

$\int_{t_{l}^{i}}^{t_{l+1}^{i}}g(\gamma_{i}(t)){\rm Len}(P_{i})dt\leq{\rm
Len}(P_{i})(t_{l+1}^{i}-t_{l}^{i})(g(\gamma(t_{l}^{i}))+\epsilon)\leq
d(p_{l}^{i},p_{l+1}^{i})(g(\gamma(t_{l}^{i}))+\epsilon).$

Finally, by summing over $l=0,\dots n(i)-1$, Lemma 2.20 gives

$\int_{\gamma_{i}}gds=\int_{0}^{1}g(\gamma_{i}(t)){\rm
Len}(\gamma_{i})dt\leq\sum_{l=0}^{n(i)-1}d(p_{l}^{i},p_{l+1}^{i})(g(\gamma(t_{l}^{i}))+\epsilon)\leq\int_{P_{i}}g+\epsilon{\rm
Len}(P_{i}).$

By taking a limit inferior with $i\to\infty$, we get

(2.23)
$\liminf_{i\to\infty}\int_{\gamma_{i}}g\leq\liminf_{i\to\infty}\int_{P_{i}}g+\epsilon\liminf_{i\to\infty}{\rm
Len}(P_{i})\,.$

Next, by Lemma 2.20, each $\gamma_{i}$ is parametrized by constant speed ${\rm
Len}(P_{i})$. Thus, the $\gamma_{i}$ are ${\rm Len}(P_{i})$-Lipschitz. Let
$L=\liminf_{i\to\infty}{\rm Len}(P_{i})$. Then, from uniform convergence, we
get that $\gamma$ is $L$-Lipschitz. Together with the fact that the functions
$h_{i}(t)=g(\gamma_{i}(t))$ converge uniformly to the function $g(\gamma(t))$,
since $g$ is continuous, we get

$\displaystyle\int_{\gamma}g\,ds$
$\displaystyle\leq\int_{0}^{1}g(\gamma(t))Ldt$
$\displaystyle=\lim_{i\to\infty}\int_{0}^{1}g(\gamma_{i}(t))Ldt$
$\displaystyle\leq\liminf_{i\to\infty}\int_{0}^{1}g(\gamma_{i}(t)){\rm
Len}(P_{i})dt$
$\displaystyle=\liminf_{i\to\infty}\int_{\gamma_{i}}gds\leq\liminf_{i\to\infty}\int_{P_{i}}g+\epsilon
L\,.$

Since $\epsilon>0$ was arbitrary, the claim follows. ∎

We will need the following compactness statement for discrete paths.

######  Lemma 2.24.

If $\\{P_{i}\\}_{i\in{\mathbb{N}}}$ is a sequence of paths in a complete
metric space $X$ satisfying

  1. (1)

$\lim_{i\to\infty}{\rm Mesh}(P_{i})=0$;

  2. (2)

${\rm Len}(P_{i})\leq S$ for some $S\in(0,\infty)$ and all $i\in{\mathbb{N}}$;
and

  3. (3)

for any $\tau>0$ there is a compact set $K_{\tau}\subset X$ that $\max_{p\in
P_{i}}d(p,K_{\tau})\leq\tau$ for all $i\in{\mathbb{N}}$,

then a subsequence of $P_{i}$ converges to a curve $\gamma:[0,1]\to X$ in the
sense of (2.21).

###### Proof.

For each $i\in{\mathbb{N}}$ let
$\gamma_{i}:[0,1]\to\ell_{\infty}({\mathbb{N}})$ be the curve linearly
interpolating $P_{i}$. Lemma 2.20 states that we have ${\rm
Len}(\gamma_{i})\leq S$ and that the curves $\gamma_{i}$ are parametrized by
constant speed. First, we show that a subsequence of
$(\gamma_{i})_{i\in{\mathbb{N}}}$ converges uniformly to some curve
$\gamma:[0,1]\to\ell_{\infty}({\mathbb{N}})$.

Fix $t\in[0,1]$. Let $A_{t}=\\{\gamma_{i}(t):i\in{\mathbb{N}}\\}$. The claim
follows from Lemma 2.9, if we show that $A_{t}$ is pre-compact. Since
$\ell_{\infty}({\mathbb{N}})$ is complete, it suffices to show that $A_{t}$ is
totally bounded. Fix $\tau>0$ and choose $N\in{\mathbb{N}}$ so that ${\rm
Mesh}(P_{i})\leq\tau/8$ for all $i\geq N$ and a compact set $K_{\tau/8}$ as in
the statement. Then, for $i\geq N$, we have

$d(\gamma_{i}(t),K_{\tau/8})\leq{\rm Mesh}(P_{i})+\max_{p\in
P_{i}}d(p,K_{\tau/8})\leq\tau/4.$

Set $K^{\prime}=K_{\tau/8}\cup\bigcup_{j=1}^{N}\gamma_{j}$ which is compact.
Since $K^{\prime}$ is compact, it can be covered by a finite collection
$\mathcal{B}$ of balls of radius $\tau/2$. Every point $\gamma_{i}(t)\in
A_{t}$ has $d(\gamma_{i}(t),K^{\prime})\leq\tau/4$, and thus by inflating each
ball in $\mathcal{B}$ by two we can cover $A_{t}$ by finitely many balls of
radius $\tau$. Therefore, $A_{t}$ is totally bounded and pre-compact as
desired.

Thus, a subsequence $\gamma_{i_{k}}$ converges uniformly to some curve
$\gamma:[0,1]\to\ell_{\infty}({\mathbb{N}})$. Further, for any $t\in[0,1]$ we
have
$d(\gamma(t),X)=\lim_{k\to\infty}d(\gamma_{i_{k}}(t),X)\leq\lim_{k\to\infty}{\rm
Mesh}(P_{i})=0$ by Lemma 2.20. Thus, the image of $\gamma$ is contained in $X$
and the claim follows. ∎

Discrete paths can be used to conveniently define functions which have given
upper gradients, in the spirit of Proposition 2.15.

######  Proposition 2.25.

Suppose $X$ is a metric space. Let $\delta,M>0$ and let $E\subset X$ be a non-
empty subset. Let $g:X\to[0,\infty)$ be a continuous function and
$h:E\to{\mathbb{R}}$ a bounded function. Define

$f(y):=\min\left(\inf_{P}\left\\{h(p_{0})+\int_{P}g\right\\},M\right),$

where the infimum is taken over all discrete paths $P=(p_{0},\dots,p_{n})$
with $p_{0}\in E,p_{n}=y$ and ${\rm Mesh}(P)\leq\delta$.

Then, $f$ is locally Lipschitz, and $g$ is an upper gradient of $f$. Moreover,
if $h$ is constant and less than or equal to $M$, then $f\equiv h$ on $E$.

###### Proof.

Fix $y\in X$ and assume that $d(x,y)\leq\delta$. Let $P=(p_{0},\ldots,p_{n})$
be a discrete path with $p_{0}\in E,p_{n}=y$ and ${\rm Mesh}(P)\leq\delta$.
Let $p_{n+1}=x$ and set $P^{\prime}=(p_{0},\ldots,p_{k})$, where
$k=\inf\\{j\geq 0:p_{j}=x\\}$. Thus, $P^{\prime}$ is a discrete path with
$p_{0}\in E$, $p_{k}=x$, and ${\rm Mesh}(P^{\prime})\leq\delta$. In
particular,

$f(x)\leq h(p_{0})+\int_{P^{\prime}}g\leq h(p_{0})+\int_{P}g+g(y)d(x,y).$

Taking the infimum over $P$ and comparing with $M$ we get

(2.26) $f(x)\leq f(y)+g(y)d(x,y)$

By switching the role of $x$ and $y$, we find that

(2.27) $|f(y)-f(x)|\leq\max(g(x),g(y))d(x,y),$

whenever $d(x,y)\leq\delta$. Since $g$ is continuous, it is also locally
bounded. Hence, (2.27) implies that $f$ is locally Lipschitz.

Next, we want to show that $g$ is an upper gradient for $f$. Let
$\gamma:[0,1]\rightarrow X$ be a curve with constant speed and length $L$. Fix
a partition $s_{0}=0<s_{1}<\cdots<s_{k}=1$. Then,

$\displaystyle\sum_{j=1}^{k}g(\gamma(s_{j-1}))L|s_{j}-s_{j-1}|$
$\displaystyle=\sum_{j=1}^{k}g(\gamma(s_{j-1}))\operatorname{length}\left(\gamma|_{[s_{j},s_{j-1}]}\right)$
$\displaystyle\geq\sum_{j=1}^{k}g(\gamma(s_{j-1}))d\left(\gamma(s_{j-1}),\gamma(s_{j})\right)$
$\displaystyle\geq\sum_{j=1}^{k}\left(f(\gamma(s_{j}))-f(\gamma(s_{j-1}))\right)$
( by (2.26)) $\displaystyle=f(\gamma(s_{k}))-f(\gamma(s_{0})).$

Taking the limit as the mesh goes to zero, we find that

$f(\gamma(1))-f(\gamma(0))\leq\int_{\gamma}gds.$

Running $\gamma$ in reverse, substituting $s$ with $1-s$, we find by a similar
argument that

$|f(\gamma(1))-f(\gamma(0))|\leq\int_{\gamma}gds.$

This shows that $g$ is an upper gradient for $f$.

Finally, assume that $h$ is constant and less than or equal to $M$. Then, for
$y\in E$, we may choose the constant discrete path $P=(y)$, and get that
$f(y)\leq h(y)=h$. Conversely, for any non-constant discrete path
$P=(p_{0},\dots,p_{n})$ with $p_{0}\in E$, $p_{n}=y$, and ${\rm
Mesh}(P)\leq\delta$, we have

$h(p_{0})+\int_{P}g\geq h(p_{0})=h.$

Taking the infimum over such paths, and then the minimum with $M$, we find
that $f(y)\geq h$. Therefore, $f(y)=h$. ∎

###  2.4. Good sequences of functions

For sequences of discrete paths it becomes often convenient to construct a
“good sequence of functions”, which approximate a given function.

######  Definition 2.28.

We say that a sequence of continuous functions $(g_{i})_{i\in{\mathbb{N}}}$,
$g_{i}:X\to[0,\infty)$, is a _good sequence of functions_ , if it satisfies
the following properties:

  1. (1)

Increasing: $g_{i}(x)\leq g_{j}(x)$ for each $i\leq j$ and all $x\in X$.

  2. (2)

Positivity: For any bounded set $V\subset X$, there exists an $\eta_{V}>0$ so
that $g_{i}(x)\geq\eta_{V}$ for every $i\in{\mathbb{N}}$ and every $x\in V$.

  3. (3)

“Goodness”: For any bounded set $V\subset X$, any $\delta,L>0$, and any
sequence $(P_{i})_{i\in{\mathbb{N}}}$ of discrete paths $P_{i}\subset V$ with
$\lim_{i\to\infty}{\rm Mesh}(P_{i})=0$, and such that

    1. (a)

$\int_{P_{i}}g_{i}\leq L$,

    2. (b)

$\operatorname{diam}(P_{i})\geq\delta$,

there is a subsequence converging to a curve $\gamma$ in the sense of (2.21).

######  Proposition 2.29.

Let $(X,d,\mu)$ be a complete separable metric measure space, where $\mu$ is a
Borel measure that is positive and finite on $r$-balls with $0<r<\infty$.
Assume $p\in[1,\infty)$ and let $g$ be given a lower semicontinuous function.
For every $\epsilon>0$, there exists a good sequence of bounded Lipschitz
continuous functions $(\tilde{g}_{i})_{i\in{\mathbb{N}}}$ converging pointwise
to a function $\tilde{g}$ that is a lower semicontinuous good function, and so
that for every bounded set $A\subset X$, there exists some $\eta_{A}>0$ so
that

(2.30) $\tilde{g}(x)\geq g(x)+\eta_{A},\qquad\text{for all $x\in A$,}$

and

(2.31) $\int_{X}\tilde{g}^{p}d\mu\leq\int_{X}g^{p}d\mu+\epsilon.$

Moreover, if $K\subset X$ is a compact set on which $g|_{K}$ is bounded, then
we can choose $\tilde{g}$ so that $\tilde{g}|_{K}$ is bounded.

###### Proof.

Let $x_{0}\in X$ be arbitrary, and let $\epsilon\in(0,1)$. For simplicity, if
$K$ is provided, scale the metric so that $K\subset B(x_{0},1)$. Let
$\psi_{i}(x)=\max(0,\min(i+1-d(x_{0},x),1))$ so that
$\psi_{i}|_{B(x_{0},i)}=1$ and $\psi_{i}|_{X\setminus B(x_{0},i+1)}=0$. One
directly observes that $\psi_{i}$ is Lipschitz for every $i\in{\mathbb{N}}$.

Define $E_{i}$ to be an increasing sequence of compact sets so that
$\mu(B(x_{0},i+1)\setminus E_{i})\leq\epsilon^{p}2^{-4pi}$. If the set $K$ is
provided as in the ‘Moreover part’ of the statement, then we choose $E_{i}$ so
that $K\subset E_{i}$ for each $i$. These sets $E_{i}$ can be constructed
since $\mu$ is Radon. By lower semicontinuity, we may choose an increasing
sequence of Lipschitz continuous bounded functions $g_{i}$ converging to $g$.
The standard construction is to let $g_{i}(x):=\inf\\{g(y)+id(x,y):y\in X\\}$,
see [22, Proposition 4.2.2].

We modify these functions as follow:

(2.32)
$\tilde{g}_{i}(x):=g_{i}(x)+\sum_{n=1}^{i}\left(n\min(1,d(x,E_{n}))+\frac{\epsilon}{8^{n}(\mu(B(x_{0},n+1))+1)}\right)\psi_{n}(x).$

Note that $\tilde{g}_{i}$ is Lipschitz continuous and bounded as well.

Also, define

$\tilde{g}(x):=g(x)+\sum_{n=1}^{\infty}\left(n\min(1,d(x,E_{n}))+\frac{\epsilon}{8^{n}(\mu(B(x_{0},n+1))+1)}\right)\psi_{n}(x).$

Then, it holds that $\lim_{i\to\infty}\tilde{g}_{i}(x)=\tilde{g}(x)$ and
$g(x)\leq\tilde{g}(x)$ for every $x\in X$. If the set $K$ was provided in the
‘Moreover part’ of the proposition, then for every $x\in K$, we have
$d(x,E_{n})=0$ and $\psi_{n}(x)=1$, so $\tilde{g}\leq g+\epsilon$ is bounded
on $K$.

We begin by verifying Inequality (2.31). By Minkowski’s Inequality,

$\displaystyle\|\tilde{g}\|_{L^{p}(X)}$
$\displaystyle\leq\|g\|_{L^{p}(X)}+\sum_{n=1}^{\infty}\|n\min(1,d(\cdot,E_{n}))\psi_{n}\|_{L^{p}(X)}+\left\|\frac{\epsilon}{8^{n}(\mu(B(x_{0},n+1))+1)}\psi_{n}\right\|_{L^{p}(X)}$

Note that

$\min(1,d(\cdot,E_{n}))\psi_{n}\leq{\mathbbm{1}}_{B(x_{0},n+1)\setminus
E_{n}}\qquad\text{and}\qquad\psi_{n}\leq{\mathbbm{1}}_{B(x_{0},n+1)}$

Therefore,

$\displaystyle\|\tilde{g}\|_{L^{p}(X)}$
$\displaystyle\leq\|g\|_{L^{p}(X)}+\epsilon\sum_{n=1}^{\infty}(n2^{-4n}+8^{-n})\leq\|g\|_{L^{p}(X)}+\epsilon.$

Raising both sides to the power $p$, applying the mean value theorem to the
function $x\mapsto x^{p}$, and using $0<\epsilon<1$, we get that

$\|\tilde{g}\|_{L^{p}(X)}\leq\|g\|_{L^{p}(X)}^{p}+\epsilon
p\left(\|g\|_{L^{p}(X)}+1\right)^{p-1}.$

Finally, replacing $\epsilon$ with $\epsilon
p^{-1}(\|g\|_{L^{p}(X)}+1)^{-(p-1)}$, yields the desired estimate (2.31).

Also, let $\eta_{i}:=\epsilon 8^{-i}(\mu(B(x_{0},i+1))+1)^{-1}$, then
$\tilde{g}_{i}|_{B(x_{0},i)}\geq g_{i}|_{B(x_{0},i)}+\eta_{i}$ for every
$i\in{\mathbb{N}}$. Further, we get that for any bounded set $A\subset X$
there is some $i$ so that $A\subset B(x_{0},i)$ and so that
$\tilde{g}|_{A}\geq g|_{A}+\eta_{i}$.

To show goodness for the sequence $\tilde{g}_{i}$. Let $L,\delta>0$ and let
$A$ be a bounded set and consider any sequence
$(P_{i})_{i\in{\mathbb{N}}}\subset A$ of discrete paths $P_{i}$ with
$\lim_{i\to\infty}{\rm Mesh}(P_{i})=0$, such that

  1. (1)

$\int_{P_{i}}\tilde{g}_{i}\leq L$,

  2. (2)

$\operatorname{diam}(P_{i})\geq\delta$.

By passing to a subsequence, we can assume ${\rm Mesh}(P_{i})\leq\frac{1}{i}$.
Since $P_{i}\subset A$, by (2.30), we have
$\tilde{g_{i}}|_{P_{i}}\geq\eta_{A}$ for some $\eta_{A}>0$. Let
$L^{\prime}=\frac{L}{\eta_{A}}$. Then

${\rm
Len}(P_{i})\frac{1}{L^{\prime}}=\int_{P_{i}}\frac{\eta_{A}}{L}\leq\int_{P_{i}}\frac{1}{L}\tilde{g_{i}}|_{A}\leq
1.$

Thus, ${\rm Len}(P_{i})\leq L^{\prime}$. By Lemma 2.24 it suffices to prove
that for every $\tau\in(0,1)$ there is a compact set $K_{\tau}$ for which
$d(P_{i},K_{\tau})\leq\tau$ for all $i\in{\mathbb{N}}$. Without loss of
generality, assume $\tau\in(0,\delta/2)$.

Since $P_{i}\subset A$ for all $i\in{\mathbb{N}}$ and since $A$ is bounded,
there is some $T$ so that $P_{i}\subset B(x_{0},T)$ for all
$i\in{\mathbb{N}}$. Choose $N=\lfloor 2^{4}\max(L,1)/\tau^{2}\rfloor+T+1$. Let
$K_{\tau}=E_{N}\cup\bigcup_{i=1}^{N}P_{i}$. Then $K_{\tau}$ is compact, and it
suffices to show that $\sup_{p\in P_{i}}d(p,K_{\tau})\leq\tau$. This is clear
for $i=1,\dots,N$, thus consider $i>N$.

Suppose for the sake of contradiction that there is a point $p_{k}^{i}\in
P_{i}$ for some $k=0,\dots,n(i)$ with $d(p_{k}^{i},K_{\tau})>\tau$. Note that
$\operatorname{diam}(P_{i})\geq\delta>2\tau$ and ${\rm Mesh}(P_{i})\leq
1/i\leq\tau/8$. Consider the maximal interval $[k_{0},k_{1}]$ containing $k$
and so that the corresponding subpath $(p_{l}^{i})_{l=k_{0}}^{k_{1}}$ stays in
$B(p_{k}^{i},\tau/2)$. In particular, for $0\leq k_{0}\leq l\leq k_{1}\leq
n(i)$, we have $d(p_{l}^{i},K_{\tau})\geq\tau/2$. Furthermore, by maximality
of the interval $[k_{0},k_{1}]$, the path must exit the ball. Hence,
$p_{l}^{i}\not\in B(p_{k}^{i},\tau/2)$, for either $l=k_{0}-1$ or $l=k_{1}+1$,
and

(2.33)
$\sum_{l=k_{0}}^{k_{1}-1}d(p_{l}^{i},p_{l+1}^{i})\geq\tau/2-1/i\geq\tau/4.$

Now, take any index $l\in\\{k_{0},\dots,k_{1}\\}$ and let $i\geq N$. Since
$d(p_{l}^{i},K_{\tau})\geq\tau/2$ and $E_{N}\subset K_{\tau}$, we have

$d(p_{l}^{i},E_{N})\geq d(p_{l}^{i},K_{\tau})\geq\tau/2.$

Further, since $p_{l}^{i}\subset B(x_{0},T)\subset B(x_{0},N)$ we have

$N\min(1,d(p_{l}^{i},E_{N}))\psi_{N}(p_{l}^{i})\geq N\tau/2.$

Therefore, we get $\tilde{g}_{i}(p_{l}^{i})\geq N\tau/2$ and thus by
Inequality (2.33)

$L\geq\sum_{l=0}^{n(i)-1}\tilde{g}_{i}(p^{i}_{l})d(p^{i}_{l},p^{i}_{l+1})\geq(\tau/4)(N\tau/2)>L.$

This is a contradiction, and thus, $d(p,K_{\tau})\leq\tau$ for each $p\in
P_{i}$ and all $i\in{\mathbb{N}}$. ∎

Finally, we formulate a result analogous to Lemma 2.22 and Lemma 2.14, in the
case of good sequences for functions.

######  Lemma 2.34.

Suppose that $\\{g_{i}\\}_{i\in{\mathbb{N}}}$ is a good sequence of functions
converging to $g$, and that $P_{i}$ is a sequence of discrete paths converging
to a curve $\gamma$, then

$\int_{\gamma}gds\leq\liminf_{i\to\infty}\int_{P_{i}}g_{i}.$

###### Proof.

By Lemma 2.22, for any $l$ fixed, we have

$\int_{\gamma}g_{l}ds\leq\liminf_{i\to\infty}\int_{P_{i}}g_{l}.$

Since $\\{g_{i}\\}_{i\in{\mathbb{N}}}$ is an increasing sequence of functions,
we get

$\int_{\gamma}g_{l}ds\leq\liminf_{i\to\infty}\int_{P_{i}}g_{i}.$

Sending $l\to\infty$ yields the claim. ∎

###  2.5. Continuous “almost” upper gradients

We will approximate an upper gradient by continuous functions. Recall, that a
minimal $p$-weak upper gradient $g_{f}$ of a function $f\in N^{1,p}(X)$, is _a
priori_ , only in $L^{p}(X)$. Lemma 2.4 shows that, by introducing a small
error $\epsilon>0$, we can find a lower semicontinuous function
$g_{\epsilon}\in L^{p}(X)$ which is an actual upper gradient. We would like to
replace $g_{\epsilon}$ with a continuous function. However, the upper gradient
inequality (1.1) is only preserved if we approximate $g_{\epsilon}$ from
_above_ by a function $h$. Further, it is impossible to approximate every
$L^{p}(X)$-function from above by a continuous, let alone bounded, function.
Fortunately, lower semicontinuous functions can be approximated _from below_
by a sequence of continuous bounded functions. This does not preserve (1.1).
However, it will preserve being an “almost upper gradient” in the following
sense.

######  Definition 2.35.

Let $V$ be a closed set with $\mu(V)<\infty$ and let $C\subset V$ be a closed
subset of $X$. A function $h$ is a $(\delta,\Delta)$-discrete upper gradient
for $f$ on $(C,V)$ if for every discrete path $P=(p_{0},\dots,p_{n})$ with
${\rm Mesh}(P)\leq\delta$, $P\subset V$, $p_{0},p_{n}\in C$ and
$\operatorname{diam}(\\{p_{0},\dots,p_{n}\\})>\Delta$ we have

$|f(p_{n})-f(p_{0})|\leq\int_{P}h\,.$

Here, it is necessary to localize the condition to apply only to curves with
large enough diameter, which lie within a bounded set $V$, and which connect
points in a closet set $C$. The first two of these are used to ensure
compactness of the relevant families of curves. The final one is a bit more
subtle, and is related to the fact that a Sobolev function may not be
continuous, and $C$ should be thought of as a closed set such that $f|_{C}$ is
continuous. In fact, the following lemma illustrates well the role of each of
these assumptions.

######  Lemma 2.36.

Assume that $C,V\subset X$ are closed bounded sets with $C\subset V$. Let
$M>0$ and $f:X\to[0,M]$ be a measurable function which is continuous on $C$.
Let $g:X\to[0,\infty]$ be a lower semicontinuous upper gradient for $f$.
Suppose that $\eta>0$ and $(g_{i})_{i\in{\mathbb{N}}}$ is a good sequence of
functions, which converges pointwise to a lower semicontinuous function
$\tilde{g}$ with $\tilde{g}|_{V}>g|_{V}+\eta$, as constructed in Proposition
2.29. Then, for every $\Delta>0$ there exists an $N\in{\mathbb{N}}$ so that
$g_{i}$ is a $(1/i,\Delta)$-discrete upper gradient for $f$ on $(C,V)$ for
every $i\geq N$.

###### Proof.

Arguing by contradiction, there exists $\Delta>0$ and an infinite subset
$\mathbb{I}\subset{\mathbb{N}}$ so that for every $i\in\mathbb{I}$ there
exists a path $P_{i}=(p_{0}^{i},\dots,p_{n(i)}^{i})$ with ${\rm
Mesh}(P_{i})\leq\frac{1}{i}$, $\operatorname{diam}(P_{i})\geq\Delta$,
$P_{i}\subset V$, $p_{0}^{i},p_{n(i)}^{i}\in C$ and

(2.37) $|f(p^{i}_{n(i)})-f(p^{i}_{0})|>\int_{P_{i}}g_{i}\,.$

Since $|f|\leq M$, we get $\int_{P_{i}}g_{i}\leq 2M$ for each
$i\in\mathbb{I}$. By Definition 2.28 (3), there exists an infinite subset
$\mathbb{J}\subset\mathbb{I}$, so that $(P_{i})_{i\in\mathbb{J}}$ converges to
a curve $\gamma$.

In particular, $\gamma(1)$ is a limit of the sequence
$(p^{i}_{n(i)})_{i\in\mathbb{J}}$ , and thus $\gamma(1)\in C$. Similarly,
$\gamma(0)$ is a limit of the sequence $(p^{i}_{0})_{i\in\mathbb{J}}$ , hence
$\gamma(0)\in C$. Further, $\gamma\subset V$, since $V$ is closed, and
$\operatorname{diam}(\gamma)\geq\Delta$ since
$\operatorname{diam}(P_{i})\geq\Delta$ for all $i\in{\mathbb{N}}$.

By sending $i\in\mathbb{J}$ to infinity in Inequality (2.37), using Lemma 2.34
and the fact that $f|_{C}$ is continuous, we get

(2.38) $|f(\gamma(1))-f(\gamma(0))|\geq\int_{\gamma}\tilde{g}ds.\,$

However, $\tilde{g}|_{V}>g|_{V}+\eta$, which contradicts the upper gradient
inequality. Therefore the claim has been proved. ∎

##  3\. The case when $X$ is complete

In this section we will prove versions of our main theorems when $X$ is a
metric measure space that is complete and separable. We show that:

  * •

That capacity is outer regular for sets $E$ with ${\rm Cap}_{p}(E)=0$;

  * •

different versions of the capacity are equal, namely ${\rm Cap}_{p}={\rm
Cap}_{p}^{c}={\rm Cap}_{p}^{\operatorname{lip}}={\rm
Cap}_{p}^{(\operatorname{lip},\operatorname{lip})}$ under some weak
hypothesis;

  * •

$C(X)\cap N^{1,p}(X)$ is dense in $N^{1,p}(X)$;

  * •

every function $f\in N^{1,p}(X)$ is quasicontinuous;

  * •

${\rm Cap}_{p}$ is outer regular, and thus a Choquet capacity.

In the subsections that follow, we address each one of these claims in turn.

###  3.1. Null capacity sets

We will employ the following lemma for capacity. A set $E$ is said to be
$p$-exceptional, if ${\rm Mod}_{p}(\Gamma_{E})=0$, where $\Gamma_{E}$ is the
collection of all rectifiable curves $\gamma$ for which $\gamma\cap
E\neq\emptyset$.

######  Lemma 3.1.

([22, Proposition 7.2.8.]) Suppose that $(X,d,\mu)$ is a separable metric
measure space, then a set $E\subset X$ satisfies ${\rm Cap}_{p}(E)=0$ if and
only if $E$ is $p$-exceptional and $\mu(E)=0$.

Lemma 3.1 is crucial when one wants to show that capacity is outer regular.
The first step is to analyze sets with zero capacity. The proof of Proposition
3.2 below follows closely that of [22, Proposition 7.2.12] – except for the
novel use of a good function.

######  Proposition 3.2.

Suppose that $(X,d,\mu)$ is a complete separable metric measure space and let
$E\subset X$ satisfy ${\rm Cap}_{p}(E)=0$. For any $\epsilon>0$ we have an
open set $O$ s.t. $E\subset O$ and ${\rm Cap}_{p}(O)<\epsilon$.

###### Proof.

Capacity is easily seen to be sub-additive and so it suffices to consider the
case when $E$ is bounded. Thus, assume that $E\subset B(x_{0},R)$ for some
ball $B(x_{0},R)$ with $x_{0}\in X,R>0$. Choose an open set $V\subset
B(x_{0},R)$ so that $E\subset V$ and $\mu(V\setminus E)\leq\epsilon 2^{-p-1}$.
By Lemma 3.1, the set $E$ is $p$-exceptional. Thus, ${\rm
Mod}_{p}(\Gamma_{E})=0$ and since $\Gamma(E,X\setminus V)\subset\Gamma_{E}$ we
have ${\rm Mod}_{p}(\Gamma(E,X\setminus V))=0$. Let $g$ be an admissible
function for $\Gamma(E,X\setminus V)$ with $\int_{X}g^{p}d\mu\leq\epsilon
2^{-p-3}$. Lemma 2.13 provides a good function that is lower semicontinuous
and admissible for $\Gamma(E,X\setminus V)$, with $g_{\epsilon}\geq g$ and
$\int_{X}g_{\epsilon}^{p}d\mu\leq\epsilon 2^{-p-2}$.

Define $u(x):=\min(1,\inf_{\gamma:X\setminus V\mapsto
x}\int_{\gamma}g_{\epsilon}ds)$. By Proposition 2.15, $u$ is lower
semicontinuous, $u|_{E}=1$, $u|_{X\setminus V}=0$, and $u$ has upper gradient
$g_{\epsilon}$. Thus, $U=\\{u>\frac{1}{2}\\}$ will be an open set containing
$E$ and $U\subset V$. Take $O=U$. Then, $\tilde{u}=2u\in N^{1,p}(X)$ and
$\tilde{u}|_{O}\geq 1$. Therefore, from $\tilde{u}\leq
2\cdot{\mathbbm{1}}_{V\setminus E}$ we get

${\rm
Cap}_{p}(O)\leq\int_{X}|2u|^{p}d\mu+\int_{X}(2g_{\epsilon})^{p}d\mu\leq\epsilon$

and the claim follows. ∎

###  3.2. Different versions of capacity

We now state and prove a version of Theorem 1.3, when the space $X$ is assumed
to be complete, rather than merely locally complete. We will use Theorem 3.3
later, in Section 5, to prove the more general statement formulated in Theorem
1.3.

######  Theorem 3.3.

Let $(X,d,\mu)$ be a complete, bounded and separable metric measure space
equipped with a Radon measure which is positive and finite on all balls. Let
$E,F\subset X$ be two non-empty closed disjoint sets with $d(E,F)>0$, and let
$p\in[1,\infty)$. Then

${\rm Cap}_{p}(E,F)={\rm Cap}_{p}^{c}(E,F)={\rm
Cap}_{p}^{\operatorname{lip}}(E,F)={\rm
Cap}_{p}^{(\operatorname{lip},\operatorname{lip})}(E,F).$

######  Corollary 3.4.

Let $E,F\subset X$ be two non-empty closed disjoint sets with $d(E,F)>0$, and
let $p\in[1,\infty)$. If $u\in N^{1,p}(X)$ is non-negative with
$u|_{E}=0,u|_{F}=1$ and $g$ is an upper gradient for $u$ in $L^{p}(X)$, then
there exists a sequence of functions $u_{i}\in N^{1,p}(X)$, which are locally
Lipschitz, and which have locally Lipschitz upper gradients $h_{i}\in
L^{p}(X)$, with $h_{i}\to g$ in $L^{p}(X)$.

Note that $h_{i}$ need not be the minimal $p$-weak upper gradient of $u_{i}$.

###### Proof of Corollary 3.4.

The proof is the same as the one for Theorem 3.3, and is obtained by setting
$h_{i}=(a_{i})^{-1}g_{i}$ at the end of the proof. ∎

###### Proof of Theorem 3.3.

An infimum over a smaller set yields a larger value than an infimum over a
larger set, and thus

${\rm Cap}_{p}(E,F)\leq{\rm Cap}_{p}^{c}(E,F)\leq{\rm
Cap}_{p}^{\operatorname{lip}}(E,F)\leq{\rm
Cap}_{p}^{(\operatorname{lip},\operatorname{lip})}(E,F).$

Therefore, it suffices to prove ${\rm
Cap}_{p}^{(\operatorname{lip},\operatorname{lip})}(E,F)\leq{\rm
Cap}_{p}(E,F)$. If ${\rm Cap}_{p}(E,F)=\infty$, this is immediate. Thus, let
us assume that ${\rm Cap}_{p}(E,F)<\infty$ and let $\epsilon>0$ be arbitrary.
By definition of capacity, there exists $u:X\to[-\infty,\infty]$ with
$u|_{E}=0$ and $u|_{F}=1$ and an $L^{p}$-upper gradient
$g:X\rightarrow[0,\infty]$ for $u$ with $\int g^{p}d\mu\leq{\rm
Cap}_{p}(E,F)+\epsilon.$ By replacing $u$ with $\max(\min(u,1),0)$ we can
assume that $u:X\to[0,1]$. Further, since $\mu(X)<\infty$, we get $u\in
L^{p}(X)$ and, moreover, that $u\in N^{1,p}(X)$.

We have $\int_{\gamma}g\,ds\geq 1$ for each rectifiable $\gamma$ connecting
$E$ to $F$. By Proposition 2.29 there exists a $g_{\epsilon}\in L^{p}(X)$
which is lower semicontinuous with $g_{\epsilon}>g$ and
$\int_{X}g^{p}d\mu\leq\int_{X}g^{p}d\mu+\epsilon$, and a good sequence of
bounded and Lipschitz continuous non-negative functions
$\\{g_{i}\\}_{i\in{\mathbb{N}}}$ that satisfy $g_{i}\nearrow g_{\epsilon}$ and
$g_{i}\geq 0$. Let

(3.5)
$u_{i}(x):=\min\left(\inf\left\\{\int_{P}g_{i}:P=(p_{0},\dots,p_{n}),p_{0}\in
E,p_{n}=x,{\rm Mesh}(P)\leq i^{-1}\right\\},1\right).$

Note that $u_{i}:X\to[0,1]$, since we are taking a minimum with $1$. Further,
$u|_{E}=0$ since for $x\in E$ we can use a constant path $P=(p_{0})$. By
Proposition 2.25, the function $g_{i}$ is an upper gradient for $u_{i}$.

We show first that the function $u_{i}$ is $M_{i}$-Lipschitz with
$M_{i}=\max\\{i,\sup_{x\in X}g_{i}(x)\\}$. Note that $M_{i}<\infty$ since
$g_{i}$ is bounded. To see the Lipschitz property, observe that if $x,y\in X$
and $d(x,y)\geq\frac{1}{i}$, then since $0\leq u_{i}\leq 1$,

$|u_{i}(x)-u_{i}(y)|\leq 1\leq M_{i}d(x,y).$

On the other hand, if $x,y\in X$ and $d(x,y)<\frac{1}{i}$, then any discrete
path $P=(p_{0},\dots,p_{n})$ with $p_{0}\in E,p_{n}=x,{\rm Mesh}(P)\leq
i^{-1}$, can be expanded to $P^{\prime}=(p_{0},\dots,p_{n},y)$ with ${\rm
Mesh}(P^{\prime})\leq i^{-1}$. It may be that $P^{\prime}$ is not simple, as
we require for paths. This occurs only if for some $i\in[0,n]$ we have
$p_{i}=y$, and then we truncate $P^{\prime}$ at such index.

This gives,
$u_{i}(y)\leq\int_{P^{\prime}}g_{i}\leq\int_{P}g_{i}+d(x,y)g_{i}(x)$.
Infimizing over $P$ yields $u_{i}(y)\leq u_{i}(x)+M_{i}d(x,y)$. By symmetry,
we get $|u(x)-u(y)|\leq M_{i}d(x,y)$, which completes the proof of the
Lipschitz bound.

Let $a_{i}=\inf_{x\in F}u_{i}(x)$. We show next that
$\lim_{i\to\infty}a_{i}=1$. Since $g_{i}\leq g_{j}$ is an increasing sequence
of functions, the limit $\lim_{i\to\infty}a_{i}$ exists. We obtain our claim
via contradiction: Suppose that $\lim_{i\to\infty}a_{i}<1$. Then there would
exist some $\delta>0$ so that $a_{i}<1-\delta$ for every $i\in{\mathbb{N}}$.

By definition, for every $i$, there exists a discrete path
$P^{i}=(p_{0}^{i},\dots,p_{n}^{i})$ with $\int_{P_{i}}g_{i}<1-\delta$ and with
$p_{0}^{i}\in E,p_{n}^{i}\in F$ and ${\rm Mesh}(P_{i})<i^{-1}$. By the final
condition, $\operatorname{diam}(P^{i})\geq d(E,F)$ for each $i$.

Since $g_{i}$ is a good sequence of functions, and since $X$ is bounded, there
exists a subsequence $i_{k}$ so that $P_{i_{k}}\to\gamma$ for some curve
$\gamma:[0,1]\to X$. Since $E$ and $F$ are closed, we conclude that
$\gamma(0)\in E,\gamma(1)\in F$. By Lemma 2.22, we have, for each
$i\in{\mathbb{N}}$,

$\int_{\gamma}g_{i}\,ds\leq\liminf_{k\to\infty}\int_{P_{i_{k}}}g_{i}<1-\delta.$

Sending $i\to\infty$, and with monotone convergence, we get
$\int_{\gamma}g_{\epsilon}\,ds<1-\delta$, which is a contradiction to the fact
that $\int_{\gamma}g_{\epsilon}\,ds\geq\int_{\gamma}g\,ds\geq 1.$ Thus, our
initial assumption was false, and $\lim_{i\to\infty}a_{i}=1$.

Choose now $i$ so large that

$\frac{\int_{X}g_{\epsilon}^{p}d\mu}{a_{i}^{p}}\leq\int_{X}g^{p}d\mu+2\epsilon.$

Then $\tilde{u}_{i}=\min(\frac{u_{i}}{a_{i}},1)$ is a Lipschitz function with
the upper gradient $(a_{i})^{-1}g_{i}$. Further, $\tilde{u}_{i}|_{E}=0$,
$\tilde{u}_{i}|_{F}=1$, and

$\int_{X}((a_{i})^{-1}g_{i})^{p}d\mu\leq\int_{X}g^{p}d\mu+2\epsilon.$

Thus, ${\rm Cap}_{p}^{\rm lip}(E,F)\leq{\rm Cap}_{p}(E,F)+2\epsilon$, and the
claim follows since $\epsilon>0$ is arbitrary. ∎

The proof of the statement shows in fact slightly more. For future reference,
we state this as a theorem.

######  Theorem 3.6.

Let $(X,d,\mu)$ be complete separable metric measure space with
$\mu(X)<\infty$. Let $E,F\subset X$ be two non-empty closed disjoint sets with
$d(E,F)>0$, and let $p\in[1,\infty)$. Then, for any $\epsilon>0$, and for any
“admissible” function $g\in L^{p}(X)$, i.e., so that $\int_{\gamma}g\,ds\geq
1$ for every $\gamma\in\Gamma(E,F)$, there exists a locally Lipschitz function
$g_{\epsilon}$ that is also admissible, meaning that
$\int_{\gamma}g_{\epsilon}\,ds\geq 1$ for every $\gamma\in\Gamma(E,F)$, and
such that $\|g-g_{\epsilon}\|_{L^{p}(X)}\leq\epsilon.$

###  3.3. Continuous functions are dense in Sobolev spaces

Next, we prove the density of continuous functions in Newton-Sobolev spaces,
in the case when the space $X$ is complete. Later, in Section 4, we will use
Theorem 3.7 below to extend the result to the case when $X$ is locally
complete, which will thus give a proof for Theorem 1.3.

######  Theorem 3.7.

Let $(X,d,\mu)$ be complete and separable metric measure space. Then $C(X)\cap
N^{1,p}(X)$ is dense (in norm) in $N^{1,p}(X)$ for $p\in[1,\infty)$.

Given a function $f\in N^{1,p}(X)$ and $\epsilon>0$, we want to find a
continuous Newton-Sobolev function $\tilde{f}$ on $X$ such that
$\|f-\tilde{f}\|_{N^{1,p}(X)}\leq\epsilon$. The idea of the proof is to
consider an appropriately large compact set $K\subset X$ (see Equation (3.9)),
where $f|_{K}$ is continuous, and then to find an extension $\tilde{f}$ which
is continuous everywhere, and which has controlled minimal $p$-weak upper
gradient $g_{\tilde{f}}$. That is, our proof will be based on the following
extension result of Whitney type.

######  Proposition 3.8.

Let $(X,d,\mu)$ be complete and separable metric measure space. Let $f\in
N^{1,p}(X)$ and let $g_{*}\in L^{p}(X)$ be an upper gradient. Suppose that
$f|_{X\setminus B(x_{0},R)}=0$ for some $x_{0}\in X$, and $R>0$. Suppose there
is a compact set $K\subset B(x_{0},R)$ with $f|_{K}$ continuous and
$g_{*}|_{K}$ bounded.

Then, for every $\epsilon>0$, there exists a function $\tilde{f}$ with:

  1. (1)

$\sup_{x\in X}|\tilde{f}(x)|\leq\sup_{x\in K}|f(x)|$.

  2. (2)

$\tilde{f}|_{K}=f|_{K}$ and $\tilde{f}|_{X\setminus B(x_{0},R)}=f|_{X\setminus
B(x_{0},R)}=0$.

  3. (3)

$\tilde{f}\in N^{1,p}(X)\cap C(X)$.

  4. (4)

$\int_{X\setminus K}g_{\tilde{f}}^{p}\,d\mu\leq\int_{X\setminus
K}g_{*}^{p}\,d\mu+\epsilon$.

We delay the proof of this extension result, briefly, in order to show how the
density result follows from it.

###### Proof of Theorem 3.7..

First, recall that by Lemma 2.8 the space of bounded Newton-Sobolev functions
with bounded support $N^{1,p}_{b}(X)$ is dense in $N^{1,p}(X)$. Next, we show
that $C(X)\cap N^{1,p}_{b}(X)$ is dense in $N^{1,p}_{b}(X)$. If $f\in
N^{1,p}_{b}(X)$, then there is a constant $M<\infty$ such that $|f|\leq M$
everywhere in $X$ and there is a ball $B(x_{0},R)$ so that $f|_{X\setminus
B(x_{0},R)}=0$. Let $g\in L^{p}(X)$ be any upper gradient of $f$. Since $f=0$
in $X\setminus B(x_{0},R)$, we can assume by modifying $g_{*}$ that
$g_{*}|_{X\setminus B(x_{0},R)}=0$. Indeed, this modification leaves 1.1
invariant.

Let $\epsilon>0$ be fixed, by using Lusin’s theorem and the absolute
continuity of integrals, choose a compact set $K\subset B(x_{0},R)$ so that
$f|_{K}$ is continuous, $g_{*}|_{K}$ is bounded and so that

(3.9) $\int_{X\setminus K}2^{p+3}g^{p}\,d\mu+\mu(B(x_{0},R)\setminus
K)2^{p+1}M^{p}\leq\epsilon.$

This is possible, since $\mu$ is Radon, $g_{*}\in L^{p}(X)$, and $g_{*}=0$ in
$X\setminus B(x_{0},R)$.

By Proposition 3.8 there exists a function $\tilde{f}\in N^{1,p}(X)\cap C(X)$
with $\tilde{f}|_{K}=f|_{K}$ and

$\int_{X\setminus K}g_{\tilde{f}}^{p}\,d\mu\leq\int_{X\setminus
K}g_{*}^{p}\,d\mu+\epsilon 2^{-p-3}\leq\epsilon 2^{-p-2},$

where the last inequality follows by (3.9). Furthermore,
$\tilde{f}|_{X\setminus B(x_{0},R)}=0$ and $|\tilde{f}|\leq M$ everywhere.

Since $(f-\tilde{f})|_{K\cup(X\setminus B(x_{0},R))}=0$, by Lemma 2.5 and
subadditivity of minimal $p$-weak upper gradients, we have that
$g_{f-\tilde{f}}\leq(g_{\tilde{f}}+g_{*}){\mathbbm{1}}_{B(x_{0},R)\setminus
K}.$ Similarly, $|f-\tilde{f}|\leq 2M{\mathbbm{1}}_{B(x_{0},R)}$. Thus,
$\int_{X}g_{f-\tilde{f}}^{p}d\mu\leq\epsilon/2$. Also, we have
$\int_{X}|f-\tilde{f}|^{p}\,d\mu\leq(2M)^{p}\mu(B(x_{0},R)\setminus K).$
Therefore,

$\|f-\tilde{f}\|_{N^{1,p}(X)}^{p}\leq\int_{X}|f-\tilde{f}|^{p}\,d\mu+\int_{X}g_{f-\tilde{f}}^{p}\,d\mu\leq\epsilon.$

∎

###### Proof of Proposition 3.8..

This proof will take some detours and require some auxiliary results. The
function $\tilde{f}$ is defined in Formula (3.21) below. However, this
definition depends on some technical choices, which are explained first. The
crucial properties ensured by these choices are codified as lemmas. Once the
function $\tilde{f}$ has been properly defined, we verify, one-by-one, the
properties of the theorem. The proof ends at the end of this subsection by
verifying the fourth property in the statement.

Fix a function $f\in N^{1,p}(X)$ and an arbitrary $\epsilon>0$. By assumption,

(3.10) there is $x_{0}\in X$ and $1\leq R<\infty$, so that $f|_{X\setminus
B(x_{0},R)}=0$.

Since $K$ is compact and $f$ is uniformly continuous on $K$,

(3.11) $M:=\sup_{x\in K}|f(x)|<\infty.$

If $X\setminus B(x_{0},R)\neq\emptyset$, assume, by scaling the metric $d$,
that

(3.12) $d(K,X\setminus B(x_{0},R))\geq 1.$

Let $g_{*}\in L^{p}(X)$ be the given upper gradient for $f$, which is assumed
to be bounded on $K$. Thus, there is a constant $S<\infty$ so that
$|\sup_{x\in K}g_{*}(x)|=S$. The result will be proven by constructing a
function $\tilde{f}\in N^{1,p}(X)\cap C(X)$ so that the properties in
Proposition 3.8 hold.

We construct $\tilde{f}$ together with an upper gradient $g\in L^{p}(X)$ for
it. Our choice of upper gradient $g$ is given in Lemma 3.13 below. Let
$\epsilon>0$ and let $g_{\epsilon}$ be a lower semicontinuous upper gradient
for $f$ with $\int_{X}g_{\epsilon}^{p}d\mu\leq\int_{X}g_{*}^{p}d\mu+\epsilon
2^{-5}$, as guaranteed by Lemma 2.4. By replacing $g_{\epsilon}(x)$ with
$\min(g_{\epsilon},S{\mathbbm{1}}_{K}+\infty{\mathbbm{1}}_{X\setminus K})$, we
can assume that $g_{\epsilon}|_{K}$ is bounded by $|\sup_{x\in
K}g_{\epsilon}(x)|=S$. Then, Proposition 2.29 applied to the function
$g_{\epsilon}$ gives the following lemma.

######  Lemma 3.13.

With $g_{*}$ and $g_{\epsilon}$ as defined above, there is a lower
semicontinuous good function $g:X\to[0,\infty]$ so that $g|_{K}$ is bounded,
that admits a good sequence $\\{g_{i}\\}_{i\in{\mathbb{N}}}$ of bounded
Lipschitz continuous functions so that $g_{i}\nearrow g$ pointwise on $X$, and
such that

$\int_{X}g^{p}d\mu\leq\int_{X}g_{\epsilon}^{p}d\mu+\epsilon
2^{-5}\leq\int_{X}g_{*}^{p}d\mu+\epsilon 2^{-4}.$

Moreover, for every bounded set $V\subset X$ there exists an $\eta>0$ such
that $g|_{V}>g_{\epsilon}+\eta$.

We now introduce several auxiliary functions that require some motivation. By
passing from $g_{*}$ to the functions $g_{i}$, we have gained continuity but
at the price of losing the property that $g_{i}$ is an upper gradient for $f$.
This loss forces us to make further choices, whose role we now briefly
describe.

The construction of a good sequence of functions guarantees that $g_{i}$, for
large $i$, is a discrete upper gradient in the sense of Definition 2.35. The
discrete upper gradient property only holds for the closed sets $C$ and $V$,
which we choose as follows. First,

(3.14) $V:=\overline{B(x_{0},2R)}.$

Note, that $V$ is the closure of the ball, and not the closed ball - although
this makes little difference for the proof. Second,

(3.15) $C:=K\cup(\overline{B(x_{0},2R)}\setminus B(x_{0},R)).$

Note that $f|_{C}$ is continuous, and $V$ is bounded, so the set $V$ localizes
the argument. In the definition of $C$ we adjoin the annulus
$\overline{B(x_{0},2R)}\setminus B(x_{0},R)$ to ensure later that our
approximation will vanish outside of $B(x_{0},R)$, see Figure 1.

The discrete upper gradient property includes two parameters
$(\delta,\Delta)$, where the first controls the mesh-size and the second the
diameter of discrete paths. As we decrease $\Delta$, we need to pass further
into the sequence $g_{i}$ and decrease the mesh-size $\delta$. Due to this, we
cannot construct an approximation using a single function $g_{i}$ or a single
mesh-size $\delta$. Consequently, as we approach the set $K$, we will force
the mesh-size to decrease, and the index $i$ to increase. This leads to a
definition of auxiliary functions ${\rm D}(x)$ and $G(x)$, where ${\rm D}$
stands for the size of gaps, and $G$ will be a candidate gradient for the
constructed function $\tilde{f}$. The idea of using different functions and
meshes, which are fixed at dyadic length scales, comes from a Whitney-type
extension argument.

Finally, to force the property that $f|_{C}=\tilde{f}|_{C}$, we need to
control the behaviour off of $K$, and this involves the modulus of continuity
$\omega$ of $f|_{K}$. The modulus of continuity is used to define a “penalty”
term ${\mathbf{P}}$, which eventually will depend on the distance to $K$. The
use of the penalty term is a bit similar to how one extends a uniformly
continuous function off a subset to a uniformly continuous function on the
entire space; see for example [27].

The value of the approximation at a point $x\in X$ will be ultimately obtained
by infimizing over discrete paths connecting $x$ to the closed set $C$, which
have mesh-size controlled by ${\rm D}(x)$ \- these will be called $(x,{\rm
D})$-admissible paths. The minimized function sums $G$ over such a path
together with a penalty term and a term from $f$. The reader may now wish to
glance at Equation (3.21) to see how the three functions, ${\mathbf{P}},{\rm
D},G$ are used. It may also be helpful to compare this to (3.5), or to the
approximation and discussion found in [16] \- where also a more detailed
historical comparison is contained.

Denote by $\omega:(0,\infty)\to{\mathbb{R}}$ the modulus of continuity for
$f|_{K}$, that is

(3.16) $\omega(\delta)=\sup\\{|f(x)-f(y)|:d(x,y)\leq\delta,x,y\in K\\}.$

######  Lemma 3.17.

With $C,$ $V,$ and $K,$ as defined above in (3.15), (3.14), and, (3.9), if
$g_{i}$ is a sequence of good functions converging to $g$, as constructed in
Lemma 3.13, and $\omega$ is the modulus of continuity of $f|_{K}$, as defined
in (3.16), then there exists an increasing sequence $i_{n}\in{\mathbb{N}}$, a
gap function ${\rm D}:X\to[0,\infty)$, a candidate upper gradient
$G:X\to[0,\infty]$, and a penalty function
${\mathbf{P}}:[0,\infty)\to[0,\infty)$, with the following properties given
$n\in{\mathbb{N}}$:

  1. (i)

$g_{i_{n}}$ is an $(i_{n}^{-1},2^{-n})$-discrete upper gradient for $f$ on
$(C,V)$;

  2. (ii)

the gap function $D$ satisfies:

     * (a)

${\rm D}(x)\leq d(x,K)/4$ for every $x\in X$;

     * (b)

$0<{\rm D}(x)<i_{3}^{-1}$ for each $x\in X\setminus K$;

     * (c)

$D(x)=\min(1/i_{n+2},2^{-n-3})$, if $2^{-n-1}\leq d(x,K)<2^{-n}$, for $n\geq
1$;

  3. (iii)

the candidate upper gradient satisfies:

     * (a)

$G(x)\geq g_{i_{3}}(x)$ for all $x$;

     * (b)

for $n>3$, $G(x)\geq g_{i_{n}}$ if $d(x,K)\leq 2^{-n}$;

     * (c)

for $n\geq 3$, $G(x)\leq g_{i_{n}}$ if $d(x,K)\geq 2^{-n-1}$;

     * (d)

$G|_{K}=g|_{K}$.

  4. (iv)

the penalty function satisfies:

     * (a)

${\mathbf{P}}(r)\geq 2M$ if $r\geq i_{3}^{-1}$;

     * (b)

$\lim_{r\to 0}{\mathbf{P}}(r)=0$, but
${\mathbf{P}}(r)\geq\omega(r)+\omega(2^{1-n})$ for $i_{n+1}^{-1}\leq
r<i_{n}^{-1}$ and $n\geq 3$;

     * (c)

${\mathbf{P}}(r)\geq\omega(r)$, for all $r>0$.

###### Proof.

By Lemma 2.36, there is an increasing sequence $i_{n}$, for
$n\in{\mathbb{N}}$, so that $g_{i_{n}}$ is an $(i_{n}^{-1},2^{-n})$-discrete
upper gradient for $f$ on $(C,V)$. Define ${\rm D}$ as a step function
depending on dyadic length scales determined by the distance to $K$:

${\rm D}(x):=\begin{cases}\min(1/i_{3},1/8)&d(x,K)\geq 2^{-1}\\\
\min(1/i_{n+2},2^{-n-3})&2^{-n-1}\leq d(x,K)<2^{-n},n\geq 1\\\ 0&x\in
K.\end{cases}$

Similarly, define the candidate upper gradient piecewise using the good
functions $g_{i}$ and their limit $g$.

$G(x):=\begin{cases}g_{i_{3}}(x)&d(x,K)\geq 2^{-3}\\\
g_{i_{n}}(x)&2^{-n-1}\leq d(x,K)<2^{-n},n\geq 3\\\ g(x)&x\in K.\end{cases}$

Finally, we define a penalty function depending on the modulus of continuity
of $f$ on $K$.

${\mathbf{P}}(r):=\begin{cases}2M&\frac{1}{i_{3}}\leq r\\\
\omega(2^{1-n})+\omega(r)&\frac{1}{i_{1+n}}\leq r<\frac{1}{i_{n}},n\geq 3\\\
0&r=0\end{cases}.$

Notice that we have $\lim_{r\to 0}{\mathbf{P}}(r)=0$. The properties of
${\mathbf{P}}$ are direct to verify, once one notices that $2M\geq\omega(r)$
for all $r>0$.

We let the reader verify that these definitions imply the properties stated
above.

∎

Next, we describe the admissible discrete paths used in the extension.

######  Definition 3.18.

With $V$, and $C$ defined as in (3.14) and (3.15), a discrete path
$P=(p_{0},\dots p_{n})$ is called $(x,{\rm D})$-admissible if $p_{0}\in C$,
$p_{n}=x$, and $d(p_{k},p_{k+1})\leq{\rm D}(p_{k})$ for each $k=1,\dots,n-1$
and $p_{1},\dots,p_{n}\in V$.

In other words, the length of the first step $d(p_{0},p_{1})$ can be
arbitrary, but after this “first jump”, the following steps are controlled by
the function ${\rm D}$. This ensures that there is always at least one
$(x,{\rm D})$-admissible path for every $x\in V$, namely $P=(p_{0},x)$ for any
$p_{0}\in C$ (or $P=(p_{0})$ if $x=p_{0}\in C$. This fact will be used to
guarantee an upper-bound for the extension.

Note that Lemma 3.17 guarantees ${\rm D}(x)\leq d(x,K)/4$ for all $x\in X$.
This implies the following useful lemma.

######  Lemma 3.19.

With $K$ as defined in (3.9), let ${\rm D}(x)\geq 0$ be a function such that
${\rm D}(x)\leq d(x,K)/4$ for all $x\in X$. If $P=(p_{0},p_{1},\dots,p_{n})$
is $(x,{\rm D})$-admissible and $p_{1}\not\in K$, then $p_{l}\not\in K$ for
any $l\geq 1$. Alternatively, if $n\geq 1$ and $p_{1}\in K$, then
$P=(p_{0},p_{1})$.

###### Proof.

If $p_{1}\in K$, since $D\equiv 0$ on $K$, $d(p_{l+1},p_{l})=0$ for $l\geq 1$,
so the path $P$ will stay at $p_{1}$. Else, if $p_{1}\not\in K$, then
$d(p_{l+1},p_{l})\leq D(p_{l})<d(p_{l},K)/2$ for $l\geq 1$, hence
$p_{l}\not\in K$ for $l\geq 1$. ∎

######  Definition 3.20.

With the functions ${\mathbf{P}},G,{\rm D}$ from Lemma 3.17 and $K,C,V\subset
X$, as defined in (3.9), (3.15), (3.14), and $M,R\in(0,\infty),x_{0}\in X$
defined in (3.11) and (3.10), with $d(K,X\setminus B(x_{0},R))\geq 1$, as in
(3.12). We set the extension of $f$ as follow: for $x\in V$,

(3.21)
$\tilde{f}(x):=\min\left(M,\inf_{P=(p_{0},\dots,p_{n}=x)}\Phi(P)\right),$

where the infimum is taken over all $(x,{\rm D})$-admissible paths $P$ and
$\Phi(P)$ is defined as follows.

(3.22)
$\Phi(P):={\mathbf{P}}(d(p_{0},p_{1}))+f(p_{0})+\sum_{k=0}^{n-1}G(p_{k})d(p_{k},p_{k+1}),$

when $n\geq 0$. When $n=0$, we define $\Phi(P):=f(p_{0})$. Finally, for
$x\not\in V$, set $\tilde{f}(x)=0$.

$P$$Q$$S$$U$$T$$R$$K$ Figure 1. The figure shows six different admissible
paths starting at various points in $C$ represented by white circles and
ending at the points $P,Q,R,S,T$ and $U$. The set $C$ is the lighter gray
annulus together with the compact set $K$, represented by the two darker gray
islands in the center. Squares indicate the points along the paths and dashed
segments the jumps that we imagine occurring in between.
\- The points $P$ and $Q$ show how a path can either start in $K$ or in the
annular region.
\- The point $R$ shows that a path contained in $C$ can have zero length.
\- The path ending at $S$ shows that one can jump between points in $K$, but
must stop there.
\- Similarly, the path ending at $U$ makes one jump from $C\setminus K$ to
$K$.
\- Finally, the path ending at $T$ depicts how a path that at some point
leaves $K$ can never return, but can get very close.
The first unrestricted jump of each path is bolded, and note that all the
paths must be contained in the bounded set $V$ which is a ball containing the
full figure.

Examples of admissible paths are depicted in Figure 1. We now show that
$\tilde{f}$ satisfies properties 1–4 in the statement of Proposition 3.8.

(3.23) $\displaystyle\textbf{Property (1): }\sup_{x\in
X}|\tilde{f}(x)|\leq\sup_{x\in K}|f(x)|.$

Recall that $M=\sup_{x\in K}|f(x)|$. We want to show that
$\tilde{f}:X\to[-M,M]$. First, from Definition 3.20, it follows that
$\tilde{f}(x)\leq M$ for each $x\in X$. On the other hand, since $G\geq 0$ and
${\mathbf{P}}\geq 0$, $\Phi(P)\geq f(p_{0})$ for every path
$P=(p_{0},\dots,p_{n})$. Thus, $\inf_{P}\Phi(P)\geq\inf_{x\in
C}f(x)=\inf_{x\in K}f(x)\geq-M$, and $\tilde{f}(x)\geq-M$ for $x\in V$. For
$x\not\in V$ we have $\tilde{f}(x)=0$, and the claim follows.

(3.24) $\displaystyle\textbf{Property (2):
}\tilde{f}|_{K}=f|_{K}\quad\text{and}\quad\tilde{f}|_{X\setminus
B(x_{0},R)}=f|_{X\setminus B(x_{0},R)}=0.$

Take an arbitrary $x\in K\cup(X\setminus B(x_{0},R))=C\cup(X\setminus V)$,
where $C,V$, and $K$ are defined above in (3.9), (3.14), and (3.15). We will
show that $\tilde{f}(x)=f(x)$. If $x\in X\setminus V$, then, by definition,
$\tilde{f}(x)=0=f(x)$. Thus, we can assume that $x\in C$. The path $P=(x)$ is
$(x,{\rm D})$-admissible and so we have $\tilde{f}(x)\leq\Phi(P)=f(x)$. We
want to prove the opposite inequality, and for that we will separate the two
cases when $x\in K$ and when $x\in C\setminus K$.

$\bullet$ First, consider the case $x\in K$. It suffices to prove $\Phi(P)\geq
f(x)$ for every $(x,D)$-admissible path $P$. This is clear if $P=(x)$, and
thus we can assume that $P=(p_{0},\dots,p_{n}=x)$ with $n\geq 1$. If
$p_{1}\not\in K$, then $p_{1}\neq x$ and Lemma 3.19 shows that the path will
never reach $x$. Therefore, $p_{1}$ must be in $K$. Then, Lemma 3.19 again
shows that $p_{1}=x$ and $n=1$, so $P=(p_{0},p_{1}=x)$. In other words, we are
reduced to considering a path with only one jump. There are two possibilities:

  * —

If $p_{0}$ is in the annulus $C\setminus K$, the path $P$ is illustrated by
the path ending at the point $U$ in Figure 1. Then, since $p_{0}\not\in
B(x_{0},R)$, the normalization (3.12) implies that $d(p_{0},x)\geq 1$. By
Property (iv)(a) of Lemma 3.17, the penalty on the first jump satisfies
${\mathbf{P}}(d(p_{0},p_{1}))\geq 2M$. Therefore, from the definition of
$\Phi(P)$ in (3.22), we get that $\Phi(P)\geq{\mathbf{P}}(d(p_{0},p_{1}))\geq
2M\geq f(x)$.

  * —

If, on the other hand, $p_{0}\in K$, then the path $P$ is illustrated by the
path ending at the point $S$ in Figure 1. In this case, we estimate using the
modulus of continuity:

$\displaystyle{\mathbf{P}}(d(p_{0},p_{1}))$
$\displaystyle\geq\omega(d(p_{0},p_{1}))$ (Property (iv)(c) of Lemma 3.17)
$\displaystyle\geq|f(p_{1})-f(p_{0})|$ (by (3.16))

Thus, from (3.22), we get $\Phi(P)\geq
f(p_{0})+{\mathbf{P}}(d(p_{0},p_{1}))\geq f(x)$.

$\bullet$ Now, consider the case that $x\in C\setminus K$, and
$P=(p_{0},\dots,p_{n})$ is any $(x,{\rm D})$-admissible path. We need to show
that $\Phi(P)\geq f(x)=0$ for every such path. Recall that $(x,D)$-admissible
paths start in $C$ and end at $x$. If $p_{0}\not\in K$, then $f(p_{0})=0$,
and, from (3.22), we get $\Phi(P)\geq f(p_{0})=0$. Thus, we are left to
consider the case when $p_{0}\in K$ and $x\in C\setminus K$. Let $i_{n}$ be
the sequence constructed in Lemma 3.17. If the first jump satisfies
$d(p_{0},p_{1})\geq i_{1}^{-1}>i_{3}^{-1}$, then by Lemma 3.17 (iv)(a),
${\mathbf{P}}(d(p_{0},p_{1}))\geq 2M$ and
$f(p_{0})+{\mathbf{P}}(d(p_{0},p_{1}))\geq 0=f(x)$. Therefore, we can assume
that $d(p_{0},p_{1})\leq i_{1}^{-1}$. By Property (ii)(b) of Lemma 3.17, we
have ${\rm D}(p_{k})\leq i_{1}^{-1}$, for $k\geq 1$. Thus,
$d(p_{k},p_{k+1})\leq{\rm D}(p_{k})\leq i_{1}^{-1}$ for all $k\geq 1$. In
particular, ${\rm Mesh}(P)\leq i_{1}^{-1}$. Since $x\in C\setminus K$, the
normalization (3.12) implies that $d(x,K)\geq 1$ and therefore
$\operatorname{diam}(P)\geq 1$. Finally, by Property (iii)(a) of Lemma 3.17,
we have that $G\geq g_{i_{1}}$. Recall that $g_{i_{1}}$ is a discrete
$(i_{1}^{-1},2^{-1})$-upper gradient for $f$ with respect to $(C,V)$. By
Definition 2.35 and Definition 3.18, since ${\rm Mesh}(P)\leq i_{1}^{-1}$,
$p_{0},p_{n}\in C$, $P\subset V$, and $\operatorname{diam}(P)\geq 1$, we get

$\sum_{k=0}^{n-1}g_{i_{1}}(p_{k})d(p_{k},p_{k+1})=\int_{P}g_{i_{1}}\geq|f(p_{n})-f(p_{0})|.$

In particular, $\Phi(P)\geq
f(p_{0})+\sum_{k=1}^{n-1}G(p_{k})d(p_{k},p_{k+1})\geq f(p_{n})=0$.

Finally, the inequality $\tilde{f}(x)\geq f(x)$ follows by infimizing over
discrete paths $P$.

(3.25) $\displaystyle\textbf{Property (3): }\tilde{f}\in N^{1,p}(X)\cap C(X).$

To prove $\tilde{f}\in N^{1,p}(X)\cap C(X)$, we proceed in a few stages.
First, we show local Lipschitz continuity and an upper gradient property in
the complement of $K$.

######  Lemma 3.26.

The function $\tilde{f}$ is locally Lipschitz in $X\setminus K$ with upper
gradient the function $g$ restricted to $X\setminus K$, where $g$ is defined
as in Lemma 3.13.

###### Proof.

Recall that $D(x)>0$ for $x\in X\setminus K$, by Lemma 3.17 property (ii)(b).
If $x,y\in X\setminus K$ and if $d(x,y)\leq\min\\{D(x),D(y)\\}$, then we claim
that

(3.27) $|\tilde{f}(x)-\tilde{f}(y)|\leq\max\\{G(x),G(y)\\}d(x,y).$

Suppose for the moment, that this is true. Then, we can show that $g$ is an
upper gradient for $\tilde{f}$ in $X\setminus K$. Indeed, let $x\in X\setminus
K$ and fix $n\geq 1$ so that $2^{-n}\leq d(x,K)$. Again, let $i_{n}$ be the
sequence constructed in Lemma 3.17. Take any $r<\min(2^{-n-3},1/i_{n+2})/2$.
Then, for every $y\in B(x,r)$ we have $d(y,K)>2^{-n-1}$ and, by Lemma 3.17
properties (ii)(c) and (iii)(c), we have and $D(y)\geq 2r$ and $G(y)\leq
g_{i_{n}}(y)\leq C(i_{n})$, where $C(i_{l})$ is the supremum of the bounded
function $g_{i_{l}}$ for $l\in{\mathbb{N}}$. Thus Inequality (3.27) implies
that $\tilde{f}|_{B(x,r)}$ is $C(i_{n})$-Lipschitz. Using this local Lipschitz
property and compactness, if $\gamma:[0,1]\to X\setminus K$ is any rectifiable
curve then $\tilde{f}\circ\gamma$ is Lipschitz, and $d(\gamma,K)>2^{-n-1}$ for
some $n$. Therefore, by Lemma 3.17 property (iii)(c) again, we have
$G\circ\gamma\leq g_{i_{n}}\circ\gamma$ and that
$|\tilde{f}(\gamma(t))-\tilde{f}(\gamma(s))|\leq\max\\{g_{i_{n}}(\gamma(t)),g_{i_{n}}(\gamma(t))\\}d(\gamma(s),\gamma(t))$
for any $s,t\in[0,1]$ with
$d(\gamma(s),\gamma(t))\leq\min\\{D(\gamma(s)),D(\gamma(t))\\}$. Following
similar arguments as in [32, Lemma 4.7], this together with the continuity of
$g_{i_{n}}$ and Lemma 3.17 property (ii)(c) yields

$|\tilde{f}(\gamma(0))-\tilde{f}(\gamma(1))|\leq\int_{0}^{1}|(\tilde{f}\circ\gamma)^{\prime}|dt\leq\int_{\gamma}g_{i_{n}}\,ds.$

Since $g_{i_{n}}\leq g$, then $g$ is an upper gradient for $\tilde{f}$ in
$X\setminus K$.

Next, we prove Inequality (3.27). Fix $x,y\in X\setminus K$ with
$d(x,y)\leq\min\\{D(x),D(y)\\}$. By Property (ii)(b) of Lemma 3.17 we have
$\min\\{D(x),D(y)\\}\leq 1$. Recall that, by (3.12), $R>1$. If $x$ or $y$ is
in $X\setminus B(x_{0},2R)$, then $d(x,y)\leq 1$ and both $x,y\not\in
B(x_{0},R)$. Thus, by Property 2 in (3.24), $\tilde{f}(x)=\tilde{f}(y)=0$ and
inequality (3.27) is immediate.

We are left to consider the case when $x,y\in B(x_{0},2R)$ and Formula (3.21)
gives the values of the function $\tilde{f}$ at $x$ and $y$. By symmetry, it
suffices to show that $\tilde{f}(x)\leq\tilde{f}(y)+G(y)d(x,y)$. If
$\tilde{f}(y)=M$, the claim follows by the definition of $\tilde{f}$.
Otherwise, we have $\tilde{f}(y)=\inf_{P}\Phi(P)$, where
$P=(p_{0},\dots,p_{n})$ runs through all $(y,{\rm D})$-admissible paths. Let
$P$ be any $(y,{\rm D})$ admissible path. If $x\in P$, then by truncating $P$,
we obtain an $(x,{\rm D})$ admissible sub-path, and $\tilde{f}(x)\leq\Phi(P)$
by definition. If $x\not\in P$, the augmented path
$P^{\prime}=(p_{0},\dots,p_{n},x)$ is $(x,{\rm D})$ admissible, since
$d(p_{n},x)=d(y,x)\leq\min\\{D(x),D(y)\\}\leq{\rm D}(p_{n})$. Thus,

$\tilde{f}(x)\leq\Phi(P^{\prime})={\mathbf{P}}(d(p_{0},p_{1}))+f(p_{0})+\sum_{k=0}^{n-1}G(p_{k})d(p_{k},p_{k+1})+G(y)d(x,y)=\Phi(P)+G(y)d(x,y).$

Infimizing over all discrete $(y,{\rm D})$-admissible paths $P$ now yields
$\tilde{f}(x)\leq\tilde{f(y)}+G(y)d(x,y)$, and thus the claim. ∎

Next, we prove continuity of $\tilde{f}$ on all of $X$.

######  Lemma 3.28.

The function $\tilde{f}:X\longrightarrow{\mathbb{R}}$ is continuous.

###### Proof.

By Lemma 3.26, the function $\tilde{f}|_{X\setminus K}$ is continuous. Also,
$\tilde{f}|_{K}=f|_{K}$ is continuous by assumption. Recall that $K$ is
closed. Thus to prove the lemma, it suffices to prove sequential continuity at
points of $\partial K$, with the sequence approaching from $X\setminus K$. Fix
$x\in\partial K$ and a sequence $x_{i}\to x$ with $x_{i}\not\in K$ for each
$i\in{\mathbb{N}}$. Since $\partial K\subset B(x_{0},R)$, we may assume that
$x_{i}\in B(x_{0},R)$ for all $i$ by passing to the tail of the sequence.
Since the first jump is free, for every $i\in{\mathbb{N}}$, the path
$P=(x,x_{i})$ is an $(x_{i},{\rm D})$-admissible path. Thus, by Property
(iv)(d) of Lemma 3.17, we have

$\tilde{f}(x_{i})\leq f(x)+{\mathbf{P}}(d(x,x_{i}))+g(x)d(x,x_{i}).$

By Property (iv)(b) of Lemma 3.17 and the fact that $g|_{K}$ is bounded by
Lemma 3.13, we have $\limsup_{i\to\infty}\tilde{f}(x_{i})\leq f(x)$. So, it
suffices to show that $\liminf_{i\to\infty}\tilde{f}(x_{i})\geq f(x)$. Indeed,
by passing to a subsequence, it suffices to assume that the limit
$\lim_{i\to\infty}\tilde{f}(x_{i})$ exists and then to show that

(3.29) $\lim_{i\to\infty}\tilde{f}(x_{i})\geq f(x).$

In the following, we will analyze several sub-cases depending on the values of
$\tilde{f}$ and the constructed paths. Eliminating each sub-case will reduce
the problem to a simpler situation. In the following, WLOG is short for
“Without loss of generality”.

Reduction 1: WLOG $\tilde{f}(x_{i})<M$ for infinitely many $i$. If for all but
finitely many $i$ we have $\tilde{f}(x_{i})=M$, the claim (3.29) follows from
the definition of $M$.

Thus, we may pass to a subsequence, where $\tilde{f}(x_{i})<M$ for every
$i\in{\mathbb{N}}$. By definition of $\tilde{f}$ in (3.21), we may find
discrete paths $P_{i}=(p^{i}_{0},\dots,p^{i}_{n(i)})$ which are $(x_{i},{\rm
D})$-admissible and for which

(3.30)
$\lim_{i\to\infty}\tilde{f}(x_{i})=\lim_{i\to\infty}\Phi(P_{i})=\lim_{i\to\infty}\left\\{{\mathbf{P}}(d(p^{i}_{0},p^{i}_{1}))+f(p^{i}_{0})+\sum_{k=0}^{n(i)-1}G(p^{i}_{k})d(p^{i}_{k},p^{i}_{k+1})\right\\},$

and $\Phi(P_{i})<M$. Note that $n(i)>0$, because $x_{i}\in B(x_{0},R)\setminus
K$, and hence is not in $C$.

Reduction 2: WLOG the points $p^{i}_{0}$ do not converge to $x$. If
$\lim_{i\to\infty}p^{i}_{0}=x$, then we get that
$\lim_{i\to\infty}\Phi(P_{i})\geq\lim_{i\to\infty}f(p^{i}_{0})=f(x)$, as
desired, because $p^{i}_{0}$ and $x$ are in $C$ and $f|_{C}$ is continuous.

Thus, by passing to some subsequence we are left to consider the case that
$\lim_{i\to\infty}d(p^{i}_{0},x)=\Delta$ for some $\Delta>0$. By further
passing to a subsequence we can ensure $\Delta/2\leq d(p^{i}_{0},x)\leq
2\Delta$, so that $\operatorname{diam}(P_{i})\geq\Delta/2$ for each
$i\in{\mathbb{N}}$. By passing to another subsequence, since
$\lim_{i\to\infty}p_{n(i)}^{i}=\lim_{i\to\infty}x_{i}=x$, we can assume that
that

(3.31)
$d(p_{n(i)}^{i},x)\leq\min\\{\Delta/2,i_{3}^{-1}\\}\leq\operatorname{diam}(P_{i})\qquad\text{for
all $i\in{\mathbb{N}}$}.$

This allows us to compare the values of $f(x)$ and $f(p_{0}^{i})$ by
considering the augmented discrete path
$P^{\prime}_{i}=(p_{0}^{i},\dots,p_{n(i)}^{i},x)$.

At this point we may picture the path $P_{i}$ as the path corresponding to the
point $T$ in Figure 1. The path $P^{\prime}_{i}$ is obtained by augmenting
$P_{i}$ with a jump to $x$. Hence, $P_{i}^{\prime}$ is no longer admissible.

Reduction 3: WLOG the first jump $d(p^{i}_{0},p^{i}_{1})$ is less than
$i_{3}^{-1}$. If not, by Lemma 3.17 (iv)(a),
${\mathbf{P}}(d(p_{0}^{i},p^{i}_{1}))\geq 2M$. However, this contradicts the
fact that $\Phi(P_{i})<M$. Therefore, we must thus have
$d(p^{i}_{0},p^{i}_{1})\leq\frac{1}{i_{3}}$ for all $i\in{\mathbb{N}}$.

Recall that Lemma 3.17 (ii)(a-b) gives ${\rm D}(x)\leq i_{3}^{-1},$ for all
$x\in X$. Thus, since $P_{i}$ is $(x_{i},{\rm D})$-admissible, and
$d(p_{n(i)}^{i},x)\leq i_{3}^{-1}$, we get ${\rm Mesh}(P_{i}^{\prime})\leq
i_{3}^{-1}$.

Reduction 4: WLOG eventually the diameter
$\operatorname{diam}(P_{i}^{\prime})$ is less than $2^{-3}$. If
$\operatorname{diam}(P_{i}^{\prime})\geq 2^{-3}$, for infinitely many
$i\in{\mathbb{N}}$, we may pass to a subsequence where this property holds.
Then, since $g_{i_{3}}$ is $(1/i_{3},2^{-3})$-discretely admissible for $f$
with respect to $(C,V)$, we can apply the admissibility condition to the path
$P^{\prime}$ and we get

$\displaystyle|f(x)-f(p_{0}^{i})|$ $\displaystyle\leq
g_{i_{3}}(p_{n(i)}^{i})d(p_{n(i)}^{i},x)+\sum_{k=0}^{n(i)-1}g_{i_{3}}(p_{k}^{i})d(p_{k}^{i},p_{k+1}^{i})$
(3.32) $\displaystyle\leq
g_{i_{3}}(p_{n(i)}^{i})d(p_{n(i)}^{i},x)+\sum_{k=0}^{n(i)-1}G(p_{k}^{i})d(p_{k}^{i},p_{k+1}^{i}).$
(by Lemma 3.17 (iii)(a))

Thus,

$\Phi(P_{i})={\mathbf{P}}(d(p^{i}_{0},p^{i}_{1}))+f(p^{i}_{0})+\sum_{k=0}^{n(i)-1}G(p^{i}_{k})d(p^{i}_{k},p^{i}_{k+1})\geq
f(x)-g_{i_{3}}(p_{n(i)}^{i})d(p_{n(i)}^{i},x),$

and by sending $i\to\infty$ along such a subsequence and noting that
$g_{i_{3}}$ is continuous and bounded, we get that
$\lim_{i\to\infty}\Phi(P_{i})\geq f(x)$. Therefore, in this case,
$\lim_{i\to\infty}\tilde{f}(x_{i})\geq f(x)$ using Equation (3.30).

Thus, by the last reduction and by (3.31), we can assume that

$\frac{\Delta}{2}\leq\operatorname{diam}(P^{\prime}_{i})\leq 2^{-3}.$

In particular, if we let $L\in{\mathbb{Z}}$ be such that
$2^{-L}\leq\Delta<2^{1-L}$, then $L\geq 3$. Since $p_{n(i)}^{i}$ is converging
to $x$, by passing to the tail, we can assume
$d(p_{n(i)}^{i},x)\leq\min\\{\Delta/2,i_{L+1}^{-1}\\}$.

Let $l_{i}\in{\mathbb{N}}$ be such that $3\leq l_{i}\leq L$ and
$2^{-l_{i}-1}\leq\operatorname{diam}(P^{\prime}_{i})\leq 2^{-l_{i}}$. By the
pigeonhole principle, we can pass to a sub-sequence with $l_{i}=l$ for all
$i\in{\mathbb{N}}$. Given $l\in{\mathbb{N}}$, which controls the size of the
diameter, we now want to control the mesh-size of the path $P_{i}^{\prime}$.

Reduction 5: WLOG for all but finitely many indices $i$, we have
$d(p_{0}^{i},p^{i}_{1})\leq i_{l+1}^{-1}$, where $i_{n}$ is the bound for the
mesh-size defined in Lemma 3.17. If not, then $d(p_{0}^{i},p^{i}_{1})\geq
i_{l+1}^{-1}$ for infinitely many $i\in{\mathbb{N}}$. For such indices $i$, we
have ${\mathbf{P}}(d(p_{0}^{i},p^{i}_{1}))\geq\omega(2^{1-l})$ by Property
(iv)(b) of Lemma 3.17. Thus,

$\displaystyle\Phi(P_{i})$
$\displaystyle\geq{\mathbf{P}}(d(p_{0}^{i},p^{i}_{1}))+f(p_{0}^{i})$
$\displaystyle\geq\omega(2^{1-l})+f(p_{0}^{i})$
$\displaystyle\geq\omega(\operatorname{diam}(P^{\prime}_{i}))+f(p_{0}^{i})$
(since $2^{1-l}\geq\operatorname{diam}(P^{\prime}_{i})$)
$\displaystyle\geq\omega(d(x,p_{0}^{i}))+f(p_{0}^{i})$ (since $x,p_{0}^{i}\in
P^{\prime}_{i}$) $\displaystyle\geq f(x)$

Letting $i\to\infty$ along the given subsequence gives the claim. Therefore,
we can assume by passing to the tail that $d(p_{0}^{i},p^{i}_{1})\leq
i_{l+1}^{-1}$ for all $i\in{\mathbb{N}}$.

End of proof of Lemma 3.28: By the reductions described above, after passing
to a subsequence,

(3.33) $d(p_{0}^{i},p^{i}_{1})\leq i_{l+1}^{-1}\qquad\text{and}\qquad
d(p_{n(i)}^{i},x)\leq i_{L+1}^{-1}\leq i_{l+1}^{-1}$

For $k=1,\dots,n(i)-1$, we have
$d(p_{k}^{i},K)\leq\operatorname{diam}(P^{\prime}_{i})\leq 2^{-l}$. Since
$P_{i}$ is $(x,D)$-admissible, by Property (ii)(c) of Lemma 3.17,

(3.34) $d(p_{k}^{i},p_{k+1}^{i})\leq{\rm D}(p_{k}^{i})\leq\frac{1}{i_{l+1}}.$

Combining (3.33) and (3.34), we get ${\rm Mesh}(P_{i}^{\prime})\leq 1/i_{l+1}$
and $\operatorname{diam}(P_{i}^{\prime})\geq 2^{-l-1}$. Finally, since
$g_{i_{l+1}}$ is $(i_{l+1}^{-1},2^{-l-1})$-discretely admissible for $f$ for
$(C,V)$ we get Inequality (3.3) with $i_{l+1}$ replacing $i_{3}$.

Therefore,

$\Phi(P_{i})={\mathbf{P}}(d(p^{i}_{0},p^{i}_{1}))+f(p^{i}_{0})+\sum_{k=0}^{n(i)-1}G(p^{i}_{k})d(p^{i}_{k},p^{i}_{k+1})\geq
f(x)-g_{i_{l+1}}(p_{n(i)}^{i})d(p_{n(i)}^{i},x),$

and the claim follows from Equation (3.30) by sending $i\to\infty$ and noting
that $g_{i_{l+1}}$ is continuous.

∎

Next, we quickly get the Sobolev property.

######  Lemma 3.35.

The function $\tilde{f}\in N^{1,p}(X)$ and $g$ is its upper gradient.

###### Proof.

Recall that $f\in N^{1,p}(X)$, $g$ is an upper gradient for $f$,
$f|_{K}=\tilde{f}|_{K}$ by Property (3.24), $\tilde{f}\in C(X)$ by Lemma 3.28,
and $g$ is an upper gradient for $\tilde{f}$ in $X\setminus K$ by Lemma 3.26.
Thus, Proposition 2.6 applied to $f,g,\tilde{f}$ and $K$ shows that $g$ is an
upper gradient for $\tilde{f}$ and that consequently $\tilde{f}\in
N^{1,p}(X)$. ∎

This establishes Property (3.25).

(3.36) $\displaystyle\textbf{Property (4): }\int_{X\setminus
K}g_{\tilde{f}}^{p}\,d\mu\leq\int_{X\setminus K}g_{*}^{p}\,d\mu+\epsilon$

By Lemma 3.35, $\tilde{f}\in N^{1,p}(X)$ with upper gradient $g$. Recall that
$g_{\tilde{f}}$ is the minimial $p$-weak upper gradient and is smaller than
any other upper gradient, i.e. $g_{\tilde{f}}\leq g$ (a.e.). By construction,
$g_{*}\leq g$. Thus, the fourth property follows from Lemma 3.13 and the fact
that $g\in L^{p}(X)$:

$\int_{X\setminus K}g_{\tilde{f}}^{p}d\mu\leq\int_{X\setminus
K}g^{p}d\mu=\int_{X}g^{p}d\mu-\int_{K}g^{p}d\mu\leq\int_{X}g_{*}^{p}+\epsilon
2^{-4}-\int_{K}g_{*}^{p}d\mu=\int_{X\setminus K}g_{*}^{p}+\epsilon 2^{-4}.$

∎

###  3.4. Newton-Sobolev functions are quasicontinuous

######  Proposition 3.37.

If $X$ is complete and separable and $f\in N^{1,p}(X)$, then $f$ is
quasicontinuous.

We follow the arguments in [7] and [32], but without relying on the hypothesis
of properness and density of continuous functions in $N^{1,p}(X)$. Hence, we
only provide a sketch.

###### Sketch of the proof of Proposition 3.37.

By Theorem 3.7, there is a sequence $f_{i}\in N^{1,p}(X)\cap C(X)$, for
$i\in{\mathbb{N}}$, with $\|f_{i}-f\|_{N^{1,p}(X)}\leq 2^{-i}$.

Next, we apply the argument from the proof of [32, Theorem 3.7] to show that
$f_{i}$ converges capacity almost everywhere to $f\in N^{1,p}(X)$ . Fix
$\epsilon_{0}>0$, and let $E_{\epsilon_{0},n}=\\{x\in
X:|f_{n}-f|\geq\epsilon_{0}/n\\}$. We have

$\int_{X}|f_{n}-f|^{p}d\mu\leq 2^{-np},$

and thus $\mu(E_{\epsilon_{0},n})\leq n^{p}2^{-np}\epsilon_{0}^{-p}$. Let
$E_{N}=\bigcup_{n\geq N}E_{\epsilon,N}$. By a union bound, we get that for any
$\epsilon>0$, there exists an $N$, so that $\mu(E_{N})\leq\epsilon.$ The
sequence of functions $f_{n}(x)$ converges uniformly to $f$ for any $x\in
X\setminus E_{N}$, and thus for a.e. $x\in X$, since $\epsilon>0$ is
arbitrary.

By considering $u_{n}=|f_{n}-f|n\epsilon_{0}^{-1}$ as a test function, we get
${\rm Cap}_{p}(E_{\epsilon_{0},n})\leq n^{p}2^{-np}\epsilon_{0}^{-p}$. At the
expense of possibly increasing $N$, we get ${\rm Cap}_{p}(E_{N})\leq\epsilon.$
Since $\epsilon>0$ is arbitrary, $\lim_{N\to\infty}{\rm Cap}_{p}(E_{N})=0$.
Further, $f_{i}$ converges pointwise to $f$ outside the set
$E=\cap_{n=1}^{\infty}E_{n}$, which has capacity zero.

Since the convergence is uniform, $f$ is continuous in $X\setminus E_{N}$, for
every $N$. Therefore, $f$ is quasicontinuous, since $\lim_{N\to\infty}{\rm
Cap}_{p}(E_{N})=0$. ∎

##  4\. Localization and when $X$ is locally complete

The previous section was focused entirely on complete spaces. In the final
sections we improve these statements to a locally complete setting.
Specifically, we prove Theorem 1.6: Concluding that $N^{1,p}(X)\cap C(X)$ is
dense in $N^{1,p}(X)$ and that each function $f\in N^{1,p}(X)$ is
quasicontinuous.

These theorems will all be reduced to the complete setting by taking
completions. This makes $X$ into an open set in its completion, and we are
left to consider domains $\Omega$ in complete spaces. Then, in each case, we
consider the set of points $X_{\delta}\subset X$, whose distance do the
boundary in the completion is at least $\delta$, and construct partitions of
unity subordinate to such sets. Each $X_{\delta}$ is complete, and the proofs
mainly involve checking that we can “patch” together the information from each
$X_{\delta}$ to their union, which is $X$.

For technical reasons, we prove these theorems in a slightly different order
from those in the complete setting.

###  4.1. Preliminaries on taking a completion

First, we address some measure theoretic issues in taking a completion. Let
$X$ be locally complete, and let $\hat{X}$ be its completion. The completion
is separable, if $X$ is separable. Further $X$ is an open subset of $\hat{X}$.
If $\mu$ is a Radon measure on $X$, then we can define a Radon measure
$\hat{\mu}$ on $\hat{X}$ as follows. If $E\subset X$ is Borel, then $E\cap X$
is also Borel and we can define $\hat{\mu}(E)=\mu(E\cap X)$. (In fact, by a
different argument $E\cap X$ is Borel in $X$ whenever $E$ is Borel even when
$X$ is not Borel measurable in $\hat{X}$, see [31, Proof of Lemma 1]). Since
$\mu$ is finite on balls, so is $\hat{\mu}$ and therefore $\hat{\mu}$ is a
Radon measure. (See discussion at the beginning of Section 2).

Since we will be dealing with concepts relative to $X$ and $\hat{X}$ we need
some care in our notation. For capacity, we will indicate the space $Y$ with
respect to which it is computed in the superscript, as in ${\rm
Cap}_{p}^{Y}(E)$, for $E\subset Y$. We remark, that if $E\subset X\subset Y$
and the measures on the spaces relate by restriction $\mu_{X}=\mu_{Y}|_{X}$
(where $X$ is measurable in $Y$), then ${\rm Cap}_{p}^{X}(E)\leq{\rm
Cap}_{p}^{Y}(E)$. Here, we use the fact that in this same setting if $u\in
N^{1,p}(Y)$, then $u|_{X}\in N^{1,p}(X)$, as readily follows from the
definition.

###  4.2. Quasicontinuity

###### Proof of quasicontinuity in Theorem 1.6.

Fix $f\in N^{1,p}(X)$. Let $\hat{X}$ be the completion of $X$ and $\hat{\mu}$
be the extension of $\mu$ to $\hat{X}$.

We have that $X$ is also an open set in $\hat{X}$ since $X$ is locally
complete. Let $\delta>0$ be arbitrary. Define
$X_{\delta}=\\{x:d(x,\hat{X}\setminus X)\geq\delta\\}$. Then, $X_{\delta}$ is
a closed subset of $\hat{X}$. Choose
$\psi_{\delta}(x)=\min\\{1,\frac{2}{\delta}d(x,\hat{X}\setminus
X_{\delta/2})\\}$. Then $\psi_{\delta}|_{X_{\delta}}\geq 1$, $\psi_{\delta}$
is $2/\delta$-Lipschitz and $\psi_{\delta}|_{\hat{X}\setminus
X_{\delta/2}}=0$.

Let $f_{\delta}=f\psi_{\delta}$. We have $f_{\delta}|_{X}\in N^{1,p}(X)$ and
$f_{\delta}|_{\hat{X}\setminus X_{\delta/2}}=0\in N^{1,p}(\hat{X}\setminus
X_{\delta/2})$. Then, $f_{\delta}\in N^{1,p}(\hat{X})$ since $N^{1,p}(X)$ has
the sheaf property: If $A,B\subset\hat{X}$ are open sets and $f|_{A}\in
N^{1,p}(A),f|_{B}\in N^{1,p}(B)$, then $f|_{A\cup B}\in N^{1,p}(A\cup
B)$.111This can be seen by the following argument: if $g_{A},g_{B}\in
L^{p}(A)$ are upper gradients for $f|_{A}$ and $f|_{B}$, then
$g=g_{A}{\mathbbm{1}}_{A}+g_{B}{\mathbbm{1}}_{B}\in L^{p}(A\cup B)$ is an
upper gradient of $f|_{A\cup B}$. Indeed, the upper gradient inequality (1.1)
can be verified for any rectifiable curve $\gamma$ in $A\cup B$ by dividing it
into finitely many parts contained in either $A$ or $B$.

Then, by Proposition 3.37 we have that $f_{\delta}$ is quasicontinuous in
$\hat{X}$. Therefore, for any $\delta>0$ there is an open subset $E_{\delta}$
so that $f_{\delta}|_{\hat{X}\setminus E_{\delta}}$ is continuous and ${\rm
Cap}_{p}^{\hat{X}}(E_{\delta})<\delta.$ Fix $\epsilon>0$ and let
$E=\cup_{i=1}^{\infty}E_{\epsilon 2^{-i}}\cap X.$

We have ${\rm Cap}_{p}^{X}(E)\leq{\rm Cap}_{p}^{\hat{X}}(E)\leq\epsilon$. Now,
$f_{2^{-i}\epsilon}|_{X\setminus E}$ is continuous for every
$i\in{\mathbb{N}}$. Therefore $f|_{X_{2^{-i}\epsilon}\setminus
E}=f_{2^{-i}\epsilon}|_{X_{2^{-i}\epsilon}\setminus E}$ is continuous on for
any $i\in{\mathbb{N}}$. From this we get $f|_{X\setminus E}$ is continuous. ∎

###  4.3. Density of continuous functions

Here and in what follows, the support ${\rm supp}(f)$ of a function
$f:X\to{\mathbb{R}}$ is the smallest closed set $C$ so that $f|_{X\setminus
C}$ vanishes identically. In the proof of the density of continuous functions
we will apply a partition of unity argument

We will need a standard construction for a partition of unity subordinate to a
cover. Let $X_{i}=\\{x:d(\hat{X}\setminus X,x)\geq 2^{-i}\\}$ and
$\Omega_{i}=\\{x:d(\hat{X}\setminus X,x)>2^{-i}\\}$. In the following, the
distance of a point to an empty set is defined as $\infty$. Also, we say that
a sum of functions $\sum_{i=1}^{\infty}f_{i}(x)$ is _locally finite_ if for
every $x\in X$ there exists a neighborhood, where only finitely many terms are
non-zero.

######  Lemma 4.1.

Let $\hat{X}$ be the completion of $X$ and let $X_{i}$ be defined as above.
For each $n\in{\mathbb{N}}$, There exist $4^{n}$-Lipschitz functions
$\psi_{n}:\hat{X}\to[0,1]$, so that

  1. (a)

${\mathrm{supp}(\psi_{0})}\subset X_{1}$ and ${\mathrm{supp}(\psi_{n})}\subset
X_{n+1}\setminus X_{n-1}$ for $n\geq 1$;

  2. (b)

the functions are a partition of unity: $\sum_{n=0}^{\infty}\psi_{n}(x)=1$ for
$x\in X$; and

  3. (c)

the previous sum is locally finite in $X$: for every $x\in X$ there exists a
$\delta>0$ so that are at most three $n\in{\mathbb{N}}$ so that
$\psi_{n}(y)\neq 0$ for $y\in B(x,\delta)$.

###### Proof.

Let $\psi_{0}(x)=\min\\{1,2d(x,\hat{X}\setminus X_{1})\\}$. Recursively, for
$n\geq 1$, define

(4.2)
$\psi_{n}(x)=\left(1-\sum_{k=0}^{n-1}\psi_{k}\right)\min\\{1,2^{n+1}d(x,\hat{X}\setminus
X_{n+1})\\}.$

First, $\psi_{0}$ is $2$-Lipschitz, and by induction one can show that
$\psi_{n}$ is Lipschitz with constant $(1+\cdots+4^{n-1})+2^{n+1}\leq 4^{n}$.
We have $\psi_{0}|_{X_{0}}=1$. By induction, we get that
$\sum_{k=0}^{n-1}\psi_{k}|_{X_{n-1}}=1$. Therefore, (b) holds. Moreover, this
gives (a), since the first factor in (4.2) vanishes on $X_{n-1}$ and the
second factor vanishes outside $X_{n+1}$.

Finally, we prove (c). If $x\in X$, then $x\in X_{n}\setminus X_{n-1}$ for
some $n\geq 0$, where $X_{-1}=\emptyset$ to simplify the argument. We have for
$\delta=2^{-(n-1)}$ that $B(x,\delta)\subset X_{n+1}$. Thus, for $y\in
B(x,\delta)$, due to (a), $\psi_{k}(y)\neq 0$ can only occur for
$k=n-1,n,n+1$. ∎

We also need a fairly simple version of the sheaf property for Sobolev
functions.

######  Lemma 4.3.

Let $p\in[1,\infty)$ and let $X$ be any metric measure space equipped with a
Radon measure $\mu$, finite on balls. If $A_{i}\subset X$ is any increasing
sequence of open sets, and
$H:A:=\bigcup_{i=1}^{\infty}A_{i}\to[-\infty,\infty]$ is a function so that
$H|_{A_{i}}\in N^{1,p}(A_{i})$ with
$\sup_{i\in{\mathbb{N}}}\|H\|_{N^{1,p}(A_{i})}<\infty$, for $i\geq 1$, then
$H\in N^{1,p}(A)$. Further,
$\|H\|_{N^{1,p}(A)}=\lim_{i\to\infty}\|H\|_{N^{1,p}(A_{i})}$.

###### Proof.

The $L^{p}$-version of the claim follows from monotone convergence, and we get
$H\in L^{p}(A)$ and $\|H\|_{L^{p}(A)}=\lim_{i\to\infty}\|H\|_{L^{p}(A_{i})}$

Let $g_{i}:X\to[0,\infty]$ be the zero-extension of the minimal $p$-weak upper
gradient of $H|_{A_{i}}$. By locality of $p$-weak upper gradients, see [22,
Proposition 6.3.22], $g_{i}|_{A_{j}}=g_{j}$ almost everywhere on $A_{j}$ for
all $j<i$. Thus, there exist a function $g:A\to[0,\infty]$ with $g\in
L^{p}(A)$ and $g|_{A_{i}}=g_{i}$ almost everywhere on $A_{i}$. Thus,
$g|_{A_{i}}$ is a $p$-weak upper gradient for $H|_{A_{i}}$ for all
$i\in{\mathbb{N}}$.

Fix $\epsilon>0$. By Lemma 2.4, for every $i$, we can find a lower semi-
continuous $g_{i,\epsilon}:A_{i}\to[0,\infty]$ which is an upper gradient for
$H|_{A_{i}}$ with $g_{i,\epsilon}\geq g|_{A_{i}}$ and
$\|g_{i,\epsilon}-g|_{A_{i}}\|_{L^{p}(A_{i})}\leq\epsilon 2^{-i}$. Extend
$g_{i,\epsilon}$ by zero, and define $\tilde{g}=\sup_{i}g_{i,\epsilon}.$ We
have, on the set $A$,

$|\tilde{g}-g|\leq\sum_{i=1}^{\infty}|g_{i,\epsilon}-g|{\mathbbm{1}}_{A_{i}}.$

Then $\tilde{g}\in L^{p}(A)$, and, by monotone convergence,

$\|\tilde{g}\|_{L^{p}(A)}\leq\epsilon+\lim_{i\to\infty}\|g_{i}\|_{L^{p}(A_{i})}.$

By construction, $\tilde{g}|_{A_{i}}\geq g_{i,\epsilon}$ and thus
$\tilde{g}|_{A_{i}}$ is an upper gradient for $H|_{A_{i}}$. Every rectifiable
curve in $\bigcup_{i\in{\mathbb{N}}}A_{i}$ is contained in $A_{i}$ for some
$i\in{\mathbb{N}}$. This argument verifies (1.1) and $\tilde{g}$ is an upper
gradient for $H$. Thus, $H\in N^{1,p}(A)$. Further,

$\|H\|_{N^{1,p}(A)}\leq(\|H\|_{L^{p}(A)}^{p}+\|\tilde{g}\|_{L^{p}(A)}^{p})^{\frac{1}{p}}\leq\lim_{i\to\infty}((\epsilon+\|g_{i}\|_{L^{p}(A_{i})})^{p}+\|H\|_{L^{p}(A_{i})}^{p})^{\frac{1}{p}}.$

Since $\epsilon>0$ is arbitrary the claim follows. ∎

###### Proof of density in Theorem 1.6.

Let $f\in N^{1,p}(X)$ be any function. Fix $\epsilon>0$. Let $\psi_{n}$ be the
partition of unity functions from Lemma 4.1. We also define
$\hat{\psi}_{n}=\psi_{n}+\psi_{n+1}+\psi_{n-1}$ for $n\geq 1$ and
$\hat{\psi}_{0}=\psi_{0}+\psi_{1}$. For every $x\in\Omega$ we have finitely
many $n$ so that $\hat{\psi}_{n}(x)\neq 0$. Further, whenever $\psi_{n}(x)\neq
0$, we have $\hat{\psi_{n}}(x)=1$. There are also constants $L_{n}$ so that
$\hat{\psi}_{n}$ are $L_{n}$-Lipschitz. Indeed, with some care, we could show
that $L_{n}\lesssim 4^{n}$, but we will not need this.

As in the proof of the quasicontinuity in Theorem 3.7 we set
$f_{n}=f\hat{\psi}_{n}\in N^{1,p}(\hat{X})$. By Theorem 3.7, there is a
continuous $u_{n}^{\prime}\in N^{1,p}(\hat{X})\cap C(\hat{X})$ so that
$\|f_{n}-u_{n}^{\prime}\|_{N^{1,p}(\hat{X})}\leq\epsilon
2^{-4-n}(1+L_{n})^{-1}$. Also, let $u_{n}=\hat{\psi}_{n}g_{n}^{\prime}$. Then,
by using the Leibniz rule (see [22, Proposition 6.3.28]), we get

$\|u_{n}-f_{n}\|_{N^{1,p}(\hat{X})}=\|\hat{\psi}_{n}(u_{n}-f_{n})\|_{N^{1,p}(\hat{X})}\leq
2(1+L_{n})\|u_{n}-f_{n}\|_{N^{1,p}(\hat{X})}\leq 2^{-2-n}\epsilon.$

Let $u=\sum_{n=1}^{\infty}u_{n}$. Since the sum is a locally finite sum of
continuous functions by Property (c) of Lemma 4.1, then $u\in C(X)$ and the
sum is well defined.

We show that $u\in N^{1,p}(X)$. Fix an $i\in{\mathbb{N}}$. We have that
$f|_{\Omega_{i}}=\sum_{i=0}^{n+1}f_{i}|_{\Omega_{i}}$ and that
$u|_{\Omega_{i}}=\sum_{i=0}^{n+1}u_{i}|_{\Omega_{i}}$. Thus,

$\|f-u\|_{N^{1,p}(\Omega_{i})}\leq\sum_{n=1}^{\infty}\|f_{n}-u_{n}\|_{N^{1,p}(\Omega_{i})}\leq\epsilon/2$

and $u|_{\Omega_{i}}\in N^{1,p}(\Omega_{i})$ with a uniformly bounded norm
independent of $i$.

By Lemma 4.3, $u\in N^{1,p}(X)$. Further,
$\|g\|_{N^{1,p}(X)}=\lim_{i\to\infty}\|g\|_{N^{1,p}(\Omega_{i})}$. Finally, by
applying this argument to the difference $f-g$, we obtain
$\|f-g\|_{N^{1,p}(X)}\leq\epsilon$. Since $g$ is continuous, the claim
follows. ∎

##  5\. Choquet capacities and equivalence of definitions

In the final section we study the capacity $E\to{\rm Cap}_{p}(E)$ and
condenser capacity ${\rm Cap}_{p}(E,F)$, and prove that they satisfy certain
regularity properties. Specifically, we prove the following three theorems.

  1. (1)

Theorem 1.8: Concluding that $E\to{\rm Cap}_{p}(E)$ is outer regular.

  2. (2)

Corollary 1.9: Concluding that $E\to{\rm Cap}_{p}(E)$ is a Choquet capacity
for $p>1$.

  3. (3)

Theorem 1.3: Concluding that different definitions of ${\rm Cap}_{p}(E,F)$
coincide. In particular, capacity can be computed with locally lipschitz
funtions with locally lipschitz upper gradients.

###  5.1. Choquet capacity and outer regularity

We start by defining a Choquet capacity. Denote by $\mathcal{P}(X)$ the
collection of all subsets of $X$, i.e. its power set.

######  Definition 5.1.

A functional $I:\mathcal{P}(X)\to[0,\infty]$ is called a Choquet capacity, if
it satisfies the following three properties.

  1. (1)

Increasing: If $A\subset B\subset X$, then $I(A)\leq I(B)$.

  2. (2)

Continuity from below: If $(A_{n})_{n\in{\mathbb{N}}}$ is an increasing
sequence of subsets of $X$, then

$\lim_{n\to\infty}I(A_{n})=I\left(\bigcup_{n\in{\mathbb{N}}}A_{n}\right).$

  3. (3)

Continuity from above: If $(K_{n})_{n\in{\mathbb{N}}}$ is a decreasing
sequence of compact subsets of $X$, then

$\lim_{n\to\infty}I(K_{n})=I\left(\bigcap_{n\in{\mathbb{N}}}K_{n}\right).$

A reader interested in Choquet capacities may consult any of the following
[15, 14]. A condensed treatise is available in [11]. An earlier result showing
that a variant of ${\rm Cap}_{p}$, see Remark 1.10, is Choquet is presented in
[24]. One of the main motivations for introducing Choquet capacities is the
“Capacitability theorem” of Choquet, which states that any analytic subset
$A\subset X$ satisfies: $I(A)=\sup_{K\subset A}I(K)$, where the supremum is
taken over compact subsets of $A$.

For $I={\rm Cap}_{p}$, the increasing property is immediate from the
definition. The continuity from below holds without further assumptions, when
$p>1$. The continuity from above is reduced to the functional being _outer-
regular_. Recall that the functional $I$ is outer regular, if for every
compact set $K\subset X$, and any $\epsilon>0$, there exists an open set $O$
such that $K\subset O$ and $I(O)\leq I(K)+\epsilon$. In other words, the main
object is to establish outer regularity, and then collect all the pieces
together to prove that ${\rm Cap}_{p}$ is a Choquet capacity.

We first prove the outer regularity of the capacity, which was stated in
Theorem 1.8. This is a repetition of the argument in [7, Proof of Corollary
1.3], with the only change being that Proposition 3.37 is used instead of [7,
Theorem 1.1]. For the reader’s convenience, we sketch the idea here.

###### Sketch of proof of Theorem 1.8.

Let $u\in N^{1,p}(X)$ be any non-negative function with $u|_{E}\geq 1$. Fix
$\epsilon>0$. Then, $u$ is quasicontinuous by Theorem 1.6, and there is an
open set $V$ with ${\rm Cap}_{p}(V)<\epsilon^{p}$ so that $u|_{X\setminus V}$
is continuous. Choose a non-negative function $v$ so that
$\|v\|_{N^{1,p}(X)}\leq\epsilon$ and $v|_{V}\geq 1$.

By continuity in $X\setminus V$, there is an open set $O_{E}$ with $E\setminus
V\subset O_{E}$ so that $u|_{O_{E}\cap X\setminus V}\geq 1-\epsilon$. Consider
the function $u_{\epsilon}=\frac{u}{1-\epsilon}+v$. Then
$u_{\epsilon}|_{O_{E}\cup V}\geq 1$. The set $O_{E}\cup V$ is open, and thus,

$\inf_{E\subset O}{\rm
Cap}_{p}(O)\leq\|u_{\epsilon}\|^{p}_{N^{1,p}(X)}\leq\left(\frac{1}{(1-\epsilon)}\|u\|_{N^{1,p}(X)}+\epsilon\right)^{p}.$

Taking an infimum over $u\in N^{1,p}(X)$ with $u|_{E}\geq 1$ and letting
$\epsilon\rightarrow 0$ yields the claim. ∎

Next, we prove that ${\rm Cap}_{p}$ is a Choquet capacity. This was stated in
the introduction as Corollary 1.9.

###### Proof of Corollary 1.9.

We verify the three properties of a Choquet capacity from Definition 5.1.

  1. (1)

Increasing: If $A\subset B\subset X$, then ${\rm Cap}_{p}(A)\leq{\rm
Cap}_{p}(B)$, since every function $u\in N^{1,p}(X)$ with $u|_{B}=1$ also
satisfies $u|_{A}=1$.

  2. (2)

Continuity from below: We follow the proof of [24], which is presented with a
slightly different definition of capacity. Let $A_{n}$ be any increasing
sequence of sets. By the increasing property, the property of continuity from
below is automatic if $\lim_{n\to\infty}{\rm Cap}_{p}(A_{n})=\infty$. Thus, we
may assume that $\lim_{n\to\infty}{\rm Cap}_{p}(A_{n})<\infty$.

Choose any sequence $u_{n}\in N^{1,p}(X)$ so that $u_{n}|_{A_{n}}=1$ and

$\lim_{n\to\infty}\|u_{n}\|_{N^{1,p}(X)}^{p}=\lim_{n\to\infty}{\rm
Cap}_{p}(A_{n}).$

The functions $u_{n}$ and their minimal $p$-weak upper gradients $g_{u_{n}}$
are uniformly bounded in $L^{p}(X)$. Therefore, by Mazur’s Lemma, we may
choose convex combinations $\tilde{u}_{n}$ of $\\{u_{k}\\}_{k=n}^{\infty}$ and
corresponding convex combinations $\tilde{g}_{n}$ of
$\\{g_{k}\\}_{k=n}^{\infty}$ so that $\tilde{u}_{n}$ and $\tilde{g}_{n}$ are
Cauchy in $L^{p}(X)$ and so that $\tilde{g}_{n}$ is an upper gradient for
$\tilde{u}_{n}$. Choose a subsequence $(n_{k})_{k=1}^{\infty}$, with
$n_{k}\geq k$, so that

(5.2)
$\sum_{k=1}^{\infty}|\tilde{u}_{n_{k+1}}-\tilde{u}_{n_{k}}|+|\tilde{g}_{n_{k+1}}-\tilde{g}_{n_{k}}|\in
L^{p}(X).$

Next, define $\tilde{u}_{l}=\sup_{k\geq l}\tilde{u}_{n_{l}}$ and
$\tilde{g}_{l}=\sup_{k\geq l}\tilde{u}_{n_{l}}$. It follows from (5.2) that
$\tilde{u}_{l},\tilde{g}_{l}\in L^{p}(X)$, and that as $l\to\infty$ they
converge in $L^{p}(X)$. A fairly direct calculation using the definition (1.1)
shows that $\tilde{g}_{l}$ is a $p$-weak upper gradient for $\tilde{u}_{l}$,
and $\tilde{u}_{l}\in N^{1,p}(X)$.

Note that
$\|\tilde{u}_{l}\|_{N^{1,p}(X)}^{p}\leq\|\tilde{u}_{l}\|_{L^{p}(X)}^{p}+\|\tilde{g}_{l}\|_{L^{p}(X)}^{p}$.