$f$ continuous in a dense set $G_\delta$ If $f:X \to Y$  is a function between a metric space baire $X$ and a metric separable space $Y$ and if for each open $U$ of $Y$, $f^{-1}(U)$ is countable union of closed sets of $X$, then there exists a dense $G_{\delta}$ in $X$ such that $f$ is continuous.
My objective: Suppose that $Z$ is the set $G_{\delta}$, then there exists a family of dense openings $\{W_i : i \in \mathbb{N}\}$ of $X$ such that $Z= \cap_{i \in \mathbb{N}} W_i$, also, as for each open $U$ of $Y$ we have to $f^{-1}(U)= \cup_{i \in \mathbb{N}}B_i$ where $B_i$ es closed in $X$, i.e, $f^{-1}(U)$ is $F_\sigma$, and since $Y$ is separable, then $Y$ has a dense subset. My idea is to use the separability of $Y$ to build my $G_ {\delta}$, but I don't know how to do it. How could I use it? or any other ideas for this test? please thank you very much.
 A: Since $Y$ is a separable space it has a countable base $\mathcal B$. For each $B\in \mathcal B$ let $f^{-1}(B)$ be a union of a countable family $\mathcal C_B$ of closed subsets of $X$. Put $Z=X\setminus \bigcup_{B\in\mathcal B}\bigcup_{C\in\mathcal C_B} C\setminus\operatorname{int} C$. Then $Z$ is a $G_\delta$-subset of $X$. Since $X\setminus Z$ is a union of countable many nowhere dense subsets of a Baire space $X$,  $Z$ is dense in $X$, see, for instance, Theorem 1.13 in [HC].
We claim that a restriction $f|Z$ is continuous. Indeed, let $x\in Z$ be any point any $U$ be any neighborhood of $f(X)$. There exist a set $B’\in\mathcal B$ such that $f(x)\in B’\subset U$. Then
$$x\in Z\cap f^{-1}(B’)=\left(X\setminus \bigcup_{B\in\mathcal B}\bigcup_{C\in\mathcal C_B} C\setminus\operatorname{int} C\right)\cap \bigcup_{C\in\mathcal C_{B’}} C= Z\cap  \bigcup_{C\in\mathcal C_{B’}}\operatorname{int} C$$
is an open subset of $Z$ and $f\left(Z\cap f^{-1}(B’)\right)\subset B’\subset U$.
References
[HC] R. C. Haworth, R. C. McCoy, Baire spaces, Warszawa, Panstwowe Wydawnictwo Naukowe, 1977.
