Extending isometries between compact subspaces of Cantor space Let $\omega$ be the set of natural numbers. $2^\omega$ is the Cantor space.
Suppose $K$, $L \subset 2^\omega$ are compact, and there is an isometry $f: K \to L$.  Then how could one extend $f$ to an isometry from $2^\omega$ to $2^\omega$?  Here we are considering $2^\omega$ with the minimum difference metric, which gives the standard product topology; i.e.
$ d(x,y) = 2^{-\min \{ n : x(n) \neq y(n) \}}. $
 A: When $u$ is a finite binary word, $u\cdot 2^\omega$ means the interval of $2^\omega$ formed by infinite words with prefix $u$ ($\cdot$ denotes word concatenation).
Let $A_{fin}$ be the set of finite prefixes of $A\subseteq 2^\omega$.
We say that $F: A_{fin}\to B_{fin}$ is an isometry if:


*

*$|F(x)|=|x|$;

*$x\preceq y$ implies $F(x)\preceq F(y)$ where $\preceq$ is the prefix relation;

*$F$ is injective, or equivalently $F(x0)\ne F(x1)$ when both are in the domain of $F$.


Side-note: When $A_{fin}=B_{fin}$ (or more generally, when the multiset of word lengths of $A_{fin}$ and $B_{fin}$ coincide), the last condition can also be replaced by "$F$ is bijective". The first condition then becomes redundant.

Lemma: The relation
  $$\forall u\in A_{fin}, \quad f(u\cdot 2^\omega)\subseteq F(u)\cdot 2^\omega$$
  is a bijection between isometries $f: A\to B$ and isometries $F: A_{fin}\to B_{fin}$.

Proof:


*

*When $uv\in A$, $F(u)$ must be the first $|u|=n$ symbols of $f(uv)$. This constructs $F$ in a well-defined way because $d(f(uv),f(uw))=d(uv,uw)\le 2^{-n}$. When $x\ne y$, if $|x|\ne|y|$ then of course $F(x)\ne F(y)$; otherwise $d(f(x),f(y))=d(x,y)>2^{-|x|}$ therefore $F(x)\ne F(y)$.

*Conversely, $f(x)=\lim_{u\preceq x} F(u)$ is well-defined by monotony of $F$, and if $d(x,y)=2^{-n}$ we can let $u0,u1$ be the prefixes of length $n+1$ of $x,y$: $2^{-n}=d(u0,u1)=d(F(u0),F(u1))=d(f(x),f(y))$.


Side-note: this also gives the following statement, which was not a priori obvious:

Corollary: An isometry $f: A\to A$ on $2^\omega$ is a bijection.



Corollary: Isometries $A_{fin}\to B_{fin}$ as defined above are precisely the isometries $A_{fin}\to B_{fin}$ under the minimum difference metric and under word length, where the metric is extended to finite words by $d(x,u)=\max d(x,u0^\omega),d(x,u1^\omega)$. This justifies the use of the word "isometry".



Theorem: Let $A,B$ be arbitrary subsets of $2^\omega$. An isometry $f: A\to B$ can be extended to an isometry $g: 2^\omega\to 2^\omega$. As could also be shown by topological arguments, the extension is unique if and only if $A_{fin}=(2^\omega)_{fin}$, that is iff $A$ is dense in $2^\omega$.

Proof: We just have to extend an isometry $F:A_{fin}\to B_{fin}$. When $u$ is non-empty, let $\sigma_F(u)$ be the last symbol of $F(u)$. We have that $\sigma:\{0,1\}^+\to\{0,1\}$ is the last symbol of an isometry $(2^\omega)_{fin}\to (2^\omega)_{fin}$ if and only if $\sigma(x1)=\neg \sigma(x0)$. So we can define $$\sigma(x0)=\begin{cases}
\sigma_F(x0) & x0\in A_{fin}\\
\neg\sigma_F(x1) & x1\in A_{fin}\\
0 & \text{else}
\end{cases}$$
so that the relations $\sigma(x1)=\neg \sigma(x0)$ and $G(ua)=G(u)\sigma(ua)$ uniquely define an isometry $G: (2^\omega)_{fin}\to (2^\omega)_{fin}$. $G$ extends $F$, so the isometry $g: 2^\omega\to 2^\omega$ extends $f$.
