A proof that continuity of $f:X\to Y$ is equivalent to $\overline{f^{-1}(M)}\subset f^{-1}(\overline{M})$. Given two topological spaces $\left\langle X,\tau\right\rangle $, $\left\langle Y,\sigma\right\rangle$ and a function $X\overset{f}\longrightarrow Y$. Would someone please sketch a proof that
(1) $\quad$ For all sets $M\subset Y$, it holds that $x\in \overline{f^{-1}(M)}\Rightarrow f(x)\in \overline{M}$
is equivalent with that $f$ is continuous?
 A: If $f$ is continuous, then $f^{-1}(\overline{M})$ is closed. Since $f^{-1}(M) \subset f^{-1}(\overline{M})$, it follows that $\overline{f^{-1}(M)} \subset f^{-1}(\overline{M})$.
For the converse, note that $\overline{f^{-1}(M)} \subset f^{-1}(\overline{M})$ implies that $$f^{-1}(\overline{M})^c=f^{-1}(\overline{M}^c)\subset \overline{f^{-1}(M)}^c=\operatorname{int}(f^{-1}(M)^c)=\operatorname{int}(f^{-1}(M^c)),$$ where we use that the complement of the closure is the interior of the complement. Any open set $U$ can be written as $M^c=\overline{M}^c$ for some closed set $M$, so this implies for $U$ open:
$$f^{-1}(U) \subset \operatorname{int}(f^{-1}(U)).$$
A: Assume that $f$ is continuous. We will argue by contradiction. Suppose $f(x)\notin \overline{M}.$ Then there exists an open set $V$ in $Y$ such that $f(x)\in V$ and $V\cap M=\emptyset.$ Since $f$ is continuous we have that $f^{-1}(V)$ is open. Moreover, $x\in f^{-1}(V)$ and $f^{-1}(V)\cap f^{-1}(M)=\emptyset.$ So, $x\notin \overline{f^{-1}(M)}.$
Conversely, assume that for any set $M\subset Y$ it is $x\in \overline{f^{-1}(M)}\Rightarrow f(x)\in \overline{M}.$ To show continuity it is enough to show that $\overline{f^{-1}(M)}$ is closed if $M$ is closed. So, assume $M$ is closed, that is, $M=\overline{M}.$ If $\overline{f^{-1}(M)}$ is not closed, then there exists $x\in \overline{f^{-1}(M)}$ such that $x\notin  f^{-1}(M).$ But this is impossible since $f(x)\in \overline{M}=M.$
A: Recall that $f^{-1}$ is a homomorphism of Boolean algebras, therefore $f^{-1}(Y\setminus A)=X\setminus f^{-1}(A)$. Therefore the definition of continuity can be expressed as follows:

$f$ is continuous if whenever $A\subseteq Y$ is closed, then $f^{-1}(A)$ is closed in $X$.

Now this is easy. Given your condition, pick $M=\overline M$, then we have that $x\in\overline{f^{-1}(M)}$ implies that $f(x)\in M$ and therefore $x\in f^{-1}(M)$. So $f^{-1}(M)$ is indeed closed (the other inclusion is trivial).
In the other direction, suppose that $f$ is continuous $M\subseteq Y$, then $f^{-1}(\overline M)$ is closed and contains $\overline{f^{-1}(M)}$, so of course if $x\in\overline{f^{-1}(M)}$ then $x\in f^{-1}(\overline M)$ and therefore $f(x)\in\overline M$ as wanted.
A: Suppose $f$ is continuous, and suppose $x\in\overline{f^{-1}(M)}$. If $U\subset Y$ is open and contains $f(x)$, then $f^{-1}(U)\subset X$ is open and contains $x$, thus intersects $f^{-1}(M)$, which means that $U$ intersects $M$, and so $f(x)\in\overline{M}$.
Conversely, suppose that the condition $(1)$ holds, and let $M\subset Y$ a closed subset. We claim $\overline{f^{-1}(M)}=f^{-1}(M)$. One inclusion is obvious, and for the other one let $x\in\overline{f^{-1}(M)}$. So by $(1)$, $f(x)\in\overline{M}$, but $M$ is closed, hence $f(x)\in M$, meaning that $x\in f^{-1}(M)$. So the inverse image of a closed subset is closed, and $f$ is continuous.
