Should the distance between two disjoint sets always equal the distance between their infimum and supremum

general-topologymetric-spacesreal-analysis

Let $A$ and $B$ be two subsets of a metric space $X \subset \mathbb{R}$, where the metric is the usual notion of distance. Clearly if $A \cap B \neq \varnothing$, then $\mathrm{dist}(A, B) = \inf\{d(a, b)\mid a \in A, b \in B\} = 0$. So suppose that $A \cap B = \varnothing$ and $\forall b \in B, \forall a \in A: b > a$. If we are talking only about metric spaces like $X$, it feels intuitive that the distance between $A$ and $B$ should equal the distance between their respective supremum and infimum. That is, $\mathrm{dist}(A, B) = d(\sup(A), \inf(B))$. (I think this could be proven by showing a contradiction with respect to the triangle inequality property of a metric.)

So my question is that how is this intuitive feeling of distance between two sets generalized, if at all, and what properties does the surrounding space $X$ need to satisfy? Is it necessary and sufficient for $X$ to obey the order axioms and density of real numbers, or whatever their general variants are called?

Best Answer

Your assumption that, if $A,B\subset\Bbb R$, then$$\operatorname{dist}(A,B)=|\sup(A)-\inf(B)|\tag1$$is wrong. Note that if you exchange $A$ and $B$, then the number $\operatorname{dist}(A,B)$ reamins the same, whereas $|\sup(A)-\inf(B)|$ changes (in general). Anyway, if$$A=\left\{\frac1n\,\middle|\,n\in\Bbb N\right\}\quad\text{and}\quad B=\left\{\frac{\sqrt2}n\,\middle|\,n\in\Bbb N\right\}$$then $\operatorname{dist}(A,B)=0$, but $\inf(A)=\inf(B)=0$, $\sup(A)=1$ and $\sup(B)=\sqrt2$. So you neither have $(1)$ nor $\operatorname{dist}(A,B)=|\sup(B)-\inf(A)|$.