Where is the Intermediate Value Theorem Valid? I'm aware that $\mathbb{R}$ is not the only set that satisfies the least upper bound property, the $p$-adics do also. Does the intermediate value theorem also hold in the $p$-adics then?
What are the spaces where the intermediate value theorem hold?
 A: The intermediate value theorem can be generalized for topological spaces.  For me, this makes sense, since the hypotheses for the IVT are in essence that given a function $f:X \to Y$, where $X,Y$ are topological spaces and


*

*X is connected

*$f$ is continuous

*There is some ordering on $(Y,<)$ (equipped with the order topology)
then the intermediate value theorem holds.
We need hypothesis $1$ and $2$ to make sure that (heuristically at least) there are no "jumps" in the values our function takes. For example, $f:(-\infty,0) \cup (0,\infty) \to \mathbb R$ given by $f(x)=1/x$ is continuous, but its domain is disconnected,  so we cannot guarantee that the function takes on the value $0$. On the other hand take $f$ to be any step function on a connected domain, and note that it fails to satisfy the intermediate value theorem.
Hypothesis $3$ is there simply to make sense of the theorem anyway. Our IVT for $\mathbb R$ can be recovered by noting that the connected components of the real line are exactly the rays and intervals.
If I'm not mistaken, the $p$-adic rationals  are totally disconnected as noted here, so it seems unlikely that there would exist a generalization to this setting.
