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:


1. The $\Hom$ functor used in $\Hom(C, {-})$ has the target category $\Set$.
2. 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:


1. If $h$ is a morphism in $\mathcal C$ with $h : A \to B$, then $m\_h$ is a function from $FA$ to $GB$.
2. 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:


1. 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$.
2. 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.



Exponentials in functor categories
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](http://ncatlab.org/nlab/show/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!)


