# When is the supremum of one set equal to the infimum of another set?

Let $$A$$ and $$B$$ be sets of real numbers. My question is, under what circumstances is the supremum of $$A$$ equal to the infimum of $$B$$?

Now $$x$$ is the supremum of $$A$$ if and only if for any $$\epsilon>0$$ there exists an $$a\in A$$ such that $$x\geq a>x-\epsilon$$. And $$y$$ is the infimum of $$B$$ if and only if there exists a $$b\in B$$ such that $$y\leq b. Is there any way to combine these two conditions into a single condition for when the supremum of $$A$$ is equal to the infimum of $$B$$? Some kind of inequality involving elements of $$A$$ and elements of $$B$$?

You might try to ask for something like $$\forall a\in A\forall b\in B(a\leq b)\wedge\forall \epsilon\exists a\in A\exists b\in B (a\leq b\leq a+\epsilon),$$ which actually means that $$A$$ is below $$B$$ as a set and thee two sets have elements that are arbitrarily close. But I am not sure if this exactly what you are looking for.
Since every element of $$A$$ is below $$B$$, the supremum of $$A$$ $$x$$ cannot be above the infimum of $$B$$ $$y$$, i.e. $$x\leq y$$. But if we had $$x, then say using $$\epsilon=|x-y|/2$$, we cannot find any element of $$B$$ at distance less than $$\epsilon$$ from $$x$$ (and so from every element of $$A$$), contradicting the formula above. This proves that the formula above implies that $$x=y$$.
On the other hand, if $$x=y$$, given any $$\epsilon$$, we can find $$a$$ and $$b$$ with distance from $$x$$ less than $$\epsilon/2$$. In particular, $$a\leq b\leq a+\epsilon$$. Moreover, clearly every element of $$A$$ is not above $$x$$ and every element of $$B$$ is not below it, so the formula follows.