Questions about open sets in ${\mathbb R}$

Consider the following problem:

Let ${\mathbb Q} \subset A\subset {\mathbb R}$, which of the following must be true?

A. If $A$ is open, then $A={\mathbb R}$

B. If $A$ is closed, then $A={\mathbb R}$

Since $\overline{\mathbb Q}={\mathbb R}$, one can immediately get that B is the answer.

Here are my questions:

Why A is not necessarily true? What can be a counterexample?


A slightly more interesting example than Luboš's can be obtained by enumerating the rationals as $\mathbb{Q} = \{q_n\}_{n=1}^\infty$ and taking $A = \bigcup_{n=1}^{\infty} (q_{n} - \frac{\varepsilon}{2^{n+1}}, q_{n} + \frac{\varepsilon}{2^{n+1}})$. Then the Lebesgue measure of $A$ can be estimated by $\mu(A) \leq \sum_{n=1}^{\infty} 2 \cdot \frac{\varepsilon}{2^{n+1}} = \varepsilon$, so $A$ cannot be all of $\mathbb{R}$ even if it's clearly open.


A counterexample for the rule A is $$ {\mathbb R} \backslash F $$ where $F$ is any non-empty finite (or countable) set of irrational numbers. For example $$ {\mathbb R} \backslash \{\pi\} $$ Note that if I remove the point $\pi$, the set is still open on both sides from $\pi$. Because $\pi$ isn't rational, the set above still contains all rational numbers.


The question boils down to whether there are nonempty subsets of $\mathbb{R}\setminus \mathbb{Q}$ that are closed in $\mathbb{R}$. The easiest examples are finite sets, as Luboš Motl noted. An easy infinite example is $\sqrt{2}+\mathbb{Z}$. Theo Buehler showed that there are positive measure examples, which is much stronger and closely related to the question at this link.

Another direction to strengthen the result is to show that there are perfect examples, which is the subject of the question at this link.