Why is the set $\{x \mid f(x) \not= g(x)\}$ measurable in a topological hausdorff space?

$h(x)=(f(x),g(x))$ is measurable and $\{x:f(x)\neq g(x)\}=h^{-1}(Y\times Y-\Delta)$ is measurable since $\Delta$ is closed, $(Y\times Y)-\Delta$ is open.


I think all presented proofs are incomplete (for instance, they don’t use the fact that $Y$ has a countable base $\mathcal B$). I also assume that $\mathcal M_X$ is closed with respect to intersections and countable unions.

Let $A=\{x\in X|f(x)\ne g(x)\}$. Let $x\in A$ be any point. Since $f(x)\ne g(x)$ and $Y$ is Hausdorff, there exists disjoint neighborhoods $U,V\in\mathcal B$ of $f(x)$ and $g(x)$, respectively. Thus

$$A=\bigcup \{f^{-1}(U)\cap g^{-1}(V): U,V\in\mathcal B, U\cap V=\varnothing\}$$

is measurable.