This question is about constructive mathematics (without Choice), such as in the internal logic of a topos with natural numbers object, or in IZF. The “reals” (and the symbol $\mathbb{R}$) refer to the Dedekind real numbers.
Classically, if $S$ is an inhabited ($\exists x\in S.\top$) set of reals that has an upper bound ($\exists x\in\mathbb{R}.\forall y\in S.(y\leq x)$), then it has a supremum (i.e., an upper bound $x$ such that additionally $\forall\delta>0.\exists y\in S.(y\geq x-\delta)$). Constructively, this can no longer be asserted.
[Edit: also, it is worth noting that “supremum” is a constructively stronger notion than “least upper bound”: see comment by Jean Abou Samra below, and my reply to it. So, to be clear, I am asking about “supremum”, and this is why I recalled the definition.]
Question: What nice additional conditions can we add to “inhabited” and “bounded above” to guarantee that $S$ has a supremum? Specifically, can we find one of “topological” nature?
Discussion about locatedness:
One notion relevant here is “locatedness”. However, there is an entire maze of subtly different notations that go under some variation of this term.
The most standard definition of “locatedness” of $S \subseteq \mathbb{R}$ seems to be that for all $z\in\mathbb{R}$ the distance $d(z,S)$ exits, but this is not at all topological, and also, since the distance is defined as the infemum of $|z-y|$ for $y\in S$, applying this with $z$ being an upper bound of $S$ does guarantee that $S$ has a supremum… but in an absolutely trivial way, so something less circular is desirable.
One form of locatedness that I had incorrectly believed to be sufficient (in conjunction with “inhabited” and “bounded above” to guarantee that the set has a supremum), and which [1] calls “pointwise almost located” is:
$$ \begin{aligned} \forall x\in\mathbb{R}.\forall \delta>0.(&(\exists y\in S.(|x-y|<\delta))\\ \lor\;&(\exists \eta>0.\neg\exists y\in S.(|x-y|<\eta))) \end{aligned} \tag{*} $$
that is, in topological terms,
$$ \begin{aligned} \forall x\in\mathbb{R}.\forall U\,\text{open}\ni x.(&S\cap U\;\text{inhabited}\\ \lor\;&(\exists V\,\text{open}\ni x.(S\cap V=\varnothing))) \end{aligned} \tag{*} $$
(In [2], definition 1.2.1(iv) this is called “located”, and naïve me was thus led into believing that what one paper calls “located” might be equivalent to what another paper calls “located”. Ha, ha, silly me.)
In the latter form, this is the sort of condition I am after. However, it is not sufficient, as the following counterexample slightly adapted from [1] shows: let $(s_n)$ be a Specker sequence in $[0,1]$, i.e., an increasing sequence of rational numbers in $[0,1]$ that is bounded away from any real (meaning: $\forall x\in\mathbb{R}.\exists\eta>0.\exists N.\forall n\geq N.(|x-s_n|\geq\eta)$). Let $(b_n)$ be a binary sequence at most one term of which equals $1$. Let $S := \{-1\} \cup \{s_n : b_n=1\}$. Then $S$ is inhabited (by $-1$), bounded above (by $1$), satisfies (*) (as is easy to see from the property of $(s_n)$), but if it has a supremum $x$ then either $\forall n.(b_n=0)$ (this is implied by $x<0$) or $\exists n.(b_n=1)$ (this is implied by $x>-\frac{1}{2}$). So if there exists a Specker sequence and if every inhabited bounded above subset of $\mathbb{R}$ satisfying (*) has a supremum, then LPO holds; and in the effective topos, a Specker sequence exists and LPO fails, so (*) is not sufficient.
The following condition, which [1] calls “almost located”, however, is sufficient by [1], corollary 5:
$$ \begin{aligned} \forall \delta>0.\exists \eta>0.\forall x\in\mathbb{R}.(&(\exists y\in S.(|x-y|<\delta))\\ \lor\;&\neg\exists y\in S.(|x-y|<\eta)) \end{aligned} \tag{†} $$
But this notion (†) does not appear to be expressible in topological terms as I did for (*): it is a uniform notion and, indeed, [1] expresses it in the context of uniform spaces.
There may be some reason (which escapes me) why we really need some kind of uniformity to express locatedness, but note that I am not demanding locatedness, I am just demanding the existence of a supremum, and maybe locatedness is uselessly strong.
References: