I was asked whether the following statement is true or false:
For a continuous function $f$, $f^{-1}(F)$ is closed whenever $F$ is closed.
I proved earlier that for open sets F this statement is true. After thinking for a while I came up with the following 'counterexample': $$ f: (0,1) \rightarrow [0,1] \\ f(x) = \begin{cases} 0 \hspace{3cm} x \in (0,1/4)\\ 2(x-1/4) \hspace{1.3cm} x \in [1/4,3/4]\\ 1 \hspace{3cm} x \in (3/4,1)\end{cases}$$
I know however that the statement should be true, as proven in https://math.stackexchange.com/a/107299/681496. Can anyone point me to the error in my counterexample?