The following question is taken from Arrows, Structures and Functors the categorical imperative by Arbib and Manes
In chapter 7 of Arbib and Manes about Functors. The authors introduce the category of generalised monoid as motivation and precursor to introducing functors.
$\color{Green}{Background:}$
$\textbf{(1) Definition:}$
- We have seen that a one-object category is a monoid, let us now see a sense in which any category is a $\textit{generalized}$ monoid. Given $\textbf{K},$ let $$\textbf{M}_{\textbf{k}}=\prod_{A,B\in \mathrm{Obj }\textbf{K}}\textbf{K}(A,B)$$ be the collection of all $\textbf{K}-$morphisms. Composition definees a $\textit{partial}$ function $$\textbf{M}_{\textbf{k}}\times\textbf{M}_{\textbf{k}}\to\textbf{M}_{\textbf{k}}:(f,g)\mapsto g\circ f.$$
Let us see how we may recapture the identities of $\textbf{K}$ from this function: We say that $u$ is an identity if $g\circ u=g$ whenever $g\circ u$ is defined, and if $u\circ f=f$ whenever $u\circ f$ is defined. As before, each $f$ has exactly one identity $u$ such that $u\circ f$ is defined, call it $C(f)$ for the identity of the $\textit{codomain}$ of $f$; and exactly one $v$ such that $f\circ v$ is defined, call it $D(f)$ for the $\textit{domain}$ of $f.$ Thus our partial function $\textbf{M}_{\textbf{k}}\times \textbf{M}_{\textbf{k}} \to \textbf{M}_{\textbf{k}}$ satisfies the conditions:
$2a)$ There are total functions $$C,D: \textbf{M}_{\textbf{k}}\to \text{identities of } \textbf{M}_{\textbf{k}}$$
for which
$$2a-i)\quad \quad D(D(f))=D(f)=C(D(f));$$ $$2a-ii) \quad D(C(f))=C(f)=C(C(f)); \text{ and,}$$ $$2a-iii)\quad \quad f\circ D(f)=f=C(f)\circ f.$$
$2b)$ $g\circ f$ is defined iff $C(f)=D(g).$ If $g\circ f$ is defined then $D(g\circ f)=D(f)$ and $C(g\circ f)=C(g).$ Moreover, if either $(h\circ g)\circ f$ or $h\circ (g\circ f)$ is defined, then both are defined and $(h\circ g)\circ f=h\circ (g\circ f).$ [In fact, given a partial function satisfying $1$ and $2$ we can reconstitute a category, with objects being the identities.]
$\textbf{(2) Exercise:}$
Let $\textbf{M}\times \textbf{M}\to \textbf{M}$ be a partial function satisfying $2a.$ and $2b.$ Introduce the notation $f:k'\to k$ to indicate that $D(f)=k'$ and $C(f)=k.$ Deduce that this yields a category, with objects the identities, whose 'generalized monoid' is $\textbf{M}\times \textbf{M}\to \textbf{M}.$
[Solution:]
Let $\textbf{M}$ be a category and if $k, k', k''' \in \textbf{M},$ are objects and given any map $f:k'\to k,$ in $\textbf{M}$ and from the notation in the question for $D(f)=k',$ we can interpret it to mean $D(f)=k':=i:k'\to k',$ similarly, for $C(f)=k:=i:k\to k.$ So let $i \text{ (identity map) }, f:k'\to k, g:k\to k'', h:k'\to k''',$ be maps in $\textbf{M}$ and let $v,u$ be identity maps where they are respectively defined as $v:D(-)\to D(-), u:C(-)\to C(-),$ and $D(-)=(-)\circ v, C(-)=u\circ (-).$ Then according to $(2a-i)-(2a-iii)$ we have the following table for what $D(-).C(-).D(D(-)).C(D(-)).D(C(-)).C(C(-)).(-)\circ D(-).C(-)\circ (-). C(-)=D(-). D((-)\circ (*)) . C((*)\circ (-)) . D((-)\circ (*))=D(*).C((*)\circ (-))=C(*)$ equal to:
$\tiny\begin{array}{c|c|c|} & & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9\\ \hline &(-)/(-)\circ (-)/(-)\circ ((-)\circ (-))/((-)\circ (-))\circ (-) & D(-)&C(-)&D(D(-))&C(D(-))&D(C(-))&C(C(-))&(-)\circ D(-)&C(-)\circ (-)& C(-)=D(-)\\ \hline 1&i & D(i) & C(i) \\ \hline 2& f & k' & k &k'& k'& k & k & f & f \\ \hline 3& g & k & k'' & k & k &k''& k''& g & g \\ \hline 4& h & k'' & k''' & k'' & k'' & k''' & k''' & h & h &\\ \hline 5& g\circ f & k' & k'' & k' & k' & k'' & k'' & g\circ f & g\circ f & C(f)=D(g)=k \\ \hline 6& h\circ g & k & k''' & k & k & k''' & k''' & h\circ g & h\circ g & C(g)=D(h)=k'' \\ \hline 7&(h\circ g)\circ f & k' & k''' & k' & k' & k''' & k''' &(h\circ g)\circ f &(h\circ g)\circ f & C( f)=D(h\circ g)=k \\ \hline 8&h\circ (g\circ f) & k' & k''' & k' & k' & k''' & k''' &h\circ (g\circ f) &h\circ (g\circ f) & C(g\circ f)=D(h)=k''\\ \hline \end{array}$
$\tiny\begin{array}{c|c|c|} & & 10 & 11 & 12 & 13\\ \hline &(-)/(-)\circ (-)/(-)\circ ((-)\circ (-))/((-)\circ (-))\circ (-) & D((-)\circ (*)) & C((*)\circ (-)) & D((-)\circ (*))=D(*)&C((*)\circ (-))=C(*)\\ \hline 1&i & & \\ \hline 2& f & & & & \\ \hline 3& g & & & & \\ \hline 4& h & & & &\\ \hline 5& g\circ f & k' & k'' & k' & k'' \\ \hline 6& h\circ g & k & k''' & k & k'''\\ \hline 7&(h\circ g)\circ f & k' & k''' & k' & k'''\\ \hline 8&h\circ (g\circ f) & k' & k''' & k' & k'''\\ \hline \end{array}$
$\color{Red}{Questions:}$
To show that $\textbf{M}\times \textbf{M}\to \textbf{M},$ the partial function satisfying (2a) and (2b) is a category for the exercises above, I have to show that it has the identity, and composition morphisms, as well as they satisfy the rule for associativity according to the rules (2a-i) to (2a-iii) along with the values of $D(-).C(-).D(D(-)).C(D(-)).D(C(-)).C(C(-)).(-)\circ D(-).C(-)\circ (-). C(-)=D(-). D((-)\circ (*)) . C((*)\circ (-)) . D((-)\circ (*))=D(*).C((*)\circ (-))=C(*)$ for the morphisms $i,f, g, h, h\circ (g\circ f), (h\circ g)\circ f.$ I constructed the table showing their values. When the exercise asks: $\textbf{"Deduce that this yields a category, with objects the identities, whose 'generalized monoid' is}$ $\textbf{M}\times \textbf{M}\to \textbf{M}.$" Do they mean the following:
To show that the map $\textbf{M}\times \textbf{M}\to \textbf{M}.$ defined by partial functions satisfies the definitions of the monoid axioms, we first note that as in the definition from (1) above, let $\textbf{M}$ be a category, and objects in $\textbf{M}$ are set $K,$ and the set of morphisms $\textbf{M}(K)$ consist composition maps ${\textbf{M}}(K)\times {\textbf{M}}(K)\to {\textbf{M}}(K)$ defined by $(f,g)\mapsto g\circ f,$ $f, g\in \textbf{M}(K),$ and $f,g:X\subset K\to K$ Hence we can let $k',k, k'',k'''$ all be subsets of $K.$
The identity morphism $i\in \textbf{M}(K)$ composing with itself $(i,i)\mapsto i\circ i$ is certainly in ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K),$ since $i\circ i=D(i)$ and $i\circ i=C(i).$
Now any morphism $f\in \textbf{M}(K)$ can be written as a composition of $f$ and the identity morphism $i$. Meaning $(f,i)\mapsto i\circ f$ and $(i,f)\mapsto f\circ i$ are both in ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K).$ If we let $f$ to be the map $f:k'\subset K\to k\subset K$ and $i$ the identity map, then $i\circ f=C(f)$ and $f\circ i=D(f).$
For composition of morphism, again, let $i$ be the identity map, the map $f$ as just defined and $g\in \textbf{M}(K),$ defined by $g:k\subset K\to k'\subset K,$ then $(i,g\circ f)\mapsto (g\circ f)\circ i$ and $(g\circ f, i)\mapsto i\circ (g\circ f)$ are both in ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K).$ From the above table, we can see that $i\circ (g\circ f)=C(g\circ f),$ and $(g\circ f)\circ i=D(g\circ f).$
For associativity of morphisms, let $h\in \textbf{M}(K)$ defined by $h:k''\subset K\to K'''\subset K,$ $i$ the identity morphism and morphisms $f,g$ as before. Then from the table above, $i\circ (h\circ (g\circ f))=C(h\circ (g\circ f))$ and $(h\circ (g\circ f))\circ i=D(h\circ (g\circ f)).$ Hence $(i, h\circ (g\circ f))\mapsto (h\circ (g\circ f))\circ i,$ and $(h\circ (g\circ f),i)\mapsto i\circ (h\circ (g\circ f)),$ are both in ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K).$ Meaning composition of morphisms holds for ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K).$ So ${\textbf{M}}(K)\times \textbf{M}(K)\to {\textbf{M}}(K).$ satisfies the definition for a monoid and hence it is a generalized monoid.
$\textbf{Also,}$ is the way I constructed the table above clear enough in terms of details?
One other minor questions: Are there tags for question clarifications over wordings, and not just for notations.
Thank you in advance