Show that $\{f : [0, 1] \rightarrow [0, 1] : |f(t) − f(s)| \leq |t − s|$, $ \forall s, t \in [0, 1]\}$ is compact. Let
$X = \{f : [0, 1] \rightarrow [0, 1] : |f(t) − f(s)| \leq |t − s|$, $ \forall s, t \in [0, 1]\}.$
Define
$d(f, g) = max_{t\in[0,1]}|f(t) − g(t)|$ for $f, g \in X$. Then show that $(X, d)$ is a compact metric space.
My attempt: I have been able to show that $(X,d) $ is a metric space. As for compactness, I was thinking of showing that $X$ is complete and totally bounded.
Completeness of $X$:
Let $f:[0,1]\rightarrow [0,1]$ and $\{f_{n}\}$ be a sequence in $X$ such that $d(f_{n},f)\rightarrow 0 $ (We have extended the metric to all functions with domain and co-domain $[0,1]$). We have
$|f(t)-f(s)|\leq |f_{n}(t)-f(t)| + |f(t)-f(s)| + |f_{n}(s)-f(s)|\leq 2d(f_{n},f) +|s-t|$
$\implies |f(t)-f(s)| \leq |s-t| \implies f\in X.$
I am not sure how do I show that $X$ is totally bounded.
I would also appreciate any other method of approaching this problem. Thank you!
 A: One way of proving compactness of
$$\mathcal{F} = \{f:[0,1]\to [0,1]: |f(x)-f(y)| \leq |x-y|, \forall (x,y) \in [0,1]^2 \},$$
is via the Arzelà–Ascoli theorem. To apply this theorem, we need to check the conditions of equicontinuity and uniform boundedness. Boundedness is trivial, as for all $f \in \mathcal{F}$ we have $\sup_{x} |f(x)| \leq 1$. Equicontinuity follow from the Lipschitz property. In particular, for $\epsilon>0$ take $\delta=\epsilon$ and check that for all $(x,y) \in [0,1]^2$ satisfying $|x-y| < \delta$ we have
$$|f(x)-f(y)| <\epsilon.$$
Notice that $\delta$ does not depend on either $x$, $y$ or on $f$, hence $\mathcal{F}$ is equicontinuous. By the Arzelà–Ascoli theorem we may now conclude that each $\{f_n\}_n \in \mathcal{F}$ contains a uniformly convergent subsequence, which is equivalent to compactness in the uniform metric.
A: Let us show that our set is totally bounded inside $B([0,1])$, the space
of bounded functions on $[0,1]$.
For every $n$ consider the set of $\mathcal{C}_n$ of functions $\colon[0,1]\to \mathbb{R}$ that are constant on each interval $[\frac{i}{n}, \frac{i+1}{n})$, and take values in the set $\{\frac{k}{n}\ | \ 0\le k \le n\}$. There are $(n+1)^n$ of these functions. Now, consider a function $f\in \mathcal{F}$. The image of every closed interval of length $\frac{1}{n}$ under $f$ is an closed subinterval of $[0,1]$ of length $\le \frac{1}{n}$. Therefore, for every function $f$ in $\mathcal{F}$ there exists $g\in \mathcal{C}_n$ such that
$$\|f - g\| \le \frac{1}{n}$$.
Therefore set $\mathcal{F}$ is totally bounded in $B([0,1]$, so also in $C([0,1])$. It is also closed.
So $\mathcal{F}$ is totally bounded and closed insided $C([0,1])$, a complete metric space. We conclude that $\mathcal{F}$ is compact.
Note: this is also a way to  prove  Arzela-Ascoli in general.
$\bf{Added:}$ @DanielWainfleet: suggested that we should construct a total $\epsilon$ set in $\mathcal{F}$, so let's do that.
Consider $n\ge 1$ natural. Let $f \in \mathcal{F}$. We have
$$|f(\frac{k+1}{n})-f(\frac{k}{n})|\le \frac{1}{n} $$
We conclude that
$$|[ n f(\frac{k+1}{n}) ] - [ n f(\frac{k}{n}) ]|\le 1$$
Now from $f$ construct a function $L_n(f)$ in the following way.

*

*$L_n(f)$ is linear on each interval $[\frac{k}{n}, \frac{k+1}{n}]$


*At each point $\frac{k}{n}$ the function $L_n(f)$ takes the value $\frac{ [ n f(\frac{k}{n})]}{n}$.
We see that each function $L_n(f)$ is in $\mathcal{F}$, and since at the points $\frac{k}{n}$ it differs from $f$ by at most $\frac{1}{n}$, we have
$$\|f - L_n(f)\|\le \frac{2}{n}$$.
Notice that the set of functions $\mathcal{L}_n\colon =\{ L_n(f) \ | f \in \mathcal{F} \}$ is  finite.
We have showed that $\mathcal{F}$ is totally bounded.
Note: With some care we can show that for every $f \in \mathcal{F}$, $f \not \in \mathcal{L}_n$ we have
$$\|f - L_n(f)\| < \frac{1}{n}$$
