As part of an exercise in a graduate measure theory course, I need to prove that if a function $f: \mathbb{R}\rightarrow \mathbb{R}$ is continuous and $B$ is a Borel set in $\mathbb{R}$, then $f^{-1}(B)$ is also a Borel set. If $B$ can somehow be expressed using countable unions and intersections of open and closed sets, this proof would be (relatively) easy.
Here is my intuition for why this is true. Let $\mathcal{F}$ be the set of countable unions of countable intersections of closed and open sets. Let $\mathcal{G}$ be the set of countable intersections of countable unions of closed and open sets. I claim that $\mathcal{B} = \mathcal{F}\cup\mathcal{G}$.
Note $ \mathcal{F}\cup\mathcal{G}\subset \mathcal{B}$ because $\mathcal{B}$ is a $\sigma$-algebra. If $ \mathcal{F}\cup\mathcal{G}$ is a $\sigma$-algebra, then $\mathcal{B} \subset \mathcal{F}\cup\mathcal{G}$ and $\mathcal{B} = \mathcal{F}\cup\mathcal{G}$. Thus, its sufficient to show that $ \mathcal{F}\cup\mathcal{G}$ is a $\sigma$-algebra.
Take an arbitrary set $S \in \mathcal{F}\cup\mathcal{G}.$ If $S \in \mathcal{F},$ De Morgan's law implies that $S^c \in \mathcal{G}.$ Similarly, if $S \in \mathcal{G}$, De Morgan's law implies that $S^c \in \mathcal{F}$. Thus, $S^c \in \mathcal{F} \cup\mathcal{G}.$
My intuition tells me that the countable union of sets in $\mathcal{F}\cup\mathcal{G}$ is also in $\mathcal{F}\cup\mathcal{G}$, but I can't think of a rigorous argument. Is this true, or is this where my intuition failed me?