TITLE: When does the direct image functor nicely push past the power/exists functor?
QUESTION [5 upvotes]: Let $D$ and $E$ be toposes and let $f_{\ast}\colon D\to E$ be the direct image part of a geometric morphism $(f^{\ast},f_{\ast})$ between them. Considered as categories, we have (covariant) power-object endofunctors on each:
$$P_D\colon D\to D \hspace{.5in} P_E\colon E\to E$$
where, for a morphism $\phi$ in $D$ we have $P_D(\phi)=\exists_\phi$, sending a sub-object of the domain to its image under $\phi$.
I'm trying to construct a natural transformation $$A_f\colon\ f_{\ast}\circ P_D\to P_E\circ f_{\ast}$$
of functors $D\to E\ $.
Question: For what geometric morphisms $(f^\ast,f_\ast)$ is such a natural transformation $A_f$ guaranteed to exist?
For example, such a thing exists in the case of change-of-base morphisms between slice toposes of ${\bf Set}$. If $q\colon X\to Y$ is a function, it induces a logical morphism $\Pi_q\colon {\bf Set}/X\to {\bf Set}/Y$. In this case the natural transformation $$A^~_{\Pi^~_q}\colon\Pi_q\circ P_{{\bf Set}/X}\to P_{{\bf Set}/Y}\circ \Pi_q$$
exists. It acts fiberwise on $Y$; for each $y\in Y$ it sends a $q^{-1}(y)\ $-indexed collection of subsets to their product.
How to construct this map $A_f$ in general? I wanted to use what would generalize to the morphism $f_{\ast}f^{\ast}\Omega_E\to\Omega_E\ $ induced by the mono-part of the epi-mono factorization for $\Omega_E\to f_{\ast}f^{\ast}\Omega_E$, where $\Omega_E$ is the subobject classifier in $E$. But while such a map does exist for all geometric morphisms, and can be used to construct the components of my desired $A_f$, I couldn't see how to prove that the naturality squares for $A_f$ commute. I showed it in the ${\bf Set}$ case using a basic set-theoretic argument.
So what made it work for slice toposes of ${\bf Set}$? Was it very specific to that case? Was it that these change-of-base functors are logical morphisms, or that they're essential geometric, or does such an $A_f$ always exist?

REPLY [9 votes]: A different way to describe the same answer that Zhen and Todd arrived at is to work in the internal logic of $E$.  That way we may pretend that $f_*$ is the global sections functor $\mathrm{Hom}(1,-) : D \to \mathrm{Set}$, as long as we treat $\mathrm{Set}$ constructively.  Then we have the components of a putative natural transformation
$$ \mathrm{Hom}(1,P A) \to P(\mathrm{Hom}(1,A)) $$
which, under the universal property of power objects $ \mathrm{Hom}(1,P A) \cong \mathrm{Sub}(A)$, sends a subobject $S\rightarrowtail A$ in $D$ to the set of all global sections $1 \to A$ which factor through it.  The naturality square for $p:A\to B$ requires that if we take the direct image subobject $p_!(S)$, then a global section of $B$ factors through $p_!(S)$ just when it lifts to some global section of $A$ factoring through $S$.  It's easy to see that this is the same as asking that $1\in D$ be projective, which is equivalent to saying that the global sections functor $f_* = \mathrm{Hom}(1,-)$ preserves epimorphisms.

REPLY [5 votes]: Since every power object is an internal Heyting algebra, and $f_*$ preserves the structure of internal Heyting algebras, there are trivial examples of such natural transformations corresponding to the constants $\top$ and $\bot$. Of course, this is uninteresting. 
Let me write $P^{\mathcal{D}}$ and $P^{\mathcal{E}}$ for the respective contravariant power object functors. Since $f_*$ preserves monomorphisms, there is a canonical comparison morphism $f_* \Omega_{\mathcal{D}} \to \Omega_{\mathcal{E}}$; since $f_*$ preserves products, there is a canonical natural morphism $f_* (Y^X) \to (f_* Y)^{f_* X}$; and so there is a canonical natural morphism $f_* P^{\mathcal{D}} X \to (f_* \Omega_{\mathcal{D}})^{f_* X} \to P^{\mathcal{E}} f_* X$. So there is an interesting canonical natural transformation $\theta : f_* P^{\mathcal{D}} \Rightarrow P^{\mathcal{E}} f_*$. 
Now allow me to argue using generalised elements. Let $T$ be an arbitrary object of $\mathcal{E}$, and let $p : X \to Y$ be a morphism in $\mathcal{D}$. Given a generalised element $t : T \to f_* P_\mathcal{D} X$, what is $\theta_X \circ t : T \to P_{\mathcal{E}} f_{\ast} X$, and what is $f_* \exists_p \circ t : T \to f_* P_{\mathcal{D}} Y$? Let $t' : f^* T \to P_\mathcal{D} X$ be the left adjoint transpose of $t$, and let $A' \rightarrowtail X \times f^* T$ be the subobject classified by $t'$. It is clear that $\theta_X \circ t$ is just the classifying morphism for the pullback of $f_* A' \rightarrowtail f_* X \times f_* f^* T$ along $f_* X \times T \to f_* X \times f_* f^* T$. Also, by naturality, $f_* \exists_p \circ t$ must be the right adjoint transpose of $\exists_p \circ t' : f^* T \to P_\mathcal{D} Y$, which is none other than the classifying morphism for the image of the composite $A' \rightarrowtail X \times f^* T \to Y \times f^*T$.
This suggests the crucial criterion is that $f_*$ preserve epimorphisms (and hence, epi–mono factorisations) – and this automatic for all base change morphisms for slices over $\textbf{Set}$ because $\textbf{Set}$ and its slices have the axiom of choice. So assume $f_*$ preserves epimorphisms. If we write $A \rightarrowtail f_* X \times T$ for the subobject classified by $\theta_X \circ t$, $B' \rightarrowtail Y \times f^* T$ for the image of $A' \rightarrowtail X \times f^* T \to Y \times f^* T$, and $B \rightarrowtail f_* Y \times T$ for the subobject classified by $\theta_Y \circ f_* \exists_p \circ t$, then the preservation of epi–mono factorisations implies that $f_* B'$ remains the image of $f_* A'$ under $f_* X \times f_* f^* T \to f_* Y \times f_* f^* T\ $; but epi–mono factorisations are stable under pullback in a topos, hence $B$ is the image of $A$ under $f_* X \times T \to f_* Y \times T$. Thus, we have
$$\theta_Y \circ f_* \exists_p \circ t = \exists_{f_{\ast} p} \circ \theta_X \circ t$$
for all generalised elements $t : T \to f_* P_{\mathcal{D}} X$, and thus $\theta$ is also a natural transformation $f_* P_{\mathcal{D}} \Rightarrow f_* P_{\mathcal{E}}$.