Suppose $S$ is a small semicategory (or semigroupoid, if that's your preferred term) and $\cdot$ is the binary operation on $S$. Implicit in this definition is the set $\operatorname{Ob}(S)$ and two functions $\operatorname{dom}: S \to \operatorname{Ob}(S)$ and $\operatorname{codom}: S \to \operatorname{Ob}(S)$ such that for $a, b \in S$, $a \cdot b$ is defined if and only if $\operatorname{dom}(a) = \operatorname{codom}(b)$. (I view members of $S$ as morphisms of $S$, not objects of $S$.)
If we somehow lose $\operatorname{Ob}(S)$, $\operatorname{dom}$ and $\operatorname{codom}$, is there a canonical way to recover them from just $\cdot$? (There are definitely many possible choices as $\operatorname{Ob}(S)$ can be enlarged arbitrarily from any correct choice.)
My current idea is as follows. First, define $L \subseteq S$ and $R \subseteq S$ by $L = \{a \in S \mid b \cdot a \text{ is not defined for all } b \in S\}$ and $R = \{a \in S \mid a \cdot b \text{ is not defined for all } b \in S\}$. Intuitively, $L$ consists of left-only elements and $R$ consists of right-only elements.
Next, define $O \subseteq S^2$ by $O = \{(a, b) \in S^2 \mid a \cdot b \text{ is defined}\}$, and define an equivalence relation $\sim$ on $O$ such that $(a, b) \sim (a', b')$ if and only if $(a, b') \in O$ or $(a', b) \in O$ (in which case both would be true). (I believe that if $(S, \cdot)$ is not a semicategory, $\sim$ would not be an equivalence relation, but it's just a guess.)
Finally, define $\operatorname{Ob}(S) = (O / \sim) \amalg \{s, t\}$ where $s$ and $t$ are distinct constants. $\operatorname{dom}$ can be defined by $$ \operatorname{dom}(a) = \begin{cases} s & ; a \in R \\ [(a, b)]_{\sim} & ; \text{any $b \in S$}, a \notin R \end{cases} $$ $\operatorname{codom}$ can be defined similarly.
To make $\operatorname{Ob}(S)$ as small as possible, we can remove $s$ or $t$ or both if they are not needed. In other words, we can re-define $\operatorname{Ob}(S)$ to be the union of the images of $\operatorname{dom}$ and $\operatorname{codom}$.
I am not sure if this construction is canonical enough because the way it deals with left-only or right-only morphisms seems somewhat unnatural to me.
Here are my questions:
- What do you think of this construction? Is it correct? If it is correct, is it natural? Can it be simplied?
- Is there an existing work discussing this?
- Are all choices that work equivalent? I have not formally defined equivalence here, but the approximate sense is that $\operatorname{dom}$ and $\operatorname{codom}$ are, in some sense, invariant.
And, the problem is mostly with your left-only and right-only arrows.
Let $\mathcal{sCat}$ denote the category of (small) semicategories without unnecessary objects (i.e. when ${\rm cod}$ and ${\rm dom}$ are jointly surjective).
And, for the moment, let us call a partial algebra $(S,\cdot)$ a graphless semicategory if whenever any two of $\ f\cdot g,\ \ g\cdot h,\ \ (f\cdot g)\cdot h,\ \ f\cdot(g\cdot h)\ $ are defined, then so are all four of them, and in this case $(f\cdot g)\cdot h\ =\ f\cdot(g\cdot h)$.
Let $\mathcal{gsCat}$ denote their category.
Then, the forgetful functor $\mathcal{sCat}\to\mathcal{gsCat}$ has a right adjoint, which is what you have described above.
But, it also has a left adjoint, which you can get if elements of $L$ and $R$ are 'not glued together' in one point [$s$ and $t$].
Alternatively, you can take the equivalence relation on $S\times\{0,1\}$ generated by
$$\quad (f,1)\sim (g,0)\quad \text{if}\quad \exists\, g\cdot f\,, $$ where $(f,0)$ wants to represent the domain of $f$ and $(g,1)$ the codomain of $g$.