# every infinite subset of a metric space has limit point => metric space compact?

I am self-studying the book, Walter Rudin, Principles of Mathematical Analysis, and I am doing the Exercise 2.26. As mentioned in the hint, Exercise 23 suggests: every separable metric space has a countable base. According to the definitions, a metric space is separable if it contains a countable dense subset. A base $$\{V_\alpha\}$$ is a collection of sets such that every open set in X is the union of a subcollection in $${V_\alpha}$$.

Exercise 24 suggests that, if in a metric space $$X$$, every infinite subset has a limit point, then $$X$$ is separable.

Following the hint, $$X$$ is separable, which means $$X$$ has a countable (infinite but countably many) base.

To prove $$X$$ is compact, we need to show for any open cover $$\{G_\alpha\}$$, there exists a finite subcover $$\{G_1, G_2, \cdots, G_n\}$$.

If I understand correctly, the hint and solution suggest first finding a countable subcover and then finding a finite subcover.

However, I do not see why "It follows that every open cover of $$X$$ has a countable subcover $$\{G_n\}_{n=1}, n=1, 2, 3, \cdots$$."

This was not proved in the hint or solution. Maybe trivial, but I can't see it at this moment. Can anyone give a hint? Thanks.

Let $$(U_i)_{i\in \mathbb{N}}$$ a countabla basis, and consider an open covering $$(V_j)_{j\in J}$$, for every $$x\in X$$, there exists $$j_x\in J$$ such that $$x\in V_{j_x}$$. There exists $$i_x\in \mathbb{N}$$ such that $$x\in U_{i_x}\subset V_{j_x}$$ since $$(U_i)_{i\in\mathbb{N}}$$ is a basis of the topology. Consider the map $$f:X\rightarrow\mathbb{N}$$ defined by $$f(x)=i_x$$ and the map $$g:\mathbb{{N}}\rightarrow J$$ defined by $$g(n)=j_y$$ where we choose one $$y\in X$$ and $$f(y)=n$$. $$X$$ is covered by $$V_{g(n)}$$. To see this, let $$x\in X$$, suppose that $$g(i_x)=j_y$$, we have $$g(y)=i_x$$. This implies that $$U_{i_x}=U_{i_y}$$ and $$x\in U_{i_x}=U_{i_y}\subset V_{j_y}=V_{g(n)}$$.