Q:

A Borel subset of a topological space

Is every Borel subset of a topological space $(X, \tau)$ either open or closed?
I'm thinking that if $B \in \mathcal B(X)$, then there are many possibilities:

$B$ is open for $\tau$, or 
it is the complement of some open set $B$ in $\tau$, and so closed, or
$B = \bigcup_{n=1}^{\infty} B_n$ where each $B_n$ is open, and so open, or 
Some trivial case in which $B$ is obviously open/closed, or
$B = \bigcap_{n=1}^{\infty} B_n$ where these are a mix of closed and open sets. Even if, ideally, all of the $B_n$'s were open, this does not necessarily give an open set, because only finite intersections yield open sets.

Thus, my conclusion is no. But could you construct some counter example for this? Thank you.
I encountered this confusion when trying to prove that every continuous function is Borel-measurable. I wanted to separate the proof into two cases (open, closed), but then I realized this. 

A:

(1) You are right in believing that the answer is no. For example, in $\mathbf R$, we have the Borel set
$$ B = (0,1] = \bigcap_n \left(0,\frac{n+1}n\right) $$
which is neither open nor closed.
(2) The possibilities that you list, are not all. When we denote set of the open sets by $B_0(\def\R{\mathbf R}\R)$ and define inductively
$$ B_n(\R) = \left\{\bigcap_k A_k\mid A_k \in B_{n-1}(\R) \text{ or } \R\setminus A_k \in B_{n-1}(\R) \right\} $$
then $B_{n-1}(\R) \subsetneq B_n(\R)$ for each $n$, and $\bigcup_n B_n(\R) \ne \textsf{Bor}(\R)$ (you have to continue the induction until $\omega_1$).

