Distance between closed and compact sets. This question is (1-21)(b) from M. Spivak's Calculus on Manifolds.
Question:
If $A$ is closed, $B$ is compact, and $A \cap B = \emptyset$, prove that there is $d > 0$ such that $||y - x|| \geq d$ for all $y \in A$ and $x \in B$. 
Now, I interpret this as an instruction to find a single $d$ that works for all $y \in A$ and $x \in B$. However, I can't see why the following is not a counter-example: 
Consider the set 
$$A_0 = (-\infty, 0) \cup \left[\bigcup_{n=1}^{\infty} \left(\frac{1}{n + 1}, \frac{1}{n}\right)\right] \cup (1, \infty)$$
where $(a,b)$ denotes the open interval as usual. Since $A_0$ is a union of open sets, it too is open. Thus 
$$A = \mathbb{R} - A_0 = \left\{ \frac{1}{n} \quad \colon \quad n \in \mathbb{N}\right\}$$
is closed. The set 
$$B = [-1, 0]$$
is certainly compact. Moreover, $A \cap B = \emptyset$. However, for all $d > 0$, there exists a $y \in A$ such that 
$$||0 - y|| = ||y|| < d$$
I must be overlooking something somewhere. Any help spotting where will be appreciated. 
 A: Here we prove the result of the book:
Recall that the function $x\mapsto d(x,A)$ is continuous and that (since $A$ is closed):
$$x\in A\iff d(x,A)=0$$
$$d=\inf_{x\in B}d(x,A)$$
The function 
$$f:B\to \mathbb{R}\quad,\quad x\mapsto d(x,A)$$
is continuous on the compact $B$ then it's bounded and there's $x_0\in B$ s.t 
$$f(x_0)=\min_{x\in B}f(x)=d=d(x_0,A)>0$$
since $x_0\not\in A$
A: Spivak includes this exercise in a section of the book that precedes the definitions of functions and continuity. He gives a hint for solving it simply from the definition of compactness, and using a previous result, that the distance between a closed set and a single point in its complement is positive. That result follows immediately from the fact that the complement of a closed set is open, and a point in an open set in $\Bbb R^n$ has a ball around it that's contained in the open set.
Anyway, here's a proof, using Spivak's hint: for every $x$ in our compact set $B$, we have a distance $d_x$ so that $\|x-y\|>2d_x$ for all $y$ in our closed set $A$. Let $U_x$ be the ball of radius $d_x$ centered at $x$. Doing this for every $x\in B$, we obtain an open cover. This open cover has the property that, for each $x$, every point in $U_x\cap B$ has distance at least $d_x$ from $A$. (Triangle inequality)
Since $B$ is compact, the open cover $\{U_x\mid x\in B\}$ admits a finite subcover: $\{U_{x_i}\mid i=1,\ldots,n\}$. Let $d=\min\{d_{x_i}\}_{i=1\ldots n}$. This positive number satisfies the requirement that $\|x-y\|>d$ for all $x\in B, y\in A$.
A: The counter-example fails as the set $A$ contains $0$ so $A \cap B \ne \emptyset$. I had overlooked this fact for some reason. 
