Anindya Bhattacharyya wrote:
>Incidentally I have a similar sense of slight puzzlement over the definition of a natural transformation. I can see how this is a neat way of defining "morphisms between functors", but is it the only way? Is there any way of deriving the definition rather than pulling it out of thin air and checking it works? This might seem kinda pedantic and trivial but I suspect that if we were to try generalising these constructions to higher dimensions, picking the "obvious" answer and checking it might not work.

Since natural transformations are maps between functors, they must preserve functorial structure.

For every functor \$$F : \mathcal{C} \to \mathcal{D}\$$, we have the following law,

\$F(f \circ g) = F(f) \circ F(g) \$

and more specifically, we get a special case,

\$F(id\_x \circ f \circ id\_y) = F(id_x) \circ F(f) \circ F(id\_y). \$

Since this functorial structure must be preserved, what counts as a possible map \$$\alpha : F \to G\$$ is in some sense forced on us: it takes every morphism \$$f\$$ being mapped by \$$F\$$ to *some* corresponding morphism \$$f'\$$ being mapped by \$$G\$$.

Or another to look at it, there is a category \$$\mathbf{Cat}\$$ that has categories as objects and functors as morphisms. Now if we ask, what are functors in this situtation, we get the notion of a natural transformation.

>Thing about that argument is that it shows that \$$h \mapsto g\circ h\circ f\$$ is a _possible_ definition for the hom functor, but it doesn't explain why it's _necessary_. If I understand @Julio correctly that's the nub of his question. It's all very well noting that this definition happens to work neatly, but _why_ this definition and not some other one? I must confess I don't have a simple answer to this, and I suspect the best answer might be something like "this definition is the one that makes the Yoneda Lemma work".

When I thought of the puzzle, on my first try was to compose horizontally, but the functorial laws wont work unless we have \$$g\$$ as an identity,

$\begin{matrix} & & h & & \\\\ & c & \rightarrow & c' &\\\\ f & \uparrow & & \downarrow & g\\\\ & d & \rightarrow & d' &\\\\ & & ? & & \\\\ \end{matrix} , \begin{matrix} & & j & & \\\\ & c' & \rightarrow & c'' &\\\\ g^{op} & \uparrow & & \downarrow & k\\\\ & d' & \rightarrow & d'' &\\\\ & & ?' & & \\\\ \end{matrix}$

however, composing vertically by subsituting \$$h=?'\$$ works perfectly fine,

\$\begin{matrix} & & k & & \\\\ & b & \rightarrow & b' &\\\\ l & \uparrow & h = ?' & \downarrow & j\\\\ & c & \rightarrow & c' &\\\\ f & \uparrow & & \downarrow & g\\\\ & d & \rightarrow & d' &\\\\ & & ? & & \\\\ \end{matrix} \$

since \$$\mathrm{hom}\$$ is a functor on a pair where the first entry is flipped, functoriality of composition therefore is,

\$\mathrm{hom}(l\circ f , g \circ j)(k) \\\\ = \mathrm{hom}(f,g)\circ\mathrm{hom}(l,j)(k) \$

and functorial identity is,

\$\mathrm{hom}(id\_x\circ f \circ id\_y , id\_{y'} \circ g \circ id\_{x'})(h) \\\\ = \mathrm{hom}(id\_{x'},id\_y) \circ \mathrm{hom}(f,g)\circ\mathrm{hom}(id\_x,id\_{y'})(h) \$