*Edit: Will Sawin has pointed out some difficulties with this answer. I'm going to leave this up for at least a while, in case anyone has any ideas about repairing it. Or perhaps this could be a cautionary tale?*

My answer is that there is no space $X$ admitting a continuous surjection $X \to D^X$.

Following one of Andrej's suggestions, let's extend the context from $\text{Top}$ to the quasitopos $\text{Choq}$ of Choquet (aka pseudotopological) spaces. This is a convenient setting because quasitoposes are cartesian closed (so we never have to wonder about the existence of certain exponentials, as we would for $\text{Top}$), and moreover this won't alter the problem of the OP because the full inclusion $i: \text{Top} \to \text{Choq}$ preserves cartesian products and any exponentials that happen to exist in $\text{Top}$. A further convenience is that $\text{Choq}$ is concrete and even topological (over $\text{Set}$), and we may say that a map of Choquet spaces is *surjective* if its underlying function is, so that the inclusion $i$ also preserves surjective maps. (By concreteness, every surjective map is an epimorphism, and the converse is true in $\text{Choq}$.)

Suppose that there is a topological space $X$ such that $D^X$ exists in $\text{Top}$ and there is a surjective continuous map $\phi: X \to D^X$. In $\text{Choq}$ we get an induced map $D^\phi: D^{D^X} \to D^X$. The idea now is to construct a retraction to $D^\phi$ which might suggestively be denoted $\text{Ran}_\phi: D^X \to D^{D^X}$ (think "right Kan extension"), by exploiting the fact that $D = [0, 1]^n$ is an internal sup-lattice in $\text{Choq}$. Granting this possibility for the moment, and putting $Z = D^X$, we now have that $D^Z$ is a *retract* of $Z$ (to simplify notation, call the retraction $r: Z \to D^Z$ and the section $s: D^Z \to Z$), which opens the door to the argument given by Sam Eisenstat over at the related thread: Is there a topological space X homeomorphic to the space of continuous functions from X to [0, 1]?. In detail, for variables $z$ of type $Z$ and $g$ of type $D^D$, introduce the fixed-point combinator $Y: D^D \to D$ (which will live by the way in $\text{Top}$, since $D$ is an exponentiable space) by the formulas

$$H := \lambda g. s(\lambda z. g(r(z)(z)))$$

$$Y := \lambda g. (r(H(g)))(H(g))$$

and verify in the usual manner that $Y(g)$ of type $D$ is a fixed point of $g$. Then invoke Sam's argument that such continuous fixed-point combinators $Y$ can't exist. (Technically, he indicated the reason for the special case $D = I = [0, 1]$, but the problem for general $D$ can be reduced to the special case as follows. Supposing a fixed point combinator $Y: D^D \to D$ exists, choose a pair $\rho: D \to I, \sigma: I \to D$ that exhibits $I$ as a retract of $D$, and verify that the composition

$$I^I \stackrel{\sigma^\rho}{\to} D^D \stackrel{Y}{\to} D \stackrel{\rho}{\to} I$$

is a fixed point combinator, which is impossible by Sam's argument.) Contradiction.

The task now is to construct the retraction $\text{Ran}_\phi: D^X \to D^{D^X}$. As indicated before, the background of this construction is a theory of sup-lattices in quasitoposes, for which I know no literature reference, but at some point I can make some notes on this available on my nLab web. In fact I had begun a pretty deep dive into this theory here, but then luckily found some simplifications which circumvent a lot of this theory. I'll go into the simplified proof in the final section, after introducing some necessary definitions in the next section (for those not very categorically minded, the next section has the function of sparing us the terrible agony of verifying that certain "easily defined" functions between certain Choquet spaces really are continuous maps -- the abstract account which comes next does all that work for us).

A quasitopos $Q$ has a regular subobject classifier $\Omega$, which for $\text{Choq}$ is just a 2-point set $\{f, t\}$ equipped with the codiscrete (indiscrete) topology. (If $X$ is a Choquet space, then the points of $P X = \Omega^X$ are given by subspaces of $X$, i.e., subsets of $X$ with the subspace pseudotopology, or just the subspace topology if $X$ is a topological space.) Next, each map in $Q$ has a (unique) epi-(regular mono) factorization, due to the very useful fact that a quasitopos is not just regular but *coregular* ($Q^{op}$ is regular); see Johnstone's Elephant, Corollary A.2.6.3. The mono part will be called the *regular image* of $f$. This permits us to define, for a map $f: X \to Y$, the direct image mapping $\exists_f: \Omega^X \to \Omega^Y$ that in the case $Q = \text{Choq}$ takes a subspace $U$ of $X$ to the subspace $f(U)$ of $Y$. Formally, $\exists_f$ is defined by starting with the canonical regular subobject $\in_X \hookrightarrow X \times \Omega^X$ that is classified by the evaluation mapping $X \times \Omega^X \to \Omega$, then taking the regular image of the composite

$$\in_X \hookrightarrow X \times \Omega^X \stackrel{f \times 1}{\to} Y \times \Omega^X,$$

then forming the classifying map $Y \times \Omega^X \to \Omega$ of the regular image, and then currying that to get $\exists_f: \Omega^X \to \Omega^Y$.

Next, let us define a poset in $Q$ to be an object $X$ together with a regular subobject $i: X_1 \hookrightarrow X \times X$ satisfying standard axioms. If $X, Y$ are two posets, we can define their internal hom $[X, Y]$ as the pullback of an evident diagram

$$\begin{array}{ccccc}
& & & & Y_1^{X_1} \\
& & & & \downarrow j^{X_1} \\
Y^X & \stackrel{sq}{\to} & (Y \times Y)^{X \times X} & \stackrel{(Y \times Y)^i}{\to} & (Y \times Y)^{X_1}
\end{array}
$$

where $sq(f) := f \times f$. The pullback of the regular mono $j^{X_1}$ along the bottom composite is again a regular mono $[X, Y] \to Y^X$. Of course $\Omega$ has a standard ordering $f \leq t$ and the points of $[X, \Omega]$ are given by regular upward-closed subobjects of $X$; for the quasitopos $\text{Choq}$ I'll just call them "up-sets", and similarly the points of $[X^{op}, \Omega]$ are "down-sets".

We will want to consider $[X^{op}, \Omega]$ as a free posetal cocompletion of $X$, so let's say a few words on that. The "Yoneda embedding" $y_X: X \to [X^{op}, \Omega]$ is obtained by letting $\chi_{X_1}: X \times X \to \Omega$ classify the regular subobject $X_1 \hookrightarrow X \times X$, and then appropriately currying to a map $X \to \Omega^X$, and noting this factors through a map $X \to [X^{op}, \Omega]$ by the poset axioms. We form a cocompletion functor $\mathbf{P}$ which takes a poset $X$ to $[X^{op}, \Omega]$. For a poset map $f: X \to Y$, the map $\mathbf{P}f: [X^{op}, \Omega] \to [Y^{op}, \Omega]$ is to take a down-set $U$ of $X$ to the down-set generated by the direct image $\exists_f(U)$ in $Y$. Formally: if the poset $Y$ is given by a span $Y \stackrel{\pi_1}{\leftarrow} Y_1 \stackrel{\pi_2}{\to} Y$, then the composite

$$\Omega^Y \stackrel{\pi_2^\ast}{\to} \Omega^{Y_1} \stackrel{\exists_{\pi_1}}{\to} \Omega^Y$$

has as its regular image the inclusion $[Y^{op}, \Omega] \hookrightarrow \Omega^Y$ we constructed earlier. This map maps a regular subobject to the down-set it generates. Denoting its epi-(regular mono) factorization as

$$\Omega^Y \stackrel{e}{\to} [Y^{op}, \Omega] \hookrightarrow \Omega^Y$$

we now define $\mathbf{P}f: \mathbf{P}X \to \mathbf{Y}$ to be the composite

$$[X^{op}, \Omega] \hookrightarrow \Omega^X \stackrel{\exists_f}{\to} \Omega^Y \stackrel{e}{\to} [Y^{op}, \Omega].$$

The functor $\mathbf{P}$ thus defined on the category of internal posets carries a monad structure whose unit is the Yoneda embedding $y$ (i.e., the component at $X$ is the principal down-set map $y_X: X \to [X^{op}, \Omega]$ we constructed earlier), and the multiplication turns out to be given by

$$\text{mult}_X := [y_X^{op}, \Omega]: [[X^{op}, \Omega]^{op}, \Omega] \to [X^{op}, \Omega].$$

Officially, a *sup-lattice* is a $\mathbf{P}$-algebra. It can also be described as a poset $X$ whose Yoneda embedding $y_X: X \to \mathbf{P}X$ has a left adjoint (which will then be *the* algebra structure $\mathbf{P}X \to X$: there can be only one, as $\mathbf{P}$ is a lax idempotent or KZ monad).

What seems to simplify matters greatly is to introduce another concept which, I'm pretty darned sure, is equivalent to the concept of sup-lattice. (See the post Retractions of Yoneda are reflectors, i.e., left adjoints? for some explanation why.)

**Definition:** An *s-lattice* is a poset $X$ whose Yoneda embedding admits a retraction. We let $\sup_X$ generically denote a chosen retraction (although as I suggest, I think there can be at most one!).

Here is the seed example. In $\text{Choq}$, the poset $I = [0, 1]$ is an s-lattice. The poset of down-sets $[I^{op}, \Omega]$ may be identified with $I \times \{f \leq t\}$ under the lexicographic order, topologized by the order topology. (One should check that the compact-open topology is in fact this order topology.) The Yoneda embedding takes $x \in I$ to $(x, t)$. The retraction is just the projection map $I \times \{f, t\} \to I$.

**Lemma 1:** If $L$ is an s-lattice, then so is $L^X$ for any object $X$.

**Proof:** Regard $X$ as an internal discrete poset (both maps of the span being $1_X$). There is an evident identification $\mathbf{P}(L \times X) = (\mathbf{P}L)^X$. Now examine the diagram

$$\begin{array}{cccccc}
L^X & \stackrel{y^X}{\to} & \mathbf{P}(L \times X) & & & & \\
y \downarrow & & y \downarrow & \searrow^{id} & & & \\
\mathbf{P}(L^X) & \underset{\mathbf{P}(y^X)}{\to} & \mathbf{PP}(L \times X) & \underset{\text{mult}}{\to} & \mathbf{P}(L \times X) & \underset{\sup_L^X}{\to} & L^X
\end{array}$$

(the square commutes by naturality of $y$, and the triangle commutes by a unit equation for the monad $\mathbf{P}$), and use the fact $\sup_L^X \circ y_L^X = 1_{L^X}$. Thus the bottom composite retracts $y_{L^X}$. $\Box$

For example, $D = I^n$ is an s-lattice in $\text{Choq}$. It follows further that any $D^X$ is an s-lattice.

Recall that if $A, B$ are posets and $f: A \to B$ is a poset map, then $f$ is an *embedding* if $a \leq a'$ in $A$ whenever $f(a) \leq f(a')$ in $B$. It is easy to see that embeddings are monomorphisms.

**Lemma 2:** If $f: X \to Y$ is a surjection in $\text{Choq}$ and $D$ is a poset, then $D^f: D^Y \to D^X$ is an embedding.

This is pretty obvious. $D^f(g) := g \circ f$, so $D^f(g) \leq D^f(g')$ means $g f \leq g' f$. This implies $g \leq g'$ by surjectivity of $f$.

**Lemma 3:** If $h: A \to B$ is a poset embedding in $\text{Choq}$, then $[h^{op}, \Omega]$ retracts $\mathbf{P}h$.

**Proof:** It suffices to check this at the level of underlying sets, by concreteness of $\text{Choq}$ over $\text{Set}$. Let $U \in \mathbf{P}A$ be a down-set of $A$. Then $\mathbf{P}h(U) = \{b \in B: \exists_{a \in A} a \in U \wedge b \leq h(a)\}$. The function $[h^{op}, \Omega]$ sends this down-set to $\{a' \in A: \exists_{a \in A} a \in U \wedge h(a') \leq h(a)\}$. Since $h$ is an embedding, this is the same as $\{a' \in A: \exists_{a \in A} a \in U \wedge a' \leq a\}$, but this is just $U$ since $U$ is downward-closed. $\Box$

Our task is completed with the following result.

**Theorem:** If $f: X \to Y$ is a continuous surjection in $\text{Choq}$ and $D$ is an s-lattice, then $\text{Ran}_f := \sup_{D^Y} \circ [(D^f)^{op},\Omega] \circ y_{D^X}$ retracts $D^f$.

**Proof:** We have

$$\begin{array}{ccc}
1_{D^Y} & = & \sup_{D^Y} \circ y_{D^Y} \\
& = & \sup_{D^Y} \circ [(D^f)^{op}, \Omega] \circ \mathbf{P}(D^f) \circ y_{D^Y} \\
& = & \sup_{D^Y} \circ [(D^f)^{op}, \Omega] \circ y_{D^X} \circ D^f
\end{array}$$

where the first equation uses Lemma 1, the second uses Lemmas 2 and 3, and the third uses naturality of $y$. $\Box$

21more comments