[proofplan]
We first record the finite-distance part of the argument: Gromov-Hausdorff convergence gives maps from $X$ into $X_j$ whose distortions tend to zero, so every finite distance vector in $X$ is the ordinary Euclidean limit of corresponding distance vectors in $X_j$. Since each approximating vector lies in the [closed set](/page/Closed%20Set) $C$, closedness forces the limiting vector to lie in $C$. We then prove that the compact limit is geodesic by approximating midpoints in the spaces $X_j$ and passing to a convergent subsequence. Iterating the midpoint construction gives isometric embeddings of dyadic subdivisions, and compactness extends them to geodesic segments.
[/proofplan]
[step:Pass finite distance vectors to the limit through Gromov-Hausdorff approximations]
Let $N := k(k-1)/2$. By the standard characterization of Gromov-Hausdorff convergence by almost isometries, there exist numbers $\varepsilon_j > 0$ with $\varepsilon_j \to 0$ and maps
\begin{align*}
f_j: X &\to X_j
\end{align*}
such that the following two properties hold. First, for all $x,y \in X$,
\begin{align*}
\bigl|d_j(f_j(x),f_j(y)) - d(x,y)\bigr| \leq \varepsilon_j.
\end{align*}
Second, $f_j(X)$ is an $\varepsilon_j$-net in $X_j$, meaning that for every $y_j \in X_j$ there exists $x \in X$ such that
\begin{align*}
d_j(f_j(x),y_j) \leq \varepsilon_j.
\end{align*}
Fix an ordered $k$-tuple $(x_1,\dots,x_k) \in X^k$. For each $j \in \mathbb{N}$, define
\begin{align*}
v_j
:=
D_{X_j}(f_j(x_1),\dots,f_j(x_k))
=
\bigl(d_j(f_j(x_a),f_j(x_b))\bigr)_{1 \leq a < b \leq k}
\in \mathbb{R}^N.
\end{align*}
Because $(X_j,d_j)$ satisfies the comparison condition, $v_j \in C$ for every $j$.
Define also the limiting distance vector
\begin{align*}
v
:=
D_X(x_1,\dots,x_k)
=
\bigl(d(x_a,x_b)\bigr)_{1 \leq a < b \leq k}
\in \mathbb{R}^N.
\end{align*}
For each coordinate indexed by a pair $1 \leq a < b \leq k$,
\begin{align*}
\bigl|(v_j)_{ab} - v_{ab}\bigr|
=
\bigl|d_j(f_j(x_a),f_j(x_b)) - d(x_a,x_b)\bigr|
\leq \varepsilon_j.
\end{align*}
Hence $v_j \to v$ in $\mathbb{R}^N$. Since $C$ is closed and $v_j \in C$ for all $j$, we obtain $v \in C$.
The tuple $(x_1,\dots,x_k)$ was arbitrary, so $(X,d)$ satisfies the closed finite distance comparison condition.
[guided]
The point of using a closed subset $C \subset \mathbb{R}^N$ is that the whole comparison statement has been reduced to an ordinary limit statement in finite-dimensional Euclidean space. Here $N := k(k-1)/2$ is the number of pairwise distances among $k$ ordered points.
Gromov-Hausdorff convergence gives approximate distance-preserving and almost-surjective maps from the limit space into the approximating spaces. Concretely, by the standard characterization of Gromov-Hausdorff convergence by almost isometries, there are numbers $\varepsilon_j > 0$ with $\varepsilon_j \to 0$ and maps
\begin{align*}
f_j: X &\to X_j
\end{align*}
such that, for every pair $x,y \in X$,
\begin{align*}
\bigl|d_j(f_j(x),f_j(y)) - d(x,y)\bigr| \leq \varepsilon_j,
\end{align*}
and such that $f_j(X)$ is an $\varepsilon_j$-net in $X_j$. The latter means that for every $y_j \in X_j$ there is some $x \in X$ with
\begin{align*}
d_j(f_j(x),y_j) \leq \varepsilon_j.
\end{align*}
For the finite-distance comparison step, the distortion estimate is the essential part, because the comparison condition only sees finitely many distances. The net property will be used later when we pull approximate midpoints in $X_j$ back to points of $X$.
Now fix any ordered $k$-tuple $(x_1,\dots,x_k) \in X^k$. For each $j$, push this tuple into $X_j$ using $f_j$ and form the distance vector
\begin{align*}
v_j
:=
D_{X_j}(f_j(x_1),\dots,f_j(x_k))
=
\bigl(d_j(f_j(x_a),f_j(x_b))\bigr)_{1 \leq a < b \leq k}
\in \mathbb{R}^N.
\end{align*}
Since $(X_j,d_j)$ satisfies the finite distance comparison condition, this vector belongs to $C$.
The corresponding distance vector in the limit space is
\begin{align*}
v
:=
D_X(x_1,\dots,x_k)
=
\bigl(d(x_a,x_b)\bigr)_{1 \leq a < b \leq k}
\in \mathbb{R}^N.
\end{align*}
For every coordinate $1 \leq a < b \leq k$, the distortion estimate gives
\begin{align*}
\bigl|(v_j)_{ab} - v_{ab}\bigr|
=
\bigl|d_j(f_j(x_a),f_j(x_b)) - d(x_a,x_b)\bigr|
\leq \varepsilon_j.
\end{align*}
Since $\varepsilon_j \to 0$, every coordinate of $v_j$ converges to the corresponding coordinate of $v$, and therefore $v_j \to v$ in $\mathbb{R}^N$.
The final step is exactly where closedness is used. A closed set contains the limits of convergent sequences contained in it. Since each $v_j$ lies in $C$ and $v_j \to v$, we conclude that $v \in C$. Because the original tuple in $X$ was arbitrary, every finite configuration in $X$ satisfies the same closed distance condition.
[/guided]
[/step]
[step:Construct exact midpoints in the limit space]
Let $x_0,x_1 \in X$ be arbitrary. We prove that there exists $m \in X$ such that
\begin{align*}
d(x_0,m) = d(m,x_1) = \frac{1}{2}d(x_0,x_1).
\end{align*}
Use the maps $f_j: X \to X_j$ from the previous step, which have distortion at most $\varepsilon_j$ and whose images are $\varepsilon_j$-nets in $X_j$. Since $X_j$ is geodesic, for each $j$ there exists $m_j \in X_j$ satisfying
\begin{align*}
d_j(f_j(x_0),m_j)
=
d_j(m_j,f_j(x_1))
=
\frac{1}{2}d_j(f_j(x_0),f_j(x_1)).
\end{align*}
By the $\varepsilon_j$-net property of $f_j(X) \subset X_j$, applied to the point $m_j \in X_j$, choose $z_j \in X$ such that
\begin{align*}
d_j(f_j(z_j),m_j) \leq \varepsilon_j.
\end{align*}
Compactness of $X$ gives a subsequence $(z_{j_\ell})_{\ell \in \mathbb{N}}$ and a point $m \in X$ such that $z_{j_\ell} \to m$ in $X$.
For $i \in \{0,1\}$, the triangle inequality in $X_{j_\ell}$ gives
\begin{align*}
\bigl|d_{j_\ell}(f_{j_\ell}(x_i),f_{j_\ell}(z_{j_\ell}))
-
d_{j_\ell}(f_{j_\ell}(x_i),m_{j_\ell})\bigr|
\leq
d_{j_\ell}(f_{j_\ell}(z_{j_\ell}),m_{j_\ell})
\leq
\varepsilon_{j_\ell}.
\end{align*}
Using the distortion estimate for $f_{j_\ell}$,
\begin{align*}
d(x_i,z_{j_\ell})
\to
\frac{1}{2}d(x_0,x_1).
\end{align*}
Since $z_{j_\ell} \to m$ and $d$ is continuous as a map $X \times X \to \mathbb{R}$, we obtain
\begin{align*}
d(x_i,m)
=
\frac{1}{2}d(x_0,x_1)
\end{align*}
for $i \in \{0,1\}$. Thus $m$ is a midpoint of $x_0$ and $x_1$.
[guided]
We want to prove that the compact limit has actual midpoints, not merely approximate midpoints. Fix arbitrary points $x_0,x_1 \in X$. The Gromov-Hausdorff approximations from the previous step give maps $f_j: X \to X_j$ with distortion at most $\varepsilon_j$ and with $f_j(X)$ an $\varepsilon_j$-net in $X_j$, where $\varepsilon_j \to 0$.
Because $X_j$ is geodesic, there is a midpoint $m_j \in X_j$ between $f_j(x_0)$ and $f_j(x_1)$, so
\begin{align*}
d_j(f_j(x_0),m_j)
=
d_j(m_j,f_j(x_1))
=
\frac{1}{2}d_j(f_j(x_0),f_j(x_1)).
\end{align*}
The point $m_j$ need not lie in the image of $f_j$, so this is where almost-surjectivity is necessary. Since $f_j(X)$ is an $\varepsilon_j$-net in $X_j$, there exists $z_j \in X$ such that
\begin{align*}
d_j(f_j(z_j),m_j) \leq \varepsilon_j.
\end{align*}
Compactness of $X$ now lets us pass from the approximate preimages $z_j$ to an actual point of $X$. Choose a subsequence $(z_{j_\ell})_{\ell \in \mathbb{N}}$ and a point $m \in X$ such that $z_{j_\ell} \to m$ in $X$. For $i \in \{0,1\}$, the [reverse triangle inequality](/theorems/2300) in the [metric space](/page/Metric%20Space) $(X_{j_\ell},d_{j_\ell})$ gives
\begin{align*}
\bigl|d_{j_\ell}(f_{j_\ell}(x_i),f_{j_\ell}(z_{j_\ell}))
-
d_{j_\ell}(f_{j_\ell}(x_i),m_{j_\ell})\bigr|
\leq
d_{j_\ell}(f_{j_\ell}(z_{j_\ell}),m_{j_\ell})
\leq
\varepsilon_{j_\ell}.
\end{align*}
The distortion estimate also gives
\begin{align*}
\bigl|d_{j_\ell}(f_{j_\ell}(x_i),f_{j_\ell}(z_{j_\ell})) - d(x_i,z_{j_\ell})\bigr| \leq \varepsilon_{j_\ell}
\end{align*}
and
\begin{align*}
\bigl|d_{j_\ell}(f_{j_\ell}(x_0),f_{j_\ell}(x_1)) - d(x_0,x_1)\bigr| \leq \varepsilon_{j_\ell}.
\end{align*}
Combining these three estimates with the midpoint identity for $m_{j_\ell}$ yields
\begin{align*}
d(x_i,z_{j_\ell}) \to \frac{1}{2}d(x_0,x_1).
\end{align*}
Finally, the metric $d: X \times X \to \mathbb{R}$ is continuous, and $z_{j_\ell} \to m$. Therefore
\begin{align*}
d(x_i,m) = \frac{1}{2}d(x_0,x_1)
\end{align*}
for $i \in \{0,1\}$. This proves that $m$ is an exact midpoint of $x_0$ and $x_1$ in the limit space $X$.
[/guided]
[/step]
[step:Build geodesic segments from iterated midpoints]
Fix $x_0,x_1 \in X$ and write $L := d(x_0,x_1)$. If $L = 0$, the constant map
\begin{align*}
\gamma: [0,L] &\to X \\
t &\mapsto x_0
\end{align*}
is a geodesic segment.
Assume $L > 0$. By the midpoint construction, we inductively choose points $x_q \in X$ for every dyadic rational $q \in [0,1]$, meaning every number of the form $q = a2^{-r}$ with $a,r \in \mathbb{N} \cup \{0\}$ and $0 \leq a \leq 2^r$. Start with the prescribed endpoints $x_0$ and $x_1$. Suppose the points at level $r$ have been chosen so that
\begin{align*}
d(x_{a2^{-r}},x_{b2^{-r}}) = (b-a)2^{-r}L
\end{align*}
for all integers $a,b$ with $0 \leq a \leq b \leq 2^r$. For each $a \in \{0,\dots,2^r-1\}$, insert a midpoint $x_{(2a+1)2^{-(r+1)}}$ between $x_{a2^{-r}}$ and $x_{(a+1)2^{-r}}$. Adjacent level-$(r+1)$ distances are then all equal to $2^{-(r+1)}L$.
For non-adjacent level-$(r+1)$ points, the triangle inequality gives the upper bound by summing adjacent distances along the dyadic chain. The lower bound follows from the triangle inequality applied to the complementary pieces of the same chain: if $0 \leq a \leq b \leq 2^{r+1}$, then
\begin{align*}
L
=
d(x_0,x_1)
\leq
d(x_0,x_{a2^{-(r+1)}})
+
d(x_{a2^{-(r+1)}},x_{b2^{-(r+1)}})
+
d(x_{b2^{-(r+1)}},x_1).
\end{align*}
The two outer terms are already equal to $a2^{-(r+1)}L$ and $(2^{r+1}-b)2^{-(r+1)}L$ by the adjacent-chain upper bound. Rearranging gives
\begin{align*}
d(x_{a2^{-(r+1)}},x_{b2^{-(r+1)}}) \geq (b-a)2^{-(r+1)}L.
\end{align*}
Together with the upper bound, this proves
\begin{align*}
d(x_q,x_{q'})
=
|q-q'|L
\end{align*}
for all dyadic rationals $q,q' \in [0,1]$.
Define
\begin{align*}
\gamma_0: [0,1] \cap \mathbb{Q}_{\mathrm{dyad}} &\to X \\
q &\mapsto x_q,
\end{align*}
where $\mathbb{Q}_{\mathrm{dyad}} := \{a2^{-r} : a,r \in \mathbb{N} \cup \{0\}\}$. The distance identity shows that $\gamma_0$ is $L$-Lipschitz on the dyadic rationals. Since $X$ is compact, hence complete, and the dyadic rationals are dense in $[0,1]$, $\gamma_0$ extends uniquely to a continuous map
\begin{align*}
\gamma: [0,1] &\to X.
\end{align*}
For arbitrary $s,t \in [0,1]$, choose dyadic sequences $(s_n)_{n \in \mathbb{N}}$ and $(t_n)_{n \in \mathbb{N}}$ with $s_n \to s$ and $t_n \to t$. Continuity of $\gamma$ and of $d$ gives
\begin{align*}
d(\gamma(s),\gamma(t))
=
\lim_{n \to \infty} d(\gamma_0(s_n),\gamma_0(t_n))
=
\lim_{n \to \infty} |s_n-t_n|L
=
|s-t|L.
\end{align*}
Therefore the map
\begin{align*}
\tilde{\gamma}: [0,L] &\to X \\
t &\mapsto \gamma(t/L)
\end{align*}
satisfies
\begin{align*}
d(\tilde{\gamma}(s),\tilde{\gamma}(t)) = |s-t|
\end{align*}
for all $s,t \in [0,L]$. Hence $\tilde{\gamma}$ is a geodesic from $x_0$ to $x_1$.
[/step]
[step:Conclude stability of distance-only triangle comparison]
We have shown two facts. First, every closed finite distance condition satisfied by all $(X_j,d_j)$ is satisfied by $(X,d)$. Second, the compact limit $(X,d)$ is geodesic.
A triangle comparison property expressible only through finitely many distances and a closed inequality condition is precisely a closed finite distance condition after including all points that appear in the comparison configuration, such as triangle vertices and designated points on geodesic sides. Since the corresponding set of admissible distance vectors is closed in a finite-dimensional Euclidean space, the preceding finite-distance argument applies to it. Therefore $(X,d)$ satisfies the same triangle comparison inequality as the spaces $(X_j,d_j)$. This proves the theorem.
[/step]