Lemma (continuous iff taking preimage preserves open or closed sets)
Let $(X,\tau)$ and $(Y,\rho)$ be topological spaces, and $f: X\to Y$. The following are equivalent:
-
$f$ is continuous;
-
for all open set $V$ in $(Y,\rho)$, the preimage $f\inv(V)$ is open in $(X,\tau)$;
-
for all closed set $V$ in $(Y,\rho)$, the preimage $f\inv(V)$ is closed in $(X,\tau)$.