the set $X '$ of limit points of $X$ is compact 
Let $(M,d)$ be a metric space. If for each $\emptyset\neq A, B ⊂ M$ closed disjoint, we have
$d (A, B) =\inf \{d (x, y): (x, y) ∈ A \times B\}> 0$ then there exists $K ⊂ M$ compact such that for any neighborhood $V$ of $K$, the set $M \setminus V$ is  is uniformly discrete (i.e,  exists $\delta >0$ such that $d (x, y) \geq \delta$ for any $x, y \in M$, with $x\neq y$).

My idea is to show that $K$ is the set of accumulation points of $M$. I observed that if $K$ is the set of accumulation points the result is already there. Indeed, if $ M \setminus K $ is not uniformly discrete, there exist $x, y \in M\setminus K$ with $x\neq y$ such that $d (x, y) <\delta$ for all $\delta> 0$ then $y \in B(x,\delta)\setminus\{x\} \cap M$, i.e $x$ is an accumulation point, which is absurd.
under the hypothesis that $d (A, B) =\inf \{d (x, y): (x, y) ∈ A \times B\}> 0$,  is it true that the set of accumulation points is compact?. I have tried to demonstrate it by contradiction but I cannot find the absurdity. I appreciate the help.
 A: A proof is provided by the following propositions.
Proposition 1. The space $(M,d)$ is complete.
Proof. It is easy to check that it suffices to show that any Cauchy sequence $(c_n)_{n\in\Bbb N}$ in $(M,d)$ with distinct members converges. Put $A=\{c_{2n-1}:n\in\Bbb N\}$ and  $B=\{c_{2n}:n\in\Bbb N\}$. Then $A$ and $B$ are disjoint subsets such that $d(A,B)\le \inf_n d(c_{2n-1}, c_{2n})=0$. Therefore either $A$ or $B$ is not closed. If the set $A$ is not closed then any point $x\in\overline{A}\setminus A$ is a limit of a subsequence of $(c_{2n-1})$, and so of the sequence $(c_{n})$, since the latter is Cauchy. The case when the set $B$ is not closed is considered similarly. $\square$
Let $M’$ be the set of non-isolated points of $M$.
Proposition 2. The set $M’$ is compact.
Proof. To show that the set $M’$ is compact we show that it is closed and totally bounded.
Let $x$ be any point of $\overline{M’}\setminus M’$. Then $x$ is non-isolated,  so $x\in M’$. Therefore the set $M’$ is closed.
Suppose to the contrary than the set $M’$ is not totally bounded. Then there exists $\varepsilon>0$ and an infinite subset $\{c_n:n\in\Bbb N\}$ of $M’$ such that $d (c_n, c_m) \ge \varepsilon$ for any distinct points $c_n, c_m\in C$. Let $n$ be any natural number. Since a point $c_n$ is not isolated, there exists distinct points $a_n, b_n\in M$ such that $d(a_n, c_n)<\varepsilon/4n$ and $d(b_n, c_n)<\varepsilon/4n$. Then $d(a_n, b_n)<\varepsilon/2n$. Put $A=\{a_n: n\in\Bbb N\}$ and
$B=\{b_n: n\in\Bbb N\}$. Let $n$ and $m$ be distinct natural numbers. Then
$$\varepsilon\le d(c_n, c_m)\le d(c_n, a_n)+d(a_n, a_m)+d(a_m, c_m)< \varepsilon/4+ d(a_n, a_m)+\varepsilon/4,$$
so $d(a_n, a_m)>\varepsilon/2$. That is the set $A$ is uniformly discrete and so closed. Similarly we can show that the set $B$ is closed. But $d(A,B)\le\inf_n d(a_n, b_n)=0$, a contradiction. $\square$
Proposition 3. For any open neighborhood $V$ of $M’$, the set $M’\setminus V$ is uniformly discrete.
Proof. Since $N=M’\setminus V$ is a closed subset consisting of isolated points of $M$, each subset of  $N$ is closed in $M$. Suppose to the contrary that set $N$ is not uniformly discrete. Then, using that each point of $N$ is isolated, by induction we can construct a sequence $(c_n)_{n\in\Bbb N}$ of distinct point of  $N$ such that $d(c_{2n-1}, c_{2n})<1/n$. Put $A=\{c_{2n-1}:n\in\Bbb N\}$ and  $B=\{c_{2n}:n\in\Bbb N\}$. Then $A$ and $B$ are disjoint closed subsets of $M$, but $d(A,B)\le \inf_n d(c_{2n-1}, c_{2n})=0$, a contradiction. $\square$
A: $\newcommand{\cl}{\operatorname{cl}}$Here’s a slightly different (though very similar) approach that I’m posting mostly so that I can easily find it again.
Let $D$ be a set of isolated points of $M$ that is not uniformly discrete. Clearly no cofinite subset of $D$ is uniformly discrete, so we can recursively define sequences $\langle x_n:n\in\Bbb N\rangle$ and $\langle y_n:n\in\Bbb N\rangle$ in $D$ such that the points $x_n$ and $y_n$ are all distinct, and $d(x_n,y_n)<2^{-n}$ for each $n\in\Bbb N$. Let $H=\{x_n:n\in\Bbb N\}$ and $K=\{y_n:n\in\Bbb N\}$; then $H$ and $K$ are disjoint, but $d(H,K)=0$, so at least one of them has a limit point $p\in M'$, the set of non-isolated points of $M$. In fact it’s clear that $p\in(\cl H)\cap\cl K$, but all that we really need is that $p\in\cl D$.
Now let $U$ be an open nbhd of $M'$, and suppose that $D\subseteq M\setminus U$ is not uniformly discrete. It follows from the previous paragraph that there is some $p\in M'\cap\cl D\subseteq U$ and hence that $U\cap D\ne\varnothing$, contradicting the choice of $D$. Thus, $M\setminus U$ is uniformly discrete, and it only remains to show that $M'$ is compact.
If $M'$ is not compact, there is a countably infinite set $D=\{x_n:n\in\Bbb N\}\subseteq M'$ that has no limit points in $M'$. $D$ is a closed discrete subset of $M$, so for each $n\in\Bbb N$ there is an $r_n>0$ such that $B(x_n,r_n)\cap D=\{x_n\}$, and we may assume that $r_n<2^{-n}$. Finally, since $x_n\in M'$, there is a $y_n\in B(x_n,r_n)\setminus\{x_n\}$. Let $E=\{y_n:n\in\Bbb N\}$ and argue much as in the first paragraph: $D\cap E=\varnothing$, $d(D,E)=0$, and $D$ is closed, so $E$ is not closed. Let $p\in(\cl E)\setminus E$; clearly $p\notin D$, so there is an $\epsilon>0$ such that $B(p,2\epsilon)\cap D=\varnothing$. $B(p,\epsilon)\cap E$, however, is infinite, so there is an $n\in\Bbb N$ such that $y_n\in B(p,\epsilon)$ and $2^{-n}<\epsilon$ and hence
$$d(p,x_n)\le d(p,y_n)+d(y_n,x_n)<2\epsilon\,,$$
which is impossible. Thus, $M'$ contains no such set $D$ and is therefore compact.
