TITLE: Assuming every continuous function is uniformly continuous
QUESTION [6 upvotes]: If every continuous function, let's say $f:X\to \mathbb{R}$, that they are uniformly continuous, can I assume that $X$ is compact?

I'm just wondering if I am true, can someone verify that I'm correct?
Since compact of a set is defined by it being closed and bounded, and since the domain $X$ has to be bounded and closed for the function $f$ to be uniformly continuous, I think it's obvious that the domain $X$ is compact.
The image $Y$ doesn't necessary have to be bounded, but the domain has to, right?  Please point out if I'm wrong, or just say I'm right, yea!

REPLY [3 votes]: First it is important to understand what uniform continuity means in a topological space $X$. In its full generality, one needs a uniform structure on $X$ to speak of uniform continuity, but let's stick to an easier concept ; a topological abelian group $X$ is an abelian group in which the operation $+$ is continuous as a function $+ : X \times X \to X$ (when $X \times X$ is equipped with the product topology).  
Saying that $f : X \to \mathbb R$ is continuous in this context means that for every $\varepsilon > 0$ and for all $x \in X$, there exists $U_x \subseteq X$ open such that $x - y \in U_x$ implies $|f(x) - f(y)| < \varepsilon$. 
Saying that $f : X \to \mathbb R$ is uniformly continuous in this context means that for every $\varepsilon > 0$, there exists $U \subseteq X$ open such that $x - y \in U$ implies $|f(x) - f(y)| < \varepsilon$, i.e. the open set $U$ does not depend on $x$ anymore.
If we take an arbitrary abelian group $X$ and equip it with the trivial topology (all its subsets are open), then of course this turns $X$ into a topological abelian group. 
Take an arbitrary function $f : X \to \mathbb R$. Taking $U = \{0\}$ (where $0 \in X$ is the neutral element for addition), we see that $f$ is uniformly continuous, hence continuous. If the abelian group is infinite, the open cover that consists of a singleton for each point does not admit a finite subcover. More formally,
$$
X = \bigcup_{x \in X} \{ x \}
$$
is an open cover of $X$ which does not admit a finite subcover because $X$ is not finite. Therefore $X$ satisfies the property that every function $f : X \to \mathbb R$ is continuous, but $X$ is not compact.
Added : Even if $X \subseteq \mathbb R^n$ to put yourself in the context where compact is equivalent to closed and bounded, your guess is still wrong. Take $n = 1$ and see that as a subset of $\mathbb R$, $\mathbb Z$ is still endowed with the discrete topology, so that the proof above applies.
Hope that helps,