Solution (source code)

= Solution

Let $K$ be a <compact set> of a <Hausdorff space> $X$. For any $x\notin K$ and each $y\in K$, the <Hausdorff> property gives disjoint <open sets> $U_y\ni y$ and $V_y\ni x$. The sets $U_y$ cover $K$; <compactness> supplies a finite subcover $U_{y_1},\ldots,U_{y_r}$. The <open set> $V=\bigcap_iV_{y_i}$ contains $x$ and misses every $U_{y_i}$, hence misses $K$. Thus $X\setminus K$ is <open>, and \b[every compact subset of a Hausdorff space is closed]. The empty-set case is immediate.

Since $\mathbb R$ with its usual topology is <Hausdorff>, its <compact sets> are <closed>. The <open cover> $\{(-n,n):n\ge1\}$ of $\mathbb R$ has a finite subcover of any <compact set> $K$. Taking the largest index in that subcover gives $K\subset(-N,N)$, so $K$ is a <bounded set>. This proves the required direction of the <Heine-Borel theorem> without assuming its converse.