How to prove that these Darboux functions are continuous? Let $f$ be a   function defined on $[0,2]$ with the following properties:
i) If $[a,b] \subset [0,\infty],$ then $f([a,c])$ contains the interval with extremes  $f(a)$ and $f(b).$ 
ii) For all $c \in \Bbb R, $  the set $f^{-1}(c)$ is open. 
Prove that $f$ is not continous on $[0,1]$  
 A: First, observe that property i) says that $f$ satisfies the conclusion of the intermediate value theorem. Such functions are called Darboux functions. They are not necessarily continuous.
Let us prove that for a Darboux function on $[0,1]$: $f$ is sequentially continuous (hence continuous, since we are dealing with metric spaces) if and only if $f^{-1}(\{c\})$ is closed for every $c\in\mathbb{R}$. The forward implication is trivial. We will prove the converse by contrapositive.
So assume there exists $x_0\in[0,1]$ and a sequence $(x_n)$ which converges to $x_0$ in $[0,1]$, such that $(f(x_n))$ does not converge to $f(x_0)$. This means that there exists $\epsilon>0$ such that for all $N$, there exists $n\geq N$ such that $|f(x_n)-f(x_0)|\geq \epsilon$, i.e. $f(x_0)+\epsilon\leq f(x_n)$ or $f(x_n)+\epsilon\leq f(x_0)$. 
These two conditions can't be both realized by a finite number of elements of the sequence. So assume the former is fulfilled for infinitely many $n$'s. A similar argument will reach the desired conclusion in case it is only the second inequality which is satisfied infinitely many times.
So up to an extraction, we can assume that $f(x_0)<c:=f(x_0)+\epsilon\leq f(x_n)$ for all $n$. By the Darboux property i), this yields for every $n$ the existence of some $y_n$ between $x_0$ and $x_n$ such that $f(y_n)=c$. Then $y_n\in f^{-1}(\{c\})$ converges to $x_0\not \in  f^{-1}(\{c\})$. So $f^{-1}(\{c\})$ is not closed for this $c$.
