TITLE: Understanding a proof in MacLane-Moerdijk's "Sheaves in Geometry and Logic"
QUESTION [6 upvotes]: I am trying to understand the proof of Theorem 2 of Section 5, Chapter I, of MacLane-Moerdijk's "Sheaves in Geometry and Logic". 

Theorem 2. If $A \colon \mathbf C \to \mathcal E$ is a functor from a small category $\mathbf C$ to a cocomplete category $\mathcal E$, the functor $R$ from $\mathcal E$ to pre sheaves given by
  $$ R(E) \colon C \mapsto \mathrm{Hom}_{\mathcal E}(A( C ),E) $$
  has a left adjoint $L \colon \mathbf{Sets}^{\mathbf C^\mathrm{op}} \to \mathcal E$ defined for each presheaf $P$ in $\mathbf{Sets}^{\mathbf C^\mathrm{op}}$ as the colimit 
  $$ L( P ) = \mathrm{Colim}\left( \int P \xrightarrow{\pi_P} \mathbf C \xrightarrow A \mathcal E \right).  $$
  In other words, there is a pair of adjoint functors $L \dashv R$, as in 
  $$ L \!: \mathbf{Sets}^{\mathbf C^\mathrm{op}} \xrightarrow {\xleftarrow{}} \mathcal E : \! R$$
  where we place the left adjoint $L$ on the left.

My difficulty is in understanding exactly why the collection of set maps $$\lbrace\tau_C:P(C)\to \mathrm{Hom}_{\mathcal{E}}(A(C),E)\rbrace_C$$ can be considered as a family $$\lbrace \tau_C(p):A(C)\to E \rbrace_{(C,p)}$$ indexed by objects $(C,p)$ of the category of elements of $P$.
I think I can see approximately why it holds, but I am not sure how it works exactly: So you have a function $\tau_C:P(C)\to \mathrm{Hom}_{\mathcal{E}}(A(C),E)$ which sends an element $p$ of the set $P(C)$ to a morphism $A(C)\to E$ (is this exactly what the function $\tau_C$ does?) in $\mathcal{E}$. So every such function corresponds to $|P(C)|$ morphisms $A(C)\to E$ in $\mathcal{E}$ -one for every element $p\in P(C)$, which gives the family $\lbrace \tau_C(p):A(C)\to E \rbrace_{(C,p)}$. But how is this made precise? (If it is correct at all). Thanks!

REPLY [4 votes]: There is nothing approximately done in what you wrote : you have a collection (let's forget about naturality for now) $(\tau_C \colon P( C ) \to \mathrm{Hom}_{\mathcal E}(A(C ), E))_C$ of applications between sets, so for each $C$ and each $p \in P( C)$ (that is for each object $(C,p)$ of $\int P$), you have
$$ \tau_C( p ) \in \mathrm{Hom}_{\mathcal E}(A(C ), E),$$
that is a morphism $\tau_C( p ) \colon A( C ) \to E$ in $\mathcal E$. Since you have it for each object $(C,p)$ of $\int P$, it gives you the family 
$$ (\tau_C( p ) \colon A( C ) \to E )_{(C,p)}$$
of Mac Lane's proof.

Only now you worry about naturality of $(\tau_C)_C$ : together with the definition of the arrows of $\int P$, it gives you that for each arrow $u \colon (C',p') \to (C,p)$, the diagram
$$ \begin{array}{rcccl} & & \tau_{C'}( p' ) & & \\
& A \pi_P C' & \longrightarrow & E & \\
A\pi_P (u) & \downarrow & & \parallel & \\
& A\pi_P C& \longrightarrow & E & \\
& & \tau_{C}( p ) & & \end{array}$$
commutes, making $(\tau_C( p ))_{(C,p)}$ a cocone of vertex $E$ on the diagram $A\pi_P$. (This is just a rewriting of diagram (10) of Mac Lane's proof, which is not crystal clear I must say.) 

Edit. What's done above construct an application $\mathrm{Nat}(P, R(E)) \to \mathrm{Hom}_{\mathcal E}(L( P ), E)$. It admits an obvious inverse : 

take an arrow $f \colon L( P ) \to E$ ; 
for $L( P )$ is the colimit of the diagram $A \pi_P$, it comes with arrows $i_{(C,p)} \colon A( C ) \to L( P )$ for each $(C,p)$ object of $\int P$ ; 
let $\tau_{(C,p)} \colon A( C ) \to E$ be defined as $f \circ i_{(C,p)}$ (and think of that collection as the $\tau_C( p )$ you want to have at the end) ;
then we can call $\tau_C \colon P( C ) \to \mathrm{Hom}_{\mathcal E}(A( C ), E)$ the application defined as
$$ p \mapsto \tau_{(C,p)} ; $$
the fact that $(\tau_{(C,p)})_{(C,p)}$ is a cocone with vertex $E$ on the diagram $A\pi_P$ shows that $(\tau_C)_C$ is a natural transformation.

It constructs $\mathrm{Hom}_{\mathcal E}(L( P ), E) \to \mathrm{Nat}(P, R(E))$, the searched inverse. So finally,
$$\mathrm{Nat}(P, R(E)) \simeq \mathrm{Hom}_{\mathcal E}(L( P ), E).$$
The naturality of such a bijection is left to the reader in Mac Lane's proof, as it is by me :) .