% vim: tw=50
% 27/10/2022 11AM

\myskip
Can this theorem be generalised to any metric
space? Obviously not: for example in $\RR
\setminus \{0\}$ with usual metric, the set $[-1,
0) \cup (0, 1]$ is closed and bounded but the
sequence $\left( \frac{1}{n} \right)_{n \ge 1}$
has no convergent subsequence. \myskip
Problem: space not complete. Maybe complete +
bounded could imply sequentially compact? \\
Even this doesn't work. Recall example from
section 1: let
\[ X = \{f \in B(\RR) \mid \sup_{x \in \RR} |f(x)|
\le 1\} \]
with uniform metric. Then $X$ is complete (closed
subset of complete space $B(\RR)$) and bounded (if
$f, g \in X$, $d(f, g) \le 2$). But consider
\[ f_n(x) = \begin{cases}
    1 & x = n \\
    0 & x \neq n
\end{cases} \]
Then $(f_n)$ is a sequence in $X$ but $\forall m,
n$, $m \neq n$ implies $d(f_m, f_n) = 1$. So
$(f_n)$ cannot have a convergent subsequence. So
the problem is that $X$ is `too big'. So we need a
stronger concept of boundedness.

\begin{definition*}
    Let $(X, d)$ be a metric space. We say $X$ is
    \emph{totally bounded} if for all $\delta > 0$
    we can find a \emph{finite} set $A \subset X$
    such that $\forall x \in X$ $\exists a \in A$
    with $d(x, a) < \delta$.
\end{definition*}

\begin{theorem}
    A metric space is sequentially compact if and
    only if it is complete and totally bounded.
\end{theorem}

\begin{proof}
    \begin{enumerate}
        \item[$\Leftarrow$] Suppose the metric
            space $(X, d)$ is complete and totally
            bounded. Let $(x_n)_{n \ge 1}$ be a
            sequence in $X$. \myskip
            As $X$ is totally bounded, can find
            finite $A_1 \subset X$ such that $\forall
            x \in X$ there exists $a \in A_1$ with
            $d(x, a) < 1$. In particular there is
            an infinite set $N_1 \subset \NN$ and
            a point $a_1 \in A_1$ such that
            $\forall n \in N_1$, $d(x_N, a_1) <
            1$. Hence $\forall m, n \in N_1$,
            $d(x_m, x_n) < 2$. Similarly, we can
            find finite $A_2 \subset X$ such that
            $\forall x \in X$, $\exists a \in
            A_2$, $d(x, a) < \half$. In
            particular, there is an infinite $N_2
            \subset N_1$ such that $\forall n \in
            N_2$, $d(x_n, a_2) < \half$ and thus
            $\forall m, n \in N_2$, $d(x_m, x_n) <
            1$. \myskip
            Keep going. We get a sequence $N_1
            \supset N_2 \supset N_3 \supset
            \cdots$ of infinite subsets of $\NN$
            such that $\forall i$, $\forall m, n$,
            $m, n \in \NN_i \implies d(x_m, x_n) <
            \frac{2}{i}$. \myskip
            Now pick $n_1 \in N_2$. Then pick $n_2
            \in N_2$ with $n_2 > n_1$. Then pick
            $n_3 \in N_3$ with $n_3 > n_2$ and so
            on. We obtain a subsequence
            $(x_{n_j})$ of $(x_n)$ such that for
            all $j$, $x_{n_j} \in N_j$. Thus if $i
            \le j$ then $x_{n_i}, x_{n_j} \in N_i$
            and so
            \[ d(x_{n_i}, x_{n_j}) < \frac{2}{i} \]
            Hence $(x_{n_j})$ is a Cauchy sequence
            and hence, by completeness, converges.
            So $X$ is sequentially compact.
        \item[$\Rightarrow$] Suppose $X$ is not
            complete. Then $X$ has a Cauchy
            sequence $(x_n)$ which doesn't
            converge. Suppose we have a convergent
            subsequence, say $x_{n_j} \to x$. Then
            $x_n \to x$ (exercise). Contradiction.
            \myskip
            Suppose instead $X$ is not totally
            bounded. Then there is some $\delta >
            0$ such that whenever $A \subset X$ is
            finite, there exists $x \in X$ such
            that $\forall a \in A$, $d(x, a) \ge
            \delta$. So pick $x_1 \in X$. Pick
            $x_2 \in X$ such that $d(x_1, x_2) \ge
            \delta$. Pick $x_3 \in X$ such that
            $d(x_1, x_3) \ge \delta$ and $d(x_2,
            x_3) \ge \delta$. Continue. Then we
            get a sequence $(x_n)$ in $X$ such
            that for all $i, j$ with $i \neq j$,
            $d(x_i, x_j) \ge \delta$. Then $(x_n)$
            has no convergent subsequence.
    \end{enumerate}
\end{proof}

\myskip
Exercise: A continuous function on a sequentially
compact metric space is uniformly continuous. If
the function is real-valued then it's bounded and
attains its bounds.

\subsection{The Topology of Metric Spaces}

Theme of section 2: to generalise convergence /
continuity, all we need is a distance. \myskip
But, for example in $\RR^n$ we have the very
different concepts of distance given by the
Euclidean, $l_1$ and $l_\infty$ metrics. But all
give same concept of convergence and continuity.

\begin{definition*}
    Let $(X, d)$ and $(Y, e)$ be metric spaces.
    Let $f : X \to Y$. We say $f$ is a
    \emph{homeomorphism} and that $X, Y$ are
    \emph{homeomorphic} if $f$ is a continuous
    bijection with continuous inverse.
\end{definition*}

\begin{remark*}
    Homeomorphism is an equivalence `relation'.
\end{remark*}

\subsubsection*{Examples}

\begin{enumerate}[(1)]
    \item If $x, y \in \RR^n$:
        \[ d_\infty(x, y) \le d_1(x, y) \le
        nd_\infty(x, y) \]
        So identity map $\RR^n \to \RR^n$ is
        continuous as map $(\RR^n, d_1) \to
        (\RR^n, d_\infty)$ and inverse map
        $(\RR^n, d_\infty) \to (\RR^n, d_1)$ is
        continuous. So it's a homeomorphism.
        Similarly, $\RR^n$ with Euclidean metric
        is homeomorphic to both these spaces.
    \item Same argument would show: if $(X, d)$
        and $(Y, e)$ are metric spaces and $f : X
        \to Y$ is a bijection satisfying:
        \begin{enumerate}[(i)]
            \item $\exists A ~ \forall x, y \in
                X$, $e(f(x), f(y)) \le A d(x, y)$.
            \item and $\exists B ~\forall x, y \in
                X$, $d(x, y) \le B e(f(x), f(y))$.
        \end{enumerate}
        Then $f, f^{-1}$ are continuous so $X, Y$
        are homeomorphic.
    \item Define $f : \left( -\frac{\pi}{2},
        \frac{\pi}{2} \right) \to \RR$ by $f(x) =
        \tan x$. Then $f$ is a homeomorphism (usual
        metric in each case). But there is no
        constant $A$ such that
        \[ \forall x, y \in \left( -\frac{\pi}{2},
        \frac{\pi}{2} \right) |\tan x - \tan y|
        \le A|x - y| \]
\end{enumerate}

\begin{proposition}
    Let $(V, b)$, $(W, c)$, $(X, d)$, $(Y, e)$ be
    metric spaces and $f : X \to V$, $g : Y \to W$
    be homeomorphisms. Then
    \begin{enumerate}[(i)]
        \item In $X$, $x_n \to x$ if and only if
            in $V$, $f(x_n) \to f(x)$;
        \item and a function $g : X \to Y$ is
            continuous at $a \in X$ if and only if
            $g \circ h \circ f^{-1}$ is continuous
            at $f(a) \in V$.
    \end{enumerate}
\end{proposition}

\begin{proof}
    \begin{enumerate}[(i)]
        \item $x_n \to x$ implies $f(x_n) \to
            f(x)$ as $f$ is continuous. $f(x_n)
            \to f(x) \implies x_n = f^{-1}(f(x_n))
            \to f^{-1}(f(x)) = x$ as $f^{-1}$ is
            continuous.
        \item $h$ continuous implies $g \circ h
            \circ f^{-1}$ because composition of
            continuous functions is continuous. \\
            And $g \circ h \circ f^{-1}$
            continuous implies $h = g^{-1} \circ
            (g \circ h \circ f^{-1}) \circ f$ is
            continuous because composition of
            continuous functions is continuous.
    \end{enumerate}
\end{proof}

\noindent
We now have examples of metric spaces that look
very different but behave identically with respect
to convergence / continuity. \\
Thought: Could we disperse with distance
altogether? \\
Another way to think about continuity:

\begin{definition*}
    Let $(X, d)$ be a metric space let $a \in X$
    and let $\eps > 0$. The \emph{open ball of
    radius $\eps$ about $a$} is the set
    \[ B_\eps(a) = \{x \in X \mid d(x, a) < \eps\} \]
\end{definition*}

\begin{remark*}
    Suppose $f : X \to Y$, $a \in X$. $d$ metric
    on $X$, $e$ metric on $Y$. Then
    \begin{align*}
        \text{$f$ continuous at $a$}
        &\iff \forall \eps > 0 ~ \exists \delta >
        0 \quad d(x, a) < \delta \implies d(f(x),
        f(a)) < \eps \\
        &\iff \forall \eps > 0~\exists \delta > 0
        \quad x \in B_\delta(a) \implies f(x) \in
        B_\eps(f(a)) \\
        &\iff \forall \eps > 0 ~ \delta > 0 \quad
        f(B_\delta(a)) \subset B_\eps(f(a)) \\
        &\iff \forall \eps > 0 ~ \exists \delta >
        0 \quad B_\delta(a) \subset
        f^{-1}(B_\eps(f(a))
    \end{align*}
    So we have redefined continuity in terms of
    open balls. But open balls have radii, so
    this still uses a notion of distance.
\end{remark*}

\begin{definition*}
    Let $X$ be a metric space. A subset $G \subset
    X$ is \emph{open} if $\forall x \in G$,
    $\exists \eps > 0$ such that $B_\eps(x)
    \subset G$. \\
    A subset $N \subset X$ is a
    \emph{neighbourhood} (\emph{nbd}) of a point
    $a \in X$ if there exists an open set $G
    \subset X$ such that $a \in G \subset N$.
\end{definition*}
