Can someone please give an example of a function between two categories that is an object function, arrow function and preserves the identity arrow(s) but fails to preserve the composition property.
Thank you!
Can someone please give an example of a function between two categories that is an object function, arrow function and preserves the identity arrow(s) but fails to preserve the composition property.
Thank you!
An easy way to produce a counterexample is to look at monoids (which are the same thing as categories with one object) : it suffices to find a function between two monoids that preserve the identity but not the composition. For example, you can take a non-abelian group $G$, and the function $g\mapsto g^2$.
For a similar example, but with a category with more objects : take the category $\mathbf{Mat}_{\Bbb R}$ whose objects are the natural numbers and arrows $m\to n$ are matrices in $\mathbb{R}^{n\times m}$, with composition defined by the matrix product. Then you can define functions $\mathbb{R}^{n\times m}\to \mathbb{R}^{n\times m}:A\mapsto AA^tA$ for all $n,m$. Together with the identity function on $\mathbb{N}$, this respects domains, codomains and identities, but not composition, because $AA^tABB^tB\neq ABB^tA^tAB$ in general.
For another abstract example, consider the preordered set $C:=(\{0,1,2\}, \le) $ as a category (i.e. besides the 3 identity morphisms, it has arrows $a:0\to1,\ b:1\to 2,\ c:0\to2$).
Let $D$ be obtained by adding one more morphism $d:0\to 2$ to $C$ (but keeping $b\circ a=c$).
Now define $F:C\to D$ by being the identity on objects and identity morphisms, and taking $a\mapsto a, \ b\mapsto b\ $ and $\ c\mapsto d$.