TITLE: An "explicit" description of cocomma-categories ?
QUESTION [5 upvotes]: Let the cocomma-square $\require{AMScd}$
\begin{CD}
    A @>T>> Y\\
    @V S V  V \Uparrow_\beta  @VV i_1 V\\
    X @>>i_0> (S\star T)
\end{CD}
where : 

$Ob\,(S\star T) :=Ob\,X\sqcup Ob\,Y$

and $\hom_{(S\star T)}(r,r') $ is given by : 

$\hom_{(S\star T)}(r,r'):=\hom_{X}(x,x')$ if $r=x, r'=x' \in X$,
$\hom_{(S\star T)}(r,r'):=\hom_{Y}(y,y')$ if $r=y, r'=y' \in Y$,
$\emptyset$ if $r\in Y$ and $r'\in X$,
for all $a\in A$, a formal arrow : $Sa \overset{\underline{a}}{\longrightarrow} Ta  $ such that : $id_{Ta}\circ \underline{a}=\underline{a}\circ id_{Sa}=\underline{a}$

all this arrows subject to the relations : 

if $r=x\in X$ and $r'=y\in Y$,  two parallel arrows of $\hom_{(S\star T)}(x,y)$ : 

$$x\overset{f}{\longrightarrow}Sa\overset{\underline{a}}{\longrightarrow}Ta\overset{g}{\longrightarrow}y$$
$$x\overset{f'}{\longrightarrow}Sa'\overset{\underline{a}'}{\longrightarrow}Ta'\overset{g'}{\longrightarrow}y$$
are equal if exists a "zig-zag" in $A$ : 
$$a\overset{q_{1}}{\longleftarrow}a_{1}\longrightarrow...\overset{q_{n}}{\longrightarrow}a' $$
and arrows $f_{i}:x\longrightarrow Sa_{i}$ in $X$ and $g_{i}:Ta_{i}\longrightarrow y$ in $Y$ making the diagram commutes  :
\begin{CD}
x @>f>>    Sa @>\underline{a}>> Ta @>g>> y \\
 @|   @A Sq_1 AA         @AA Tq_1 A  @| \\
x @>f_1>>  Sa_1 @>>\underline{a_1}> Ta_1   @>g_1>> y \\
@|   @V Sq_2 VV   @VV Tq_2 V @| \\
\cdots @>>> \cdots @>>> \cdots   @>>> \cdots \\
@| @V Sq_n VV   @VV Tq_n V @| \\
x @>>f'>  Sa' @>>\underline{a'}> Ta' @>>g'> y\\
\end{CD}
In this description : $\beta_a:=\underline{a}$.
Can someone confirm me if it is right or not ?

REPLY [6 votes]: Your construction is basically correct.  The only slight mistake (probably you had the correct thing in mind and this was just a mistake in phrasing) is that the formal arrows $\underline{a}$ are not sufficient to give the hom-sets $\hom_{S\star T}(r,r')$ when $r\in X$ and $r'\in Y$; you also need the "formal composites" of these arrows with arrows in $X$ and $Y$ on either side, which then get quotiented by the equivalence relation you describe.
Here is an abstract argument for why this construction is correct.

Every comma object is a discrete two-sided fibration.
Dually, every cocomma object is a codiscrete two-sided cofibration.
In Cat, every discrete two-sided fibration is the comma of its cocomma, and every codiscrete two-sided cofibration is the cocomma of its comma.  This sets up an equivalence between discrete two-sided fibrations and codiscrete two-sided cofibrations, both of which represent profunctors from $Y$ to $X$.
Moreover, the comma of the cocomma is a reflection from arbitrary spans into discrete two-sided fibrations, and dually the cocomma of the comma is a coreflection from arbitrary cospans into codiscrete two-sided cofibrations.  Thus, to compute an arbitrary cocomma, it suffices to compute the reflection of a span into discrete two-sided fibrations, regard it as a profunctor, and then take the collage of that profunctor.
Every span $X \leftarrow A \to Y$ generates a free two-sided fibration $X \leftarrow X^{\mathbf{2}}\times_X A \times_Y Y^{\mathbf{2}} \to Y$, where $X^{\mathbf{2}}$ is the category of arrows in $X$.  The objects of this free two-sided fibration are therefore triples $(a,f,g)$ where $a\in A$, $f:x\to S a$, and $g:T a \to y$, which we can regard as the above "formal composites".  Now it suffices to take the discrete reflection of this over $X$ and $Y$, which amounts to imposing your zig-zag equivalence relation.