Given a nondiscrete compact Hausdorff space $K$, does there always exist a real-valued function $f$ on $K$ that is not locally constant? Why/why not?


In <http://arxiv.org/abs/math/9505204> the authors show that there are compact Hausdorff spaces $K$ such that all $f \in C(K)$ are locally constant on a dense subset (example: $\beta \mathbb{N} \setminus \mathbb{N}$). However, they do not mention anything about functions that are locally constant *everywhere*.



Existence of non-locally constant functions
A $P$-space is a completely regular space where the countable intersection of open sets is open. It is well known and easy to prove that that a completely regular space is a $P$-space if and only if every continuous function is locally constant.
In fact, there are several other necessary and sufficient conditions for whether a space is a $P$-space and these conditions can be found in the book Rings of Continuous Functions by Gillman and Jerison. The only compact $P$-spaces are the finite spaces: First take note that every $P$-space is zero-dimensional(i.e. it has a basis of clopen sets). If $X$ is an infinite $P$-space, and $A\subseteq X$ is a countable subset, then for each $a,b\in A$ with $a\neq b$, let $\{C\_{a,b,1},C\_{a,b,2}\}$ be a partition of $X$ into two clopen sets such that $a\in C\_{a,b,1},b\in C\_{a,b,2}$. Let $P=\bigcap\_{a,b\in P}\{C\_{a,b,f(a,b)}|f:A^{2}\setminus 1\_{A}\rightarrow\{1,2\}\}.$ Then $P$ is a partition of $X$ into infinitely many clopen sets. Therefore $X$ cannot be compact.


