Here is Prob. 13, Chap. 4 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:
Let $E$ be a dense subset of a metric space $X$, and let $f$ be a uniformly continuous real function defined on $E$. Prove that $f$ has a continuous extension from $E$ to $X$ (see Exercise 5 for terminology). (Uniqueness follows from Exercise 4.) Hint: For each $p \in X$ and each positive integer $n$, let $V_n(p)$ be the set of all $q \in E$ with $d(p, q) < 1/n$. Use Exercise 9 to show that the intersection of the closures of the sets $f\left(V_1(p)\right)$, $f\left(V_2(p)\right)$, $\ldots$, consists of a single point, say $g(p)$, of $\mathbb{R}^1$. Prove that the function $g$ so defined on $X$ is the desired extension of $f$.
Could the range space $\mathbb{R}^1$ be replaced by $\mathbb{R}^k$? By any compact metric space? By any complete metric space? By any metric space?
Here is Prob. 9, Chap. 4 in Baby Rudin, 3rd edition:
Show that the requirement in the definition of uniform continuity can be rephrased as follows, in terms of diameters of sets: To every $\varepsilon > 0$ there exists a $\delta > 0$ such that $\mathrm{diam} \ f(E) < \varepsilon$ for all $E \subset X$ with $\mathrm{diam} \ E < \delta$.
My effort:
Since $E$ is dense in $X$, for each $p \in X$ and each positive integer $n$, the set $$V_n(p) = \left\{ \ q \in E \ \colon \ d(p,q) < \frac{1}{n} \ \right\}$$ is non-empty, and so each image set $f\left(V_n(p)\right)$ is also a non-empty subset of $\mathbb{R}^1$ and so each of the closures $\mathrm{cl}\left(f\left(V_n(p)\right)\right)$ is a non-empty closed subset of $\mathbb{R}^1$. Moreover since $V_n(p) \supset V_{n+1}(p)$, therefore we can conclude that $$\mathrm{cl}\left(f\left(V_n(p)\right)\right) \supset \mathrm{cl}\left(f\left(V_{n+1}(p)\right)\right).$$ How do we know that the intersection of these closures is actually non-empty? [ The answer to this I've figured out myself, but what if we just use the sets $f\left( V_n(p) \right)$ instead of their closures?]
And, how to show that the function $g$ so obtained is actually a continuous extension of $f$ from $E$ to $X$? Is $g$ also uniformly continuous?
What if $f$ is merely a continuous mapping of $E$ into $\mathbb{R}^1$? Can we stil continuously extend $f$ from $E$ to all of $X$?
We can replace the range space $\mathbb{R}^1$ by $\mathbb{R}^k$. If $\mathbf{f}$ is a uniformly continuous mapping of $E$ into $\mathbb{R}^k$, then we can write $$\mathbf{f}(x) = \left( f_1(x), \ldots, f_k(x) \right) \ \mbox{ for all } \ x \in E,$$ where each $f_i$ is a uniformly continuous mapping of $E$ into $\mathbb{R}^1$ and hence has a continuous extension $g_i$ from $E$ to all of $\mathbb{R}^1$. Then the map $$\mathbb{g} = \left( g_1, \ldots, g_k \right)$$ is a continuous extension from $E$ to all of $\mathbb{R}^k$.
Am I right?
The conclusion is valid if we replace $\mathbb{R}^1$ by any complete metric space $Y$. I've tried to show this at the following link.
Am I right? If so, is the proof I've given at the above-mentioned link correct?
Since every compact metric space is complete, so the above result could be extended to any compact metric space $Y$ as the range space instead of $\mathbb{R}^1$.
Am I right?
What if we replace $\mathbb{R}^1$ by an arbitrary (not complete) metric space $Y$ as the range space? Can we still extend $f$ continuously from $E$ to all of $X$?