Let $M$ be a metric space, $A\subset M, \ B\subset M, \ A\cap B = \emptyset, \ A \ \text{closed}, \ B\ \text{compact}.$
Define distance between sets as $D(A,B) = \inf d(a,b)$ where $d$ is the metric on $M$.
I'm asked to prove that $D(A,B) > 0$ which is equivalent to proving that $D(A,B) \neq 0.$
My attempt:
Assume $D(A,B) = 0.$
This means that $\exists\ (a,b) \ s.t. \ d(a,b) < \epsilon \ \ \forall \epsilon > 0.$ Let $a,b$ denote these specific $a,b$.
Take a sequence in $A$ including $a$ as last element. This sequence must converge to $b$ because of the above statement. This means there exists a sequence in $A$ converging to an element not in $A$. This is not possible since $A$ is closed.
Thus $D(A,B) \neq 0.$
Is this proof correct? If it is not, how can I modify it / rewrite it. If it is, why do I need to know that $B$ is compact?
What follows is valid in a metric space, but out of habit I write $|a-b|$ in place of $d(a,b)$.
Every point $x \in B$ belongs to the complement of $A$ which is open. Thus, for every $x \in B$ there exists $r_x > 0$ with the property that $B(x,r_x) \cap A = \emptyset$. In particular $|a - x| \ge r_x$ for all $x$.
The family $\{ B(x,r_x/2) \mid x \in B\}$ covers $B$, and since $B$ is compact there exists a finite subcover which we can label by $\{B(x_k,r_k/2)\}_{k=1}^n$.
Define $r = \min\{r_1,\ldots,r_n\}$ and note $r > 0$.
Select a point $b \in B$ and $a \in A$.
There exists an index $k$ with the property that $b \in B(x_k,r_k/2)$, so that $|b - x_k| < r_k/2$.
For the same index $k$ you have also that $|a - x_k| \ge r_k$.
The triangle inequality gives you $$|a - b| \ge |a - x_k| - |b - x_k| > \frac{r_k}2 \ge \frac r2.$$
Since $a,b$ were arbitrary it follows that $d(A,B) \ge \dfrac r2$.