What do compact sets look like in the rationals? I'm trying to prove that $\mathbb Q$ is not locally compact and I'm having trouble seeing what the compact sets are.
Besides merely thinking of sets and then checking if they are compact or not, is there a better way of finding the compact sets?
EDIT: Any subset of the rationals $[q_1,q_2]\cap \mathbb Q$ is not compact because we can take a cover which covers both endpoints but limits from both sides to an irrational inside the interval.
EDIT2: The only compact subsets that I can find are finite subsets.
 A: $\newcommand{\ms}{\mathscr}$The compact subsets of $\Bbb Q$ are a little awkward to describe unless you’re familiar with infinite ordinals, but here’s a rough, intuitive description.
Let $\mathscr{C}_0=\big\{\{q\}:q\in\Bbb Q\big\}$; clearly every member of $\ms{C}_0$ and every finite union of members of $\ms{C}_0$ is compact, since these are just the finite sets.
Let $\ms{C}_1$ be the family of sets that consist of a rational number and the points of a sequence of rational numbers converging to it, like $\{0\}\cup\{2^{-n}:n\in\Bbb N\}$; these are compact, and so, of course, are finite unions of them.
Let $\ms{C}_2$ be the family of sets that consist of a rational number $q$ and the union of a countably infinite set of members of $\ms{C}_1$ whose limit points converge to $q$. An example of such a set is
$$\{0\}\cup\bigcup_{n\in\Bbb N}\left(\{2^{-n}\}\cup\{2^{-n}+2^{-k}:k>n\}\right)\;;$$
if you make a sketch, you’ll see that each of the sets $\{2^{-n}\}\cup\{2^{-n}+2^{-k}:k>n\}$ is a simple sequence with its limit point, so it’s a member of $\ms{C}_1$, and the limit points of these sequences $-$ the points $2^{-n}$ $-$ converge to $0$. Each member of $\ms{C}_2$ is compact, as is any finite union of them.
By continuing this construction one can produce compact subsets of $\Bbb Q$ of greater and greater complexity. In fact it continues transfinitely: there is a class $\ms{C}_\alpha$ for every ordinal $\alpha<\omega_1$, and for each $\alpha<\omega_1$ the sets in $\ms{C}_\alpha$ are homeomorphic to the ordinal $\alpha$ with the order topology.
As you’ve probably realized by now, this is not the best way to think about the problem of showing that $\Bbb Q$ is nowhere locally compact.
HINT: A better idea is simply to show that if $q\in\Bbb Q$, then $q$ does not have a compact neighborhood. If $N$ is any nbhd of $q$, there is an $r>0$ such that $[q-r,q+r]\subseteq N$. Now pick an irrational number $x\in[q-r,q+r]$, and use it to show that $N$ is not compact; there are at least two different ways to do this, one involving open covers and the other involving sequences.
A: The only compact sets in $\mathbb Q$ are nowhere dense. This is example 31 in Counterexamples in topology by Seebach.
A set $A$ in space $X$ is called nowhere dense if $X\setminus \mathrm{cl}(A)$ is dense
