For a locally small category $\mathscr A$, the functor $H_A:\mathscr A^{op}\to \mathbf{Set}$ is defined as follows:
- for objects $A\in\mathscr A$: $H_A(B)=\mathscr A(B,A)$
- for arrows $g:B'\to B$ in $\mathscr A$: $H_A(g):\mathscr A(B,A)\to\mathscr A(B',A),p\mapsto p\circ g$
I'm still confused with the $^{op}$ thing. To say that $H_A$ is a functor is to say that $H_A(g\circ f)=H_A(g)\circ H_A(f)$ where $g:B'\to B, f:B''\to B'$. But the composition $H_A(g)\circ H_A(f)$ doesn't make sense. What's wrong with my application of the definition of a functor?
I think my confusion is caused by the fact that Leinster (from whose book I borrowed the definition) uses the same letter for an arrow and the arrow it corresponds to in the opposite category. First, he considers an arrow $g:B'\to B$ in $\mathscr A$. Then, on the left-hand side of $$H_A(g):\mathscr A(B,A)\to\mathscr A (B',A)\\ p\mapsto p\circ g$$
(i.e., in $H_A(g)$), $g$ no longer refers to the arrow $B'\to B$ in $\mathscr A$ but instead it refers to the corresponding arrow $B\to B'$ in $\mathscr A^{op}$ (otherwise the notation $H_A(g)$ wouldn't make sense). And then when he writes $p\mapsto p\circ g$, his $g$ again refers to the arrow $B'\to B$.
To make things more precise, one could re-define $H_A$ on arrows in this way. If $g:B'\to B$ is an arrow in $\mathscr A$, then $$H_A(g^{op}):\mathscr A(B,A)\to\mathscr A (B',A)\\ p\mapsto p\circ g$$
So suppose we have arrows $f:B''\to B'$ and $g:B'\to B$ in $\mathscr A$. Functoriality means that $$H_A(f^{op}\circ_{op}g^{op})=H_A(f^{op})\circ H_A(g^{op}).$$ By definition, we have:
Thus $H_A(f^{op}\circ_{op}g^{op})=H_A(f^{op})\circ H_A(g^{op})$.