differential $D_{P}f(x)$ is either a $J$-linear isomorphism or a
$J$-antilinear graded isomorphism for a.e. $x\in U$. Then $f$ is holomorphic
or antiholomorphic (with respect to the complex structure $J$).

######  Corollary 7.2.

Let $U\subset G$ be open, let $p\geq\nu$, let $f\in
W^{1,p}_{\operatorname{loc}}(U,G)$. Suppose that any graded isomorphism
$\mathfrak{g}\to\mathfrak{g}$ is either $J$-linear or $J$-antilinear and that
$D_{P}f(x)$ is an isomorphism for a.e. $x\in U$. Then $f$ is holomorphic or
antiholomorphic (with respect to the complex structure $J$).

The condition that any graded isomorphism $\mathfrak{g}\to\mathfrak{g}$ is
either $J$-linear or $J$-antilinear is in particular satisfied for the
complexified Heisenberg algebras $\mathfrak{h}^{\mathbb{C}}_{m}$, see [RR00,
Section 6].

###### Proof of Theorem 7.1.

The result is proved in [KMX20] under the stronger condition
$p>\text{homogeneous dimension of $G$}=2\nu$. The key step in the proof is to
show that $D_{P}f$ cannot switch between a $J$-linear and a $J$-antilinear
map. To show this we use the Pullback Theorem to prove that the the pullback
of the top degree holomorphic form cannot oscillate between a holomorphic and
an anti-holomorphic form. Since the top degree holomorphic form has weight
$-\nu$, the improved version of the Pullback Theorem, Theorem 4.24, gives this
result already under the weaker condition $p\geq\nu$. Note that $G$ is a group
of step $m$ with $m<\nu$ so the condition
$\frac{1}{p}\leq\frac{1}{m}+\frac{1}{\bar{\nu}}$, where $\bar{\nu}=2\nu$ is
the homogeneous dimension of $G=H^{\mathbb{C}}$, is automatically satisfied.

Thus, under the assumption $p\geq\nu$, we still may asssume that $D_{P}f$ is
$J$-linear a.e. (the case that $D_{P}f$ is $J$-antilinear a.e. being
analogous). Let $\pi_{G}:G\to G/[G,G]$ denote the abelianization map. By
Remark 2.46, the map $\pi_{G}\circ f$ belongs to
$W^{1,p}_{\operatorname{loc}}$ and for each horizontal vectorfield $X$ the
weak derivative satisfies $X(\pi_{G}\circ f)(x)=D_{P}f(x)X$ for a.e. $x\in U$.
Since $D_{P}f(x)$ is $J$-linear, the horizontal anticonformal derivatives
$\bar{Z}(\pi_{G}\circ f)$ vanish. It follows easily that $\pi_{G}\circ f$ is
holomorphic (see, e.g., [KMX20]). In particular $\pi_{G}\circ f$ is smooth and
hence $|D_{P}f(x)|:=\max\\{|D_{P}f(x)X|_{\mathfrak{g}}:|X|_{\mathfrak{g}}\leq
1,X\in V_{1}\\}$ is locally bounded. By (2.44), it follows that $f\in
W^{1,\infty}_{\operatorname{loc}}(U;G)$. Thus the assertion follows from the
result in [KMX20] for $p>2\nu$.

∎

###### Proof of Corollary 7.2.

This follows immediately from Theorem 7.1. ∎

##  Appendix A $L^{p*}$-Pansu-differentiability

Here we give another proof of the the following result by Vodopyanov.

######  Theorem A.1 ($L^{p*}$ Pansu differentiability a.e., [Vod03], Corollary
2).

Let $U\subset G$ be open, let $1\leq p<\nu$ and define $p^{*}$ by
$\frac{1}{p^{*}}=\frac{1}{p}-\frac{1}{\nu}$. Let $f\in W^{1,p}(U;G^{\prime})$.
For $x\in U$ consider the rescaled maps

$f_{x,r}=\delta_{r^{-1}}\circ\ell_{f(x)^{-1}}\circ
f\circ\ell_{x}\circ\delta_{r}.$

Then, for a.e. $x\in U$, there exists a graded group homomorphism $\Phi:G\to
G^{\prime}$ such that

(A.2) $f_{x,r}\to\Phi\quad\text{in $L^{p^{*}}_{loc}(G;G^{\prime})$ as $r\to
0$.}$

We write

$D_{P}f(x)=\Phi$

for the $L^{p*}$ Pansu derivative and we use the same notation to denote the
corresponding graded Lie algebra homomorphism given by $D\Phi(e)$.

######  Remark A.3.

It follows easily from Theorem A.1 that for all $z\in G^{\prime}$ the
functions $u_{z}:=d^{\prime}(z,f(\cdot))$ satisfy

(A.4) $|D_{h}u_{z}|\leq|D_{P}f|$ a.e., where (A.5)
$|D_{P}f(x)|=\max\\{|D_{P}f(x)X|_{V^{\prime}_{1}}:\,X\in
V_{1},\,|X|_{V_{1}}\leq 1\\}.$

Here $|\cdot|_{V_{1}}$ and $|\cdot|_{V^{\prime}_{1}}$ denote the norms induced
by the scalar product on the first layer of $\mathfrak{g}$ and
$\mathfrak{g}^{\prime}$, respectively. Thus the condition (2.30) in Definition
2.29 holds with $g=|D_{P}f|$. We provide a proof after the proof of Theorem
A.1.

######  Remark A.6.

It follows from Step 2 of the proof of Theorem A.1 that $f_{x,r}$ converges to
$\Phi$ in the stronger sense that the horizontal distributional derivatives of
the composition $\pi_{G^{\prime}}\circ f_{x,r}$ converge in
$L^{p}_{\operatorname{loc}}$ to a constant function, where
$\pi_{G^{\prime}}:G^{\prime}\rightarrow G^{\prime}/[G^{\prime},G^{\prime}]$ is
the abelianization map; more precisely, for a.e. $x\in U$, and a basis $X_{i}$
of the space of left-invariant horizontal vectorfields

(A.7) $X_{i}(\pi_{G^{\prime}}\circ f_{x,r})\longrightarrow
g_{i}(x)\quad\text{in $L^{p}_{loc}$}\quad\text{where
$g_{i}=X_{i}(\pi_{G^{\prime}}\circ f)$}$

is the weak horizontal derivative of $\pi_{G^{\prime}}\circ f$ in direction
$X_{i}$. It follows from (A.2) that $\pi_{G^{\prime}}\circ
f_{x,r}\to\pi_{G^{\prime}}\circ\Phi$ in $L^{p}_{loc}$ and thus

$g_{i}(x)=X_{i}(\pi_{G^{\prime}}\circ\Phi)\quad\text{on $G$}$

Evaluating the right hand side at $e\in G$ and viewing $D_{P}f(x)$ as a map
from $\mathfrak{g}$ to $\mathfrak{g}^{\prime}$ given by $D\Phi(e)$ we get

$g_{i}(x)=D_{P}f(x)X_{i}.$

Here we used the fact that $D_{P}f(x)$ maps the first layer of $\mathfrak{g}$
to the first layer of $\mathfrak{g}^{\prime}$ and that $D\pi_{G^{\prime}}(e)$
is the identity map on the first layer of $\mathfrak{g}^{\prime}$. It follows
that for every horizontal vectorfield $X$ on $G$ the weak derivative of
$(\pi_{G^{\prime}}\circ f)$ in direction $X$ satisfies

(A.8) $X(\pi_{G^{\prime}}\circ f)(x)=D_{P}f(x)X\quad\text{for a.e.\ $x$.}$

We give the proof using the distributional definition of Sobolev spaces, see
Definitions 2.26 and 2.29. The proof uses only the Poincaré-Sobolev inequality
(which easily implies compactness of the Sobolev embedding, see Appendix B)
and a characterization of group homomorphism by their abelianization (see
Lemma A.16 below). Thus the proof applies verbatim if one instead uses the
definition of Sobolev spaces by upper gradients, if one replaces the function
$g$ in Definition 2.29 by an upper gradient; see [HKST15, Theorem 9.1.15] for
the Poincaré-Sobolev inequality for Sobolev spaces defined by upper gradients.
For the convenience of the reader a short discussion of Sobolev spaces defined
by upper gradient is given in Appendix C.

The strategy of the proof is as follows. Denote by
$\pi_{G^{\prime}}:G^{\prime}\to G^{\prime}/[G^{\prime},G^{\prime}]\simeq
V_{1}$ the abelianization map. By Proposition 2.31 we have
$\pi_{G^{\prime}}\circ f\in W^{1,p}(U;G^{\prime}/[G^{\prime},G^{\prime}])$.
Let $x$ be a Lebesgue point of $f$, the function $g$ in Definition 2.29 and of
the weak derivatives $g_{i}=X_{i}(\pi_{G^{\prime}}\circ f)$.

  1. (1)

By the compact Sobolev embedding, Theorem B.1 (2), a subsequence $f_{x,r_{j}}$
converges to a Lipschitz map $\hat{f}$ in $L^{p^{*}}_{loc}$ with
$\hat{f}(e)=e$.

  2. (2)

The whole sequence $\pi_{G^{\prime}}\circ f_{x,r}$ converges to a linear map
$\hat{u}$, i.e., the weak horizontal derivatives of $\hat{u}$ are constant.

  3. (3)

If $F:G\to G^{\prime}$ is Lipschitz, $F(e)=e$ and $\pi_{G^{\prime}}\circ F$ is
a linear map, then $F$ is a group homorphism and $F$ is uniquely determined by
$\pi_{G^{\prime}}\circ F$; see Lemma A.16 below.

  4. (4)

Uniqueness of the limit implies that the full sequence $f_{x,r}$ converges in
$L^{p*}_{loc}$.

We begin by recalling some properties of the abelianization map.

######  Proposition A.9.

Let $G$ be a Carnot group, equipped with the Carnot-Caratheodory distance,
with graded Lie algebra $\mathfrak{g}=\oplus_{i=1}^{m}\mathfrak{g}_{i}$. Then
the abelianization homomorphism $\pi=\pi_{G}:G\to G/[G,G]$ has the following
properties.

  1. (1)

The map $\pi$ is graded, i.e., $\pi(\delta_{r}g)=r\pi(g)$, and the restriction
of $d\pi(g)$ to the horizontal subspace of $T_{g}G$ is an isomorphism onto
$G/[G,G]$. Thus for every $Y\in G/[G,G]$ there exists a unique horizontal
vectorfield $Z$ on $G$ with $d\pi(g)Z(g)=Y$. Moreover $Z$ is left-invariant.

  2. (2)

The map $\pi$ is $1$-Lipschitz if $G/[G,G]$ is equipped with the induced
metric
$d_{\pi}(\pi(a),\pi(b)):=\min_{g,g^{\prime}\in[G,G]}d_{CC,G}(ag,bg^{\prime})$.
Moreover, the induced metric comes from a norm:
$d_{\pi}(a^{\prime},b^{\prime})=|a^{\prime}-b^{\prime}|$.

###### Proof.

(1) By definition, the commutator subgroup $[G,G]$ is the closure of the set
of finite products of commutators $[xy]=x^{-1}y^{-1}xy$. In particular $[G,G]$
is a normal subgroup. If $G$ is a Carnot group then $[G,G]$ is a Lie subgroup
with
$T_{e}[G,G]=[\mathfrak{g},\mathfrak{g}]=\oplus_{j=2}^{m}\mathfrak{g}_{j}$.
Thus $\ker d\pi(e)=\oplus_{j=2}^{m}\mathfrak{g}_{j}$ and hence the restriction
of $d\pi(e)$ to the horizontal subspace $\mathfrak{g}_{1}$ is an isomorphism
onto $G/[G,G]$ (note that we can identifty $T_{g}G/[G,G]$ and $G/[G,G]$ since
$G/[G,G]$ is abelian). In particular $d\pi(e)$ is graded and hence $\pi$ is
graded. Since $\pi$ is a group homomorphism we have
$d\pi(g)\circ(\ell_{g})_{*}=d\pi(e)$ and the remaining assertions easily
follow from this identity.

(2) The fact that $\varphi$ is $1$-Lipschitz follows directly from the
definition of the induced metric. Since the Carnot-Caratheodory distance is
left-invariant, so is the induced metric $d_{\pi}$. Thus $d_{\pi}(a,b)=N(a-b)$
since $G/[G,G]$ is abelian. The fact that $\pi$ is graded implies the $N$ is
$1$-homogeneous and hence a norm. ∎

To show that the limit map $\hat{f}$ is Lipschitz and to ensure that the
normalisation $f_{x,r}(e)=e$ implies that $\hat{f}(e)=e$ we use the following
facts, which are a simple consequence of the Poincaré inequality.

######  Proposition A.10.

Let $X^{\prime}$ be a complete, separable metric space. Let $U\subset G$ be
open, let $f\in W^{1,p}(U;X^{\prime})$ and let $g:U\to\mathbb{R}$ be the
common bound for the weak derivatives of the maps $x\mapsto d(z,f(x))$ in
Definition 2.29.

  1. (1)

Suppose that $x$ is $p$-Lebesgue point of $f$ and $g$. Then there exists a
constant $C_{x}<\infty$ such that, for all $0<s<\operatorname{dist}(x,U)$,

(A.11) $\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(x,s)}(d^{\prime})^{p}(f(y),f(x))d\mu\leq
C_{x}s^{p}$

  2. (2)

If $g$ is bounded by $L$ a.e on $B(x,R)$ then $f$ has a representative which
is $CL$-Lipschitz in $B(x,R/5)$.

###### Proof.

(1) Consider the local maximal function of $g^{p}$ at $x$:

$M_{x}=M_{x,R}:=\sup_{0<r<R}\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(x,r)}g^{p}(y)\,\mu(dy).$

Since $x$ is a $p$-Lebesgue point of $g$ we have $M_{x}<\infty$. By the
Poincaré inequality, for every $r\in(0,R]$ there exists a point $f_{r}\in
X^{\prime}$ such that

(A.12) $\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(x,r)}(d^{\prime})^{p}(f(y),f_{r})\,\mu(dy)\leq
Cr^{p}M_{x}.$

By the triangle inequality we have $d^{\prime}(f_{r},f_{r/2})\leq
d^{\prime}(f(y),f_{r})+d^{\prime}(f(y),f_{r/2})$. Integrating this estimate
over $B(x,r/2)$ and using that $\mu(B(x,r))=2^{\nu}\mu(B(x,r/2))$ we deduce
that

$d^{\prime}(f_{r},f_{r/2})\leq CrM_{x}^{1/p}.$

Thus the sequence $i\mapsto f_{2^{-i}r}$ is a Cauchy sequence and hence has a
limit $f_{0}$ and $d^{\prime}(f_{r},f_{0})\leq CrM_{x}^{1/p}$. Now $x$ is a
$p$-Lebesgue point of $f$ and it follows from (A.12) that $f_{0}=f(x)$. This
gives the desired estimate with $C_{x}=CM_{x}$.

(2) Since $g$ is bounded we have $M_{x,s}\leq L^{p}$ for all $x\in B(x,R/5)$
and all $s\leq\frac{4}{5}R$. Let $x_{1},x_{2}\in B(x,R/5)$ be $p$-Lebesgue
points of $f$ and set $r=d^{\prime}(x_{1},x_{2})$. Then $r\leq\frac{2}{5}R$.
Application of assertion (1) with $C_{x}=CM_{x}$ gives for $i=1,2$

$\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(x_{i},2r)}(d^{\prime})^{p}(f(y),f(x_{i}))d\mu\leq
CL^{p}r^{p}.$

Now one can integrate the inequality $d^{\prime}(f(x_{1}),f(x_{2}))\leq
d^{\prime}(f(y),f(x_{1}))+d^{\prime}(f(y),f(x_{2}))$ over $B(x_{1},r)\subset
B(x_{1},2r)\cap B(x_{2},2r)$ and use that the measure of the ball $B(x_{i},s)$
is $\mu(B(x_{i},s))=s^{\nu}$ to deduce that

$d^{\prime}(f(x_{1}),f(x_{2}))\leq CLr$

Since the Lebesgue points are dense in $B(x,R/5)$ there exists a unique
$CL$-Lipschitz function $\bar{f}$ on $B(x,R/5)$ which agrees with $f$ at all
Lebesgue points. ∎

###### Proof of Theorem A.1.

Since the assertion is local we may assume that $U$ is bounded. Let
$g:U\to\mathbb{R}$ be the common bound for the weak derivatives of the maps
$x\mapsto d^{\prime}(z,f(x))$ as in Definition 2.29. Let
$u=\pi_{G^{\prime}}\circ f$. Since $G^{\prime}/[G^{\prime},G^{\prime}]$ is a
linear space, $\pi_{G^{\prime}}$ is $1$-Lipschitz and $U$ is bounded, it
follows from Proposition 2.31 that $u\in
W^{1,p}(U;G^{\prime}/[G^{\prime},G^{\prime}])$. For $j=1,\ldots,K$ let
$g_{j}=X_{j}u$ denotes the weak derivatives. Let $x$ be a Lebesgue point for
$f$, $g$ and $g_{1},\ldots g_{K}$. Fix a ball $B(e,R)$.

Step 1: There exists a subsequence $r_{j}\to 0$ such that
$f_{x,r_{j}}\to\hat{f}$ in $L^{p*}(B(e,R),G^{\prime})$. Moreover $\hat{f}\in
W^{1,p}(B(e,R);G^{\prime})$ and $\hat{f}$ has a representative which is
Lipschitz in $B(e,R/5)$ and satisfies $\hat{f}(e)=e$.

Set

$G_{x,r}:=g\circ\ell_{x}\circ\delta_{r}$

and let $z\in G^{\prime}$. It follows directly from the behaviour of the
Carnot-Caratheodory metric on $G^{\prime}$ under left-translation and dilation
that $|D_{h}d^{\prime}(z,f_{x,r}(\cdot)|\leq G_{x,r}$ in $B(e,R)$ (as long as
$Rr<\operatorname{dist}(x,G\setminus U)$).

Since $x$ is a Lebesgue point of $g$ the sequence $G_{x,r}$ converges to a
constant:

(A.13) $G_{x,r}\to g(x)\quad\text{in $L^{p}(B(e,R))$}.$

Applying (A.11) to $f$ and $B(x,\rho r)$ and unwinding definitions we see that
for all $0<\rho\leq R$:

(A.14) $\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(e,\rho)}(d^{\prime})^{p}(f_{x,r}(y),e)\,d\mu\leq
C_{x}\rho^{p}.$

Taking $\rho=R$ and using in addition (A.13) we can apply the compact Sobolev
embedding, Theorem B.1 (2). Thus there exists a subsequence $r_{j}\to 0$ and a
map $\hat{f}\in W^{1,p}(B(e,R);G^{\prime})$ such that

$f_{x,r_{j}}\to\hat{f}\quad\text{in $L^{p*}(B(e,R);G^{\prime})$ as
$j\to\infty$.}$

In particular $d^{\prime}(z,f_{x,r_{j}}(\cdot))\to
d^{\prime}(z,\hat{f}(\cdot))$, for all $z\in G^{\prime}$, and it follows from
the $L^{p}$ convergence of $G_{x,r}$ that
$|D_{h}d^{\prime}(z,\hat{f}(\cdot))|\leq g(x)$.

Thus by Proposition A.10 (2) the map $\hat{f}$ has a representative which is
$Cg(x)$-Lipschitz in $B(e,R/5)$. Passing to the limit in (A.14) we see that

(A.15) $\mathchoice{{\vbox{\hbox{$\textstyle-$
}}\kern-7.83337pt}}{{\vbox{\hbox{$\scriptstyle-$
}}\kern-5.90005pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.75003pt}}{{\vbox{\hbox{$\scriptscriptstyle-$
}}\kern-4.25003pt}}\\!\int_{B(e,\rho)}(d^{\prime})^{p}(\hat{f}(y),e)\,d\mu\leq
C_{x}\rho^{p}.$

Thus a representative of $\hat{f}$ which is $Cg(x)$-Lipschitz in $B(e,R/5)$
satisfies $\hat{f}(e)=e$.

Step 2: The functions $\pi_{G^{\prime}}\circ f_{x,r}$ converge in
$L^{p^{*}}(B(e,R);G^{\prime}/[G^{\prime},G^{\prime}]))$ to a linear map
$\hat{u}$, i.e. $\hat{u}(e)=0$ and the (weak) horizontal derivatives of
$\hat{u}$ are constant.

Set $u=\pi_{G^{\prime}}\circ f$ and define $u_{x,r}$ like $f_{x,r}$, i.e.,
$u_{x,r}=\delta_{r}^{-1}\circ\ell_{{u(x)}^{-1}}\circ
u\circ\ell_{x}\circ\delta_{r}$. Since the target is abelian this can actually
be written in the more conventional form:

$u_{x,r}(y)=\frac{u(x\delta_{r}y)-u(x)}{r}.$

Since $\pi_{G^{\prime}}$ is a graded group homomorphism it follows that
$\pi_{G^{\prime}}\circ f_{x,r}=u_{x,r}$. Since $\pi_{G^{\prime}}$ is a
Lipschitz map we get

$u_{x,r_{j}}\to\hat{u}=\pi_{G^{\prime}}\circ\hat{f}\quad\text{in
$L^{p*}(B(e,R);G^{\prime}/[G^{\prime},G^{\prime}])$ as $j\to\infty$.}$

In particular $\hat{u}$ has a representative which is $Cg(x)$-Lipschitz in
$B(0,R/5)$ and satisfies $\hat{u}(e)=0$.

In addition, we have

$X_{j}u_{x,r}=g_{j}\circ\ell_{x}\circ\delta_{r}$

and thus $X_{j}u_{x,r}$ converges to a constant:

$X_{j}u_{x,r}\to g_{j}(x)\quad\text{in $L^{p}(B(e,R))$.}$

It follows directly from the definition of weak derivatives that $\hat{u}$ has
constant weak horizontal derivatives which are given by
$X_{j}\hat{u}=g_{j}(x)$. Since $\hat{u}(e)=0$ it follows (e.g., from the
Poincaré inequality) $\hat{u}$ is uniquely determined by $g_{j}(x)$. Thus the
whole sequence $u_{x,r}$ converges to $\hat{u}$.

Step 3: Conclusion.
Apply Steps 1 and 2 on balls $B(e,R)$ with $R=1,2,\ldots$. For each $R$ choose
a further subsequence in Step 1 and finally choose a diagonal sequence. Thus
we find a single sequence $r_{k}\to 0$ such that

$f_{x,r_{k}}\to\hat{f}\quad\text{in $L^{p*}_{loc}(G;G^{\prime})$}.$

Moreover $|D_{h}d^{\prime}(z,\hat{f}(\cdot))|$ is bounded by the constant
$g(x)$ for all $z\in G^{\prime}$.

Thus $\hat{f}$ has a Lipschitz representative and we have already shown that
this representative satisfies $\hat{f}(e)=e$. In combination with Step 2 we
see that

$\pi_{G^{\prime}}\circ\hat{f}=\hat{u}$

where $\hat{u}$ has constant horizontal derivatives. Now Lemma A.16 below
implies that $\hat{f}$ is a graded group homomorphism and $\hat{f}$ is
uniquely determined by $\hat{u}$. Uniqueness implies that the full sequence
$f_{x,r}$ converges to $\hat{f}$ in $L^{p^{*}}_{loc}(G)$. ∎

###### Proof of (A.4).

Fix $z\in G^{\prime}$ and write $u=u_{z}$. Theorem A.1 and Remark A.6 also
apply to the map $u:G\to\mathbb{R}$ and thus for a.e. $x\in U$ there exists a
linear map $L_{x}:G\to\mathbb{R}$ (i.e. $L_{x}(e)=0$ and the horizontal
derivatives of $L$ are constant) such that the maps
$u_{x,r}(y):=r^{-1}(u(x\delta_{r}y)-u(x))$ satisfy

$u_{x,r}\to L_{x}\quad\text{in $L^{p^{*}}_{\rm loc}(G)$}\quad\text{and}\quad
X_{i}L_{x}\equiv(X_{i}u)(x).$

Here $X_{i}u$ denotes the weak horizontal derivatives. On the other hand the
triangle inequality for $d^{\prime}$ and the behaviour of $d^{\prime}$ under
left-translation and dilation imply that

$|u_{x,r}(y)|=\frac{|d^{\prime}(z,f(x)\delta_{r}f_{x,r}(y))-d^{\prime}(z,f(x))|}{r}\leq
d(e,f_{x,r}(y)).$

Passing to the limit $r_{j}\to 0$ we see that $|L_{x}(y)|\leq
d(e,D_{P}f(x)(y))$ for a.e. $x\in U$. Taking $y=\exp tX$ and letting $t\to 0$
we obtain (A.4). ∎

To show that the map $\hat{f}$ constructed in the proof of Theorem A.1 is a
graded group homomorphism, we introduce some notation. Let $X^{\prime}$ be a
finite-dimensional, normed, linear space. We say that a map $u:G\to
X^{\prime}$ is affine if for every left-invariant horizontal vector field $X$
the weak derivative $Xu$ is constant. We say that a map $f:G\to G^{\prime}$ is
an $L$-map if $\pi_{G^{\prime}}\circ f=L$ and $L$ is affine.

######  Lemma A.16.

Let $f$ and $f^{\prime}$ be Lipschitz $L$-maps.

  1. (1)

If $f$ and $f^{\prime}$ agree at one point than $f\equiv f^{\prime}$.

  2. (2)

If $f(e)=e$ then $f$ is a graded group homomorphism.

###### Proof.

We first show that the second assertion is an immediate consequence of the
first. Let $f$ be an $L$-map with $f(e)=e$. Since $\pi_{G^{\prime}}$ is a
graded group homomorphism the maps $F_{a}:=\ell_{(f(a))^{-1}}\circ
f\circ\ell_{a}$ and $F^{r}:=\delta_{r^{-1}}\circ f\circ\delta_{r}$ are also
$L$-maps and $F_{a}(e)=F^{r}(e)=e$. Thus $F_{a}=F^{r}=f$ and hence $f$ is a
graded group homomorphism.

Note that the closure of the group generated by $\exp\mathfrak{g}_{1}$ is $G$.
Thus to prove the first assertion it suffices to show the following
implication:

(A.17) $f(x_{0})=f^{\prime}(x_{0})\quad\Longrightarrow f(x_{0}\exp
X)=f^{\prime}(x_{0}\exp X)\quad\forall X\in\mathfrak{g}_{1}.$

Let $Y=XL$ be the constant horizontal derivative of $L=\pi\circ f=\pi\circ
f^{\prime}$. Consider the curves

$\gamma(t)=f(x_{0}\exp tX),\quad\eta(t)=f^{\prime}(x_{0}\exp tX).$

Since $t\mapsto x_{0}\exp tX$ is a horizontal Lipschitz curve in $G$ and since
$f$ and $f^{\prime}$ are Lipschitz, the curves $\gamma$ and $\eta$ are
rectifiable curves in $G^{\prime}$ (where $G^{\prime}$ is equipped with the
Carnot-Carathéodory metric) and hence differentiable a.e. with horizontal
derivative, see [Pan89, Proposition 4.1].

Moreover

$X(\pi_{G^{\prime}}\circ\gamma)=X(\pi_{G^{\prime}}\circ\eta)=\frac{d}{dt}L(x_{0}\exp
tX)=Y.$

By Proposition A.9 (1) there exists a unique horizontal vectorfield $Z$ on
$G^{\prime}$ such that $d\pi^{\prime}(g^{\prime})Z(g^{\prime})=Y$. Thus both
$\gamma$ and $\eta$ are integral curves of $Z$. Moreover $Z$ is left-invariant
and hence smooth. Since $\gamma(0)=\eta(0)$ it follows that
$\gamma\equiv\eta$. Taking $t=1$ we get (A.17). ∎

##  Appendix B Compact Sobolev embeddings

Here we give a proof of the compact Sobolev embedding. For scalar-valued maps
it is observed in [GN96] that the compactness of the Sobolev embedding is an
immediate consequence of the Poincaré-Sobolev inequality. The same reasoning
applies to Sobolev maps with values in metric spaces and we provide the
details for the convenience of the reader.

######  Theorem B.1.

Let $U\subset G$ be open, let $X^{\prime}$ be a metric space. Suppose that
every closed ball in $X^{\prime}$ is compact. Let $1\leq p<\nu$ and define
$p^{*}$ by

$\frac{1}{p*}=\frac{1}{p}-\frac{1}{\nu}.$

Let $f_{k}\in W_{loc}^{1,p}(B(x,r),X^{\prime})$ and let $g_{k}\in
L^{p}(B(x,r))$ be a common bound for the weak derivatives of the maps
$x\mapsto d(z,f_{k}(x))$ as in Definition 2.29. Assume that, for some $a\in
X^{\prime}$

(B.2)
$\sup_{k}\|d^{\prime}(f_{k}(\cdot),a)\|_{L^{p}(B(x,r)}+\|g_{k}\|_{L^{p}(B(x,r))}<\infty.$

Then:

  1. (1)

there exists a subsequence $f_{k_{j}}$ and a map $f_{\infty}$ such that

(B.3) $f_{k_{j}}\to f_{\infty}\quad\text{in $L^{q}(B(x,r);X^{\prime})$ for all
$q<p^{*}$,}$

i.e.,

(B.4) $d^{\prime}(f_{k_{j}}(\cdot),f_{\infty}(\cdot))\to 0\quad\text{in
$L^{q}(B(x,r))$ for all $q<p^{*}$.}$

  2. (2)

If, in addition, the sequence $|g_{k}|^{p}$ is equiintegrable then the
convergence also holds in $L^{p^{*}}_{loc}(B(x,r))$.

Recall that a sequence of $L^{1}$ functions $h_{k}:U\to\mathbb{R}$ is
equiintegrable if there exists a function $\omega:[0,\infty)\to[0,\infty)$
with $\lim_{t\to 0}\omega(t)=0$ such that for all measurable sets $A\subset U$
one has $\int_{A}|h_{k}|\,d\mu\leq\omega(\mu(A))$. Note that if $g_{k}\to g$
in $L^{p}(U)$ then $|g_{k}|^{p}$ is equiintegrable.

For the proof we use the following simple covering result.

######  Proposition B.5.

Let $X$ be a metric space with a doubling measure. Then there exists a
constant $C(X)$ with the following property. Let $\mathcal{F}$ be a family of
balls of fixed radius $s>0$ in $X$. Then there exists a disjointed subfamily
$\mathcal{G}$ such that

(B.6) $\bigcup_{B\in\mathcal{F}}B\subset\bigcup_{B\in\mathcal{G}}5B$

where $5B$ denotes the concentric ball of five times the radius. Moreover each
point is contained in at most $C(X)$ of the balls $5B$ with $B\in\mathcal{G}$:

(B.7) $\sum_{B\in\mathcal{G}}1_{5B}\leq C(X).$

###### Proof.

The existence of a subfamily $\mathcal{G}$ is classical, see e.g. [HKST01],
Theorem 1.2. To show (B.7) consider $x\in X$ and let
$\mathcal{G}_{x}=\\{B\in\mathcal{G}:x\in 5B\\}$. Let $B(a,s)$ be a ball in
$\mathcal{G}_{x}$. Then $d(x,a)\leq 5s$ and hence $B(a,s)\subset
B(x,6s)\subset B(a,11s)$. Since $\mu$ is doubling there exist a $C(X)>0$ such
that $\mu(B(x,6s)\leq\mu(B(a,11s)\leq C(X)B(a,s)$. Since the balls in
$\mathcal{G}_{x}$ are disjoint it follows that the number of ball in
$\mathcal{G}_{x}$ is bounded by $C(X)$. ∎

###### Proof of Theorem B.1.

We first show (1). The argument is essentially the same as in the scalar-
valued case, see for example the proof of Theorem 1.28 in [GN96]. By the
Poincaré inequality the functions $d(f_{k}(\cdot),a)$ are uniformly bounded in
$L^{p*}(B(x,r))$. It thus suffices to show convergence in
$L^{p}(B(x,r);X^{\prime})$. Actually it suffices to show $L^{p}$ convergence
for all $B(x,r^{\prime})$ with $r^{\prime}<r$ since the $L^{p}$ norm in
$B(x,r)\setminus B(x,r^{\prime})$ is small, uniformly in $k$, if $r^{\prime}$
is close to $r$. Indeed,

$\displaystyle\,\int_{B(x,r)\setminus
B(x,r^{\prime})}{d^{\prime}}^{p}(f_{k}(y),a)\,\mu(dy)$ $\displaystyle\leq$
$\displaystyle\,\big{(}\mu(B(x,r)\setminus
B(x,r^{\prime}))\big{)}^{1-\frac{p}{p^{*}}}\,\,\|d^{\prime}(f_{k}(\cdot,a)\|_{L^{p*}(B(x,r)}^{p}$

and $\mu(B(x,r)\setminus B(x,r^{\prime}))=r^{\nu}-(r^{\prime})^{\nu}$.

Let $r^{\prime}<r$. To show convergence of a subsequence in
$L^{p}(B(x,r^{\prime});X^{\prime})$ it suffices to show that for every
$\varepsilon>0$ there exist a compact subset $K$ of
$L^{p}(B(x,r^{\prime});X^{\prime})$ such that
$\sup_{k}\operatorname{dist}(f_{k},K)\leq\varepsilon$. We will take $K$ as a
set of functions which are piecewise constant on a fixed partition of
$B(x,r^{\prime})$. If the partition is taken sufficiently fine then the
Poincaré inequality will guarantee that all members of the sequence are
$\varepsilon$-close to $K$.

Set

$M:=\sup_{k}\|d(f_{k}(\cdot),a)\|_{L^{p}(B(x,r)}+\|g_{k}\|_{L^{p}(B(x,r))}.$

Let $j$ be an integer with $j^{-1}<\frac{1}{10}(r-r^{\prime})$. By Proposition
B.5 there exist disjoint balls $B(x_{i},j^{-1})$ such that the balls
$B(x_{i},5j^{-1})$ cover $B(x,r^{\prime})$, $B(x_{i},5j^{-1})\subset B(x,r)$
and each point is contained in at most $C(G)$ of the balls $B(x_{i},5j^{-1})$.
Since the balls $B(x_{i},j^{-1})$ are disjoint, the collection of balls is
finite. Define a partition of $B(x,r^{\prime})$ recursively by

$A_{1}=B(x_{1},5j^{-1})\cap B(x,r^{\prime}),\quad
A_{i+1}=B(x_{i+1},5j^{-1})\cap
B(x,r^{\prime})\setminus\bigcup_{k=1}^{i}A_{i}.$

Let

$\tilde{K}_{j}=\\{f:B(x,r^{\prime})\to X^{\prime}:\text{for all $i$ the map
$f$ is constant on $A_{i}$},\forall i\\}.$

Now the Poincaré inequality implies that there exist $h_{k}\in\tilde{K}_{j}$
such that

$\displaystyle\,\int_{A_{i}}{d^{\prime}}^{p}(f_{k}(y),h_{k}(y))\,\mu(dy)\leq\int_{B(x_{i},5j^{-1})}{d^{\prime}}^{p}(f_{k}(y),h_{k}(y))\,\mu(dy)$
$\displaystyle\leq$
$\displaystyle\,Cj^{-p}\int_{B(x_{i},5j^{-1})}g_{k}^{p}\,\mu(dy).$

Summing over $i$ we see that

$\operatorname{dist}_{L^{p}}(f_{k},\tilde{K}_{j})\leq C(G)^{1/p}Cj^{-1}M.$

Now set
$K_{j}=\\{h\in\tilde{K}_{j}:\|d^{\prime}(h(\cdot),a)\|_{L^{p}(B(x,r^{\prime}))}\leq
M+1\\}$ and choose $j$ so large that $C(G)^{1/p}Cj^{-1}M\leq\varepsilon<1$.
Then $K_{j}$ is compact in $L^{p}(B(x^{\prime},r);X^{\prime})$ (since the
functions in $K_{j}$ take only finitely many values and the values stay in a
bounded set) and

$\operatorname{dist}_{L^{p}}(f_{k},K_{j})\leq\operatorname{dist}_{L^{p}}(f_{k},\tilde{K}_{j})\leq\varepsilon.$

This finishes the proof of the first assertion.

To prove the second assertion, let $A_{i}\subset U$ and $\tilde{K}_{j}$ be as
before. Let $\omega:[0,\infty)\to[0,\infty)$ be the function in the definition
of equi-integrability. The Sobolev-Poincaré inequality yields

$\displaystyle\,\operatorname{osc}_{p^{*}}^{p^{*}}(f_{k},A_{i})\leq
C\|g_{k}\|_{L^{p}(B(x_{i},5j^{-1}))}^{p^{*}}$ $\displaystyle\leq$
$\displaystyle\,C\omega^{\frac{p^{*}}{p}-1}\big{(}\mu(B(x_{i},5j^{-1}))\big{)}\,\,\|g_{k}\|_{L^{p}(B(x_{i},5j^{-1}))}^{p}$

Summation over $i$ yields

$\operatorname{dist}^{p^{*}}_{L^{p*}(B(x,r^{\prime})}(f_{k},\tilde{K}_{j})\leq\omega^{\frac{p^{*}}{p}-1}(5^{\nu}j^{-\nu})C(G)CM^{p}\quad\forall
k\in\mathbb{N}$

Thus given $\varepsilon\in(0,1]$ there exists a $j$ such that

$\operatorname{dist}_{L^{p*}(B(x,r^{\prime})}(f_{k},\tilde{K}_{j})\leq\varepsilon\quad\forall
k\in\mathbb{N}.$

By the Sobolev-Poincaré inequality we have

$M^{\prime}:=\sup_{k}\|d(f_{k}(\cdot),a)\|_{L^{p*}(B(x,r))}<\infty.$

Thus setting

$K_{j}=\\{h\in\tilde{K}_{j}:\|h\|_{L^{p^{*}}(B(x,r^{\prime}))}\leq
M^{\prime}+1\\}$

we see that $K_{j}$ is compact and
$\operatorname{dist}_{L^{p*}}(f_{k},K_{j})=\operatorname{dist}_{L^{p*}}(f_{k},\tilde{K}_{j})\leq\varepsilon$.
∎

##  Appendix C Sobolev spaces defined by upper gradients

In this section we first recall the definition of a (weak) upper gradient, the
Poincaré-Sobolev inequality for maps which possess a $p$-integrable $p$-weak
upper gradient, and the stability of $p$-weak upper gradients under $L^{p}$
convergence.

We then show that if the domain $U$ is an open subset of a Carnot group, then
a map is in $W^{1,p}(U;X^{\prime})$ in the sense of Definition 2.29 if and
only if it has a representative which has $p$-integrable $p$-weak upper
gradient. While this can be shown by combining standard arguments in the
field, we are not aware of a specific reference for this result. The
corresponding result for scalar-valued functions defined on open subsets of
Euclidean space can be found, for example, in [HKST15, Theorem 7.4.5].

A comprehensive introduction to the Sobolev spaces defined via (weak) upper
gradients is given in the book [HKST15] by Heinonen, Koskela, Shanmugalingam
and Tyson and we closely follow their exposition.

###  C.1. Weak upper gradients and the Poincaré-Sobolev inequality

Let $X=(X,d,\mu)$ be a metric measure space, i.e. a separable metric space
$(X,d)$ with a nontrivial locally finite Borel regular (outer) measure $\mu$.
A curve $\gamma:I\to X$ is a continuous map from an interval
$I\subset\mathbb{R}$ to $X$. We say that $\gamma$ is compact or open if $I$ is
compact or open. We define the length of a compact curve $\gamma:[a,b]\to X$
as the supremum of the numbers
$\sum_{i=1}^{k}d(\gamma(t_{i}),\gamma(t_{i-1}))$ where the supremum is taken
over all choices $t_{0},\ldots t_{k}$ with $a=t_{0}<t_{1}<\ldots<t_{k}=b$ and
all $k\in\mathbb{N}$. For a noncompact curve the length is defined as the
supremum of the length of all compact subcurves. A curve if rectifiable if it
has finite length and locally rectifiable if all compact subcurves have finite
length. For a rectifiable curve $\gamma$ we denote by $\gamma_{s}$ its arc-
length parametrization. We say that a rectifiable curve $\gamma:[a,b]\to X$ is
absolutely continuous if for every $\varepsilon>0$ we can find a $\delta>0$
such that $\sum_{i=1}^{k}d(\gamma(b_{i}),\gamma(a_{i}))<\varepsilon$ whenever
$(a_{i},b_{i})\subset[a,b]$ are non-overlapping intervals with
$\sum_{i=1}^{k}(b_{i}-a_{i})<\delta$. For a rectifiable curve $\gamma:I\to X$
and a Borel function $\rho:X\rightarrow[0,\infty]$ we define the integral
$\int_{\gamma}\rho\,ds$ by
$\int_{0}^{\mathrm{length}(\gamma)}\rho\circ\gamma_{s}(t)\,dt$. If $\gamma$ is
locally rectifiable $\int_{\gamma}\rho\,ds$ is defined as the supremum of the
integrals over all compact subcurves.

For $p\geq 1$ the $p$-modulus of a family $\Gamma$ of curves is defined by

$\displaystyle\mathrm{mod}_{p}(\Gamma):=\inf\Bigg{\\{}$
$\displaystyle\,\int_{X}\rho^{p}\,d\mu:\rho:X\to[0,\infty]\text{ Borel},$
$\displaystyle\int_{\gamma}\rho\,ds\geq 1$ $\displaystyle\text{ for all
locally rectifiable $\gamma\in\Gamma$.}\Bigg{\\}}$

We call the Borel functions $\rho$ with $\int_{\gamma}\rho\,ds\geq 1$ for all
$\gamma\in\Gamma$ admissible densities. Every family of non-locally
rectifiable curves has modulus zero and every family which contains a constant
curve has modulus $\infty$. Moreover the modulus is countably subadditive.

We say that a family of curves is $p$-exceptional if it has $p$-modulus zero.
We say that a property holds for $p$-a.e. curve if there exists a curve family
$N$ of zero $p$-modulus such that the property holds for all which do not
belong to $N$. A set $E$ is $p$-exceptional if the $p$-modulus of the family
of all nonconstant (rectifiable) curves which meet $E$ is zero. We denote the
family of all nonconstant compact rectifiable curves by $\Gamma_{\rm rec}$.

We give the definition of a $p$-weak upper gradient directly in the setting of
metric-space-valued maps.

######  Definition C.1 ([HKST15], Section 6.2, p. 152).

Let $U\subset G$ be open, let $1\leq p<\infty$ and let
$(X^{\prime},d^{\prime})$ be a metric space. Let $g:U\to[0,\infty]$ be a Borel
function. We say that $g$ is $p$-weak upper gradient of a map $f:U\to
X^{\prime}$ if for $p$-a.e. rectifiable curve $\gamma:[a,b]\to U$

(C.2)
$d^{\prime}\big{(}f(\gamma(b)),f(\gamma(a))\big{)}\leq\int_{\gamma}g\,ds$

If $g$ is $p$-integrable then one easily sees that $\int_{\gamma}g\,ds<\infty$
on $p$-a.e. compact curve. This yields the following result.

######  Proposition C.3 ([HKST15], Proposition 6.3.2).

Suppose that the Borel function $g:U\to[0,\infty]$ is a $p$-integrable
$p$-weak upper gradient of $f:U\to X^{\prime}$. Then $p$-a.e. every compact
rectifiable curve $\gamma$ in $U$ has the following property: $g$ is
integrable on $\gamma$ and the pair $(f,g)$ satifies the upper gradient
inequality (C.2) on $\gamma$ and each of its compact subcurves. In particular
every map $f:U\to X^{\prime}$ that has a $p$-integrable $p$-weak upper
gradient is absolutely continuous on $p$-a.e. compact curve in $X$.

To state the Poincaré-Sobolev inequality we recall that for a measurable set
$A\subset G$ and a map $f:A\to X^{\prime}$ we defined the $L^{p}$ oscillation
by

(C.4) $\operatorname{osc}_{p}(f,A):=\inf_{a\in
X^{\prime}}\left(\int_{A}d^{p}(f(x),a)\mu(dx)\right)^{1/p}.$

######  Theorem C.5 ([HKST15], Thm. 9.1.15).

Let $U\subset G$ be open, let $X^{\prime}$ be a metric space. Let $1\leq
p<\nu$ and define $p^{*}$ by

$\frac{1}{p*}=\frac{1}{p}-\frac{1}{\nu}.$

Let $f\in W^{1,p}(U,X^{\prime})$ and let $g\in L^{p}(U)$ be a $p$-weak upper
gradient. Then for every ball $B(x,r)\subset U$

(C.6) $\operatorname{osc}_{p^{*}}(f,(B(x,r))\leq C\|g\|_{L^{p}(B(x,r))}$

and

(C.7) $\operatorname{osc}_{p}(f,(B(x,r))\leq Cr\|g\|_{L^{p}(B(x,r))}.$

###### Proof.

First note that $G$ supports a $p$-Poincaré inequality (for scalar-valued
functions) in the sense of (1.3) in [HKST15]. A short proof is due to
Varapoulos [Var87], see also [HK00, Proposition 11.17], [SC95, p. 461] or
[GN96, Corollary 1.6.]. Note also that a $p$-weak upper gradient $g$ can be
approximated in $L^{p}$ by upper gradients $g_{k}$ (see Lemma 6.2.2. in
[HKST15]).

Now (C.6) follows from Theorem 9.1.15 in [HKST15] and the isometric embedding
of $X^{\prime}$ into the Banach space $\ell^{\infty}(X^{\prime})$ of bounded
functions on $X^{\prime}$ given by
$i(x)=d^{\prime}(\cdot,x)-d^{\prime}(\cdot,a)$ where $a$ is an arbitrary point
in $X^{\prime}$. Indeed, Theorem 9.1.15 in [HKST15] implies that there exists
an element $h$ of $\ell^{\infty}(X^{\prime})$ such that

$\left(\int_{B(x,r)}|(i\circ f)(y)-h|^{p^{*}}\,\mu(dy)\right)^{1/p^{*}}\leq
C\|g\|_{L^{p}(B(x,r))}.$

Hence there exists a $\bar{y}\in B(x,r)$ s.t. $|i\circ
f(\bar{y})-h|^{p^{*}}\mu(B(x,r))\leq C\|g\|^{p^{*}}_{L^{p}(B(x,r))}$. Thus by
the triangle inequality

$\left(\int_{B(x,r)}|(i\circ f)(y)-(i\circ
f)(\bar{y})|^{p^{*}}|\,\mu(dy)\right)^{1/p^{*}}\leq 2C\|g\|_{L^{p}(B(x,r))}.$

This implies (C.6) since $i$ is an isometric embedding.

Finally, (C.7) follows from (C.6) and Hölder’s inequality since
$\mu(B(x,r))=cr^{\nu}$. ∎

A key feature of the $p$-weak upper gradient is that it is stable under
$L^{p}$ convergence in the following sense.

######  Lemma C.8.

Let $(X^{\prime},d^{\prime})$ be a complete metric space. Let $f_{k}:U\to
X^{\prime}$ be maps and let $g_{k}:U\to[0,\infty]$ be Borel functions and
assume that $g_{k}$ is a $p$-weak upper gradient of $f_{k}$. Assume further
that there exist a map $f:U\to X^{\prime}$ and a Borel function
$g:U\to[0,\infty]$ such that $d^{\prime}(f_{k},f)\to 0$ in $L^{p}(U)$ and
$g_{k}\to g$ in $L^{p}(U)$. Then there exists a subsequence $f_{k_{j}}$ with
the following property. The set $E$ where $f_{k_{j}}$ does not converge is a
$\mu$-null set, the set of curves $\gamma$ such that $f_{k_{j}}\circ\gamma$
does not converge pointwise is a $p$-exceptional set and if we define

(C.9) $\bar{f}(x)=\lim_{j\to\infty}f_{k_{j}}(x)\quad\text{if $x\in U\setminus
E$,}$

and extend $\bar{f}$ arbitrarily in $E$ then $g$ is a $p$-weak upper gradient
of $\bar{f}$ and $\bar{f}=f$ a.e.

The proof of this result uses two standard arguments. The first is Fuglede’s
lemma which can be seen as a counterpart of Fubini’s theorem in metric measure
spaces.

######  Lemma C.10 (Fuglede’s lemma).

Let $X$ be a metric measure space and suppose that $f_{k}:X\to\mathbb{R}$ is a
sequence of Borel functions which converges in $L^{p}(X)$ to a Borel function
$f$. Then there exists a subsequence $f_{k_{j}}$ such that

$\lim_{j\to\infty}\int_{\gamma}|f_{k_{j}}-f|^{p}=0$

for $p$-a.e. all rectifiable curves $\gamma$ in $X$.

###### Proof.

This follows directly from the definition of the modulus of a curve family if
we choose the subsequence such that

$\int_{E}|f_{k_{j}}-f|^{p}\,dx<2^{-pj-j},$

see, for example, [V7̈1], Thm. 28.1 or [HKST15], Chapter 5.2. ∎

The second standard tool is an improvement of a.e. properties to properties
which hold away from a $p$-exceptional set once we have a $p$-integrable
$p$-weak upper gradient (see [HKST15, Lemma 6.3.5, Corollary 6.3.6] for
closely related results and arguments). We state the result for a metric
measure space $X$. It applies equally to open subsets $U\subset X$ considered
as metric measure spaces with the induced metric and measure.

######  Proposition C.11.

Let $X$ be a metric measure space. Then the following assertions hold.

  1. (1)

If $E\subset X$ is a $\mu$-nullset then $p$-a.e. curve has zero length in $E$,
i.e. $\mathcal{L}^{1}(\\{t\in[0,\mathrm{length}(\gamma)]:\gamma_{s}(t)\in
E\\})=0$ where $\gamma_{s}$ denotes the arclength parametrization.

  2. (2)

Suppose $f:X\to X^{\prime}$ has a $p$-integrable $p$-weak upper gradient.
Assume that there exists $c\in X^{\prime}$ such that $f=c$ $\mu$-a.e. (or
assume $X^{\prime}=\mathbb{R}$ and $f\geq a$ $\mu$-a.e.). Then there exists a
$p$-exceptional set $E$ such that $f=c$ in $X\setminus E$ (or $f\geq a$ in
$X\setminus E$).

  3. (3)

Suppose that the maps $f_{j}:X\to X^{\prime}$ have $p$-integrable $p$-weak
upper gradients $g_{j}$. Assume that $f_{j}\to f$ $\mu$-a.e. and that exists a
Borel function $g$ such that $g_{j}\to g$ in $L^{p}(X)$. Then there exists a
$p$-exceptional set $E$ such that $f_{j}$ converges in $X\setminus E$.

###### Proof.

(1). Let $E^{\prime}\supset E$ be a Borel null set. Then the assertion follows
from the definition of the $p$-modulus if we consider the admissible function
$\rho$ which is $\infty$ on $E^{\prime}$ and zero elsewhere.

(2). Assume $f=c$ $\mu$-a.e. and let $E$ be the set where $f\neq c$. By
assertion (1) we have $f\circ\gamma_{s}=c$ $\mathcal{L}^{1}$ a.e. for $p$-a.e.
curve. Since $f$ is absolutely continuous on $p$-a.e. curve, it follows that
$p$-a.e. curve does not meet $E$. The same reasoning applies if
$X^{\prime}=\mathbb{R}$ and $f\geq a$ a.e.

(3). Let $E$ be set where the sequence $f_{j}$ does not converge. It follows
from Fuglede’s lemma that, for $p$-a.e. rectifiable curve $\gamma$, we have
$g_{j}\circ\gamma_{s}\to g\circ\gamma_{s}$ in
$L^{1}([0,\mathrm{length}(\gamma)])$. Thus the functions
$f_{j}\circ\gamma_{s}$ are equicontinuous on $p$-a.e. curve and one concludes
as for assertion (2). ∎

###  C.2. Upper gradients and weak derivatives

In this subsection we provide a proof that a map is in the Sobolev space
$W^{1,p}(U;X^{\prime})$ defined by weak derivatives if and only if it has a
represenative which possesses a $p$-integrable $p$-weak upper gradient.
Specifically we show the following results.

######  Proposition C.12.

Let $U\subset G$ be open and let $1\leq p<\infty$. Let $u:U\to\mathbb{R}$ be
in $L^{p}(U)$. Then the following two assertions are equivalent:

  1. (1)

$u\in W^{1,p}(U)$;

  2. (2)

$u$ has a representative $\bar{u}$ which has a $p$-integrable $p$-weak upper
gradient $g$.

Moroever, if $u\in W^{1,p}(U)$ then every Borel respresentative of $|D_{h}u|$
is a $p$-weak upper gradient. Conversely if $g$ is a $p$-weak upper gradient
then $|D_{h}u|\leq g$ a.e.

######  Proposition C.13.

Let $U\subset G$ be open and let $1\leq p<\infty$. Let $X^{\prime}$ be a
complete separable metric space and let $f:U\to X^{\prime}$ be a measurable
function such that $d(f(\cdot),a)\in L^{p}(U)$ for some $a\in X^{\prime}$.
Then the following three assertions are equivalent:

  1. (1)

There exists a representative $\bar{f}$ of $f$ which has a $p$-integrable
$p$-weak subgradient $g$;

  2. (2)

for every Lipschitz function $\varphi:X^{\prime}\to\mathbb{R}$ the function
$\varphi\circ f-\varphi(a)$ is in $W^{1,p}(U)$;

  3. (3)

$f\in W^{1,p}(U;X^{\prime})$;

Moreover if the above assertions hold, $\bar{f}$ is as in (1), and $\bar{g}\in
L^{p}(U)$ is a Borel representative of the function $g$ in Definition 2.29
then $\bar{g}$ is a $p$-weak upper gradient for $\bar{f}$. Conversely if
$\bar{g}$ is a $p$-weak upper gradient of $\bar{f}$ then we can take
$g=\bar{g}$ in Definition 2.29.

The same conclusions holds if one replaces $L^{p}(U;X^{\prime})$ and
$W^{1,p}(U;X^{\prime})$ by $L^{p}_{loc}(U;X^{\prime})$ and
$W^{1,p}_{loc}(U;X^{\prime})$, respectively.

Similar equivalences using absolute continuity along a.e. horizontal curve
$t\mapsto a\exp(tX_{j})$ rather than absolute continuity for $p$-a.e.
rectifiable curve have been studied by Vodopyanov [Vod99, Proposition 3, p.
674].

###### Proof of Proposition C.12.

To show the implication (1) $\Longrightarrow$ (2) we first note that smooth
functions are dense in $W^{1,p}(U)$. This was proved by Friedrichs [Fri44] (in
local coordinates) who observed that for a $C^{1}$ vectorfield $X$ the
commutator $\tilde{J}_{\varepsilon}=[X,J_{\varepsilon}]$, where
$J_{\varepsilon}$ is the usual (Euclidean) mollification, satisfies
$\tilde{J}_{\varepsilon}u\to 0$ in $L^{p}_{loc}$ for $u\in L^{p}$; see also
Thm. 1.13 and Thm. A.2 in [GN96]).

Now let $u_{k}$ be a sequence of smooth functions such that $u_{k}\to u$ and
$X_{i}u_{k}\to h_{i}$ in $L^{p}(U)$ where $h_{i}$ are the weak horizontal
derivatives of $u$. Then $g_{k}:=|D_{h}u_{k}|$ is an upper gradient of $u_{k}$
and $g_{k}\to(\sum h_{i}^{2})^{1/2}=|D_{h}u|$. Let $g$ be a Borel
representative of $|D_{h}u|$. Then it follows from Lemma C.8 that $u$ has a
representative $\bar{u}$ such that $g$ is a $p$-weak upper gradient of
$\bar{u}$.

For the converse implication one uses essentially absolute continuity on a.e.
curve $t\mapsto a\exp(tX_{j})$ and Fubini’s theorem. For the convenience of
the reader we sketch some details. By a partition of unity it suffices to show
that the weak derivatives exists in a small neighbourhood of any point in $U$.
Let $X$ be a left-invariant vectorfield. Let
$B^{\prime}\subset\mathbb{R}^{N-1}$ be a (small) ball around $0$ and consider
a smooth surface $\Psi:B^{\prime}\to G$ which is transversal to $X$. Then
$\Phi(t,x^{\prime})=\Psi(x^{\prime})\exp tX$ defines a smooth diffeomorphism
of $(-\delta,\delta)\times B^{\prime}$ to its image if $\delta>0$ is small
enough. Moreover $\partial_{1}\Phi=X\circ\Phi$. Since the Haar measure $\mu$
is biinvariant, the pull-back measure $\Phi^{*}\mu$ is invariant under
translation in $x_{1}$ direction, i.e.
$\Phi^{*}\mu=dx_{1}\otimes\mu^{\prime}$. Consider the curves
$\gamma_{x^{\prime}}(t)=\Phi(t,x^{\prime})=\Psi(x^{\prime})\exp tX$ and the
family $\Gamma_{E}=\\{\gamma_{x^{\prime}}:x^{\prime}\in E\\}$. Using Fubini’s
theorem one easily checks that $\mathrm{mod}_{p}(\Gamma_{E})=0$ implies
$\mathcal{L}^{N-1}(E)=0$ (or, equivalently, $\mu^{\prime}(E)=0$).

Set $\tilde{u}=u\circ\Phi$. Then $t\mapsto\tilde{u}(t,x^{\prime})$ is
absolutely continuous for $\mathcal{L}^{N-1}$-a.e. $x^{\prime}$ and
$|\tilde{u}(b,x^{\prime})-\tilde{u}(a,x^{\prime})|\leq\int_{a}^{b}\tilde{g}(t,x^{\prime})\,dt$
where $\tilde{g}=g\circ\Phi$. Set $\tilde{u}=u\circ\Phi$. It is then easy to
show that the difference quotients
$\Delta^{s}\tilde{u};=s^{-1}(u(t+s,x^{\prime})-u(t,x^{\prime}))$ are
controlled by a family of one-dimensional convolutions of $g$ and hence a
subsequence $s_{j}\downarrow 0$ converges weakly in $L^{p}_{loc}$ (for $p=1$
use the Dunford-Pettis theorem) to a function $h\in L^{p}$ with $|h|\leq g$
a.e. Then $h$ is a weak derivative of $\tilde{u}$, i.e.
$\int\tilde{u}\,\partial_{1}\varphi\,\,\Phi^{*}\mu=-\int
h\,\varphi\,\,\Phi^{*}\mu$. Unwinding definitions, we see that
$h=\tilde{h}\circ\Phi^{-1}$ is the desired weak derivative $Xu$. Moreover
$|h|\leq g$ a.e. from which we deduce $|D_{h}u|\leq g$ by considering a
countable dense family of left-invariant unit vector fields. ∎

###### Proof of Proposition C.13.

. The assertion essentially follows from Theorem 7.1.20 in [HKST15] upon using
the isometric embedding of $(X^{\prime},d^{\prime})$ into the Banach space
$V=\ell^{\infty}(X^{\prime})$ of bounded functions on $X^{\prime}$. We give a
self-contained proof for the convenience of the reader.

We only give the argument for $W^{1,p}(U;X^{\prime})$. The version for
$W^{1,p}_{loc}$ is then deduced easily.

(1) $\Longrightarrow$ (2). Note that $(\operatorname{Lip}\varphi)\,\,g$ is a
$p$-weak upper gradient of $\varphi\circ\bar{f}$ and that
$\varphi\circ\bar{f}=\varphi\circ f$ almost everywhere. Thus the implication
follows from Proposition C.12.

(2) $\Longrightarrow$ (3). This is clear since the map $y\mapsto
d^{\prime}(y,z)$ is $1$-Lipschitz.

(3) $\Longrightarrow$ (1). Set $u_{z}(x)=d^{\prime}(z,f(x))$. Let $D\subset Z$
be a countable dense subset. By the definition of $W^{1,p}(U;X^{\prime})$
there exists a Borel function $\bar{g}$ such that $|D_{h}u_{z}|\leq\bar{g}$
almost everywhere. By Proposition C.12 for each $z\in D$ there exists a
representative $\bar{u}_{z}$ such that $\bar{g}$ is a $p$-weak upper gradient
of $\bar{u}_{z}$. The main point is to show that there exist a $p$-exceptional
set $E$ and a map $\bar{f}:U\setminus E\to X^{\prime}$ such that

(C.14) $d^{\prime}(z,\bar{f}(x))=\bar{u}_{z}(x)\quad\forall x\in U\setminus
E,\quad\forall z\in D$

Then the upper gradient inequality for the function $\bar{u}_{z}$ implies that

$|d^{\prime}(z,\bar{f}(\gamma_{s}(t)))-d^{\prime}(z,\bar{f}(\gamma_{s}(s)))|\leq\int_{s}^{t}\bar{g}\circ\gamma_{s}\,d\mathcal{L}^{1}$

for all $z\in D$ and $p$-a.e. curve $\gamma$. If $z_{k}\to z$ in $Z$ then the
functions $d(z_{k},\cdot)$ converge uniformly to $d(z,\cdot)$. Thus the
inequality holds for all $z\in Z$. Taking $z=\bar{f}(\gamma_{s}(t))$ we see
that $\bar{g}$ is $p$-weak upper gradient of $f$.

To construct $\bar{f}$, note that the definition of $u_{z}$ and the triangle
inequality imply that

$\inf_{z\in D}u_{z}=0,\quad\forall z,z^{\prime}\in D\quad
d^{\prime}(z,z^{\prime})-u_{z^{\prime}}\leq u_{z}\leq
d^{\prime}(z,z^{\prime})+u_{z^{\prime}}.$

Since $\bar{u}_{z}$ agrees with $u_{z}$ a.e., it follows from and Proposition
C.11 (2) that there exists a $p$-exceptional set $E$ such that

$\displaystyle\inf_{z\in D}u_{z}$ $\displaystyle=$ $\displaystyle
0\quad\text{in $U\setminus E$}$ (C.15) $\displaystyle
d^{\prime}(z,z^{\prime})-\bar{u}_{z^{\prime}}$ $\displaystyle\leq$
$\displaystyle\bar{u}_{z}\leq
d^{\prime}(z,z^{\prime})+\bar{u}_{z^{\prime}}\quad\text{in $U\setminus E$}$

for all $z,z^{\prime}\in D$. We claim that for all $x\in U\setminus E$ there
exists a unique $\bar{z}=\bar{z}(x)\in Z$ such that

(C.16) $d^{\prime}(z,\bar{z})=\bar{u}_{z}(x)\quad\forall z\in D$

Fix $x\in U\setminus E$. By definition of $\underline{u}$ there exist
$z_{k}\in D$ such that $\bar{u}_{z_{k}}(x)\to 0$. Moreover
$d^{\prime}(z_{k},z_{l})\leq\bar{u}_{z_{k}}(x)+\bar{u}_{z_{l}}(x)$. Hence
$z_{k}$ is a Cauchy sequence. Thus $z_{k}\to\bar{z}$ and taking
$z^{\prime}=z_{k}$ in (C.15) we get (C.16). If also
$d^{\prime}(z,\tilde{z})=\bar{u}_{z}(x)$ for all $z\in D$ then we get
$d^{\prime}(z,\bar{z})=d(z,\tilde{z})$ for $z\in D$. Thus $\tilde{z}=\bar{z}$.

We now define $\bar{f}(x)=\bar{z}(x)$ for $x\in U\setminus E$. Since
$\bar{u}_{z}(x)=u_{z}(x)=d^{\prime}(z,f(x))$ for a.e. $x\in U$ it follows from
the uniqueness for $\bar{z}$ that $\bar{f}=f$ a.e. ∎

## References

  * [Aus] A. Austin, _The contact mappings of a flat (2,3,5)-distribution_ , arXiv:2006.03464.
  * [BI83] B. Bojarski and T. Iwaniec, _Analytical foundations of the theory of quasiconformal mappings in ${\bf R}^{n}$_, Ann. Acad. Sci. Fenn. Ser. A I Math. 8 (1983), no. 2, 257–324. MR 731786
  * [BK81] P. Buser and H. Karcher, _Gromov’s almost flat manifolds_ , Astérisque, vol. 81, Société Mathématique de France, Paris, 1981. MR 619537
  * [CG90] L. J. Corwin and F. P. Greenleaf, _Representations of nilpotent Lie groups and their applications. Part I_ , Cambridge Studies in Advanced Mathematics, vol. 18, Cambridge University Press, Cambridge, 1990, Basic theory and examples. MR 1070979
  * [Dai99] N. S. Dairbekov, _The morphism property for mappings with bounded distortion on the Heisenberg group_ , Sibirsk. Mat. Zh. 40 (1999), no. 4, 811–823. MR 1721676
  * [Fri44] K. O. Friedrichs, _The identity of weak and strong extensions of differential operators_ , Trans. Amer. Math. Soc. 55 (1944), 132–151. MR 9701
  * [GN96] N. Garofalo and D. Nhieu, _Isoperimetric and Sobolev inequalities for Carnot-Carathéodory spaces and the existence of minimal surfaces_ , Comm. Pure Appl. Math. 49 (1996), no. 10, 1081–1144. MR 1404326
  * [GT01] D. Gilbarg and N. S. Trudinger, _Elliptic partial differential equations of second order_ , Classics in Mathematics, Springer-Verlag, Berlin, 2001, Reprint of the 1998 edition. MR 1814364
  * [HH97] J. Heinonen and I. Holopainen, _Quasiregular maps on Carnot groups_ , J. Geom. Anal. 7 (1997), no. 1, 109–148. MR 1630785
  * [HK00] P. Hajłasz and P. Koskela, _Sobolev met Poincaré_ , Mem. Amer. Math. Soc. 145 (2000), no. 688, x+101. MR 1683160
  * [HKST01] J. Heinonen, P. Koskela, N. Shanmugalingam, and J. T. Tyson, _Sobolev classes of Banach space-valued functions and quasiconformal mappings_ , J. Anal. Math. 85 (2001), 87–139. MR 1869604
  * [HKST15] by same author, _Sobolev spaces on metric measure spaces_ , New Mathematical Monographs, vol. 27, Cambridge University Press, Cambridge, 2015, An approach based on upper gradients. MR 3363168
  * [IM93] T. Iwaniec and G. Martin, _Quasiregular mappings in even dimensions_ , Acta Math. 170 (1993), no. 1, 29–81. MR 1208562
  * [Iwa92] T. Iwaniec, _$p$ -harmonic tensors and quasiregular mappings_, Ann. of Math. (2) 136 (1992), no. 3, 589–624. MR 1189867
  * [KMSXa] B. Kleiner, S. Müller, László Székelyhidi, Jr., and X. Xie, _Rigidity of Euclidean product structure: breakdown for low Sobolev exponents_ , in preparation.
  * [KMSXb] by same author, _Sobolev mappings of Euclidean space and product structure_ , in preparation.
  * [KMX] B. Kleiner, S. Müller, and X. Xie, _Sobolev mappings between nonrigid Carnot groups_.
  * [KMX20] by same author, _Pansu pullback and rigidity of mappings between Carnot groups_ , 2020.
  * [KMX21a] by same author, _Rigidity of flag manifolds_ , 2021.
  * [KMX21b] by same author, _Sobolev mappings and the Rumin complex_ , 2021.
  * [Lel] J. Lelmi, _On the smoothness of $C^{1}$-contact maps in $C^{\infty}$-rigid Carnot groups_, arXiv:2006.06772, to appear in Indiana Univ. Math. J.
  * [Lu94] G. Lu, _The sharp Poincaré inequality for free vector fields: an endpoint result_ , Rev. Mat. Iberoamericana 10 (1994), no. 2, 453–466. MR 1286482
  * [Mic08] P. W. Michor, _Topics in differential geometry_ , Graduate Studies in Mathematics, vol. 93, American Mathematical Society, Providence, RI, 2008. MR 2428390
  * [Mon02] R. Montgomery, _A tour of subriemannian geometries, their geodesics and applications_ , Mathematical Surveys and Monographs, vol. 91, American Mathematical Society, Providence, RI, 2002. MR 1867362
  * [Pan89] P. Pansu, _Métriques de Carnot-Carathéodory et quasiisométries des espaces symétriques de rang un_ , Ann. of Math. (2) 129 (1989), no. 1, 1–60. MR 979599
  * [Res89] Yu. G. Reshetnyak, _Space mappings with bounded distortion_ , Translations of Mathematical Monographs, vol. 73, American Mathematical Society, Providence, RI, 1989, Translated from the Russian by H. H. McFaden. MR 994644
  * [Res97] by same author, _Sobolev classes of functions with values in a metric space_ , Sibirsk. Mat. Zh. 38 (1997), no. 3, 657–675, iii–iv. MR 1457485
  * [Ric93] Seppo Rickman, _Quasiregular mappings_ , Ergebnisse der Mathematik und ihrer Grenzgebiete (3) [Results in Mathematics and Related Areas (3)], vol. 26, Springer-Verlag, Berlin, 1993. MR 1238941
  * [RR00] H. M. Reimann and F. Ricci, _The complexified Heisenberg group_ , Proceedings on Analysis and Geometry (Russian) (Novosibirsk Akademgorodok, 1999), Izdat. Ross. Akad. Nauk Sib. Otd. Inst. Mat., Novosibirsk, 2000, pp. 465–480. MR 1847532
  * [SC95] L. Saloff-Coste, _Parabolic Harnack inequality for divergence-form second-order differential operators_ , vol. 4, 1995, Potential theory and degenerate partial differential operators (Parma), pp. 429–467. MR 1354894
  * [V7̈1] J. Väisälä, _Lectures on $n$-dimensional quasiconformal mappings_, Lecture Notes in Mathematics, Vol. 229, Springer-Verlag, Berlin-New York, 1971. MR 0454009
  * [Var87] N. T. Varopoulos, _Fonctions harmoniques sur les groupes de Lie_ , C. R. Acad. Sci. Paris Sér. I Math. 304 (1987), no. 17, 519–521. MR 892879
  * [Vod96] S. K. Vodopyanov, _Monotone functions and quasiconformal mappings on Carnot groups_ , Sibirsk. Mat. Zh. 37 (1996), no. 6, 1269–1295, ii. MR 1440383
  * [Vod99] by same author, _Mappings with bounded distortion and with finite distortion on Carnot groups_ , Sibirsk. Mat. Zh. 40 (1999), no. 4, 764–804. MR 1721674
  * [Vod00] by same author, _$p$ -differentiability on Carnot groups in different topologies and related topics_, Proceedings on Analysis and Geometry (Russian) (Novosibirsk Akademgorodok, 1999), Izdat. Ross. Akad. Nauk Sib. Otd. Inst. Mat., Novosibirsk, 2000, pp. 603–670. MR 1847541
  * [Vod03] by same author, _On the differentiability of mappings of Sobolev classes on the Carnot group_ , Mat. Sb. 194 (2003), no. 6, 67–86. MR 1992177
  * [Vod07a] by same author, _Differentiability of mappings in the geometry of Carnot manifolds_ , Sibirsk. Mat. Zh. 48 (2007), no. 2, 251–271. MR 2330058
  * [Vod07b] by same author, _Foundations of the theory of mappings with bounded distortion on Carnot groups_ , The interaction of analysis and geometry, Contemp. Math., vol. 424, Amer. Math. Soc., Providence, RI, 2007, pp. 303–344. MR 2316342
  * [VU96] S. K. Vodopyanov and A. D. Ukhlov, _Approximately differentiable transformations and the change of variables on nilpotent groups_ , Sibirsk. Mat. Zh. 37 (1996), no. 1, 70–89, ii. MR 1401081
  * [Xie13] X. Xie, _Quasisymmetric homeomorphisms on reducible Carnot groups_ , Pacific J. Math. 265 (2013), no. 1, 113–122. MR 3095115