\section{Introduction}
The statistical analysis of functional time series has become increasingly important to many scientific fields including climatology \citep{shang2011nonparametric}, finance \citep{kokoszka2012functional}, geophysics \citep{hormann2012functional}, demography \citep{hyndman2008stochastic}, manufacturing \citep{woodall2007current}, and environmental modeling \citep{fortuna2020functional}.
A functional time series is a sequence of functions (i.e., infinite objects), observed over time.
Functional time series are analogous to univariate or multivariate time series, except that we observe a continuous function at each point in time \citep{bosq2012linear}.
Similar to univariate and multivariate time series, a functional time series can experience abrupt changes in its data generating mechanism.
These abrupt changes are known as changepoints and can complicate further analysis by invalidating stationarity assumptions.
They also can lead to interesting analysis by determining when data has patterns which are not homogeneous over time, or when a forcing has caused the data generation mechanism to change.

A problem with current methods in the Functional Data Analysis (FDA) literature on changepoint detection has been solely focused on cross-sectional analysis.
This process completely ignores phase variability that may exist in the data.
This is an issue because phase variability could be just a nuisance parameter or actually contain information.
In \cite{berkes:2009} a Cumulative Sum (CUSUM) test was proposed for independent functional data, which was further studied in \cite{aue2009estimation}, where its asymptotic properties were developed.
This test was then extended to weakly dependent functional data by \cite{hormann2010weakly}. \cite{zhang2011testing} introduced a test for changes in the mean of weakly dependent functional data using self-normalization to alleviate the use of asymptotic control.
Later, \cite{sharipov2016sequential} similarly developed a sequential block bootstrap procedure for these methods.
More recently, \cite{gromenko:2017} considered changes in spatially-correlated functional data, and \cite{aue:2018} proposed a fully functional method for finding a change in the mean without losing information due to functional principal component analysis (fPCA) truncation.

Recently, \cite{tucker:2013} and \cite{srivastava2016functional} have demonstrated the need to account for phase variability in functional data.
If the phase variability is ignored, subsequent statistical analysis and modeling is affected as the metric between functions is degenerate.
Specifically, within the changepoint detection problem is the computation of the mean function.
When phase variability is ignored, the mean computed will not be representative of the underlying data generating mechanism.
An example of this is shown in Figure~\ref{fig:toy_data} where Panel (a) presents a set of functional data that contains a large amount of phase variability.
Panel (b) shows the computed mean if the phase variability is ignored, and it is easily seen that the mean is not representative of the underlying data generating mechanism.
Panel (c) shows the alignment of the data using the method in \cite{tucker:2013} and the resulting Karcher Mean in Panel (d) where the phase variability is accounted for.
The mean in Panel (d) is representative of the underlying data generating mechanism.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/toy_orig.pdf}
	\label{fig:origtoy}
	\caption{Original Data}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/toy_orig_mean.pdf}
	\label{fig:origtoy_mean}
	\caption{Original Mean}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/toy_aligned.pdf}
	\label{fig:alignedtoy}
	\caption{Aligned Data}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/toy_alignedmean.pdf}
	\caption{Karcher Mean}
	\label{fig:alignedtoy_mean}
	\end{subfigure}

	\caption{Example of using proper mean calculation on functional data.}
	\label{fig:toy_data}
\end{figure}

In this paper we present a functional changepoint method that accounts for the amplitude and phase variability.
We demonstrate that we account for this variability in two different ways, utilizing the appropriate fPCA \citep{tucker:2013,lee:2017} or utilizing a fully functional approach similar to \cite{aue:2018} where the mean is computed using the Karcher mean under the Fisher-Rao Metric \citep{srivastava2016functional}.
This metric which we will call \textit{elastic} is a proper distance and invariant to random warping.
Through this we can separate out the amplitude and phase variability for subsequent changepoint analysis.
Therefore, we are able to find changepoints where the underlying mean changes in amplitude, phase, or a combination of both.

The rest of the paper is organized as follows:
Section \ref{sec:efchange} presents the elastic amplitude and phase changepoint methods, and provides implementation using fully functional or functional principal component analysis.
Section \ref{sec:results} provides analysis of the methodologies on simulated and climate monitoring data sets.
Finally, concluding remarks and future work are presented in Section \ref{sec:conclusion}.

\section{Elastic Functional Changepoint Analysis} \label{sec:efchange}

\subsection{The Functional Changepoint Problem}
Assume we have real-valued functions $f_1,\dots,f_n$ that are absolutely continuous on the interval $[0,1]$.
Using this interval is not a restriction and can be easily extended to any interval.
The standard changepoint problem \citep{berkes:2009,aue:2018} assumes the data is from the following model:
\[
f_i = \mu + \delta \vmathbb{1}(i > k^*) + \epsilon_i.
\]
Where the point $k^*$ labels the time of the unknown mean change, $\epsilon_i$ is a zero mean random error term with may be i.i.d.\ or potentially weakly dependent as in \cite{aue:2018}.
The changepoint problem then becomes a hypothesis testing problem of
\[H_0: \delta = 0~~\text{vs}~~H_A: \delta\neq 0.\]
\cite{aue:2018} considers the test statistic of $T_n = \max_{1 \leq  k \leq n} \lVert S_{n,k}\rVert^2$, where \begin{align*}
    S_{n,k} = \frac{1}{\sqrt{n}} \left( k\mu_k -  k \mu_n\right),
\end{align*}$\mu_k = k^{-1} \sum_{i=1}^k f_i$, and $\lVert \cdot \rVert$ is the standard $\mathbb{L}^2$ norm on the functions $f_i$.
\cite{aue:2018} demonstrate asymptotic properties of this test statistic.
Also, \cite{berkes:2009} and subsequent work propose a functional principal component-based test statistic that includes dimension reduction.
These two approaches will motivate our test statistics for functional data with phase and amplitude variability.

Since the test statistics of \cite{aue:2018} and \cite{berkes:2009} are based functional statistics that do not use functional alignment, this cross-sectional approach assumes there is no phase variability and that there is only a random amplitude term.
We know from \cite{tucker:2013} and \cite{srivastava2016functional} that functional data contains two types of variation, amplitude and phase, and both are important to consider when evaluating functional data for statistical analysis and modeling.

\subsection{The Elastic Functional Changepoint Problem}

We now formulate the changepoint problem for functional data with amplitude and phase variation.
We can include phase variation in the model in the following form
\[
f_i = \left(\mu + \delta \vmathbb{1}(i > k^*) + \epsilon_i \right) \circ \gamma_i^{-1},
\]
where $\gamma_i$ is an unknown phase variation.
We will assume that $\gamma_i$ is from the following group $\Gamma$, the phase space of the unit interval $[0, 1]$ defined as
\[
\Gamma = \{\gamma : [0, 1] \mapsto [0, 1] \ | \ \gamma(0) = 0 \text{, } \gamma(1) = 1 \text{, } \gamma \text{ is a diffeomorphism}\}.
\]
This diffeomorphic constraint gives rise to the notion of elasticity because the elements of $\Gamma$, i.e.\ phase functions, can only smoothly stretch and contract portions of the unit interval so that it maps back to itself.
Additionally, we will use the Fisher-Rao metric and the square-root velocity function (SRVF) for its attractive properties (see \cite{srivastava2016functional} for properties and appropriate proofs).
The square-root velocity function is defined as:
\[q = sign(\dot{f})\sqrt{|\dot{f}|}.\]
Therefore we propose the model
\[q_i = \left( (\mu_q + \delta \vmathbb{1}(i > k^*) + \epsilon_i), \gamma_i^{-1}\right).
\]
where the action $(q,\gamma) = q\circ\gamma\sqrt{\dot{\gamma}}$.
Here, we now aim to detect a changepoint in the sequence of SRVF functions while controlling for phase variability.
We can also view the data as
\[(q_i,\gamma_i) = \mu_q + \delta \vmathbb{1}(i > k^*) + \epsilon_i.\]

We wish to test the hypothesis
\[H_0: \delta = 0~~\text{vs}~~H_A: \delta\neq 0.\]

One might also observe a change in phase of the functional data that would not be detected with cross-sectional methods.
In this setting, we consider a model for $\gamma_i$ as \[\gamma_i = \mu_{\gamma} + \delta_{\gamma}\vmathbb{1}(i > k^*) + \epsilon_{\gamma, i}\]where $\epsilon_{\gamma,i}$ is another zero-mean error term and test the hypothesis
\[H_0: \delta_\gamma = 0~~\text{vs}~~H_A: \delta_\gamma\neq 0.\]
In the next two subsections, we propose a test procedure for changepoints in the amplitude mean and phase mean of functional data, respectively.

\subsection{Amplitude changepoint}
\label{sec:ampchange}
From \cite{srivastava2016functional} the amplitude distance (which is a proper distance) between two functions is defined as
\[d_a(f_1,f_2)=\inf_{\gamma\in\Gamma} \|q_1-(q_2,\gamma)\|.\]
From a proper distance we can define the Karcher mean of functions as
\[\mu_q^k = \argmin_{q} \sum_{i=1}^k d_a(q,q_i)^2.\]

To determine if an amplitude changepoint has occurred, we can define a test statistic using the (scaled) functional cumulative sum.
This is similar to the approach used in \cite{aue:2018}.
The test statistic is defined as
\begin{equation}
	S_{n,k} = \frac{1}{\sqrt{n}}\left(k\mu_q^k-k\mu_q^n\right)\label{eq:ff_amp}
\end{equation}
where $\mu_q^n$ is the Karcher mean of the entire data set and for a specific value of $k$ we can compute the Karcher mean $\mu_{q}^k$.
We can also define a test statistic using the $\ensuremath{\mathbb{L}^2}$ norm to also test for differences in means which is similar to the test statistic proposed in \cite{gromenko:2017}.
The test statistic is defined as
\begin{equation}
	\Lambda_2 = \frac{1}{n}\sum_{k=1}^n \|k\mu_q^k - k\mu_q^n\|^2.
\end{equation}

One can find the changepoint by using the max-point structural break detector,
\[T_n = \max_{1\leq k \leq n} \|S_{n,k}\|^2\]
to test the hypothesis $H_0$ versus $H_A$ and determine the estimated changepoint $k^*$ when
\[k^* = \min\{k:\|S_{n,k}\|= \max_{1\leq k \leq n} \|S_{n,k}\|\}.\]
For the asymptotic properties of this statistic the reader is referred to \cite{aue:2018}.
Under this model $T_n$ is distributed according to
\[T_n \xrightarrow{d} \sup_{0\leq x\leq 1} \sum_{l=1}^\infty \lambda_l B_l^2(x)\]
where $B_l$ are i.i.d.\ standard Brownian bridges defined on $[0,1]$ and $\{\lambda_l\}$ are the eigenvalues on the long-run covariance kernel of the error sequence $\epsilon_i$.
Computation of critical values of $T_n$ can be done by the simulation of independent Brownian bridges and truncating the infinite sum; see Section 3.2 of \cite{aue:2018} for more details on this computation.

This tests for mean shape changes under phase variability.
We can also easily implement this using functional principal component analysis (fPCA) as in \cite{berkes:2009}.
In order to properly account for the variability, we can use the vertical
fPCA and horizontal fPCA presented in \cite{tucker:2013}.
These fPCA methods account for the variability by first separating the
phase and amplitude and then performing the fPCA on the spaces
separately.
Using these methods one can construct the changepoint test in the
amplitude space using the SRVF, \(q\), or
specifically the aligned SRVF, \(\tilde{q}\), and in the phase space using the warping
functions, \(\gamma\).

We can use the \textit{vertical} fPCA from \cite{tucker:2013} to test for an amplitude change. We will first give a short review of this fPCA method below.

\subsubsection{Vertical Functional Principal
Components}
Let \(f_1,\cdots,f_n\) be a given set of functions, and
\(q_1,\cdots,q_n\) be the corresponding SRVFs, \({\mu}_q\) be their
Karcher Mean, and let \(\tilde{q}_i\)s be the corresponding aligned
SRVFs using Algorithm 1 from \cite{tucker:2013}. In
performing vertical fPCA, one also needs to include the variability
associated with the initial values, i.e., \(\{f_i(0)\}\), of the given
functions.
Since representing functions by their SRVFs ignores
vertical translation, this variable is treated separately. That is, a
functional variable \(f\) is analyzed using the pair \((q, f(0))\)
rather than just \(q\). This way, the mapping from the function space
\(\ensuremath{\mathcal{F}}\) to \(\ensuremath{\mathbb{L}^2} \times \mathbb{R}\) is a bijection. In practice, where
\(q\) is represented using a finite partition of \([0,1]\), say with
cardinality \(T\), the combined vector \(h_i = [q_i~~f_i(0)]\) simply
has dimension \((T+1)\) for fPCA. We can define a sample covariance
operator for the aligned combined vector
\(\tilde{h}_i = [\tilde{q}_i~~f_i(0)]\) as
\[K_h = \frac{1}{n-1}\sum_{i=1}^n (\tilde{h}_i - \mu_h)(\tilde{h}_i - \mu_h)^\ensuremath{\mathsf{T}} \in \mathbb{R}^{(T+1) \times (T+1)}\ ,\]
where \(\mu_h = [\mu_q~~ \bar{f}(0)]\).
Taking the SVD,
\(K_h=U_h\Lambda_h V_h^\ensuremath{\mathsf{T}}\), we can calculate the directions of principal
variability in the given SRVFs using the first \(p\leq n\) columns of
\(U_h\) and can then converted back to the function space \(\mathcal{F}\),
via integration, for finding the principal components of the original
functional data. Moreover, we can calculate the observed principal
scores as \(\eta_{i, l} = \inner{\tilde{h}_i}{U_{h,l}}\).

The test statistic would then follow directly from \cite{berkes:2009} with test statistic
\begin{equation}
	\label{eq:tn}
	T_N(x) = \frac{1}{N}\sum_{l=1}^d\lambda_l^{-1}\left(\sum_{1\leq i \leq Nx} \eta_{i,l}-x\sum_{1\leq i\leq N} \eta_{i,l}\right)^2
\end{equation}
where $\lambda$ are the eigenvalues from $\Lambda_h$ and $\eta$ are the scores from the fPCA.
The test statistic is distributed as
\[T_N(x) \xrightarrow{d} \sum_{1\leq l \leq d} B_l^2(x),~~0\leq x \leq 1\]
where $B_l(\cdot)$ are independent Brownian Bridges on $[0,1]$.

\subsection{Phase changepoint}
\label{sec:phasechange}
From the calculation of the Karcher Mean, $\mu_q^k$, we have the set of warping functions $\{\gamma_i\}^k$.
To perform a changepoint test on the space of warping functions directly is difficult, as $\Gamma$ is a infinite-dimensional nonlinear manifold and computation of the mean is not straightforward due to the unknown geometry.
To facilitate computing a mean, we can simplify the geometry of $\Gamma$.

\subsubsection{Simplifying Geometry of $\Gamma$}
The space of warping functions, \(\Gamma\), is an infinite-dimensional
nonlinear manifold and therefore cannot be treated as a standard
Hilbert space. To overcome this problem, we will use tools from
differential geometry to perform statistical analyses and model the
warping functions. The following framework was previously used in
various settings including (1) modeling re-parameterizations of curves
\citep{srivastava-jermyn-PAMI:09} and (2) putting prior distributions on
warping functions \citep{Kurtek17,tucker:21}, and many others. It is also very
closely related to the square-root representation of probability density
functions introduced by \cite{bhattacharya-43}.

We represent an element \(\gamma \in \Gamma\) by the square-root of its
derivative \(\psi = \sqrt{\dot{\gamma}}\). Note that this is the same as
the SRVF defined earlier, and it takes this form since
\(\dot{\gamma} > 0\). The identity \(\gamma_{id}\) maps to a constant
function with value \(\psi_{id}(t) = 1\). Since \(\gamma(0) = 0\), the
mapping from \(\gamma\) to \(\psi\) is a bijection and one can
reconstruct \(\gamma\) from \(\psi\) using
\(\gamma(t) = \int_0^t \psi(s)^2 ds\). An important advantage of this
transformation is that since
\(\| \psi\|^2 = \int_0^1 \psi(t)^2 dt = \int_0^1 \dot{\gamma}(t) dt = \gamma(1) - \gamma(0) = 1\),
the set of all such \(\psi\)s is the positive orthant of the unit Hilbert
sphere in \(\ensuremath{\mathbb{L}^2}\): \(\Psi=\ensuremath{\mathbb{S}}_{\infty}^+\). In other words, the square-root representation simplifies
the complicated geometry of \(\Gamma\) to a (subset of a) unit sphere. The distance
between any two warping functions, i.e., the phase distance, is exactly
the arc-length between their corresponding SRVFs on \(\Psi\):
\begin{equation}
  d_{p}(\gamma_1, \gamma_2) = d_{\psi}(\psi_1, \psi_2) \equiv \cos^{-1}\left(\int_0^1 \psi_1(t) \psi_2(t) dt \right)\ .
\end{equation}
Figure \ref{fig:sphere-map} depicts the SRVF space
of warping functions as a unit sphere \citep{tucker-2014}.

\begin{figure}[!t]
\begin{center}
  \input{figs/spheremap}
  \caption{Depiction of the SRVF space of warping functions as a sphere and a tangent space at $\psi_{1}$.}
  \label{fig:sphere-map}
\end{center}
\end{figure}

While the geometry of \(\Psi\subset\ensuremath{\mathbb{S}}_{\infty}\) is more tractable, it
is still a nonlinear manifold and computing standard statistics remains
difficult. Instead, we use a tangent (vector) space at a certain fixed
point for further analysis. The tangent space at any point
\(\psi \in \Psi\) is given by:
\(T_{\psi}(\Psi) = \{v \in \ensuremath{\mathbb{L}^2}| \int_0^1 v(t) \psi(t) dt = 0\}\). To
map between the representation space \(\Psi\) and tangent spaces, one
requires the exponential and inverse-exponential mappings. The
exponential map at a point \(\psi\in\Psi\) denoted by
\(\exp_\psi : T_{\psi}(\Psi) \mapsto \Psi\), is defined as

\begin{equation}
  \exp_\psi(v) = \cos(\|v\|)\psi+\sin(\|v\|)\frac{v}{\|v\|},
  \end{equation} \noindent where \(v\in T_{\psi}(\Psi)\). Thus,
\(\exp_\psi(v)\) maps points from the tangent space at \(\psi\) to the
representation space \(\Psi\). Similarly, the inverse-exponential map,
denoted by \(\exp_{\psi}^{-1} : \Psi \mapsto T_{\psi}(\Psi)\), is
defined as

\begin{equation}
  \exp_{\psi}^{-1}(\psi_1) = \frac{\theta}{\sin(\theta)}(\psi_1-\cos(\theta)\psi),
  \end{equation} \noindent where \(\theta = d_{p}(\gamma_1, \gamma)\).
This mapping takes points from the representation space to the tangent
space at \(\psi\).

The tangent space representation \(v\) is sometimes referred to as a
\emph{shooting vector}, as depicted in Figure \ref{fig:sphere-map}. The
remaining question is which tangent space should be used to represent
the warping functions. A sensible point on \(\Psi\) to define the
tangent space is at the sample Karcher mean \(\hat{\mu}_{\psi}\)
(corresponding to \(\hat{\mu}_{\gamma}\)) of the given warping
functions. We can compute the mean of the warping functions using Algorithm 2 from \cite{tucker:2013}.

We then can perform a test if we have a changepoint in the phase space (on the tangent space of $\ensuremath{\mathbb{S}}_\infty$) using the test statistic
\begin{equation}
	S_{n,k} = \frac{1}{\sqrt{n}}\left(k\bar{v}^k - k \bar{v}^n\right),
\end{equation}
which is similar as defined previously, where $\bar{v}^k$ is the shooting vector of the Karcher mean of the warping functions, $\hat{\mu}_\psi$, computed using the first $k$ warping functions.
We can also define the test using the $\ensuremath{\mathbb{L}^2}$ norm similar to \cite{gromenko:2017} as
\[\Lambda_2 = \frac{1}{n}\sum_{k=1}^n \| k\bar{v}^k - k\bar{v}^n\|^2.\]
Under this test we are testing if there is a phase shift or changepoint.
The definition of $T_n$, its distribution, and finding $k^*$ are the same as the amplitude changepoint in Section~\ref{sec:ampchange}.
As mentioned above we can also implement this using \textit{horizontal} fPCA from \cite{tucker:2013}.

\subsubsection{Horizontal Functional Principal
Components}
To perform horizontal fPCA we will use the tangent space at
\(\mu_{\psi}\) \citep{srivastava2016functional} to perform analysis, where \(\mu_{\psi}\) is the mean of
the transformed warping functions.
In this tangent space we can define a sample covariance function:
\[K_\psi = \frac{1}{n-1} \sum_{i=1}^n v_i v_i^\ensuremath{\mathsf{T}} \in \mathbb{R}^{T\times T}.\]
The singular value decomposition (SVD) of
\(K_{\psi} = U_{\psi} \Lambda_{\psi} V_{\psi}^\ensuremath{\mathsf{T}}\) provides the estimated
principal components of \(\{ \psi_i\}\): the principal directions
\(U_{\psi,l}\) and the observed scores
\(\eta_{i,l} = \inner{v_i}{U_{\psi,l}}\). This analysis on \(\ensuremath{\mathbb{S}}_{\infty}\) is similar
to the ideas presented in \cite{srivastava-joshi-etal:05} although one
can also use the idea of principal nested sphere for this analysis
\citep{jung-dryden-marron:2012}.

We can then use the test defined in Equation \ref{eq:tn} to perform the changepoint test.
The distribution to find critical point and confidence interval apply directly.

\section{Results}
\label{sec:results}
\defcitealias{era5}{ECMWF}
To demonstrate our proposed method, we will compare our elastic method to the cross-section changepoint methods of \cite{aue2009estimation} and \cite{aue:2018}.
First, we will assess our method's performance on simulated data where an amplitude changepoint exists. Next, we will look at a simulated data where a phase changepoint exists.
Finally, we will apply our method to a global temperature observation dataset from ERA5 \citepalias{era5} and a global aerosol optical depth (AOD) dataset from MERRA-2 \citep{MERRA2} during the time period that contains the eruption of Mt.\ Pinatubo in Indonesia in June 1991.
For each dataset, we will demonstrate the use of the changepoint methodology to a location near Mt.\ Pinatubo; following this, we will present the results of the changepoint methodology applied to different locations across the globe.

\subsection{Simulation Data}
\label{sec:simulation}

\noindent\textbf{Amplitude Changepoint}\\
\indent Consider the following simulated data shown in Figure \ref{fig:amp_orig} which presents a set of Gaussian peaks with random phase warpings.
This data was
simulated using the equation $f_i(t) = z_i e^{-(t-a_i)^2/2}$,
$t \in [-6, 6], ~i=1,2,\dots, 75$, where $z_{i}$ is i.i.d.\ $\mathcal{N}(1, (0.05)^2)$ and $a_i$ is i.i.d.\ $\mathcal{N}(0, (1.25)^2)$.
(Note that although the elastic framework was developed for functions on $[0,1]$, it can easily be adapted to an arbitrary interval).
The randomness of $z_i$ introduces amplitude variability while $a_i$ introduces phase variability in the functional data.
The dataset consists of 75 functions with an amplitude changepoint occurring after the 30$^{th}$ function.
The changepoint was computed such that the mean of $z_i$ was changed to 1.5.

\begin{figure}
    \centering
    \includegraphics[width=.6\textwidth]{figs/amp_orig.pdf}
    \caption{Simulated data set of Gaussian curves with an amplitude changepoint and random phase variation.}
    \label{fig:amp_orig}
\end{figure}

Panel (a) in Figure \ref{fig:amp_change} presents the elastic amplitude changepoint method on the simulated data utilizing the fully functional approach.
The elastic method finds the changepoint at function 30 with a $p$-value of .001.
The mean of the functions before the changepoint is shown in red and the corresponding functions are shown in pink.
The mean of the functions after the changepoint is shown in blue and the corresponding functions are shown in light blue.
Panel (b) in Figure \ref{fig:amp_change} presents the elastic phase changepoint method on the simulated data and does not find a changepoint using a significant threshold of $\alpha=0.05$.
Panel (c) in Figure \ref{fig:amp_change} presents the method of \cite{aue:2018} where a changepoint is found at function 38 with a $p$-value of 0.00.
This is not the correct changepoint and due to the cross-sectional nature of the data the corresponding means computed before and after the changepoint are not representative of the underlying data generating mechanism.
Both curves have a much lower amplitude and vastly different shape than the original data.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/amp_test_amp.pdf}
	\label{fig:amp_test_amp}
	\caption{Elastic Amplitude Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=.78\textwidth]{figs/amp_test_warp.pdf}
	\label{fig:amp_test_warp}
	\caption{Elastic Phase Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/amp_test_aue.pdf}
	\label{fig:amp_test_aue}
	\caption{Cross-Sectional Changepoint of \cite{aue:2018}}
	\end{subfigure}
	\caption{Changepoint results on simulated data with an amplitude changepoint.}
	\label{fig:amp_change}
\end{figure}

\vspace{.1in}\noindent\textbf{Phase Changepoint}\\
\indent Consider the following simulated data shown in Figure \ref{fig:phase_orig} consisting of two peaks with random phase warpings.
This dataset is similar to data previously used in \cite{kneip-ramsay:2008}.
The individual functions are given by: $y_i(t) = z_{i,1} e^{-(t-1.5)^2/2} + z_{i,2}e^{-(t+1.5)^2/2}$, $t \in [-3, 3], ~i=1,2,\dots, 75$, where $z_{i,1}$ and $z_{i,2}$ are i.i.d.\ $\mathcal{N}(1, (0.25)^2)$.
Each of these functions is then warped according to: $\gamma_i(t) = 6\left(\frac{e^{a_i(t+3)/6} -1}{e^{a_i} - 1}\right) - 3$ if  $a_i \neq 0$, otherwise $\gamma_i = \gamma_{id}$ ($\gamma_{id}(t) = t$ is the identity warping).
Here $a_i$ are randomly generated from a uniform distribution on $-1$ to $1$, and the observed functions are computed using $x_i(t) = y_i \circ \gamma_i (t)$.
The dataset consists of 75 functions with a phase changepoint occurring after the 30$^{th}$ function.
The mean of the warping functions was shifted from the identity after the 30$^{th}$ function.

\begin{figure}
    \centering
    \includegraphics[width=.6\textwidth]{figs/phase_orig.pdf}
    \caption{Simulated functional data set of two peaks with a phase changepoint and random phase variation.}
    \label{fig:phase_orig}
\end{figure}

Panel (a) in Figure \ref{fig:phase_change} presents the elastic amplitude changepoint method on the simulated data utilizing the fully functional approach.
The elastic amplitude method does not find a changepoint at any significant value.
Panel (b) in Figure \ref{fig:phase_change} presents the elastic phase changepoint method on the simulated data and does find a changepoint at function 30 using the significant threshold of $\alpha=0.05$.
The mean of the warping functions before the changepoint are shown in red and the corresponding functions in pink.
The mean of the warping functions after the changepoint are shown in blue and the corresponding functions in light blue.
Panel (c) in Figure \ref{fig:phase_change} presents the method of \cite{aue:2018} where a changepoint is found at function 41 with a $p$-value of 0.00.
This is not the correct changepoint and due to the cross-sectional nature of the data the corresponding means computed before and after the changepoint are not representative the underlying data generating mechanism.
Both curves are have much lower amplitude than the original data.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/phase_test_amp.pdf}
	\label{fig:phase_test_amp}
	\caption{Elastic Amplitude Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=.78\textwidth]{figs/phase_test_warp.pdf}
	\label{fig:phase_test_warp}
	\caption{Elastic Phase Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/phase_test_aue.pdf}
	\label{fig:phase_test_aue}
	\caption{Cross-Sectional Changepoint of \cite{aue:2018}}
	\end{subfigure}
	\caption{Changepoint results on simulated data with an phase changepoint.}
	\label{fig:phase_change}
\end{figure}

\vspace{.1in}\noindent\textbf{Sensitivity Analysis}\\
\indent Lastly, we examined the ability of the method versus \cite{aue2009estimation} over 1000 random data sets.
Figure \ref{fig:boxplots} presents the results of generating 75 simulated functions and inserting a changepoint (either amplitude or phase) after function 30.
The simulated data set was generated according the following structure
$$
f = a_0\cos(2\pi t) + b_0\sin(2\pi t) + a_1\cos(4\pi t) + b_1\sin(4\pi t)
$$
where $a_i\sim\mathcal{N}(a^*,.08)$ and $b_i\sim\mathcal{N}(b^*,.08)$ for $i\in\{0,1\}$.
The components $a^*$ and $b^*$ are drawn of a uniform distribution.
For each of the 1000 runs the parameters were sampled from the corresponding distributions, the data generated and the elastic changepoint methods utilizing the fPCA approach and the fPCA changepoint method of \cite{aue2009estimation}.
The change occurs when $a^*$ and $b^*$ change values.

Panel (a) in Figure \ref{fig:boxplots} shows a boxplot of estimated changepoint (using a significance level of $\alpha = 0.05$) over the 1000 simulations for the elastic amplitude method versus the cross-sectional method of Aue where an amplitude changepoint occurs.
Over the 1000 replicates, the elastic method finds the changepoint in all but 11 simulations.
The cross-sectional method finds a later changepoint and has a high distribution of the estimated changepoint.
Panel (b) in Figure \ref{fig:boxplots} shows the boxplot estimated changepoint over the 1000 simulation (where a significant $p$-value for $\alpha=0.05$) for the elastic phase method versus the cross-sectional method of Aue where a phase changepoint occurs.
Over the 1000 replicates, the elastic method finds the changepoint more often.
The cross-sectional method finds the changepoint at certain times, but has a more variable distribution, and overall the estimated changepoint mean is incorrect due to the cross-sectional behavior as mentioned above.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/amp_sim_box.pdf}
	\caption{Amplitude}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/ph_sim_box.pdf}
	\caption{Phase}
	\end{subfigure}
	\caption{Detected changepoints over 1000 replicate simulations.}
	\label{fig:boxplots}
\end{figure}

\subsection{ERA5}
\label{sec:era5}

We rely on the ERA5 \citepalias{era5} global temperature dataset which has hourly temporal coverage from 1979 to present, horizontal resolution of 0.25 degree grid cells, and a vertical coverage from 1 to 1,000 hPA.
ERA5 is the fifth generation European Centre for Medium-Range Weather Forecasts (ECMWF) atmospheric reanalysis of the global climate.
Reanalysis assimilates observational data with simulation data to produce a globally consistent dataset.
For this study, we focus on daily averages between 1986 and 1995 at near-surface level (1,000) hPa across 7.5 degree grid cells.
We treat each year as independent functional observations and apply our principal-component-based elastic functional changepoint method to identify key shifts in temporal climate trends from year to year.
We first focus on a specific location near the Mt.\ Pinatubo eruption of 1991.

Panel (a) in Figure \ref{fig:era5_data} presents temperature profiles smoothed using a box filter for the years 1986 to 1995 at a location near the Mt.\ Pinatubo eruption shown by the blue dot in Panel (b).
The profiles are the daily average temperature for each year.
Both the elastic amplitude and elastic phase changepoint methods were executed on the data.
The elastic amplitude changepoint found a significant changepoint ($\alpha=0.05)$ at the year of 1991.
The mean before the changepoint is shown in red and the mean after the changepoint is shown in blue in Panel (a) of Figure \ref{fig:era5_change}.
The estimated functional change in the mean of the SRVFs is shown in Panel (b).
The estimated changepoint is the year of the eruption and we see a cooling in the later months.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/era5_f.pdf}
	\caption{}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/map.pdf}
	\caption{}
	\end{subfigure}
	\caption{ERA5 temperatures at location near Mt.\ Pinatubo Eruption.}
	\label{fig:era5_data}
\end{figure}

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/amp_era5_amp.pdf}
	\caption{Elastic Amplitude Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/amp_era5_chg.pdf}
	\caption{}
	\end{subfigure}
	\caption{ERA5 changepoint and estimated amplitude change function.}
	\label{fig:era5_change}
\end{figure}

Figure \ref{fig:era5_sn} presents the test statistic for the elastic amplitude test.
The clear maximum of the test statistic is shown at 1991.
There is a slight peak at 1989 or 1994, and if multiple changepoint methods such as in \cite{harris:21} are used, a possibility of multiple changepoints can be detected.

\begin{figure}
    \centering
    \includegraphics[width=.6\textwidth]{figs/era5_Sn.pdf}
    \caption{ERA5 elastic amplitude changepoint test statistic.}
    \label{fig:era5_sn}
\end{figure}

In Figure \ref{fig:era5_ph_sn}, we present the results of the elastic phase changepoint test, which also shows a maximum in the test statistic at 1991.
This detected changepoint is significant with a p-value of $0.002$, and one can see clear separation between the means of the warping functions before and after the estimated phase change in the data in Panel (b).

\begin{figure}
    \centering
    \includegraphics[width=.4\textwidth]{figs/era5_ph_Sn.pdf}
    \includegraphics[width=.4\textwidth]{figs/era5_warp.pdf}
    \caption{(Left) ERA5 elastic phase changepoint test statistic. (Right) ERA5 warping functions before and after the estimated changepoint.}
    \label{fig:era5_ph_sn}
\end{figure}

We next repeat this analysis at 173 additional locations across the globe to provide a more comprehensive analysis.
The estimated changepoints for the amplitude PCA approach are plotted in Figure \ref{fig:era5_all_locs}.
For the amplitude PCA approach, each estimated changepoint was significant at the $\alpha= 0.05$ level, although this does not correct for multiple testing.
In general, there is mild-to-moderate spatial coherence in the estimated changepoints.
We also plot in Figure \ref{fig:era5_all_locs} a frequency table of the number of times each year was detected as a changepoint.
There appear to be more changepoints estimated throughout the middle range of the years studied (1990-1992).
Since many variabilities (for example, El Ni\~no) are present in climate and reanalysis data, filtering out known variabilities may better isolate a potential observed change around the time or after the eruption of Mt.\ Pinatubo.

\begin{figure}
    \centering
    \includegraphics[width=.48\textwidth]{figs/map_vert.pdf}
    \includegraphics[width=.4\textwidth]{figs/era5_vert_hist_year.pdf}
    \caption{(Left) Estimated ERA5 temperature elastic amplitude changepoints using the principal component-based test. Points were not plotted if the estimated p-value was greater than 0.05. (Right) Histogram of detected changepoints using the elastic amplitude changepoint method. }
    \label{fig:era5_all_locs}
\end{figure}

\subsection{MERRA-2}

We repeat this analysis on another atmospheric variable of interest, aerosol optical depth (AOD), a unitless quantity describing the amount of light that aerosols block in the air.
Since volcanic activity directly injects aerosols into the atmosphere, identifying changes related to Mt.\ Pinatubo's 1991 eruption may be easier to discern.
See, for example, \cite{thompson_2009} for more information on variability and variables related to Mt.\ Pinatubo's eruption.
We use a reanalysis product from NASA called MERRA-2 \citep{MERRA2}.
For this study, we focus on daily averages of total AOD extinction at a wavelength of 550 nanometers between 1986 and 1997.

In Figure \ref{fig:merra2_data}, we plot smoothed AOD curves at a location near Mt.\ Pinatubo.
There appears to be a drastic change in this variable around the time of the eruption, after which the AOD decreases.
In Figure \ref{fig:merra2_change}, we present results from the amplitude change test, which detects a significant change at the $0.05$ level in 1991.
The estimated change shows an increase in AOD for the second half of the year (corresponding to the months immediately after the eruption for 1991), as well as an increase in AOD for the first two months of the year.

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/merra2_f.pdf}
	\caption{}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/merra2_map.pdf}
	\caption{}
	\end{subfigure}
	\caption{MERRA-2 aerosol optical depths (AOD) at location near Mt.\ Pinatubo Eruption.}
	\label{fig:merra2_data}
\end{figure}

\begin{figure}[htbp]
	\centering
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics[width=\textwidth]{figs/amp_merra2_amp.pdf}
	\caption{Elastic Amplitude Changepoint}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.48\textwidth}
	\centering
	\includegraphics [width=\textwidth]{figs/amp_era5_chg.pdf}
	\caption{}
	\end{subfigure}
	\caption{MERRA-2 changepoint and estimated amplitude change function.}
	\label{fig:merra2_change}
\end{figure}

As with the ERA5 data, we repeat this analysis at different locations, plotted in Figure \ref{fig:merra2_all_locs}.
Overall, significant changepoints at the $0.05$ level were found, and the estimated changepoints are more concentrated around 1991 compared to those for the temperature reanalysis.
We found that the AOD decreased quickly to its pre-Pinatubo behavior in 1992 or 1993 in some locations, leading to estimated changepoints in these years; therefore, considering an ``epidemic'' changepoint as in \cite{aston_2012} may more accurately identify the change of behavior in this variable.

\begin{figure}
    \centering
    \includegraphics[width=.48\textwidth]{figs/MERRA_AOD_map_vert.pdf}
    \includegraphics[width=.4\textwidth]{figs/MERRA_AOD_hist_year.pdf}
    \caption{(Left) Estimated aerosol optical depth (AOD) MERRA-2 elastic amplitude changepoints using the principal component-based test. Points were not plotted if the estimated p-value was greater than 0.05. (Right) Histogram of detected changepoints using the elastic amplitude changepoint method. }
    \label{fig:merra2_all_locs}
\end{figure}

\section{Conclusion}
\label{sec:conclusion}
We have proposed a new flexible elastic approach to functional changepoint detection that handles phase and amplitude variability in the data accordingly.
We have demonstrated its advantages over the state-of-the-art methods in the functional changepoint literature using both simulated and real datasets.
Unlike the current cross-sectional methods, the elastic method accurately estimates the mean of the underlying data generating mechanism and also handles phase as a nuisance or as information suggesting a potential changepoint in the functional data.
Correctly estimating the underlying mean before and after the change can have large impacts on interpretability of the data and implementation of downstream analysis.

For future work, we look to extend the method to the multiple change-point problem.
This extension will not be trivial as scalability is a problem as shown in \cite{harris:21}.
Multiple changepoints can be detected in $S_{n,k}$ if using a multiple peak detection scheme, but determining the $p$-value is not straightforward, and the test statistics will have to be defined carefully.
Additionally, we can extend this from curves to trajectories that lie on Riemannian manifolds $\mathcal{M}$.
In this case, one has to account for the non-zero curvature of the space and in particular, the calculation of the gradient in the Fisher Rao metric and computation of the required statistics.

\section*{Acknowledgment}
This paper describes objective technical results and analysis. Any subjective views or opinions that might be expressed in the paper do not necessarily represent the views of the U.S. Department of Energy or the United States Government. This work was supported by the Laboratory Directed Research and Development program at Sandia National Laboratories; a multi-mission laboratory managed and operated by National Technology and Engineering Solutions of Sandia, LLC, a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-NA0003525.

\baselineskip=20pt


\section{Introduction}

In investigating the extension to which Dirichlet problems on a Euclidean domain
can be posed in the study of partial differential equations, O.~V.~Besov~\cite{Besov, Besov2} formulated the notion of
Besov spaces, thus extending the work of Nikolski\u{\i}~\cite{N}. It was seen in~\cite{Besov, Besov2, BIKLN,BIN} and the
series of papers~\cite{Besov3, Besov4, Besov5} that for certain bounded Euclidean Lipschitz domains $\Omega\subset{\mathbb R}^n$,
traces of Sobolev functions $W^{1,p}(\Omega)$ belong to the Besov space $B^{1-1/p}_{p,p}(\partial\Omega)$,
where $\Omega$ denotes the boundary of $\Omega$, see also~\cite{Gag}. In his papers, Besov refers to the Besov
spaces as \emph{Lipschitz-type spaces}.
The subsequent work of Jonsson and Wallin~\cite{JW80, JW84} extended this identification
of certain Besov spaces as trace class of Sobolev spaces for more irregular Euclidean domains, namely
domains whose boundaries are Ahlfors regular sets.
In~\cite[Chapter~10]{Maz}, Maz'ya gives a detailed account of Besov capacities of Euclidean sets, using both the
homogeneous and inhomogeneous versions of Besov spaces.
Thus, every Besov function on the boundary of such a domain is permissible as a boundary condition
in the study of elliptic Dirichlet problems.

The exploration of traces of Sobolev function has been extended to the setting of metric measure
spaces where the measure is doubling and supports a suitable Poincar\'e
inequality. There, uniform domains $\Omega$ whose boundary $\partial\Omega$ satisfies a natural $\theta$-codimensional Hausdorff measure
condition for $0<\theta<p$ were shown in~\cite{Mal} to satisfy the condition that the traces of functions in the Newton-Sobolev space
$N^{1,p}(\Omega)$ are in the Besov class $B^{1-\theta/p}_{p,p}(\partial\Omega)$.
The preprint~\cite{Mal}, however, required the domain to be bounded. Subsequently, this result was extended for unbounded uniform
domains with \emph{bounded} boundaries in~\cite{GKS}.

In the event that the boundary of the uniform domain is unbounded, it is natural to ask what trace
theorems hold true when $N^{1,p}(\Omega)$ is replaced by its homogeneous analogue, the Dirichlet-Sobolev space
$D^{1,p}(\Omega)$, and $B^{1-\theta/p}_{p,p}(\partial\Omega)$ is replaced by the homogeneous Besov space,
$HB^{1-\theta/p}_{p,p}(\partial\Omega)$. The primary goal of the present paper is to address this question,
the answer to which is summarized in the following, the main theorem of the present note.

\begin{thm}\label{thm:main}
Let $(\Omega,d,\mu)$ be an unbounded, locally compact, non-complete doubling metric measure space that supports a $p$-Poincar\'e inequality
for some $1\leq p<\infty$, and in addition $\Omega$ be a uniform domain in its completion $\overline{\Omega}$. Suppose also that
$\partial\Omega:=\overline{\Omega}\setminus\Omega$, the boundary of $\Omega$, is unbounded and
supports a non-atomic Borel regular measure $\nu$ satisfying the following $\theta$-codimensional condition for some $0<\theta<p$\,:
there exists a constant $C\ge 1$
such that for each $\zeta\in\partial\Omega$ and
$r>0$, we have
\[
\frac{1}{C}\, \nu(B(\zeta,r)\cap\partial\Omega)\le \frac{\mu(B(\zeta,r)\cap\Omega)}{r^\theta}\le C\, \nu(B(\zeta,r)\cap\partial\Omega).
\]
Then there is a bounded linear trace operator $T: D^{1,p}(\Omega)\to HB^{1-\theta/p}_{p,p}(\partial\Omega)$ such that we have
\[
\lim_{r\to 0^+}\fint_{B(\zeta,r)\cap\Omega}\!|u-Tu(\zeta)|\, d\mu=0
\]
for $\nu$-a.e.~$\zeta\in\partial\Omega$ whenever $u\in D^{1,p}(\Omega)$. Moreover, there is a bounded linear extension
operator $E:HB^{1-\theta/p}_{p,p}(\partial\Omega)\to D^{1,p}(\Omega)$
such that $T\circ E$ is the canonical identity operator on $HB^{1-\theta/p}_{p,p}(\partial\Omega)$.
\end{thm}

The proof of the above theorem, adapting the technique of~\cite{Mal}, will be in two parts; the trace part is proved in
Theorem~\ref{thm:trace},
and the extension part is proved in Theorem~\ref{thm:ext}. The reader might also be interested in~\cite{HM} for a discussion of
trace classes of Haj\l asz-Sobolev functions on Euclidean domains satisfying a John-type condition.

We do not know whether choice of homogeneous versions of Besov and Sobolev spaces in the above theorem
can be replaced with their inhomogeneous counterparts.
In~\cite{Mal}, where $\Omega$ is bounded,
the homogeneous spaces in the above theorem coincide with the corresponding inhomogeneous spaces;
in this case, there is even control of the
$L^p$-norms of the respective functions. When $\Omega$ is an unbounded uniform domain but with
$\partial\Omega$ bounded, then the identity of certain {\emph{inhomogeneous}}
Besov classes of functions on $\partial\Omega$ as the trace of
Dirichlet-Sobolev classes of functions on $\Omega$ follows from~\cite{GKS}. Thus, the novelty in the present work is the ability
to handle the possibility that $\partial\Omega$ is unbounded.

Note that when $p=1$, the theorem forces $0<\theta<1$. This is necessary as, when $\theta=1$, the trace class of $N^{1,1}(\Omega)$
is known to be $L^1(\partial\Omega)$. Indeed, in  the case that $\theta=1$, there is a \emph{linear} extension operator from
$B^{0}_{1,1}(\partial\Omega)$ to $N^{1,1}(\Omega)$, but the trace operator from $N^{1,1}(\Omega)$ is onto $L^1(\partial\Omega)$,
with the extension from $L^1(\partial\Omega)$ being necessarily non-linear, see~\cite{Gag, Pe} for the Euclidean setting, and~\cite{MSS} for the
setting of metric measure spaces. In the case that $0<\theta<1$, the
extension operator we obtain \emph{is} bounded and linear. For the case of Euclidean domains, there is a nice discussion of alternate
definitions of trace given in~\cite{BuMa1, BuMa2}, and an accessible version of this can also be found in~\cite[Chapter~9.5]{Maz}.

Slight modifications throughout the paper show that the theorem still holds if we regard $\Omega$ as a domain living inside a larger
complete metric measure space $X$ (as opposed to $\overline{\Omega}$). Since the problem of traces in that setting can be reduced to the case that
the ambient space is merely $\overline{\Omega}$, we leave this detail to the interested reader.

The link between Newton-Sobolev or Dirichlet-Sobolev spaces and the homogeneous or inhomogeneous
Besov spaces give us a handy way of
analyzing the behavior of potentials related to Besov energy, a non-local energy, by utilizing the now
well-known behavior of potentials related to
Dirichlet-Sobolev energy, see for example~\cite{CKKSS, LS}. Conversely, the identification of Besov
spaces as traces of Sobolev-type spaces
also gives us the limit on the type of boundary data that give rise to finite-energy solutions, on the
domain, of certain Dirichlet boundary value problems, see for
instance~\cite{BBS}. We hope the results given in this paper help further this endeavor of connecting
non-local energies to local energies.

\vskip .3cm

\noindent {\bf Acknowledgement:} The authors thank Riikka Korte for valuable discussions on matters related to this paper.
 The second author's work is partially supported by the NSF (U.S.A.) grant DMS~\#2054960.

\section{Preliminaries}\label{Sec:2}

In this section, we develop the background material needed for the remainder of the paper. In what follows,
$(Z,d_Z,\mu_Z)$ is an arbitrary metric measure space unless otherwise stated.

\subsection{Sobolev spaces}

	In a metric measure space with no {\it a priori} smooth structure, let alone linear structure, there is no one natural candidate for the
notion of derivative. One possibility, which generalizes the fundamental theorem of calculus and exploits the geometry of curves in a
metric measure space, is the notion of upper gradients, first proposed by
Heinonen and Koskela~\cite{HK}.

We say that a non-negative Borel function $g$ on $Z$ is an \emph{upper gradient} of a measurable function $u$ on $Z$ if
\begin{equation}\label{ug}
	|u(y)-u(x)|\le \int_\gamma\! g\, ds
\end{equation}
holds for all rectifiable cures in $Z$ joining $x$ to $y$. The right-hand side is meant to be interpreted as infinity if at
least one of $u(x)$ or $u(y)$ is infinite. Every function trivially has $g\equiv\infty$ as an upper gradient, and for each upper
gradient $g$ the function $g+\tilde{g}$ is also an upper gradient for every non-negative Borel function $\tilde{g}$. For $1\le p<\infty$,
we say that $g$ is a {\emph{$p$-weak upper gradient}} of $u$ if the collection $\Gamma$ of rectifiable curves for
which inequality~\eqref{ug} fails has $p$-modulus zero. Here, by a family $\Gamma$ of curves having $p$-modulus zero we
mean that there is a non-negative Borel function $\rho\in L^p(Z)$ such that $\int_\gamma\rho\, ds=\infty$ for each $\gamma\in\Gamma$.

	Of special importance in the context of metric measure spaces are the Lipschitz functions, which, in some sense,
play a similar role to that of the smooth functions in real analysis. If $u$ is $L$--Lipschitz, then it is immediate that $g\equiv L$ is an
upper gradient for $u$. For a merely locally Lipschitz function $u$, then its \emph{local Lipschitz constant function}
\[
\Lip u(x)=\limsup_{y\rightarrow x}\frac{|u(y)-u(x)|}{d_Z(y,x)}
\]
is an upper gradient for $u$.

	For a fixed measurable function $u$ on $Z$, consider the collection $D_p(u)$ of all $p$-weak upper gradients of $u$. The set
$D_p(u)\cap L^p(Z)$ is a closed convex subset of $L^p(Z)$ and so, if it is non-empty, has a unique element of smallest $L^p$-norm.
We denote this element by $g_u$ and call it the {\emph{minimal $p$-weak upper gradient}} of $u$.

	We say that a measurable function $u$ on $Z$ is in the {\emph{Dirichlet-Sobolev space}} $D^{1,p}(Z)$ for $1\leq p<\infty$ if the following
semi-norm is finite: $\|u\|_{D^{1,p}}:=\|g_u\|_{L^p}$. If, in addition, $u$ satisfies $\int_Z|u|^p\, d\mu_Z<\infty$, then $u$ is said to be
in the {\emph{Newton-Sobolev space}} $N^{1,p}(Z)$ with
semi-norm $\|u\|_{N^{1,p}}:=\|u\|_{L^p}+\|u\|_{D^{1,p}}$.

In the context of Euclidean domains, $N^{1,p}(Z)$ corresponds to the classical Sobolev spaces $W^{1,p}(Z)$. We invite
the interested reader to consult~\cite{HKST} for details and proofs regarding the statements made in this subsection.

\subsection{Sobolev $p$-capacities}\label{sub:capacities}

Let $1\leq p <\infty$. Given a set $E\subset Z$, we set its {\emph{Sobolev $p$-capacity}} to be the number
\[
\text{Cap}_p^Z(E):=\inf_{u\in\mathcal{A}(E)} \Vert u\Vert_{N^{1,p}}\,
\]
where $\mathcal{A}(E)$ is the collection of all functions $u\in N^{1,p}(Z)$ such that $u\ge 1$ on $E$.

A function in $L^p(Z)$ is well-defined only up to sets of $\mu_Z$-measure zero. Newton-Sobolev functions are more constrained, for they are
well-defined up to sets of Sobolev $p$-capacity zero in the sense that if $u\in N^{1,p}(Z)$, then $\Vert u\Vert_{N^{1,p}}=0$ if and only if
the $p$-capacity of the set $\{z\in Z\, :\, u(z)\ne 0\}$ is zero, see for instance~\cite[Corollary~7.2.10]{HKST}.

\subsection{Doubling property of measure}

The metric measure space $(Z,d_Z,\mu_Z)$ is said to be {\emph{doubling}} if there is a constant $C\geq 1$
such that for all $z\in Z$ and $r>0$ we have
\[
\mu_Z(B(z,2r))\le C\, \mu_Z(B(z,r))\,.
\]
Given a ball $B\subset Z$, there may be more than one choice of center $z$ and radius $r$; we will assume that a generic ball $B$
is identified together with its center and radius. For a ball $B=B(z,r)$, we will denote by $\tau B$ the  ball $B(z,\tau r)$ when $\tau>0$.

The doubling property of $\mu_Z$ implies that $(Z,d_Z)$ is a {\emph{doubling metric space}}. That is, there exists a positive integer $N$,
depending only on the doubling constant of $\mu_Z$, such that for each $r>0$ and $x\in Z$, every $r/2$--separated set
$A\subset B(x,r)$ has at most $N$ elements. A set being $r/2$--separated means that for each $y,z\in A$ with $y\ne z$,
we have $d_Z(y,z)\ge r/2$.

\subsection{Poincar\'e inequalities}

Let $1\le p<\infty$. The metric measure space $(Z,d_Z,\mu_Z)$ is said to support a {\emph{$p$-Poincar\'e inequality}} if
there are constants $C>0$ and $\lambda\ge 1$
such that for all balls $B\subset Z$ and upper gradients $g$ of function $u\in D^{1,p}(Z)$,
\[
\fint_B\!|u-u_B|\, d\mu_Z\le C\, \rad(B)\, \left(\fint_{\lambda B}\!g^p\, d\mu_Z\right)^{1/p}.
\]
Support of a Poincar\'e inequality implies some strong geometric connectivity properties of $Z$; see~\cite{HKST} and the
references therein for
more on this topic. The validity of $p$-Poincar\'e inequality automatically implies that functions in $D^{1,p}(Z)$
are necessarily in $L^1_{loc}(Z)$.

When $(Z,d_Z,\mu_Z)$ is doubling and supports a $p$-Poincar\'e inequality, a stronger version of the Lebesgue
differentiation theorem is known for
Newton-Sobolev functions. Recall that if $\mu_Z$ is doubling, then $\mu_Z$-almost every point in $Z$ is a
Lebesgue point of a function $u\in L^p(Z)$.
From~\cite[Theorem~9.2.8]{HKST} for the case $p>1$ and from~\cite{KKST} for the case $p=1$
(see also~\cite{KV} for a related Sobolev function-space called the Haj\l asz-Sobolev space), we have the
following result. Note that when $u\in D^{1,p}(Z)$, for each ball $B\subset Z$ we have that $u\,\eta_B$
is in the Newton-Sobolev class $N^{1,p}(Z)$ where
$\eta_B$ is a Lipschitz function on $Z$ with support in $2B$ such that $\eta_B=1$ on $B$ and $0\le \eta_B\le 1$.

\begin{prop}\label{prop:Lebesgue-pt}
If $(Z,d_Z,\mu_Z)$ is complete,
doubling, and supports a $p$-Poincar\'e inequality, then for each $u\in D^{1,p}(Z)$ the set of non-Lebesgue points of $u$ is of
Sobolev $p$-capacity zero.
\end{prop}

The homogeneous space $D^{1,p}(Z)$ is, in some instances, different from $N^{1,p}(Z)$. Note that
$N^{1,p}(Z)+{\mathbb R}\subset D^{1,p}(Z)$ in the sense
that adding constants to functions in $N^{1,p}(Z)$ gives a function that is in $D^{1,p}(Z)$. However, $D^{1,p}(Z)$ could be larger than
$N^{1,p}(Z)+{\mathbb R}$, see for example~\cite[Theorem~1.4, Proposition~7.3, Example~7.1]{BBS1}. Currently, to the best our knowledge, no potential
non-trivial criteria are known that characterize when $D^{1,p}(Z)=N^{1,p}(Z)+{\mathbb R}$. A similar question for the homogeneous and inhomogeneous
Besov spaces $HB^\alpha_{p,p}(Z)$, $B^\alpha_{p,p}(Z)$ can be posed;
these spaces are defined in the next subsection below. The above-mentioned relationships
between the homogeneous and inhomogeneous spaces
have implications to existence problems related to global energy minimizers and potential theory.

\subsection{Besov spaces}

The study of a specific
sub-class of Besov spaces was first initiated, in the context of $Z$ being a smooth Euclidean space, by
Nikolski\u{\i}~\cite{N} in relation to ``fractional derivatives" of functions in a generalized Zygmund class. These were then extended to more
general Besov classes $B^\alpha_{p,q}(Z)$ by O.~V.~Besov~\cite{Besov, Besov2}. Motivated by Dirichlet problems
for Lipschitz domains in Euclidean spaces, the papers~\cite{Besov2, Besov4} developed the theory of Besov spaces as traces,
to the boundary of the domain, of
certain Sobolev function classes on the domain. In~\cite{Besov2}, one can also find the identification of Besov spaces as interpolation spaces,
interpolated between $L^p$ and Sobolev spaces, in the context of Euclidean spaces, see also~\cite{Kar, Tri,Y} for some
discussion on this aspect of the theory. From the point of view of
interpolation in the context of metric measure spaces,
Besov spaces were first studied in~\cite{GKS2}. The context of traces in the metric setting, under various limitations on the
shape of the domain in the metric space,
can be found in~\cite{GKS,Mal, MSS} for instance. The aim of the present note is to extend this aspect of traces to the
case where both the domain and its boundary are
unbounded.

	We say that a function $f\in L^p_{\text{loc}}(Z)$ is in the {\emph{homogeneous Besov space}} $HB^\alpha_{p,q}(Z)$
for $0\leq\alpha<\infty$, $1\leq p<\infty$, and $1\leq q\leq\infty$ if the following semi-norm is finite:
\[
\|f\|_{HB^\alpha_{p,q}}:=
\begin{cases} \left(\displaystyle \int_{0}^{\infty}\left( \displaystyle \int_{Z}\displaystyle \fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p}}\,d\mu_Z(x)\,d\mu_Z(y) \right)^{\frac qp}\frac{dr}{r} \right)^{\frac 1q}\!,&q<\infty\\
	\sup\limits_{r>0}\left(\displaystyle \int_{Z}\displaystyle \fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p}}\,d\mu_Z(x)\,d\mu_Z(y)\right)^{\frac 1p}\!,&q=\infty
\end{cases}.
\]
	If, in addition, $f\in L^p(Z)$, then $f$ is said to be in the {\emph{inhomogeneous Besov space}} ${B}^\alpha_{p,q}(Z)$
with semi-norm $\|f\|_{{B}^\alpha_{p,q}}=\|f\|_{L^p}+\|f\|_{HB^\alpha_{p,q}}$. Note that
the case $q=\infty$ is related to the so-called Korevaar-Schoen spaces, see for instance~\cite{KMc} or~\cite[Section~4]{ABCRST}.
In the present paper, we focus on the classes $B^\alpha_{p,p}(Z)$ for suitable choice of $\alpha$, as these spaces
arise in the theory of traces of Sobolev functions on $Z$. Such Besov spaces enjoy the following characterization, the proof of
which is included for the benefit of the interested reader, see also \cite{BP,GKS2}.

\begin{lem}
Assume that $\mu_Z$ is doubling and has no atoms. For $\alpha>0$, $1\leq p<\infty$, and $f\in L^p_{\text{loc}}(Z)$,
\begin{equation}\label{eq:B-P}
	\|f\|_{HB^\alpha_{p,p}}
	\approx \int_{Z}\int_{Z}\!\frac{|f(y)-f(x)|^p}{d_Z(y,x)^{\alpha p}\mu_Z(B(y,d_Z(y,x))) }\,d\mu_Z(x)\,d\mu_Z(y)\,,
\end{equation}
and, for each $C>0$, we have
\begin{equation}\label{rem:partition}
	\|f\|_{HB^\alpha_{p,p}}
	\approx
	\sum_{l\in{\mathbb Z}}\frac{1}{2^{l\alpha p}}\int_{Z}\fint_{B(y,C2^l)}\!|f(y)-f(x)|^p\,d\mu_Z(x)\,d\mu_Z(y)\,.
\end{equation}
\end{lem}

\begin{proof}
Let $f\in L^p_{\text{loc}}(Z)$. Fix $y\in Z$ and partition $(0,\infty)$ into intervals of the form $(C2^{l-1},C2^l)$ for some $C>0$ and $l\in{\mathbb Z}$.
For $C2^{l-1}<r<C2^l$, we have that
\begin{equation}\label{eq:step1}
    \fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p + 1}}\,d\mu_Z(x)\approx \frac{1}{2^{l(\alpha p +1)}}\fint_{B(y,C2^l)}\!|f(y)-f(x)|^p\,d\mu_Z(x)\,,
\end{equation}
and so, since $\mu_Z$ is non-atomic, \eqref{rem:partition} follows.

Setting $A_i=B(y,C2^i)\setminus B(y,C2^{i-1})$, \eqref{eq:step1} also tells us, using the doubling property of $\mu_Z$, that
\[
\fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p + 1}}\,d\mu_Z(x)\approx
   \frac{1}{2^{l(\alpha p +1)}\mu_Z(B(y,2^l))}\sum_{i=-\infty}^{l}\int_{A_i}\!|f(y)-f(x)|^p\,d\mu_Z(x)\,.
\]
Hence,
\begin{align*}
	\int_{0}^{\infty}\!\fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p + 1}}\,d\mu_Z(x)
	&\approx \sum_{l\in{\mathbb Z}}\frac{1}{2^{l\alpha p}\mu_Z(B(y,2^l))}\sum_{i=-\infty}^{l}\int_{A_i}\!|f(y)-f(x)|^p\,d\mu_Z(x)\\
	& = \sum_{i\in{\mathbb Z}}\left(\sum_{l=i}^{\infty} \frac{1}{2^{l\alpha p}\mu_Z(B(y,2^l))}\right) \int_{A_i}\!|f(y)-f(x)|^p\,d\mu_Z(x).
\end{align*}
Since
\begin{align*}
\frac{1}{2^{l\alpha p}\mu_Z(B(y,2^i))}\leq\sum_{l=i}^{\infty} \frac{1}{2^{l\alpha p}\mu_Z(B(y,2^l))}
&\leq \frac{1}{2^{i\alpha p}\mu_Z(B(y,2^i))}\sum_{l=i}^{\infty}\frac{1}{2^{(l-i)\alpha p}}\\
&\lesssim \frac{1}{2^{i\alpha p}\mu_Z(B(y,2^i))}\,,
\end{align*}
we have that
\begin{align*}
\int_{0}^{\infty}\!\fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p + 1}}\,d\mu_Z(x)& \approx
\sum_{i\in{\mathbb Z}}\frac{1}{2^{i\alpha p}\mu_Z(B(y,2^i))}\int_{A_i}\!|f(y)-f(x)|^p\,d\mu_Z(x)\\
&\approx \sum_{i\in{\mathbb Z}}\frac{1}{2^{i\alpha p}\mu_Z(B(y,2^i))}\int_{A_i}\!|f(y)-f(x)|^p\,d\mu_Z(x).
\end{align*}
For $x\in A_i$, we have that $d_Z(y,x)\approx 2^i$ and so $\mu_Z(B(y,d_Z(y,x)))\approx \mu_Z(B(y,2^i))$ by doubling and
monotonicity of measure; therefore,
\begin{align*}
\int_{0}^{\infty}\!\fint_{B(y,r)}\!\frac{|f(y)-f(x)|^p}{r^{\alpha p + 1}}\,d\mu_Z(x)
&\approx \sum_{i\in{\mathbb Z}}\int_{A_i}\!\frac{|f(y)-f(x)|^p}{d_Z(y,x)^{\alpha p}\mu_Z(B(y,d_Z(y,x)))}\,d\mu_Z(x)\\
&= \int_{Z}\!\frac{|f(y)-f(x)|^p}{d_Z(y,x)^{\alpha p}\mu_Z(B(y,d_Z(y,x)))}\,d\mu_Z(x).
\end{align*}
An application of Fubini's theorem then yields~\eqref{eq:B-P}.
\end{proof}

\subsection{Uniform domains}

Uniform domains were first introduced by Martio and Sarvas~\cite{MaSa} in the context of quasiconformal mappings between
Euclidean domains, and
since then, they have been used extensively in different contexts, including quaisconformal mapping theory, potential theory, and PDEs.

If $(Z,d_Z)$ is a complete metric space and $\Omega$ is a locally compact, non-complete domain in $Z$, its boundary
is the set $\partial\Omega:=\overline{\Omega}\setminus \Omega$,
where $\overline{\Omega}$ is the metric completion of the non-complete space $\Omega$ with respect to the metric $d_Z$.
For $z\in Z$, we set
\[
d_\Omega(z):=\dist(z,\partial \Omega):=\min\{d_Z(z,x)\, :\, x\in\partial\Omega\}.
\]
Since $\Omega$ is locally compact,
it follows that $\Omega$ is open in $\overline{\Omega}$ and so $d_\Omega(z)>0$ when $z\in\Omega$.

The domain $\Omega$
 is said to be a \emph{uniform domain} if there is a constant $A\ge 1$ such that
whenever $x,y\in\Omega$, we can find a curve $\gamma$ in $\Omega$ with end points $x,y$ such that
\begin{enumerate}
\item[(i)] the length $\ell(\gamma)\le A\, d_Z(x,y)$,
\item[(ii)] for each point $z$ in the trajectory of $\gamma$ we have
\[
 \min\{\ell(\gamma_{x,z}),\ell(\gamma_{z,y})\}\le A\,d_\Omega(z),
\]
where $\gamma_{x,z}$ denotes any segment of $\gamma$ with end points $x,z$, and a similar interpretation for $\gamma_{z,y}$ holds.
\end{enumerate}

From~\cite{BS} we know that if $\Omega$ is a uniform domain in a metric measure space $(Z,d_Z,\mu_Z)$ such that the metric measure space is
doubling and supports a $p$-Poincar\'e inequality, then the restriction of the measure $\mu_Z$ and the metric $d_Z$ to $\Omega$ also yields
a metric measure space that is doubling and supports a $p$-Poincar\'e inequality.

\subsection{Standing assumptions}

Let $(\Omega,d,\mu)$ be an unbounded, locally compact metric measure space such that $\Omega$ is uniform in its completion
$\overline\Omega$. We assume $(\Omega,d,\mu)$ is doubling
and satisfies a $p$-Poincar\'{e} inequality, $1\leq p<\infty$, and that there exists a
non-atomic
Borel regular measure $\nu$ on $\partial\Omega$ that is
$\theta$--codimensional to $\mu$, $0<\theta<p$, in the sense that there exists  $C\geq 1$ for which
\begin{equation}\label{eq:codim}
C^{-1}\frac{\mu(B(\zeta,r)\cap\Omega)}{r^\theta}\leq\nu(B(\zeta,r)\cap\partial\Omega)\leq C\frac{\mu(B(\zeta,r)\cap\Omega)}{r^\theta}
\end{equation}
holds for all $\zeta\in\partial\Omega$ and $r>0$. Note that $\mu$ being doubling on $\Omega$ implies that $\nu$ is doubling on $\partial\Omega$.

	We will often consider $\Omega$ as a domain living within the metric measure space $(\overline\Omega,d,\mu)$, where
$\mu$ is extended by zero to $\partial\Omega$. Since $\mu$ is doubling on $\Omega$, its extension is doubling
on $\overline\Omega$. Moreover, since $\Omega$ supports a $p$-Poincar\'e inequality, then so does
$\overline{\Omega}$, see~\cite[Proposition~7.1]{AS}.
Hence we have that $D^{1,p}(\Omega)=D^{1,p}(\overline{\Omega})$ and $N^{1,p}(\Omega)=N^{1,p}(\overline{\Omega})$.

As discussed in Subsection~\ref{sub:capacities}, under the above standing assumptions, it follows from
Proposition~\ref{prop:Lebesgue-pt} that for $u\in D^{1,p}(\overline{\Omega})$
the complement of the Lebesgue points of $u$ has Sobolev $p$-capacity zero. Hence, by~\cite[Proposition~3.11, Lemma~8.1]{GKS}
we know that $\nu$-almost every point in $\partial\Omega$ is a Lebesgue point of $u$.
For greater details on the above, we refer the reader to Subsection~\ref{Sec3.2} below.

\section{On traces}\label{Sec:3}

In this section, we consider the trace of Dirichlet-Sobolev functions under the aforementioned standing assumptions.
We can assume also without loss
of generality that $\Omega$ is $A$-uniform domain with $A\ge 2$.

\subsection{Constructing cones}\label{subsec:cones}

Here we fix a parameter $\tau\ge 1$ (in our application, we will choose $\tau=\lambda$ where $\lambda$ is the scaling factor
on the right-hand side of the Poincar\'e inequality). The following construction is based on~\cite[Lemma~4.3]{BS}.
Let $\xi,\zeta\in\partial\Omega$, and let $\gamma$ be a uniform curve in $\Omega$ with end points $\zeta,\xi$, that is,
$\gamma:[0,\ell(\gamma)]\to\overline{\Omega}$ such that $\gamma(0)=\xi$, $\gamma(\ell(\gamma))=\zeta$,
and $\gamma((0,\ell(\gamma)))\subset\Omega$ is a uniform curve.
Let $x_0=\gamma(\ell(\gamma)/2)$, the mid-point of the curve $\gamma$.
We focus on the subcurve $\gamma_{\xi,x_0}$ of $\gamma$ to construct the balls $B_k$ for $k\ge 0$, with the
similar construction for $\gamma_{x_0,\zeta}$ giving balls $B_k$ for $k<0$.

Let $r_0=\tfrac{d_\Omega(x_0)}{16\tau}$, and set $B_0=B(x_0,r_0)$. Next, let $x_1$ be the point in the trajectory of
$\gamma_{\xi,x_0}$ to be the
last point at which $\gamma_{\xi,x_0}$ leaves the ball $B_0$ so that $\gamma_{\xi,x_1}$
does not intersect $B_0$. If $d_\Omega(x_1)\ge \tfrac{d_\Omega(x_0)}{2}$, then we choose $r_1=r_0$; if
$d_\Omega(x_1)<\tfrac{d_\Omega(x_0)}{2}$, then we set $r_1=\tfrac{d_\Omega(x_1)}{16\tau}$. We then set
$B_1=B(x_1,r_1)$. Continuing inductively, once $x_k$ and $r_k$ have been selected for some positive integer $k$,
let $x_{k+1}$ be the last point in $\gamma_{\xi,x_0}$ at which $\gamma_{\xi,x_0}$ leaves
$\bigcup_{j=0}^k B_k$, namely, $\gamma_{\xi,x_{k+1}}$ does not intersect $\bigcup_{j=0}^k B_k$,
but $\gamma_{x_{k+1},x_k}\setminus\{x_{k+1}\}\subset \bigcup_{j=0}^kB_k$. We then set
$r_{k+1}=r_k$ if $d_\Omega(x_{k+1})\ge 8\tau r_k$, and $r_{k+1}=\tfrac{d_\Omega(x_{k+1})}{16\tau}$ otherwise.
Note that in either case,
\begin{equation}\label{eq:rad-dOm}
d_\Omega(x_{k+1})\ge 8\tau r_{k+1}.
\end{equation}

Now we consider the properties of the chain of balls $B_k$, $k=0, 1,\ldots.$ Clearly, $B_k\cap B_{k+1}$ is not empty.
We fix a non-negative integer $j$ such that $r_j=\tfrac{d_\Omega(x_j)}{16\tau}$,
and let $k>j$ be such that $r_k=r_j$. Let $L=\ell(\gamma_{\xi,x_j})$, and
$l=\ell(\gamma_{x_k,x_j})$. As $r_k=r_j$, we have that $d_\Omega(x_k)\ge 8\tau r_j=d_\Omega(x_j)/2$. It then follows from
the $A$-uniformity of $\gamma$  that
\[
\frac{d_\Omega(x_j)}{2}\le d_\Omega(x_k)\le d(x_k,\xi)\le L-l\le Ad_\Omega(x_j)-l.
\]
Thus, $l\le (A-\tfrac12)d_\Omega(x_j)$, and so
\begin{equation}\label{eq:length-control}
k-j\le \frac{l}{r_j}\le (A-\tfrac12)\, \frac{d_\Omega(x_j)}{d_\Omega(x_j)/(16\tau)}\le 16\tau A.
\end{equation}
If $k=j+1$ such that $r_k\ne r_j$, then $r_k<r_j/2$, and so we have that $\lim_kr_k=0$. As each $x_k$ lies on the
curve $\gamma_{\xi,x_0}$, it follows that $\lim_kx_k=\xi$.

Next, fix a non-negative integer $j$ for which $r_j=\tfrac{d_\Omega(x_j)}{16\tau}$,
and let $k>j$ be the smallest integer for which $r_k\ne r_j$. Then we know that $r_k=\tfrac{d_\Omega(x_k)}{8\tau}$ and
$d_\Omega(x_k)<\tfrac{d_\Omega(x_j)}{2}$, with $d_\Omega(x_{k-1})\ge \tfrac{d_\Omega(x_j)}{2}$. It follows from triangle
inequality that
\[
d_\Omega(x_k)\ge d_\Omega(x_{k-1})-d(x_k,x_{k-1})\ge \frac{d_\Omega(x_j)}{2}-r_j
=\left[1-\frac{1}{8\tau}\right] \, \frac{d_\Omega(x_j)}{2},
\]
and so
\begin{equation}\label{eq:rad-control}
\left[1-\frac{1}{8\tau}\right] \, \frac{d_\Omega(x_j)}{2}\le d_\Omega(x_k)<\frac{d_\Omega(x_j)}{2}.
\end{equation}
From~\eqref{eq:length-control} and~\eqref{eq:rad-control} we see that there is some constant $K>1$ (which depends
only on $A$ and $\tau$) such that for each $k\ge 0$ we have
\begin{equation}\label{eq:rk-vs-2-k}
\frac{1}{K}\, 2^{-k}\, d_\Omega(x_0)\le r_k\le K\, 2^{-k}d_\Omega(x_0)
\end{equation}
and
\begin{equation}\label{eq:rk-vs-dOm}
8\tau r_k\le d_\Omega(x_k)\le K\, r_k.
\end{equation}
By the $A$-uniformity of $\gamma$ we also have that
\[
d_\Omega(x_k)\le d(\xi, x_k)\le A\, d_\Omega(x_k).
\]
It follows that for $x\in 4\tau B_k$, we have that
\[
d_\Omega(x)\approx d_\Omega(x_k)\approx d(x,\xi)\approx d(x_k,\xi).
\]
Now suppose that $k$ and $j$ are non-negative integers with $k>j$ such that $4\tau B_k\cap 4\tau B_j$ is non-empty
and that $r_j\ne r_k$. Then by~\eqref{eq:rad-dOm}, we have
\begin{equation}\label{eq:gen-x}
d_\Omega(x_j)-d_\Omega(x_k)\le d(x_j,x_k)\le 4\tau(r_j+r_k)\le \frac{d_\Omega(x_j)+d_\Omega(x_k)}{2},
\end{equation}
from which we obtain $d_\Omega(x_j)\le 3\, d_\Omega(x_k)$. Now by~\eqref{eq:rk-vs-2-k} and~\eqref{eq:rk-vs-dOm}
we see that $2^{-j}\le 2^{-k+N_0}$ for some positive integer $N_0$ that depends solely on $K$ and $\tau$ (and hence
solely on $A$ and $\tau$), that is, $k\le j+N_0$. Thus we have shown that if $k,j$ are non-negative integers so that
$4\tau B_j\cap 4\tau B_k$ is non-empty, then $|k-j|\le N_0$. Combining this with~\eqref{eq:length-control} we see that
there is a constant $C\ge 1$ such that
\begin{equation}\label{eq:bdd-overlap}
\sum_{k=0}^\infty \chi_{4\tau B_k}\le C,
\end{equation}
that is, we have a bounded overlap of the enlarged balls $4\tau B_k$.

The cones $C[\xi,\zeta]$ and $C[\zeta,\xi]$ are the sets
\begin{equation}\label{eq:Cones}
C[\xi,\zeta]:=\bigcup_{k=0}^\infty 4\tau B_k,\qquad C[\zeta,\xi]:=\bigcup_{k=0}^\infty 4\tau B_{-k}.
\end{equation}
Note also that $d_\Omega(x_0)\approx d(\zeta,\xi)$ with the comparison constant depending solely on $A$.

\subsection{The co-dimensional measure on $\partial\Omega$ and the existence of traces}\label{Sec3.2}

Recall that we assume $\Omega$ to support a $p$-Poincar\'e inequality. It follows that
given a function $u\in D^{1,p}(\Omega)$, and a compactly supported Lipschitz function $\eta$ on $\Omega$, the function
$\eta u$ is in the inhomogeneous Sobolev class $N^{1,p}(\Omega)$. It follows from~\cite[Proposition~7.1]{AS} that
$\eta u$ has an extension to $\partial\Omega$ such that the extended function lies in $N^{1,p}(\overline{\Omega})$.
As the minimal $p$-weak upper gradient of a function is determined by the local behavior of the function, it follows that
$u$ itself has an extension to $\partial\Omega$ such that the extended function lies in $D^{1,p}(\overline{\Omega})$;
that is, $D^{1,p}(\Omega)=D^{1,p}(\overline{\Omega})$.

 From~\cite[Proposition~3.11]{GKS} (with $U=\overline{\Omega}$ and $\mu_Z$ the measure $\mu$,
and with $A=E\subset\partial\Omega\subset U$)
we know that whenever $E\subset\partial\Omega$ is a set such that
the Sobolev capacity $\text{Cap}_p^{\overline{\Omega}}(E)=0$, then necessarily the codimensional Hausdorff measure of $E$,
$\mathcal{H}^{-t}(E)$, is zero for $0<t<p$. From~\cite[Lemma~8.1]{GKS} we know that when $0<\theta<p$, necessarily
$\mathcal{H}^{-\theta}\vert_{\partial\Omega}\approx \nu$, and so it follows that
$\nu(E)=0$.

Having established that $u\in D^{1,p}(\Omega)$ has an extension to a function in $D^{1,p}(\overline{\Omega})$ and that
(by the Poincar\'e inequality on $\overline{\Omega}$) $p$-capacity almost every point in $\partial\Omega$ is a Lebesgue point
of $u$, and that $p$-capacity zero subsets of $\partial\Omega$ are $\nu$-null,
see~\cite[Theorem~9.2.8]{HKST},
we have that $\nu$-a.e. point in $\partial\Omega$ is a Lebesgue point of
$u\in D^{1,p}(\overline{\Omega})$. Thus for each $u\in D^{1,p}(\Omega)$ there is a set $E_u\subset\partial\Omega$ with $\nu(E_u)=0$
such that whenever $\zeta\in \partial\Omega\setminus E_u$, there is a real number, denoted $Tu(\zeta)$, such that
\[
\lim_{r\to 0^+}\fint_{B(\zeta,r)\cap\Omega}|u-Tu(\zeta)|\, d\mu=0.
\]

\subsection{The trace theorem}

In this subsection we finally identify the trace relationship, the first part of Theorem~\ref{thm:main}.

\begin{thm}\label{thm:trace}
Let $1\leq p <\infty$ and $0<\theta<p$. Then there is a bounded linear trace operator
$T:D^{1,p}(\Omega)\to HB^{1-\theta/p}_{p,p}(\partial\Omega)$ such that when $u\in D^{1,p}(\Omega)$, we have
\[
 Tu(\zeta)=\lim_{r\to 0^+} \fint_{B(\zeta,r)}u\, d\mu
\]
for $\nu$-almost every $\zeta\in\partial\Omega$.
\end{thm}

In the above setting, we can also consider $\nu$ to be a measure on $\overline{\Omega}$ by extending $\nu$ by zero to $\Omega$;
a similar null-extension of $\mu$ to $\partial\Omega$ would allow us to simplify notation (by not needing to use $B(\zeta,r)\cap\partial\Omega$
but merely using $B(\zeta,r)$ for instance in talking about the measure $\nu$ of the balls).

\begin{proof}[Proof of Theorem~\ref{thm:trace}]
For $\zeta,\xi\in\partial\Omega$ that are $\mu$-Lebesgue points of $u$, we
use the chain of balls $B_k$, $k\in{\mathbb Z}$ from Subsection~\ref{subsec:cones} above, with the choice of $\tau=\lambda$,
where $\lambda$ is the scaling constant associated with the Poincar\'e inequality.

Let $u\in D^{1,p}(\Omega)=D^{1,p}(\overline{\Omega})$; the discussion of Subsection~\ref{Sec3.2} tells us that
$\nu$-almost every point $\zeta\in\partial\Omega$ is a $\mu$-Lebesgue point of such $u$, and hence $Tu(\zeta)$ is well-defined.
For the rest of the proof, we will continue to denote $Tu(\zeta)$ by $u(\zeta)$ as this does not give rise to conflict of notation.
Then, fixing $\varepsilon>0$ such that $\theta+\varepsilon<p$,
\begin{align*}
|u(\zeta)-u(\xi)|\le \sum_{k\in{\mathbb Z}} |u_{B_k}-u_{B_{k+1}}|
  &\lesssim \sum_{k\in{\mathbb Z}} r_k \left(\fint_{4\lambda B_k}g_u^p\, d\mu\right)^{1/p} \\
  &= \sum_{k\in{\mathbb Z}} r_k^{1-(\theta+\varepsilon)/p}\, r^{(\theta+\varepsilon)/p}\left(\fint_{4\lambda B_k}g_u^p\, d\mu\right)^{1/p}\\
  &\le \left(\sum_{k\in{\mathbb Z}} r_k^{\theta+\varepsilon}\fint_{4\lambda B_k}g_u^p\, d\mu\right)^{1/p}
      \left(\sum_{k\in{\mathbb Z}} r_k^{\tfrac{p-\theta-\varepsilon}{p-1}}\right)^{1-1/p}.
\end{align*}
Note that
\[
\sum_{k\in{\mathbb Z}} r_k^{\tfrac{p-\theta-\varepsilon}{p-1}}\approx d(\xi,\zeta)^{\tfrac{p-\theta-\varepsilon}{p-1}}
\, \sum_{k\in{\mathbb Z}} 2^{-k\, \tfrac{p-\theta-\varepsilon}{p-1}}.
\]
Since the sum on the right-hand side of the above expression is finite (and independent of $\xi,\zeta$), it follows that
\[
\left(\sum_{k\in{\mathbb Z}} r_k^{\tfrac{p-\theta-\varepsilon}{p-1}}\right)^{1-1/p}\approx d(\zeta,\xi)^{1-\tfrac{\theta+\varepsilon}{p}}.
\]
Hence,
\[
|u(\zeta)-u(\xi)|^p\lesssim d(\xi,\zeta)^{p-\theta-\varepsilon}\ \sum_{k\in{\mathbb Z}} r_k^{\theta+\varepsilon}\fint_{4\lambda B_k}g_u^p\, d\mu
  \approx d(\xi,\zeta)^{p-\theta-\varepsilon}\ \sum_{k\in{\mathbb Z}}\frac{r_k^{\theta+\varepsilon}}{\mu(B_k)}\int_{4\lambda B_k}g_u^p\, d\mu.
\]
By the codimensionality condition on $\partial\Omega$, and by the doubling property of $\mu$, we have
\[
\mu(B_k)\approx\mu(4AB_k)\approx \mu(B(\omega_k, r_k)\cap\Omega)\approx r_k^\theta\, \nu(B(\omega_k,r_k)\cap\partial\Omega),
\]
where $\omega_k=\zeta$ for $k>0$ and $\omega_k=\xi$ for $k\le 0$. It follows that
\[
\frac{|u(\zeta)-u(\xi)|^p}{d(\xi,\zeta)^{p-\theta}}\lesssim d(\xi,\zeta)^{-\varepsilon} \
  \sum_{k\in{\mathbb Z}}\frac{r_k^{\varepsilon}}{\nu(B(\omega_k,r_k)\cap\partial\Omega)}\int_{4\lambda B_k}g_u^p\, d\mu.
\]

Setting
\[
I:=\sum_{k=0}^\infty \frac{r_k^{\varepsilon}}{\nu(B(\zeta,r_k)\cap\partial\Omega)}\int_{4\lambda B_k}g_u^p\, d\mu
\]
and
\[
II:=\sum_{k=1}^{-\infty}\frac{r_k^{\varepsilon}}{\nu(B(\xi,r_k)\cap\partial\Omega)}\int_{4\lambda B_k}g_u^p\, d\mu,
\]
we have the following:
\begin{align*}
I&\approx \sum_{k=1}^\infty  \int_{4\lambda B_k}\frac{d(x,\zeta)^\varepsilon g_u(x)^p}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)}\, d\mu(x)
 =\int_{C[\zeta,\xi]}\frac{d(x,\zeta)^\varepsilon g_u(x)^p}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)}\, d\mu(x),\\
II&\approx \sum_{k=0}^{-\infty}\int_{4\lambda B_k}\frac{d(x,\xi)^\varepsilon g_u(x)^p}{\nu(B(\xi,d(\xi,x))\cap\partial\Omega)}\, d\mu(x)
 =\int_{C[\xi,\zeta]}\frac{d(x,\xi)^\varepsilon g_u(x)^p}{\nu(B(\xi,d(\xi,x))\cap\partial\Omega)}\, d\mu(x),
\end{align*}
where we have used the fact that $r_k\approx d(x,\omega_k)\approx d_\Omega(x_k)$ for each $x\in 4\lambda B_k$,
see~\eqref{eq:gen-x} together with~\eqref{eq:rk-vs-dOm}.
We have denoted in the above $C[\zeta,\xi]=\bigcup_{k=0}^\infty 4\lambda B_k$ and
$C[\xi,\zeta]=\bigcup_{k=1}^{-\infty} 4\lambda B_k$, as in Subsection~\ref{subsec:cones}, and used the fact that the balls
$4\lambda B_k$ are of bounded
overlap, see~\eqref{eq:bdd-overlap}.

Now, we write
\[
\frac{|u(\zeta)-u(\xi)|^p}{d(\xi,\zeta)^{p-\theta}}
\lesssim
\int_{C[\zeta,\xi]}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\zeta)^\varepsilon g_u(x)^p}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)}\, d\mu(x)
+\int_{C[\xi,\zeta]}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\xi)^\varepsilon g_u(x)^p}{\nu(B(\xi,d(\xi,x))\cap\partial\Omega)}\, d\mu(x).
\]
Hence,
\[
\int_{\partial\Omega}\int_{\partial\Omega}\frac{|u(\zeta)-u(\xi)|^p}{d(\xi,\zeta)^{p-\theta}\nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\nu(\zeta)\, d\nu(\xi)
  \lesssim E+F,
\]
where
\[
E:=\int_{\partial\Omega}\int_{\partial\Omega}\int_{C[\zeta,\xi]}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\zeta)^\varepsilon g_u(x)^p}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)\, \nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\mu(x)\, d\nu(\zeta)\, d\nu(\xi)
\]
and
\[
F:=\int_{\partial\Omega}\int_{\partial\Omega}\int_{C[\xi,\zeta]}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\xi)^\varepsilon g_u(x)^p}{\nu(B(\xi,d(\xi,x))\cap\partial\Omega)\, \nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\mu(x)\, d\nu(\zeta)\, d\nu(\xi).
\]
We estimate $E$ as follows. We first note that for $x\in\Omega$, if $x\in C[\zeta,\xi]$ then necessarily
$d(\xi,\zeta)\ge d_\Omega(x)/A$ by the uniformity of the curve that was used to generate $C[\zeta,\xi]$, and, moreover,
$Ad_\Omega(x)\ge d(\zeta,x)$. Therefore,
\begin{align*}
E&=\int_{\partial\Omega}\int_{\partial\Omega}\int_{\Omega}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\zeta)^\varepsilon g_u(x)^p\, \chi_{C[\zeta,\xi]}(x)}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)\, \nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\mu(x)\, d\nu(\zeta)\, d\nu(\xi)\\
&\le \int_{\partial\Omega}\int_{\partial\Omega}\int_{\Omega} \frac{d(\xi,\zeta)^{-\varepsilon}d(x,\zeta)^\varepsilon g_u(x)^p\, \chi_{B(x,Ad_\Omega(x))}(\zeta)\, \chi_{\partial\Omega\setminus B(\zeta,d_\Omega(x)/A)}(\xi)}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)\, \nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\mu(x)\, d\nu(\zeta)\, d\nu(\xi)\\
&=\int_\Omega g_u(x)^p\, \int_{\partial\Omega}\int_{\partial\Omega\setminus B(\zeta,d_\Omega(x)/A)}\frac{d(\xi,\zeta)^{-\varepsilon}d(x,\zeta)^\varepsilon\, \chi_{B(x,Ad_\Omega(x))}(\zeta)}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)\, \nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\nu(\xi)\, d\nu(\zeta)\, d\mu(x).
\end{align*}
In the last line above we used Tonelli's theorem.
To estimate the inner-most integral, for each positive integer $j$ we set
\[
A_j=\left(B(\zeta, 2^jd_\Omega(x)/A)\setminus B(\zeta, 2^{j-1}d_\Omega(x)/A)\right)\cap\partial\Omega,
\]
and see from the doubling property of $\nu$ that
\begin{align*}
\int\limits_{\partial\Omega\setminus B(\zeta,d_\Omega(x)/A)}\frac{d(\xi,\zeta)^{-\varepsilon}}{\nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\nu(\xi)
&=\sum_{j=1}^\infty \int_{A_j}\frac{d(\xi,\zeta)^{-\varepsilon}}{\nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\nu(\xi)\\
&\approx \sum_{j=1}^\infty (2^jd_\Omega(x)/A)^{-\varepsilon}\\ & \approx d_\Omega(x)^{-\varepsilon}.
\end{align*}
Hence, as $d(x,\zeta)\approx d_\Omega(x)$ when
$\zeta\in B(x,Ad_\Omega(x))\cap\partial\Omega\subset \left(B(x,Ad_\Omega(x))\setminus B(x,d_\Omega(x))\right)\cap\partial\Omega$, it follows that
\begin{align*}
E&\lesssim
\int_\Omega g_u(x)^p\, \int_{B(x,Ad_\Omega(x))\cap\partial\Omega}\frac{d(x,\zeta)^\varepsilon\, d_\Omega(x)^{-\varepsilon}}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)}\, d\nu(\zeta)\, d\mu(x)\\
&\approx \int_\Omega g_u(x)^p\, \int_{B(x,Ad_\Omega(x))\cap\partial\Omega}\frac{1}{\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)}\, d\nu(\zeta)\, d\mu(x).
\end{align*}
Again, by the above observation about $d(\zeta,x)$ for $\zeta\in B(x,Ad_\Omega(x))\cap\partial\Omega$, it follows that
for each such $\zeta$ we have $\nu(B(\zeta,d(\zeta,x))\cap\partial\Omega)\approx \nu(B(x,Ad_\Omega(x))\cap\partial\Omega)$
via the doubling property of $\nu$. Hence
\[
E\lesssim \int_\Omega g_u(x)^p\, d\mu(x).
\]
A similar treatment of the term $F$ yields
\[
F\lesssim \int_\Omega g_u(x)^p\, d\mu(x).
\]

In conclusion, we obtain the desired estimate
\[
\int_{\partial\Omega}\int_{\partial\Omega}\frac{|u(\zeta)-u(\xi)|^p}{d(\xi,\zeta)^{p-\theta}\nu(B(\zeta,d(\zeta,\xi))\cap\partial\Omega)}\, d\nu(\zeta)\, d\nu(\xi)
  \lesssim \int_\Omega g_u(x)^p\, d\mu(x).
\]
\end{proof}

\section{On extensions}\label{Sec:4}

In this section, we consider the extension of Besov functions from the boundary to the entire domain.
To construct the extension operator, we consider a partition of unity subordinate to a Whitney cover.

\subsection{Whitney coverings and constructing the extension operator}

	Since $\partial\Omega$ is non-empty and $(\Omega,d)$ is a doubling metric space, we are able to construct a Whitney
decomposition of $\Omega$; that is, a countable collection $W_\Omega$ of balls $B_{i,j}=B(x_{i,j},r_{i,j})$, $i\in{\mathbb Z}$ and
$j\in{\mathbb N}$, in $\Omega$ satisfying the following:
 \begin{enumerate}
 \item[(i)] $\Omega=\bigcup\limits_{i,j}B_{i,j}$;
 \item[(ii)] there exists a constant $C>0$ such that $\sum\limits_{i,j}\chi_{2B_{i,j}}\leq C$;
 \item[(iii)] for each $i\in{\mathbb Z}$, $2^{i-1}<r_{i,j}\leq 2^i$ for all $j\in{\mathbb N}$;
 \medskip
 \item[(iv)] and, for each $i\in{\mathbb Z}$ and $j\in{\mathbb N}$, $r_{i,j}=\frac{1}{8}\,d_\Omega(x_{i,j})$.
 \end{enumerate}
The elements of $W_\Omega$ are called Whitney balls. See for example~\cite[Proposition~4.1.15]{HKST}; a
simple modification of the proof found
there yields our desired Whitney decomposition.

\begin{remark}\label{rem:bnded-overlap}
	The constant $C$ in (ii) above depends only on $N$ from the definition of a doubling metric space,
which in turn depends only on the doubling constant of $\mu$. In fact, we can choose this cover in such
a way that for each $\sigma\ge 1$, there is a constant $N_\sigma$ which depends only on $\sigma$ and the
doubling constant of $\mu$, such that for each
$i\in{\mathbb Z}$ and $j\in{\mathbb N}$ there are at most $N_\sigma$ many indices $k\in{\mathbb N}$ for which $\sigma B_{i,j}\cap\sigma B_{i,k}$ is non-empty.
\end{remark}

Note also that by construction, for $x\in 2B_{i,j}$ the triangle inequality gives that
\[
d_\Omega(x)\geq d_\Omega(x_{i,j}) - d(x,x_{i,j})>8r_{i,j}-2r_{i,j}>0,
\]
and so $2B_{i,j}\subset\Omega$ for each $i\in{\mathbb Z}$ and $j\in{\mathbb N}$.

\begin{lem}\label{claim:intersect}
If $2B_{i,j}\cap B_{l,m}\neq\emptyset$, then $|i-l|\leq 3$.
\end{lem}

\begin{proof}
We begin by assuming that $i>l$. Then, by the triangle inequality, and properties (iii) and (iv), we have that
\[
d(x_{l,m},x_{i,j})\geq d_\Omega(x_{i,j})-d_\Omega(x_{l,m}) = 8r_{i,j}-8 r_{l,m} > 2^{i+2}-2^{l+3}.
\]
This implies, still using property (iii), that
\[
\dist(B_{l,m},2B_{i,j})\geq d(x_{l,m},x_{i,j})-2r_{i,j}-r_{l,m}>2^{i+2}-2^{l+3}-2^{i+1}-2^l >2^{i+1}-2^{l+4},
\]
which is positive if $i-l>3$.

On the other hand, when $i<l$, similar calculations yield
\[
d(x_{i,j},x_{l,m})\geq d_\Omega(x_{l,m}) - d_\Omega(x_{i,j}) = 8 r_{l,m} - 8 r_{i,j}> 2^{l+2}-2^{i+3}
\]
and so
\[
\dist(2B_{i,j},B_{l,m})\geq d(x_{i,j},x_{l,m}) - 2r_{i,j} - r_{l,m} > 2^{l+2} - 2^{i+3} - 2^{i+1} - 2^l  > 2^{l+1}-2^{i+4},
\]
which is positive if $l-i>3$.
\end{proof}

We now form a partition of unity subordinate to the Whitney decomposition $W_\Omega$. Select
functions $\varphi_{i,j}$ satisfying the following:
\begin{enumerate}
\item[(i')] $\chi_{\Omega}=\sum\limits_{i,j}\varphi_{i,j}$;
\item[(i'')] for each $i\in{\mathbb Z}$ and $j\in{\mathbb N}$, $0\leq\varphi_{i,j}\leq\chi_{2B_{i,j}}$;
\medskip
\item[(iii')] and, for each $i\in{\mathbb Z}$ and $j\in{\mathbb N}$, $\varphi_{i,j}$ is $C/r_{i,j}$--Lipschitz.
\end{enumerate}

Given a center $x_{i,j}\in\Omega$ of the Whitney ball $B_{i,j}$, denote by $\hat{x}_{i,j}$ a closest point in $\partial\Omega$;
there may be more
than one such choice, but we fix one choice for each $B_{i,j}$. Then set
$U_{i,j}:=B(\hat{x}_{i,j},r_{i,j})\cap\partial\Omega$ and $U_{i,j}^*:=B(\hat{x}_{i,j}, 2^8r_{i,j})$. The number $2^8$ in the construction
of $U_{i,j}^*$ looks strange at this point of the discourse, but it is forced upon us in the proof in the next subsection, see
for instance~\eqref{radii} and~\eqref{osc}. But at this juncture, the reader will not go astray by replacing $2^8$ with any
large constant in visualizing $U_{i,j}^*$ and in the following lemma.

\begin{lem}\label{bdd-overlap-U}
There is a positive integer $N$ that depends only on the doubling constant of $\mu$ such that
for each fixed $i\in{\mathbb Z}$ and for each $j\in{\mathbb N}$,  there are at most $N$ number of sets $U_{i,k}^*$, $k\in{\mathbb N}$,
for which $U_{i,j}^*\cap U_{i,k}^*$ is non-empty.
\end{lem}

\begin{proof}
Indeed, if $U_{i,j}^*$ intersects $U_{i,k}^*$, then we have
\[
d(x_{i,j},x_{i,k})\le d_\Omega(x_{i,j})+d_\Omega(x_{i,k})+d(\hat{x}_{i,j},\hat{x}_{i,k})=8(r_{i,j}+r_{i,k})+2^8(r_{i,j}+r_{i,k})
\le 2^9(r_{i,j}+r_{i,k}).
\]
As $r_{i,k}\le 2^i\le 2r_{i,j}$, it follows that $d(x_{i,j},x_{i,k})\le 2^{10}\, r_{i,j}$, and hence $2^{11}B_{i,j}\cap 2^{11}B_{i,k}$ is non-empty.
By the construction of the Whitney cover, it follows that there are at most $N=N_{2^{11}}$ number of such positive
integers $k$ -- see Remark~\ref{rem:bnded-overlap}.
\end{proof}

We are finally able to construct the extension operator. Beginning with a function $f\in L^1_{\text{loc}}(\partial\Omega)$, we
construct an extension $F$ on $\Omega$ by writing
\begin{equation}\label{construction}
	F(x)=\sum_{i,j}f_{U_{i,j}}\varphi_{i,j}(x),
\end{equation}
where $U_{i,j}:=B(\hat{x}_{i,j},r_{i,j})\cap\partial\Omega$ and $f_{U_{i,j}}:=\fint_{U_{i,j}}\!f\,d\nu$.

\subsection{The extension theorem}

	First, we show that the extension $F$ of a function in $f\in{HB}^{1-\theta/p}_{p,p}(\partial\Omega)$ will be in $D^{1,p}(\Omega)$.

\begin{prop}\label{LipF}
If $f\in HB^{1-\theta/p}_{p,p}(\partial\Omega)$, $1\leq p <\infty$, and $0<\theta<p$, then
$F$ is locally Lipschitz continuous in $\Omega$, and
$\|\Lip F\|_{L^p}\lesssim\|f\|_{HB^{1-\theta/p}_{p,p}(\partial\Omega)}$. In particular, $F\in D^{1,p}(\Omega)$ with
\[
\|F\|_{D^{1,p}}\lesssim\|f\|_{HB^{1-\theta/p}_{p,p}(\partial\Omega)}.
\]
\end{prop}

\begin{proof}
Fix a Whitney ball $B_{l,m}\in W_\Omega$. For any two points $x,y\in B_{l,m}$, we have from property (i') that
\[
\sum_{i,j}(\varphi_{i,j}(y)-\varphi_{i,j}(x))=0,
\]
and so
\[
|F(y)-F(x)|=\left| \sum_{i,j}f_{U_{i,j}}(\varphi_{i,j}(y)-\varphi_{i,j}(x)) \right|=\left| \sum_{i,j}(f_{U_{i,j}}-f_{U_{l,m}})(\varphi_{i,j}(y)-\varphi_{i,j}(x)) \right|.
\]
Denoting by $I(l,m)$ the collection of all $(i,j)$ such that $2B_{i,j}\cap B_{l,m}\neq\emptyset$, we have from properties (ii) and (iii') that
\begin{equation}\label{difference}
|F(y)-F(x)|\leq \sum_{I(l,m)}|f_{U_{i,j}}-f_{U_{l,m}}|\frac{d(y,x)}{r_{i,j}}.
\end{equation}

From Lemma~\ref{claim:intersect} we know that if $(i,j)\in I(l,m)$, then $|i-l|\leq 3$. From this and (iii) it follows that
\begin{equation}\label{radii}
\min_{I(l,m)}r_{i,j}\approx r_{l,m}\approx 2^{l}.
\end{equation}
Lemma~\ref{claim:intersect} also implies that for $(i,j)\in I(l,m)$,
$U_{i,j}\subset B(\hat{x}_{l,m},2^8 r_{l,m})\cap\partial\Omega=:U^*_{l,m}$ and, from the doubling property of $\nu$ we
then also have that $\nu(U^*_{l,m})\approx \nu(U_{l,m})\approx \nu(U_{i,j})$. Thus,
\begin{equation}\label{osc}
|f_{U_{i,j}}-f_{U_{l,m}}|\leq \fint_{U_{i,j}}\fint_{U_{l,m}}\!|f(\zeta)-f(\xi)|\,d\nu(\xi)d\nu(\zeta)
\lesssim \fint_{U^*_{l,m}}\fint_{U^*_{l,m}}\!|f(\zeta)-f(\xi)|\,d\nu(\xi)d\nu(\zeta).
\end{equation}
Hence, for $x\in B_{l,m}$, property (ii) along with equations \eqref{difference}, \eqref{radii}, and \eqref{osc} imply that
\[
\Lip F(x)\lesssim \frac{1}{2^l}\fint_{U^*_{l,m}}\fint_{U^*_{l,m}}\!|f(\zeta)-f(\xi)|\,d\nu(\xi)d\nu(\zeta).
\]
Applying the doubling property of $\mu$ along with the codimensionality condition on $\nu$, we have that
$\mu(B_{l,m})\approx\mu(U_{l,m})\lesssim r_{l,m}^\theta\nu(U_{l,m})\approx 2^{l\theta}\nu(U^*_{l,m})$, and so
\begin{align*}
\int_{\Omega}\!(\Lip F)^p\,d\mu\leq\sum_{l,m}\int_{B_{l,m}}\!(\Lip F)^p\,d\mu
&\lesssim \sum_{l,m}\frac{\mu(B_{l,m})}{(2^l)^p}\left(\fint_{U^*_{l,m}}\fint_{U^*_{l,m}}\!|f(\zeta)-f(\xi)|\,d\nu(\xi)d\nu(\zeta)\right)^p\\
&\lesssim \sum_{l,m}\frac{\nu(U^*_{l,m})}{(2^l)^{p-\theta}}\fint_{U^*_{l,m}}\fint_{U^*_{l,m}}\!|f(\zeta)-f(\xi)|^p\,d\nu(\xi)d\nu(\zeta)\\
&= \sum_{l,m}\frac{1}{(2^l)^{p-\theta}}\int_{U^*_{l,m}}\fint_{U^*_{l,m}}\!|f(\zeta)-f(\xi)|^p\,d\nu(\xi)d\nu(\zeta).
\end{align*}
For $\zeta\in U^*_{l,m}$, we have
$U^*_{l,m}\subset B(\zeta,2^9r_{l,m})\cap\partial\Omega\subset B(\zeta,C\,2^{l})\cap\partial\Omega$ with
$\nu(U^*_{l,m})\approx\nu(B(\zeta,C\,2^{l})\cap\partial\Omega)$ from the doubling property of $\nu$. This implies that
\begin{align*}
\int_{\Omega}\!(\Lip F)^p\,d\mu&\lesssim \sum_{l,m}\frac{1}{(2^l)^{p-\theta}}\int_{U^*_{l,m}}\fint_{B(\zeta,C\,2^{l})\cap\partial\Omega}\!|f(\zeta)-f(\xi)|^p\,d\nu(\xi)d\nu(\zeta)\\
&\lesssim  \sum_{l}\frac{1}{(2^l)^{p-\theta}}\int_{\partial\Omega}\fint_{B(\zeta,C\,2^{l})\cap\partial\Omega}\!|f(\zeta)-f(\xi)|^p\,d\nu(\xi)d\nu(\zeta)
\end{align*}
using the fact that $\{U^*_{l,m}\}_m$ has bounded overlap for each fixed $l$, see Lemma~\ref{bdd-overlap-U}.
Finally, by~\eqref{rem:partition},
\[
\int_{\Omega}\!(\Lip F)^p\,d\mu\lesssim \int_{0}^{\infty}\frac{1}{r^{p-\theta}}\int_{\partial\Omega}\fint_{B(\zeta,r)\cap\partial\Omega}\!|f(\zeta)-f(\xi)|^p\,d\nu(\xi)d\nu(\zeta)\frac{dr}{r}\approx\|f\|^p_{{HB}^{1-\theta/p}_{p,p}(\partial\Omega)}.
\]
\end{proof}

Next, we show that this extension is really an extension.

\begin{prop}\label{thm:L^p-trace}
If $f\in L^p_{\text{loc}}(\partial\Omega)$, $1\leq p <\infty$, then
\[
\lim_{r\rightarrow 0^+}\fint_{B(\zeta,r)\cap\Omega}\!|F-f(\zeta)|^p\,d\mu=0
\]
for $\nu$-a.e. $\zeta\in\partial\Omega$. That is, the trace of $F$ exists and equals $f$ $\nu$-a.e..
\end{prop}

We will prove the above proposition using Lebesgue's differentiation theorem for the function $f$ with respect to
$\nu$, together with the following lemmas.

\begin{lem}\label{prop:Lploc}
If $f\in L^p_{\text{loc}}(\partial\Omega)$, then
\begin{equation}\label{eq:Lploc}
\int_{B_{l,m}}\!|F|^p\,d\mu\lesssim 2^{l\theta}\int_{U^*_{l,m}}\!|f|^p\,d\nu.
\end{equation}
\end{lem}

\begin{proof}
Fix a Whitney ball $B_{l,m}\in W_\Omega$. Lemma~\ref{claim:intersect} implies that
$U_{i,j}\subset U^*_{l,m}$ for all $(i,j)\in I(l,m)$
and that $\nu(U^*_{l,m})\approx\nu(U_{i,j})$. Thus, by property (i') and by H\"older's inequality,
\begin{align*}
\int_{B_{l,m}}\!|F|^p\,d\mu=\int_{B_{l,m}}\!\left|\sum_{I(l,m)}\left(\fint_{U_{i,j}}\!f\,d\nu\right)\varphi_{i,j}\right|^pd\mu
&\leq \int_{B_{l,m}}\!\left(\left(\fint_{U^*_{l,m}}\!|f|\,d\nu\right)\sum_{i,j}\varphi_{i,j}\right)^pd\mu\\
&\leq\mu(B_{l,m})\fint_{U^*_{l,m}}\!|f|^p\,d\nu.
\end{align*}
As $\mu(B_{l,m})\lesssim 2^{l\theta}\nu(U^*_{l,m})$ (this follows from the doubling property of $\mu$ and the
$\theta$-codimensionality of $\nu$), we have the desired inequality.
\end{proof}

\begin{lem}\label{prop:Lploc-layer}
If $f\in L^p_{\text{loc}}(\partial\Omega)$ and $r>0$, then
\[
\int_{B(\zeta,r)\cap\Omega}\!|F|^p\,d\mu\lesssim r^\theta \int_{B(\zeta,2^8r)\cap\partial\Omega}\!|f|^p\,d\nu.
\]
\end{lem}

\begin{proof}
Fix $\zeta\in\partial\Omega$ and $r>0$.
Suppose that some Whitney ball $B_{i,j}$ intersects  $B(\zeta,r)$. Then by the construction of the Whitney cover, we have
$8r_{i,j}=d_\Omega(x_{i,j})\le d(\zeta,x_{i,j})$, and so it follows that $r_{i,j}\le r/7$. Let $I(r)$ be the collection of all integers $i$ for which
there is some positive integer $j$ with $B_{i,j}\cap B(\zeta,r)$ non-empty. For each $i\in I(r)$,
denote  by $\mathcal{J}(i)$ the collection of $j\in{\mathbb N}$ such that $B_{i,j}\cap B(\zeta,r)\neq\emptyset$.
Then~\eqref{eq:Lploc} implies that
\[
\int_{B(\zeta,r)\cap\Omega}\!|F|^p\,d\mu
\leq \sum_{i\in I(r)}\sum_{j\in\mathcal{J}(i)}\int_{B_{i,j}}\!|F|^p\,d\mu
\lesssim \sum_{i\in I(r)}\sum_{j\in\mathcal{J}(i)}2^{i\theta}\int_{U^*_{i,j}}\!|f|^p\,d\nu.
\]
For $i\in I(r)$ and $j\in\mathcal{J}(i)$, we have that $B_{i,j}\cap B(\zeta,r)\neq\emptyset$ and
so $d(\zeta,x_{i,j})\leq r+r_{i,j}$. Recall that for each $i\in I(r)$ and $j\in\mathcal{J}(i)$ we have
\begin{equation}\label{eq:rij-r}
2^{i-1}\le r_{i,j}\le r/7.
\end{equation}
The triangle inequality then implies that
$U^*_{i,j}\subset B(\zeta, r+2^9r_{i,j})\subset B(\zeta, 2^8r)$.
By the bounded overlap property of $\{U^*_{i,j}\}_{j\in\mathcal{J}(i)}$ for each fixed $i\in I(r)$, see
Lemma~\ref{bdd-overlap-U}, we have that
\begin{align*}
\sum_{i\in I(r)}2^{i\theta}\sum_{j\in\mathcal{J}(i)}\int_{U^*_{i,j}}\!|f|^p\,d\nu
&\lesssim \sum_{i\in I(r)}2^{i\theta}\int_{B(\zeta, 2^8r)\cap\partial\Omega}|f|^p\, d\nu\\
&=2^{i_0\theta}\left(\sum_{i=0}^\infty 2^{-i\theta}\right)\, \int_{B(\zeta, 2^8r)\cap\partial\Omega}|f|^p\, d\nu\\
&\approx 2^{i_0\theta}\, \int_{B(\zeta, 2^8r)\cap\partial\Omega}|f|^p\, d\nu,
\end{align*}
where $i_0=\max I(r)$. Since for $i\in I(r)$ we have $2^{i-1}\le r/7$,
see~\eqref{eq:rij-r} above,
it follows that $2^{i_0\theta}\lesssim r^\theta$; the
claim of the lemma now follows.
\end{proof}

\begin{proof}[Proof of Proposition~\ref{thm:L^p-trace}]
Fix $\zeta\in\partial\Omega$ and write $f_{\zeta}(\xi)=f(\xi)-f(\zeta)$ for $\xi\in\partial\Omega$.
We have that $f_{\zeta}\in L^p_{\text{loc}}(\partial\Omega)$ and its extension $F_{\zeta}$
satisfies $F_{\zeta}(x)=F(x)-f(\zeta)$ for every $x\in\Omega$. An application of
Lemma~\ref{prop:Lploc-layer} to $f_{\zeta}$ yields
\begin{align*}
\int_{B(\zeta,r)\cap\Omega}\!|F(x)-f(\zeta)|^p\,d\mu(x)
&=\int_{B(\zeta,r)\cap\Omega}\!|F_{\zeta}(x)|^p\,d\mu(x)\\
&\lesssim r^\theta \int_{B(\zeta,2^8r)\cap\partial\Omega}\!|f_\zeta(\xi)|^p\,d\nu(\xi)
=r^\theta \int_{B(\zeta,2^8r)\cap\partial\Omega}\!|f(\xi)-f(\zeta)|^p\,d\nu(\xi).
\end{align*}
From the doubling and codimensionality of $\nu$ it follows that
\[
\fint_{B(\zeta,r)\cap\Omega}\!|F(x)-f(\zeta)|^p\,d\mu(x)\lesssim \fint_{B(\zeta,r)\cap\partial\Omega}\!|f(\xi)-f(\zeta)|^p\,d\nu(\xi).
\]
By the local $p$-integrability of $f$, $\nu$-almost every $\zeta\in\partial\Omega$ is a Lebesgue point of $f$,
and so the right-hand side of the above inequality tends to 0 as $r\rightarrow{0^+}$ for $\nu$-almost every $\zeta\in\partial\Omega$.
	\end{proof}

Now we are ready to prove the second part of Theorem~\ref{thm:main}.

\begin{thm}\label{thm:ext}
Let $1\leq p <\infty$ and $0<\theta<p$. There is a bounded linear extension operator
$E:HB^{1-\theta/p}_{p,p}(\partial\Omega)\to D^{1,p}(\Omega)$ such that
$T\circ E$ is the identity map on $HB^{1-\theta/p}_{p,p}(\partial\Omega)$, where $T$ is the trace operator constructed in
the proof of Theorem~\ref{thm:trace}.
\end{thm}

\begin{proof}
For $f\in HB^{1-\theta/p}_{p,p}(\partial\Omega)$, take $Ef=F$, where $F$ is as in \eqref{construction}. Then $E$ is linear
by construction and is bounded from $HB^{1-\theta/p}_{p,p}(\partial\Omega)$ to $D^{1,p}(\Omega)$ by Proposition~\ref{LipF}.
Consider the trace operator $T$ from Theorem~\ref{thm:trace}. Then $T\circ E f = TF = f$ $\nu$-almost everywhere
by Proposition~\ref{thm:L^p-trace}.
\end{proof}

This completes the proof of the main theorem of this note, Theorem~\ref{thm:main}.