Under the standard topology on $\Bbb{R}$, how come $\Bbb{Q}$ isn't a closed set? By definition, a set $A\subset S$ is closed iff $S\backslash A$ is open. Now, the open sets on the standard topology on $\Bbb{R}$ take the form $\bigcup_i(a_i, b_i)$ for some real numbers $a_i$ & $b_i$. Then it is easy to see that closed sets take the form $\Bbb{R}\backslash \bigcup_i(a_i, b_i) = \bigcup_i[c_i, d_i]$ for some real numbers $c_i$ and $d_i$. This further means that a set that is the countable union of singleton sets (i.e. $\bigcup_i \{r_i\}$) is closed. Therefore, for example, $\Bbb{Z}$ is closed.
Now, if everything I've said up to this point is correct, what's confusing me is how $\Bbb{Q}$ isn't a closed. The reason I assume it's not a closed set is because I was told that $\Bbb{Q}$ is dense in $\Bbb{R}$, which means that $\text{cl}(\Bbb{Q}) = \Bbb{R}$, so if $\Bbb{Q}$ was closed then $\text{cl}(\Bbb{Q})=\Bbb{Q}\ne \Bbb{R}$. We can write $\Bbb{Q} = \bigcup_{\substack{p,\ q\in\Bbb{Z} \\ (p,\ q)=1}}\left\{\frac p q\right\}$, which is the union of a countable number of singleton sets. By what I said above, this should be closed, but clearly it isn't, so what gives? I have a feeling it has to do with the fact that $\Bbb{Q}$ is dense, but I can't exactly draw the connection. That, or something I said above is incorrect.
Can anyone give me some pointers? What's wrong in my thought process?
 A: Little mistake of the OP: 
$\Bbb{R}\backslash \bigcup_i(a_i, b_i) = \bigcup_i[c_i, d_i]$.
Not true. According to De Morgan's Law
$$
\Bbb{R}\backslash \bigcup_i(a_i, b_i)=\bigcap_i\big(\mathbb R\backslash (a_i, b_i)\big)=\bigcap_i\big(\mathbb R\backslash (-\infty,a_i]\cup [b_i,\infty)\big).
$$
A: The closure of a subset of a topological space $A\subset X$ is the smallest closed subset of $X$ containing $A$. The closure of a closed set is the set itself. Sounds logical. Now $\Bbb{Q}$ is dense in $\Bbb{R}$ so the closure of $\Bbb{Q}$ is $\Bbb{R}$ and $\Bbb{Q}$ is therefore not closed in $\Bbb{R}$.
A: The union of isolated singletons is closed.  To wit:
You state the if $S = \bigcup_i(a_i, b_i)$ is open then
$\Bbb{R}\backslash \bigcup_i(a_i, b_i) = \bigcup_i[c_i, d_i]$
This is true if we take liberty with notation and allow {$x$} to be written as [$x,x$] and allow ($-\infty, x$] to be written as [$-\infty, x$].
But it doesn't follow that if $K = \bigcup_i[a_i, b_i]$ is closed then $\Bbb{R}\backslash \bigcup_i[a_i, b_i] = \bigcup_i(c_i, d_i)$ for some $c_i, d_i$.
Assume $[a_i, b_i] \subset K$ with $b_i$ beings such that for all $\epsilon > 0$, $(b_i, b_i + \epsilon)$ there exists a $y_{\epsilon}$ such that $y_{\epsilon} \in (b_i, b_i + \epsilon)$ but it doesn't follow that $(b_i, y_{\epsilon}) \subset K^c$ and it is quite possible there is absolutely no $\delta > 0$ such that $(b_i, b_i + \delta) \subset K^c$.
So your conclusion that a countable union of singletons is closed is incorrect.  It is correct that a countable union of isolated singletons is closed but if the are not isolated the union is not necessarily closed.  (Isolated means that there does exist a $\delta > 0$ such that $(x-\delta, x)$ and $(x, x + \delta)$ are not in K.)
In particular if $K =\bigcup_{\alpha}[x_{\alpha}; \text { not rational}]$, then no $(x_{\alpha}, x_{\alpha} + \epsilon) \subset K^c = \mathbb Q$ exist.  ($\mathbb Q$ is not open.)
