Preserving compactness and connectedness implies continuity for functions between locally connected, locally compact spaces?

In this question: Connected and Compact preserving function is not continuous example? It is mentioned that "a function between locally-compact, locally-connected topological spaces which preserves connected and compact subsets is in fact continuous". I've come close to coming up with a proof for functions between $\mathbb{R}$ , but the more general statement above seems much more interesting, however I haven't been able to find a proof anywhere or to think of a way to prove it myself.

Could someone provide a reference, where I could find the proof of that? Or a counterexample if the statement is actually false.

EDIT: As was pointed out in an answer below, the statement turns out false with a very simple counterexample, in which the spaces are not Hausdorff. Perhaps the additional condition of both spaces being Hausdorff will be sufficient to make it true?

EDIT2: Since some people asked, here's my proof for $f: \mathbb{R} \rightarrow \mathbb{R}$:

Assume f is not continuous at a point $x$. We can find a sequence $x_n \rightarrow x$ monotonically with no subsequence of $f(x_n)$ converging to $f(x)$.

If $f(x_n)$ isn't constant for infinitely many $n$, we can find a subsequence $x_{n_k}$ such that $f(x_{n_k})$ is strictly increasing or decreasing. Hence, $f(x_{n_k})$ cannot converge to $f(x)$ nor to $f(x_{n_k})$ for any $k$. $\{ x_{n_k} \} \cup \{ x \}$ is compact, but $\{ f(x_{n_k}) \} \cup \{ f(x) \}$ is not, which gives a contradiction, since $f$ preserves compactness.

If $f(x_n) = c$ for infinitely many $n$, we can assume it's constant for all $n$, going to a subsequence if necessary. $f$ preserves connectedness, so for arguments between $x$ and $x_n$ it takes all values between $f(x)$ and $c$. For each $n$ take $y_n$ between $x$ and $x_n$ so that $0 < |f(y_n) - c| < \frac{1}{n}$. $\{y_n\} \cup \{x\}$ is compact, but the image is not, since $f(y_n) \rightarrow c \ne f(x)$. Contradiction.

• Perhaps you should ask about the proof you're still working on before trying to generalize... – Zach466920 Apr 30 '15 at 22:05
• How are you doing with the proof over $\mathbb R$? I've got a nice hint for you if you want it. – John Gowers May 1 '15 at 21:17
• I've added my rough proof to the question. Unless I've missed something, it should be complete. – Ormi May 2 '15 at 17:24
• I think you have to admit that between me and @BrianMScott, your original question is now answered... – Hew Wolff May 6 '15 at 2:20

You definitely need the target space to be Hausdorff. Theorem $\mathbf{5.4}$ of Gerlits, Juhász, Soukup, & Szentmiklóssy, Characterizing continuity by preserving compactness and connectedness, says that if $X$ is $T_3$, and every connectedness-preserving, compactness-preserving map from $X$ to a $T_1$ space is continuous, then $X$ is discrete. Thus, there must be a $T_1$ space $Y$ and a connectedness-preserving, compactness-preserving map $f:\Bbb R\to Y$ such that $f$ is not continuous. In fact, let $Y$ denote $\Bbb R$ with the cofinite topology, and define
$$f:\Bbb R\to Y:x\mapsto\begin{cases} 1,&\text{if }x=2^{-n}\text{ for some }n\in\Bbb N\\ x,&\text{otherwise}\;. \end{cases}$$
Then $f$ is not continuous, since the inverse image of $\{1\}$ is not closed in $\Bbb R$. $Y$ is hereditarily compact, so $f$ certainly preserves compactness. Finally, if $C\subseteq\Bbb R$ is connected, then either $|C|=1$, in which case $f[C]$ is connected, or $C$ contains a non-empty open interval, in which case $f[C]$ is infinite and therefore connected.
The positive result closest to what you want is Corollary $\mathbf{2.4}$ of the same paper, which says that if $X$ is locally compact, locally connected, and monotonically normal, and if $f$ is a connectedness-preserving, compactness-preserving map from $X$ to a $T_3$ space, then $f$ is continuous.
I believe the general statement is false. Consider the set $X = \{x_0, x_1\}$ with the topologies $\mathcal{T}_0 = \{\emptyset, \{x_0\}, \{x_0, x_1\}\}$ and $\mathcal{T}_1 = \{\emptyset, \{x_1\}, \{x_0, x_1\}\}$. In both topologies, every subset is both compact and connected. So both spaces are locally connected and locally compact, and furthermore any map between them preserves both connected and compact subsets. But the identity map $1_X: (X, \mathcal{T}_0) \to (X, \mathcal{T}_1)$ is not continuous because $\{x_1\}$ is not open in $\mathcal{T}_0$.