$\Newextarrow{\xRightarrow}{5,5}{0x21D2}$ $\newcommand\empty{}$

Example (Cospans). Let $\operatorname{\mathcal{C}}$ be a category containing a pair of objects $X$ and $Y$. A cospan from $X$ to $Y$ is an object $B \in \operatorname{\mathcal{C}}$ together with a pair of morphisms $X \xrightarrow {f} B \xleftarrow {g} Y$ in $\operatorname{\mathcal{C}}$. The cospans from $X$ to $Y$ can be regarded as the objects of a category $\operatorname{\mathcal{B}}_{X,Y}$, where a morphism from $(B,f,g)$ to $(B',f',g')$ in $\operatorname{\mathcal{B}}_{X,Y}$ is a morphism $u: B \rightarrow B'$ in the category $\operatorname{\mathcal{C}}$ which satisfies $f' = u \circ f$ and $g' = u \circ g$, so that the diagram

\[ \xymatrix@R =50pt@C=50pt{ & B \ar [dd]^{u} & \\ X \ar [ur]^{f} \ar [dr]_{f'} & & Y \ar [ul]_{g} \ar [dl]^{g'} \\ & B' & } \]

is commutative.

Assume now that the category $\operatorname{\mathcal{C}}$ admits pushouts. We can then construct a $2$-category $\operatorname{Cospan}(\operatorname{\mathcal{C}})$ as follows:

  • The objects of $\operatorname{Cospan}(\operatorname{\mathcal{C}})$ are the objects of $\operatorname{\mathcal{C}}$.

  • For every pair of objects $X,Y \in \operatorname{\mathcal{C}}$, we define $\underline{\operatorname{Hom}}_{ \operatorname{Cospan}(\operatorname{\mathcal{C}})}(X,Y)$ to be the category $\operatorname{\mathcal{B}}_{X,Y}$; in particular, $1$-morphisms from $X$ to $Y$ in the $2$-category $\operatorname{Cospan}(\operatorname{\mathcal{C}})$ can be identified with cospans from $X$ to $Y$.

  • For every triple of objects $X,Y,Z \in \operatorname{\mathcal{C}}$, the composition law

    \[ \circ : \underline{\operatorname{Hom}}_{\operatorname{Cospan}(\operatorname{\mathcal{C}})}( Y, Z) \times \underline{\operatorname{Hom}}_{\operatorname{Cospan}(\operatorname{\mathcal{C}})}( X, Y) \rightarrow \underline{\operatorname{Hom}}_{ \operatorname{Cospan}(\operatorname{\mathcal{C}})}( X, Z ) \]

    is given on objects by the construction $(C, B) \mapsto C \amalg _{Y} B$.

  • For every object $X \in \operatorname{\mathcal{C}}$, the identity $1$-morphism from $X$ to itself in $\operatorname{\mathcal{C}}$ is given by the cospan $X \xrightarrow { \operatorname{id}_ X } X \xleftarrow { \operatorname{id}_ X} X$, and the unit constraint $\upsilon _{X}$ is given by the canonical isomorphism $X \amalg _{X} X \xrightarrow {\sim } X$.

  • For every triple of composable $1$-morphisms

    \[ W \xrightarrow {A} X \xrightarrow {B} Y \xrightarrow {C} Z \]

    in $\operatorname{Cospan}(\operatorname{\mathcal{C}})$, the associativity constraint $\alpha _{C,B,A}$ is the canonical isomorphism of iterated pushouts

    \[ C \amalg _{Y} (B \amalg _{X} A) \xrightarrow {\sim } (C \amalg _{Y} B) \amalg _{X} A. \]

We will refer to $\operatorname{Cospan}(\operatorname{\mathcal{C}})$ as the $2$-category of cospans in $\operatorname{\mathcal{C}}$.