Show that $\{0,1\}^{\mathbb{R}}$ with the product topology is separable. (Hint: Let $\mathcal{D}$ be the set of all finite unions of intervals $(a,b) \subset \Bbb R$ with rational endpoints. Show that the set of characteristic functions on $\mathcal{D}$ is countable and dense in $\{0,1\}^{\mathbb{R}}$).
Let $\mathcal{D}$ be the collection described above. Then $\mathcal{D} = \{U \subset \Bbb R \mid U = \bigcup_{i \in F} (a_i, b_i) \}$ where $F$ is finite and $a_i,b_i \in \Bbb Q$.
Let $A = \{ \chi_D \mid D \in \mathcal{D}\}$. Now $A$ is countable as $\mathcal{D}$ is countable. We only need to show then that $A$ is dense.
Let $O$ be a basic open set in $\{0,1\}^{\mathbb{R}}$. Then $$O = \bigcap_{x \in K} \pi_x^{-1}(V_x)$$ for $K \subset \Bbb R$ finite. Now we need to show that $A \cap O$ is non-empty.
The intersection is non-empty iff there exists $f \in A \cap O$ which is equivalent to $f \in A$ and $f \in O$. Now $f \in A$ if and only if $f = \chi_{D'}$ for $D' \in \mathcal{D}$. And $f \in O$ if and only if $f(x) \in \{0,1\}$ for all $x \in K$.
If I let $f = \chi_K$, then I think I can find intervals such that $K \in \mathcal{D}$ so $f \in A$. Also $f(x) = 1$ for all $x \in K$ so $f \in O$.
My question is that is it true that $K \in \mathcal{D}$ in order for $f$ to be in $A$? Also what is the motivation to define $\mathcal{D}$ as the set of such finite unions?