[This question came up while idly thinking about this other one, but it is not directly related.]
Definitions: If $X$ is a topological space, let $C(X)$ stand for the $\mathbb{R}$-algebra of continuous real-valued functions $X\to\mathbb{R}$ where $\mathbb{R}$ has its usual (Euclidean) topology, and let $D(X)$ stand for the $\mathbb{R}$-algebra of locally constant functions $X\to\mathbb{R}$, or equivalently, continuous functions $X\to\mathbb{R}_{\mathrm{disc}}$ where $\mathbb{R}_{\mathrm{disc}}$ stands for $\mathbb{R}$ endowed with the discrete topology. Both $C$ and $D$ can be seen as contravariant functors from the category of topological spaces to the category of $\mathbb{R}$-algebras (by taking a continuous map $f\colon X\to Y$ to the ring homomorphism defined by right-composition by $f$).
Motivations for the following questions: Quite a lot is known about $C(X)$ (and its subalgebra $C^*(X)$ of bounded functions), as witnessed, e.g., by the classic book by Gillman & Jerison, Rings of Continuous Functions (and also its “sequel” of sorts, by Fine, Gillman & Lambek, Rings of Quotients of Rings of Functions). For example, $C(X)$ uniquely determines $X$ up to isomorphism when $X$ is [completely regular and] realcompact, and when this is the case, $X$ can be recovered as the closure of the image of $X$ under the evaluation map $X \to \mathbb{R}^{C(X)}$, or as the set of maximal ideals of $C(X)$ whose quotient ring is $\mathbb{R}$ endowed with the Zariski topology. However, that I know of, there is no satisfactory purely algebraic characterization of $\mathbb{R}$-algebras of the form $C(X)$.
Now I realized to my horror that I had no idea about the analogous questions for $D(X)$ (and its subalgebra $D^*(X) := D(X) \cap C^*(X)$). I could ask a million questions, the gist of which would be “where can I learn about the same things concerning $D(X)$ that Gillman & Jerison teaches us about $C(X)$?”, so if somebody knows the answer to that, please do tell; but since MathOverflow requires that I ask something more specific than “every question answered in Gillman & Jerison”, let me ask something slightly different, namely whether we can reduce the study of $D(X)$ to that of the well understood $C(X)$. Namely:
Questions: Given a topological space $X$, does there always exist a topological space $\nabla X$ such that $C(\nabla X) = D(X)$? Better: can we find a functor $\nabla$ (from topological spaces to topological spaces) such that $C\circ\nabla = D$ and a natural transformation $\eta \colon 1_{\mathbf{Top}} \to \nabla$ such that $C(\eta_X)\colon C(\nabla X) = D(X) \to C(X)$ is the inclusion, and perhaps, say, that $\eta$ is an isomorphism on discrete spaces? Even better: is $\nabla$ left-adjoint to the inclusion functor of the full subcategory of topological spaces $X$ for which $D(X)=C(X)$ (the existence of this left adjoint would answer all questions positively)? [edit: see below]
PS: I just remembered that spaces such that $D(X)=C(X)$ are known as “P-spaces”, but this doesn't really help. It does, however, allow me to restate the strongest version of my question as: “the the full subcategory of P-spaces reflective?”. Also, maybe I should be formulating my questions in the language of locales rather than topological spaces?
Edit: Simon Pépin-Lehalleur has just pointed outPepin Lehalleur has just pointed out to me that an arbitrary product of P-spaces can fail to be a P-space (Gillman & Jerison, exercise 4K(6)), so we can't hope for them to form a reflective subcategory. This doesn't invalidate weaker forms of the question, however.
Remark: Even in the case of $X=\mathbb{Q}$ (with the usual (=order) topology), I don't know whether there exists a space $\nabla\mathbb{Q}$ such that $C(\nabla\mathbb{Q}) = D(\mathbb{Q})$.