Exponentials in functor categories Is it described somewhere in the literature how exponentials in functor categories other than presheaf categories can be constructed? So far I did not find anything in this regard. In the following, I sketch what I have developed myself. I would like to know whether this can be improved, and whether it is similar to some standard approach.
$\newcommand{\Obj}{\mathop{\mathrm{Obj}}}\newcommand{\Mor}{\mathop{\mathrm{Mor}}}\newcommand{\dom}{\mathop{\mathrm{dom}}}\newcommand{\codom}{\mathop{\mathrm{codom}}}\newcommand{\Hom}{\mathrm{Hom}}\newcommand{\hom}{\mathrm{hom}}\newcommand{\id}{\mathrm{id}}\newcommand{\Tw}{\mathrm{Tw}}\newcommand{\op}[1]{#1^{\mathrm{op}}}\newcommand{\Set}{\mathbf{Set}}$In a presheaf category $\mathbf{Set}^{\op{\mathcal C}}$, exponentials are obtained by defining$$G^F(f) = \Hom(Yf \times \id_F, G)\enspace,$$ where $Y$ is the Yoneda embedding. If we turn from $\Set^{\op{\mathcal C}}$ to $\Set^{\mathcal C}$, this definition becomes$$G^F(f) = \Hom(\Hom(f, {-}) \times \id_F, G)\enspace.$$So applying an exponential $G^F$ to an object $C$ yields the set of natural transformations from $\Hom(C, {-}) \times F$ to $G$.
This way of constructing exponentials only works if the target category of the functor category is $\Set$, for the following reasons:


*

*The $\Hom$ functor used in $\Hom(C, {-})$ has the target category $\Set$.

*The set of natural transformations from some functor to another one is, well, a set.
Let us now try to generalize the above construction such that it works for functor categories $\mathcal D^{\mathcal C}$ where $\mathcal D$ is not necessarily $\Set$.
We first tackle the second of the above points. Let $F$ and $G$ be functors with $F, G : \mathcal C \to \mathcal D$. We define the functor $M : \Tw(\mathcal C) \to \mathcal D$ from the twisted arrow category of $\mathcal C$ to the category $\mathcal D$ as follows:


*

*For every object $f$ in $\Tw(\mathcal C)$, which is a morphism $f : A \to B$ in $\mathcal C$, we define$$Mf = (GB)^{FA}\enspace.$$

*For every morphism $(p, q) : f \to g$ in $\Tw(\mathcal C)$, we define$$M(p, q) = (Gq)^{Fp}\enspace.$$
If the limit of $M$ exists, then this limit represents the set of natural transformations from $F$ to $G$. This can be made plausible by considering the special case that $\mathcal D = \Set$. In this case, the limit of $M$ is the set of all indexed families $\{m_h\}_{h \in \Mor \mathcal C}$ that have the following properties:


*

*If $h$ is a morphism in $\mathcal C$ with $h : A \to B$, then $m_h$ is a function from $FA$ to $GB$.

*If $f$, $g$, and $h$ are morphisms in $\mathcal C$ with $f : A' \to A$, $g : B \to B'$, and $h : A \to B$, then$$m_{ghf} = (Gg)m_h(Ff)\enspace.$$
Each indexed family $\{m_h\}$ gives rise to a natural transformation $\tau : F \to G$ with $\tau_A = m_{\id_A}$ for every $A \in \Obj \mathcal C$. To see this, let us look again at the above two properties of families $\{m_h\}$:


*

*The first property tells us that for each object $A$, we have $m_{\id_A} : FA \to GA$. This corresponds to $\tau_A : FA \to GA$.

*From the second property, we can deduce that the following equations must hold for any morphism $h : A \to B$:$$\begin{align}m_{h\id_A\id_A} & = (Gh)m_{\id_A}\id_{FA}\\m_{\id_B\id_Bh} & = \id_{GB}m_{\id_B}(Fh)\end{align}$$This in turn gives us$$(Gh)m_{\id_A} = m_{\id_B}(Fh)\enspace,$$ which corresponds to the naturality condition$$(Gh)\tau_A = \tau_B(Fh)\enspace.$$
It is relatively easy to show that the mapping from families $\{m_h\}$ to natural transformations $\tau : F \to G$ is actually a bijection.
Now we do not want to represent the set of natural transformations from $F$ to $G$, but from $\Hom(C, {-}) \times F$ to $G$ for any $C \in \Obj \mathcal C$. To do so, we replace the functor $M : \Tw(\mathcal C) \to \mathcal D$ by a functor $L : \Tw(C \downarrow \mathcal C) \to \mathcal D$, which we define as follows:


*

*For any morphisms $a : C \to A$ and $b : C \to B$ in $\mathcal C$, which are objects in $(C \downarrow \mathcal C)$, and any morphism $f : A \to B$ in $\mathcal C$ with $fa = b$, which is a morphism from $a$ to $b$ in $(C \downarrow \mathcal C)$ and thus an object in $\Tw(C \downarrow \mathcal C)$, we define$$Lf= (GB)^{FA}\enspace.$$

*For any morphism $(p, q) : f \to g$ in $\Tw(C \downarrow \mathcal C)$, we define$$L(p, q) = (Gq)^{Fp}\enspace.$$
If the limit of $L$ exists, then it represents the set of natural transformations from $\Hom(C, {-}) \times F$ to $G$. To make this plausible, we consider again the case that $\mathcal D = \Set$. In this case, the limit of $L$ is the set of all indexed families $\{\ell_{a, h}\}_{a, h \in \Mor \mathcal C \wedge \codom a = \dom h}$ that have the following properties:


*

*If $a$ and $h$ are morphisms in $\mathcal C$ with $a : C \to A$ and $h : A \to B$, then $\ell_{a, h}$ is a function from $FA$ to $GB$.

*If $a'$, $f$, $g$, and $h$ are morphisms in $\mathcal C$ with $a' : C \to A'$ $f : A' \to A$, $g : B \to B'$, and $h : A \to B$, then$$\ell_{a', ghf} = (Gg)\ell_{fa', h}(Ff)\enspace.$$
Each indexed family $\{\ell_{a, h}\}$ gives rise to a natural transformation $\tau : \Hom(C, {-}) \times F \to G$ with $\tau_A(a, x) = \ell_{a, \id_A}(x)$ for any $A \in \Obj \mathcal C$, $a : C \to A$, and $x \in FA$. Let us look at the above two properties of families $\{\ell_{a, h}\}$ to see why this is the case:


*

*The first property tells us that for each object $A$ and each morphism $a \in \hom(C, A)$, we have $\ell_{a, \id_A} : FA \to GA$. This corresponds to $\tau_A : \Hom(C, A) \times FA \to GA$.

*From the second property, we can deduce that the following equations must hold for any morphisms $a : C \to A$ and $h : A \to B$:$$\begin{align}\ell_{a, h\id_A\id_A} & = (Gh)\ell_{a, \id_A}\id_{FA}\\\ell_{a, \id_B\id_Bh} & = \id_{GB}\ell_{ha, \id_B}(Fh)\end{align}$$This gives us$$(Gh)\ell_{a, \id_A} = \ell_{ha, \id_B}(Fh)$$and thus$$(Gh)(\ell_{a, \id_A}(x)) = \ell_{ha, \id_B}((Fh)(x))$$for each $x \in FA$. This corresponds to$$(Gh)(\tau_A(a, x)) = \tau_B(ha, (Fh)(x))\enspace.$$Since$$\begin{align}\tau_B(ha, (Fh)(x)) & = \tau_B(\Hom(C, h)(a), (Fh)(x)) \\ & = \tau_B((\Hom(C, h) \times Fh)(a, x)) \\ & = \tau_B(((\Hom(C, {-}) \times F)h)(a, x))\enspace,\end{align}$$we get $$(Gh)\tau_A = \tau_B((\Hom(C, {-}) \times F)h)\enspace,$$which is the naturality condition for $\tau$.
I suppose that the mapping from families $\ell_{a, h}$ to natural transformations $\tau : \Hom(C, {-}) \times F \to G$ is actually a bijection, but I have not checked this yet.
 A: I have just noticed that a more abstract and more general proof of this can be found in Theorem 2.12 of


*

*Street and Verity, The comprehensive factorization and torsors, TAC.


Their theorem is more general than this, because (1) it refers to specific exponentiable (a.k.a. "powerful") objects rather than assuming cartesian closure of the codomain, and (2) it refers to local exponentials as well.  The fairly abstract proof uses comonadicity of some slice categories and the "adjoint triangle theorem"; they attribute a "vast simplification" of it to Steve Lack.
A: If $\mathcal{C}$ is small and $\mathcal{D}$ is complete and cartesian closed, then $\mathcal{D}^{\mathcal{C}}$ is also cartesian closed.  We can compute exponentials in essentially the same way as for presheaves, motivated by $\mathcal{D}$-enriched category theory:
$$
G^F(x) = \int_{y\in \mathcal{C}} \prod_{\mathcal{C}(x,y)} G(y)^{F(y)}.
$$
Then we can compute

$$
\begin{align}
  \mathcal{D}^{\mathcal{C}}\left(H,G^F\right)
  &= \int_{x\in \mathcal{C}} \mathcal{D}\left(H(x), G^F(x)\right)\\
  &= \int_{x\in \mathcal{C}} \mathcal{D}\left(H(x), \int_{y\in \mathcal{C}} \prod_{\mathcal{C}(x,y)} G(y)^{F(y)}\right)\\
  &= \int_{x\in \mathcal{C}} \int_{y\in \mathcal{C}} \prod_{\mathcal{C}(x,y)} \mathcal{D}\left(H(x), G(y)^{F(y)}\right)\\
  &=  \int_{y\in \mathcal{C}} \mathcal{D}\left( \int^{x\in \mathcal{C}} \sum_{\mathcal{C}(x,y)} H(x), G(y)^{F(y)}\right)\\
  &=  \int_{y\in \mathcal{C}} \mathcal{D}\left(H(y), G(y)^{F(y)}\right)\\
  &=  \int_{y\in \mathcal{C}} \mathcal{D}\left(H(y)\times F(y), G(y)\right)\\
  &= \mathcal{D}^{\mathcal{C}}(H\times F, G).
\end{align}
$$

Here the antepenultimate step uses the co-Yoneda lemma.  This appears to involve colimits in $\mathcal{D}$ as well, but the existence of these colimits is not actually an extra assumption: the co-Yoneda lemma tells us that $\int^{x\in \mathcal{C}} \sum_{\mathcal{C}(x,y)} H(x)$ exists and is isomorphic to $H(y)$.
Similarly, the above argument can be interpreted to say that even if $\mathcal{D}$ is not complete, then the exponential $G^F$ in $\mathcal{D}^{\mathcal{C}}$ exists if and only if the particular limits above exist, and in that case they are isomorphic.  (I don't immediately see how to remove the assumption that $\mathcal{D}$ is cartesian closed, though.  Not that that is a surprising thing to have to assume!)
