# Compact closed category

In category theory, a branch of mathematics, compact closed categories are a general context for treating dual objects. The idea of a dual object generalizes the more familiar concept of the dual of a finite-dimensional vector space. So, the motivating example of a compact closed category is FdVect, the category having finite-dimensional vector spaces as objects and linear maps as morphisms, with tensor product as the monoidal structure. Another example is Rel, the category having sets as objects and relations as morphisms, with Cartesian monoidal structure.

## Symmetric compact closed category

A symmetric monoidal category $(\mathbf {C} ,\otimes ,I)$ is compact closed if every object $A\in \mathbf {C}$ has a dual object. If this holds, the dual object is unique up to canonical isomorphism, and is denoted $A^{*}$.
In a bit more detail, an object $A^{*}$ is called the dual of $A$ if it is equipped with two morphisms called the unit $\eta _{A}:I\to A^{*}\otimes A$ and the counit $\varepsilon _{A}:A\otimes A^{*}\to I$, satisfying the equations
    $\lambda _{A}\circ (\varepsilon _{A}\otimes A)\circ \alpha _{A,A^{*},A}^{-1}\circ (A\otimes \eta _{A})\circ \rho _{A}^{-1}=\mathrm {id} _{A}$
and
    $\rho _{A^{*}}\circ (A^{*}\otimes \varepsilon _{A})\circ \alpha _{A^{*},A,A^{*}}\circ (\eta _{A}\otimes A^{*})\circ \lambda _{A^{*}}^{-1}=\mathrm {id} _{A^{*}},$
where $\lambda ,\rho$ are the introduction of the unit on the left and right, respectively, and $\alpha$ is the associator.
For clarity, we rewrite the above compositions diagrammatically. In order for $(\mathbf {C} ,\otimes ,I)$ to be compact closed, we need the following composites to equal $\mathrm {id} _{A}$:
    $A{\xrightarrow {\cong }}A\otimes I{\xrightarrow {A\otimes \eta }}A\otimes (A^{*}\otimes A){\xrightarrow {\cong }}(A\otimes A^{*})\otimes A{\xrightarrow {\epsilon \otimes A}}I\otimes A{\xrightarrow {\cong }}A$
and $\mathrm {id} _{A^{*}}$:
    $A^{*}{\xrightarrow {\cong }}I\otimes A^{*}{\xrightarrow {\eta \otimes A^{*}}}(A^{*}\otimes A)\otimes A^{*}{\xrightarrow {\cong }}A^{*}\otimes (A\otimes A^{*}){\xrightarrow {A^{*}\otimes \epsilon }}A^{*}\otimes I{\xrightarrow {\cong }}A^{*}$

## Definition

More generally, suppose $(\mathbf {C} ,\otimes ,I)$ is a monoidal category, not necessarily symmetric, such as in the case of a pregroup grammar. The above notion of having a dual $A^{*}$ for each object A is replaced by that of having both a left and a right adjoint, $A^{l}$ and $A^{r}$, with a corresponding left unit $\eta _{A}^{l}:I\to A\otimes A^{l}$, right unit $\eta _{A}^{r}:I\to A^{r}\otimes A$, left counit $\varepsilon _{A}^{l}:A^{l}\otimes A\to I$, and right counit $\varepsilon _{A}^{r}:A\otimes A^{r}\to I$. These must satisfy the four yanking conditions, each of which are identities:
    $A\to A\otimes I{\xrightarrow {\eta ^{r}}}A\otimes (A^{r}\otimes A)\to (A\otimes A^{r})\otimes A{\xrightarrow {\epsilon ^{r}}}I\otimes A\to A$
    $A\to I\otimes A{\xrightarrow {\eta ^{l}}}(A\otimes A^{l})\otimes A\to A\otimes (A^{l}\otimes A){\xrightarrow {\epsilon ^{l}}}A\otimes I\to A$
and
    $A^{r}\to I\otimes A^{r}{\xrightarrow {\eta ^{r}}}(A^{r}\otimes A)\otimes A^{r}\to A^{r}\otimes (A\otimes A^{r}){\xrightarrow {\epsilon ^{r}}}A^{r}\otimes I\to A^{r}$
    $A^{l}\to A^{l}\otimes I{\xrightarrow {\eta ^{l}}}A^{l}\otimes (A\otimes A^{l})\to (A^{l}\otimes A)\otimes A^{l}{\xrightarrow {\epsilon ^{l}}}I\otimes A^{l}\to A^{l}$
That is, in the general case, a compact closed category is both left and right-rigid, and biclosed.
Non-symmetric compact closed categories find applications in linguistics, in the area of categorial grammars and specifically in pregroup grammars, where the distinct left and right adjoints are required to capture word-order in sentences. In this context, compact closed monoidal categories are called (Lambek) pregroups.

## Properties

Compact closed categories are a special case of monoidal closed categories, which in turn are a special case of closed categories.
Compact closed categories are precisely the symmetric autonomous categories. They are also *-autonomous.
Every compact closed category C admits a trace. Namely, for every morphism $f:A\otimes C\to B\otimes C$, one can define
    $\mathrm {Tr_{A,B}^{C}} (f)=\rho _{B}\circ (id_{B}\otimes \varepsilon _{C})\circ \alpha _{B,C,C^{*}}\circ (f\otimes C^{*})\circ \alpha _{A,C,C^{*}}^{-1}\circ (id_{A}\otimes \eta _{C^{*}})\circ \rho _{A}^{-1}:A\to B$
which can be shown to be a proper trace. It helps to draw this diagrammatically: $A{\xrightarrow {\cong }}A\otimes I{\xrightarrow {A\otimes \eta _{C^{*}}}}A\otimes (C\otimes C^{*}){\xrightarrow {\cong }}(A\otimes C)\otimes C^{*}{\xrightarrow {\;\;f\otimes C^{*}\;\;}}(B\otimes C)\otimes C^{*}{\xrightarrow {\cong }}B\otimes (C\otimes C^{*}){\xrightarrow {B\otimes \varepsilon _{C}}}B\otimes I{\xrightarrow {\cong }}B.$

## Examples

The canonical example is the category FdVect with finite-dimensional vector spaces as objects and linear maps as morphisms. Here $A^{*}$ is the usual dual of the vector space $A$.
The category of finite-dimensional representations of any group is also compact closed.
The category Vect, with all vector spaces as objects and linear maps as morphisms, is not compact closed; it is symmetric monoidal closed.

### Simplex category

The simplex category can be used to construct an example of non-symmetric compact closed category. The simplex category is the category of non-zero finite ordinals (viewed as totally ordered sets); its morphisms are order-preserving (monotone) maps. We make it into a monoidal category by moving to the arrow category, so the objects are morphisms of the original category, and the morphisms are commuting squares. Then the tensor product of the arrow category is the original composition operator. The left and right adjoints are the min and max operators; specifically, for a monotone map f one has the right adjoint
    $f^{r}(n)=\sup\{m\in \mathbb {N} \mid f(m)\leq n\}$
and the left adjoint
    $f^{l}(n)=\inf\{m\in \mathbb {N} \mid n\leq f(m)\}$
The left and right units and counits are:
    ${\mbox{id}}\leq f\circ f^{l}\qquad {\mbox{(left unit)}}$
    $\,{\mbox{id}}\leq f^{r}\circ f\quad \ \ \ {\mbox{(right unit)}}$
    $f^{l}\circ f\leq {\mbox{id}}\qquad {\mbox{(left counit)}}$
    $f\circ f^{r}\leq {\mbox{id}}\qquad {\mbox{(right counit)}}$
One of the yanking conditions is then
    $f=f\circ {\mbox{id}}\leq f\circ (f^{r}\circ f)=(f\circ f^{r})\circ f\leq {\mbox{id}}\circ f=f.$
The others follow similarly. The correspondence can be made clearer by writing the arrow $\to$ instead of $\leq$, and using $\otimes$ for function composition $\circ$.

### Dagger compact category

A dagger symmetric monoidal category which is compact closed is a dagger compact category.

## Rigid category

A monoidal category that is not symmetric, but otherwise obeys the duality axioms above, is known as a rigid category. A monoidal category where every object has a left (resp. right) dual is also sometimes called a left (resp. right) autonomous category. A monoidal category where every object has both a left and a right dual is sometimes called an autonomous category. An autonomous category that is also symmetric is then a compact closed category.