TITLE: $\forall x \in \mathbb{R}$, there exits $\delta$ such that $(x-\delta,x+\delta) \cap A$ is countable. Prove that $A$ is countable.
QUESTION [7 upvotes]: As stated in the title. At the first glance I think the approach can be constructing an injection from $A$ to $\mathbb Q$, since obviously $\mathbb Q$ is a set that satisfies such condition. However I have no idea on how to get such injection. Any hints would be appreciated.

REPLY [3 votes]: An elementary argument: Let
$$
S =  \left\{ r \in \mathbb{R}^+ \; : \; (-r, r) \cap A \text{ is countable} \right\} 
$$
Clearly if $r \in S$ and $r_0 < r$, then $r_0 \in S$.  Also, $S$ is nonempty, since we can find $\delta > 0$ such that $(-\delta, \delta) \cap A$ is countable.
We would like to show $\sup S = \infty$, because then we will have $n \in S$ for all positive integers $n$, and
$$
A = \bigcup_{n = 1}^\infty (-n, n) \cap A
$$
will be a countable union of countable sets, hence countable.
Suppose towards contradiction $\sup S < \infty$.  Then let $R = \sup S$, and find 
$\delta_1$ and $\delta_2$ such that $(-R - \delta_1, -R+ \delta_1) \cap A$ and $(R - \delta_2, R + \delta_2) \cap A$ are countable.  Then observe that $R - \delta_1, R - \delta_2 \in S$, so in fact $(-R - \delta_1, R + \delta_2) \cap A$ is countable.  Letting $\delta = \min(\delta_1, \delta_2)$, it follows that $R + \delta \in S$, contradicting that $R$ was the supremum.

Alternatively, you can show that $S$ is open, closed, and nonempty.  Since the only clopen sets in $\mathbb{R}^+$ are $\varnothing$ and $\mathbb{R}^+$ itself, $S = \mathbb{R}^+$.