Continuity at a point in terms of closure

Let $V\subset Y$ be an open such that $f(x_0)\in V$. If $x_0 \in \overline{f^{-1}(Y\setminus V)}$, then $f(x_o)\in \overline{f(f^{-1}(Y\setminus V))}\subset \overline{Y\setminus V}= Y\setminus V$, a contradiction, so $x_0 \not\in \overline{f^{-1}(Y\setminus V)}$. Then, if $U = X\setminus \overline{f^{-1}(Y\setminus V)}$ is an open in $X$ such that $x_0\in U$, and $f(U)\subset V$, so $f$ is continuous in $x_0$.


It's also sufficient: let $y=f(x_0)$ and $y \in V$, $V$ open in $Y$. We want to find (for continuity at $x_0$) find some open neighbourhood $U$ of $x_0$ such that $f[U] \subseteq V$.

Suppose that this would fail, then for every neighbourhood $U$ of $x_0$ we would have $f[U] \nsubseteq V$, or equivalently $U \cap f^{-1}[Y\setminus V] \neq \emptyset$.

It follows that then $x_0 \in \overline{f^{-1}[Y\setminus V]}$ and so the assumption on $f$ would imply that $y=f(x_0) \in \overline{f[f^{-1}[Y\setminus V]]}$. But $f[f^{-1}[B]] \subseteq B$ for any $B$ so we'd deduce that $y \in \overline{Y\setminus V} = Y\setminus V$ which is nonsense. So contradiction and such a $U$ must exist.