On preimage of open sets of functions on real line having at most countably many discontinuity points Let $f:\mathbb R \to \mathbb R$ be a function whose set of discontinuity points is at most countable ; is it true that for every open set $G \subseteq \mathbb R$ , there is an open set $U$ and a countable set $C$ such that $f^{-1}(G)=U \cup C$ ? Is the converse true i.e. if $f:\mathbb R \to \mathbb R$ is a function such that for every open set $G \subseteq \mathbb R$ , there is an open set $U$ and a countable set $C$ such that $f^{-1}(G)=U \cup C$ , then is it true that $f$ has at most countably many discontinuity points ? Please help . Thanks in advance 
 A: Let $G$ be an arbitrary open subset of $\Bbb R$ and $U=\operatorname{int} f^{-1}(G)$. Since the function $f$   is discontinuous at any point of a set $C=f^{-1}(G)\setminus U$, this set is countable.
The converse is true too. Let $\mathcal B$ be a countable open base of the space $\Bbb R$. Then for each neighborhood $B\in\mathcal B$ there exists an open set $U_B$ and a countable set $C_B$ such that $f^{-1}(B)=U_B\cup C_B$. Put $U_0=\Bbb R\setminus \bigcup_{B\in\mathcal B} C_B$. We claim that the map $f$ is continuous at each point $x\in U_0$. Indeed, let $B\in\mathcal B$ be an arbitrary open neighborhood of the point $f(x)$. Then $x\in U_0\cap f^{-1}(B)=U_0\cap (U_B\cup C_B)= U_0\cap U_B\subset U_B$. Thus $U_B$ is an open neighborhood of the point $x$ and $f(U_B)\subset B$.
We can generalize the above arguments as follows. Let $X$ and $Y$ be topological spaces, $\mathcal B$ be an open base of the space $Y$ such that $|\mathcal B|=w(Y)$, and $f:X\to Y$ be a map. For each subset $U$ of the space $Y$ we put $C_U=\operatorname{int} f^{-1}(U)$ and $D_U=f^{-1}(U)\setminus C_U$. Put $D_f=\bigcup_{B\in\mathcal B} D_B$. Let $D(f)$ denotes the set of discontinuity points of the function $f$. We claim that $D(f)=D_f$. Indeed, since for each set $B\in\mathcal B$ the function $f$  is discontinuous at any point of a set $D_B$,  we see that $D_f\subset D(f)$. Conversely, we claim that the map $f$ is continuous at each point $x\in X\setminus D_f$. Indeed, let $B\in\mathcal B$ be an arbitrary open neighborhood of the point $f(x)$. Then $x\in (X\setminus D_f)\cap f^{-1}(B)\subset (X\setminus D_f)\cap C_B\subset C_B$. Thus $C_B$ is an open neighborhood of the point $x$ and $f(C_B)\subset B$. Thus $D(f)=D_f$. In particular, is the space $Y$ is second-countable, the set $D(f)$ is countable iff the set $D_B$ is countable for each $B\in\mathcal B$ iff the set $D_U$ is countable for each open subset $U$ of the space $Y$.
