I'm a newbie at category theory and just started reading Emily Riehl's Category Theory in Context. I got to the definition of functors, which contains the following two axioms: if $F:C\to D$ is a functor between categories, then
- For every composable pair of morphisms $f:x\to y$, $g:y\to z$ in $C$, $F(g\circ f)=Fg\circ Ff$
- For every object $c\in C$, $F\left(1_c\right)=1_{Fc}$
I'm concerned about the second axiom. For a group homomorphism $f:G\to G'$, it's enough to say that $f$ respects the group operation, and it follows from there that $f\left(1_G\right)=1_{G'}$. On the other hand, it's not enough to say that a ring homomorphism $g:R\to R'$ respects both addition and multiplication, for there exist maps that are both additive and multiplicative that don't preserve the multiplicative identity.
I tried coming up with a counterexample with a category consisting of one object and whose morphisms are the elements of a ring; however, this creates two identity morphisms (the additive and multiplicative identity). Even worse, these morphisms aren't necessarily associative.
Are there any examples of almost-functors that obey the first axiom but not the second?
Here is the simplest example I can think of.
Let $\mathcal{1}$ be the category with a single object (call it $\bullet$) and a single morphism, which is the identity morphism on $\bullet$.
Let $\mathcal{C}$ be the category with one object (call it $*$) and a morphism $f\colon *\to *$ such that $f\circ f = f$. The morphisms $f$ and the identity $\mathrm{id}_*$ are the only morphisms in this category.
Then we can define an "almost-functor" $A\colon \mathcal{1}\to\mathcal{C}$ that maps $\bullet$ to $*$ and maps $\mathrm{id}_\bullet$ to $f$.
This almost-functor obeys the composition of morphisms because $A(\mathrm{id}_\bullet\circ\mathrm{id}_\bullet) = f = A(\mathrm{id}_\bullet)\circ A(\mathrm{id}_\bullet)$. However, it does not obey the identity axiom because it maps an identity morphism to a non-identity morphism.