The closed graph theorem in topology

Theorem A map $\phi$ maps a topological space $X$ to another $Y$, where $X$ is Hausdorff, $Y$ is compact and the graph of $\phi$ is closed. Then $\phi$ is continuous.

Is it reallly necessary to include the condition that $X$ is Hausdorff? Since I see no reason, and I appear to have a proof without using the condition, I would like to know the answer.

A proof:
For any closed subspace $C$ of $Y$, the pre-image $D$ ought to be closed. For any element $a$ in the complement of $D$, we can use the compactness to show that there is a finite number of open sets in $Y$ such that the union of them covers the C, and then the corresponding open sets in $X$ is an open neighborhood of $a$ which has an empty intersection with $D$; so $D$ is closed.
P.S. in the proof, those open sets are obtained by the condition that the graph is closed and that $(a,c)$ is not in the graph for any $c$ in $C$.


You do not need Hausdorffness on $X$. Let $\pi$ be the projection of $X \times Y$ onto $X$. As $Y$ is compact (we just need compact, not Hausdorff) the map $\pi$ is closed. See here or here e.g. It's due to Kuratowski, I believe.

Now, if $f: X \mapsto Y$ has the property that its graph $G_f = \{ (x,f(x)) \mid x \in X \}$ is closed in $X \times Y$, and $Y$ is compact, then $f$ is continuous: let $C$ be a closed subset of $Y$. Then $$f^{-1}[C] = \pi[(X \times C) \cap G_f]$$ and as $X \times C$ is closed in $X \times Y$, and so is $G_f$, we have written $f^{-1}[C]$ as the image of a closed set under a closed map, hence is closed. As $C$ was arbitary, $f$ is continuous (inverse image of closed is closed).

So we need no separation axioms at all.