Suppose that you have a metric space $X$. Could you give an example of a theorem or a statement that holds for compact sets but does not hold for closed sets?

This question is motivated from a paragraph in Stephen Abbott's Understanding Analysis:

Whenever a fact involving closed intervals (in $\mathbb{R}$) is true, it is often the case that the same result holds when we replace "closed interval" with "compact set."

What would be the fact that contradicts the inverse statement?

-
Compact sets are characterised by the property of being closed sets and also (as subsets of $\mathbb{R}^n$) bounded sets. Can you think of a statement which is true for a closed set only if it's bounded? –  Daniel Rust Feb 12 '13 at 19:45
The question you ask is not related to the citation. In $\mathbb R$, closed intervals are compact sets hence you could ask for a statement true for closed intervals but not for every compact set. (Then: "connectedness" might answer your query.) –  Did Feb 12 '13 at 19:46
Let $A$ be a compact subset of the reals. Any continuous function is bounded on $A$. Not true if $A$ is merely closed. –  André Nicolas Feb 12 '13 at 19:46
Your question is not clear, because you do not specify the inverse statement that should be contradicted. Naively that would be "Whenever a fact involving compact set is true, it is often the case that the same result holds when we replace 'compact' with 'closed interval'", but that is a true statement (assuming "interval" implies "bounded" which I suppose is the case for this author) since closed intervals of $\Bbb R$ are compact (and in general metrix spaces the notion of interval is meaningless), hence there cannot be anything that contradicts it. –  Marc van Leeuwen Feb 12 '13 at 20:28
@Did $\mathbb{R}$ is a closed interval. –  1015 Feb 12 '13 at 22:19
show 1 more comment

“The continuous image of a (blah) set is (blah).” True when (blah) is “compact”, false when (blah) is “closed”.

-
+blah.    –  Did Feb 12 '13 at 20:47

Every open covering of a compact set has finite subcovering.

-
Well, that was an easy one. –  Hagen von Eitzen Feb 12 '13 at 20:32

In a metric space, every sequence in a compact set has a subsequence that converges. This need not be true if the set is simply closed. As a counterexample think of $a_n=n$: the sequence is in the set $\mathbb R$ which is closed (but not compact) and $$\lim_{n\to+\infty}a_n=+\infty \notin \mathbb R$$

-

Note that in Euclidean spaces, such as $\mathbb{R}$, a set is compact if and only if it is closed and bounded. So what you're looking for is something that separate bound and unbound sets. The most trivial one is: "every compact set in $\mathbb{R}$ is bound", which is true, but not true for closed sets, since for instance $\mathbb{R}$ itself is a closed set.

-

You may not have encountered all of these definitions yet, but here is a hint at the bigger picture.

The Heine–Borel theorem states that the following are equivalent for a subspace $E \subset \mathbb{R}^n$:

(1) $E$ is compact.

(2) Every subsequence in $E$ has a convergent subsequence.

(3) $E$ is closed and bounded.

This theorem can be generalized to any metric space $X$ with a slight modification:

(1) $X$ is compact.

(2) Every subsequence in $X$ has a convergent subsequence.

(3) $X$ is totally bounded and complete.

In case these definitions are new:

A metric space $X$ is called totally bounded if for each $\varepsilon > 0$, there exists a finite number of open balls of radius $\varepsilon$ that cover $X$.

A metric space $X$ is called bounded if there exists $b > 0$ such that $d(x,y)<b$ for all $x,y\in X$.

As Andreas pointed out above, we can break stuff if we remove the 'bounded' condition. A similar example is the theorem that any continuous function on a metric space will achieve its maximum and minimum on a compact set, e.g., any continuous function on a (finite and closed) interval $[a,b]\subset\mathbb{R}$. However, $\mathbb{R}\subset\mathbb{R}$ is itself closed, but a function like $f(x) = x$ has no maximum or minimum on $\mathbb{R}$ because $\mathbb{R}$ is not bounded.

-