Separately continuous function vanishing on a dense set This is a follow-up to If a separately continuous function $f : [0,1]^2 \to \mathbb{R}$ vanishes on a dense set, must it vanish on the whole set?.
Is there an example of:


*

*a pair of metric spaces $X,Y$

*a dense set $E \subset X \times Y$

*a separately continuous function $f : X \times Y \to \mathbb{R}$ (that is, for each $x_0, y_0$ the functions $x \mapsto f(x, y_0)$ and $y \mapsto f(x_0, y)$ are continuous)
such that $f = 0$ on $E$, but $f$ is not identically 0?
I gave an answer to the linked question, citing a theorem of Sierpiński that there is no such example when $X=Y=\mathbb{R}$.  The proof seems to go through for arbitrary metric spaces, as long as either $X$ or $Y$ is complete.  So for an example as desired here, $X$ and $Y$ must both be incomplete (and moreover, neither can be homeomorphic to a complete metric space).  I thought about trying $X = Y = \mathbb{Q}$ but couldn't come up with a working example.
 A: Given two topological spaces $X$ and $Y$, let $Z=X\times Y$ with the topology of separate continuity (i.e, the finest topology such that the inclusion of every horizontal and vertical section is continuous).

Theorem: Suppose $X$ and $Y$ are countable regular spaces.  Then $Z$ is normal.

Proof:  Let $A,B\subset Z$ be disjoint closed sets.  The idea is to construct open sets $U$ and $V$ separating them by a dovetailing inductive process where at each step, we add a new horizontal or vertical neighborhood to either $U$ or $V$.  We start with $U_0=A$ and $V_0=B$, and inductively construct larger and larger sets $U_n$ and $V_n$ such that $\overline{U_n}\cap \overline{V_n}=\emptyset$ for each $n$.  To define $U_{n+1}$, choose a point $(x,y)\in U_n$ and either an open neighborhood $W\subseteq X$ of $x$ or an open neighborhood $W\subseteq Y$ of $y$ such that $\overline{W}\times\{y\}$ (or $\{x\}\times\overline{W}$) is disjoint from $\overline{V_n}$ (we can do this because $U_n\cap\overline{V_n}=\emptyset$ and $X$ and $Y$ are regular).  Define $U_{n+1}=U_n\cup W\times\{y\}$ (or $U_{n+1}=U_n\cup\{x\}\times W$).  To define $V_{n+1}$, do the same thing (add a horizontal or vertical neighborhood to $V_n$ while keeping the closure disjoint from $\overline{U_{n+1}}$).
Using the countability of $X$ and $Y$, it is easy to see that we can arrange to choose the points we add horizontal/vertical neighborhoods around in a dovetailing fashion such that every point in any $U_n$ or $V_n$ eventually gets a horizontal and vertical neighborhood around it added to some later $U_m$ or $V_m$.  Thus the sets $U=\bigcup_n U_n$ and $V=\bigcup_n V_n$ have the property that for any $p\in U$, there is both a horizontal and a vertical neighborhood of $p$ contained in $U$, and similarly for $V$.  This says exactly that $U$ and $V$ are open in $Z$.  By construction, $U$ and $V$ are disjoint and contain $A$ and $B$.  Thus $Z$ is normal.

Now to answer your question, let $X=Y=\mathbb{Q}$.  It is easy to construct a proper subset $E\subset \mathbb{Q}\times\mathbb{Q}$ which is dense in the product topology but closed in the $Z$-topology (for instance, inductively choose points of $E$ such that $E$ contains at most one point on each horizontal and vertical line).  If $p\not\in E$, then by the Theorem and Urysohn's lemma, there is a continuous function $f:Z\to\mathbb{R}$ sending $E$ to $0$ and $p$ to $1$.  Since continuity on $Z$ is exactly separate continuity, this satisfies your requirements.
