nLab traced monoidal category



Monoidal categories

monoidal categories

With symmetry

With duals for objects

With duals for morphisms

With traces

Closed structure

Special sorts of products



Internal monoids



In higher category theory



The concept of traced monoidal category axiomatizes the structure on a monoidal category for it to have a sensible notion of trace the way it exists canonically in compact closed categories.

In denotational semantics of programming languages, the trace is used to model recursion, though if the language is not substructural?, then this can be simplified to a fixed point operator.


The original definition due to (Joyal-Street-Verity 96) is stated in the general setting of balanced monoidal categories. Here we give just the slightly simpler formulation for the case of symmetric monoidal categories (Hasegawa 1997).

A symmetric monoidal category (C,,1,b)(C,\otimes,1,b) (where bb is the symmetry) is said to be traced if it is equipped with a natural family of functions

Tr A,B X:C(AX,BX)C(A,B)Tr_{A,B}^X : C(A \otimes X, B\otimes X) \to C(A,B)

satisfying three axioms:

  • Vanishing: Tr A,B 1(f)=fTr_{A,B}^1(f) = f (for all f:ABf : A \to B) and Tr A,B XY(f)=Tr A,B X(Tr AX,BX Y(f))Tr_{A,B}^{X\otimes Y}(f) = Tr_{A,B}^X(Tr_{A\otimes X,B\otimes X}^Y(f)) (for all f:AXYBXYf : A \otimes X \otimes Y \to B \otimes X \otimes Y)

  • Superposing: Tr CA,CB X(id Cf)=id CTr A,B X(f)Tr_{C\otimes A,C\otimes B}^X(id_C \otimes f) = id_C \otimes Tr_{A,B}^X(f) (for all f:AXBXf : A \otimes X \to B \otimes X)

  • Yanking: Tr X,X X(b X,X)=id XTr_{X,X}^X(b_{X,X}) = id_X

In string diagrams, the trace Tr(f):ABTr(f) : A \to B of a morphism f:AXBXf : A \otimes X \to B \otimes X is visualized by wrapping the outgoing wire representing XX to the incoming wire representing XX, thus “tying a loop” in the diagram of ff. The three axioms above (as well as the naturality conditions) then all have natural graphical interpretations (see Joyal-Street-Verity 96 or Hasegawa 1997).


  • The category of finite-dimensional vector spaces is traced monoidal. In skeletal form, the objects are natural numbers regarded as dimensions, morphisms are matrices regarded as linear maps, and tensor product is multiplication of the dimensions. The trace is a minor generalization of matrix trace:

    Tr m,n p((a (i,k),(j,k)) (i,k),(j,k)m×p×n×p) i,j= k=1 pa (i,k),(j,k). Tr_{m,n}^p((a_{(i,k),(j,k')})_{(i,k),(j,k')\in m\times p\times n\times p})_{i,j}= \sum_{k=1}^p a_{(i,k),(j,k)}.

    This is an instance of a trace in a compact closed category.

  • The category of profunctors is also compact closed, hence traced monoidal (actually a bicategory, though). The trace of a profunctor H:(B×X) op×A×XSetH:(B\times X)^{op} \times A\times X\to \mathbf{Set} is the profunctor Tr A,B X(H):B op×ASetTr_{A,B}^X(H):B^{op}\times A\to \mathbf{Set} given by the coend formula:

    Tr(H)(b,a)= xH(b,x,a,x). Tr(H)(b,a)=\int^x H(b,x,a,x) .
  • The category of sets and partial functions with the coproduct monoidal structure is traced, if we let the trace of a partial function f:A+XB+Xf:A+X\to B+X be defined as follows. First, let f A,B:ABf_{A,B}:A\to B, f X,X:XXf_{X,X}:X\to X and so on be the evident partial functions that come from restricting the domain and codomain of ff. Then define

    Tr A,B X(f)(a)=bTr_{A,B}^X(f)(a)=b

    if either f A,B(a)=bf_{A,B}(a)=b or if there exists nn such that b=f X,B(f X,X n(f A,X(a)))b=f_{X,B}(f_{X,X}^n(f_{A,X}(a))). See for instance Section 5.2 of (Abramsky, Haghverdi and Scott). This is an example of a partially additive category.

    This is a basis for a categorical semantics of “while loops” in programming languages: we keep applying ff while it is returning in XX.

  • Consider the category of pointed cpo‘s and continuous functions. A pointed cpo is a poset with a bottom element \bot and least upper bounds of ω\omega-chains. The morphisms preserve least upper bounds of chains but are not required to preserve bottom elements. This is a cartesian monoidal category, and with this structure it is traced, if we let the trace of a continuous function f:A×XB×Xf:A\times X\to B\times X be given as follows. First, for fixed aAa\in A, let x aXx_a\in X be the least fixed point of (π 2f(a,)):XX(\pi_2\cdot f(a,-)):X\to X, writing π 2\pi_2 for the second product projection. Here the least fixed point exists by Tarski’s fixed point theorem, indeed

    x a= n(π 2f(a,)) n().x_a=\bigvee_n(\pi_2\cdot f(a,-))^n(\bot).

    Then we let

    Tr A,B X(f)(a)=π 1(f(a,x a))BTr_{A,B}^X(f)(a)=\pi_1(f(a,x_a))\in B

    In Haskell notation, where ‘let’ allows recursive definitions, we can more swiftly just write

    Tr A,B X(f)(a)=let(b,x)=f(a,x)inbTr_{A,B}^X(f)(a)\ \ \ = \ \ \ let\ (b,x)=f(a,x)\ in\ b

    (except that the built-in product types in Haskell are lifted products rather than categorical products: (A,B)(A,B) in Haskell is like A×BA\times B but with an extra bottom element added).

    This is an example of a cartesian category with a parameterized fixed point operator (Hasegawa 1997).


Relation to compact closed categories

Every compact closed category is equipped with a canonical trace defined by

Tr A,B X(f)=AidηAXX *fidBXX *idεB Tr_{A,B}^X(f) = A \overset{id\otimes \eta}{\to} A \otimes X \otimes X^* \overset{f \otimes id}{\to} B \otimes X \otimes X^* \overset{id \otimes \varepsilon'}{\to} B

where η\eta is a unit and ε\varepsilon' is a counit of appropriate adjunctions (note that the symmetry makes the dual X *X^* both a right and left adjoint of XX: the adjunctions are ambidextrous).

Conversely, given a traced monoidal category 𝒞\mathcal{C}, there is a free construction completion of it to a compact closed category Int(𝒞)Int(\mathcal{C}) (Joyal-Street-Verity 96):

the objects of Int(𝒞)Int(\mathcal{C}) are pairs (A +,A )(A^+, A^-) of objects of 𝒞\mathcal{C}, a morphism (A +,A )(B +,B )(A^+ , A^-) \to (B^+ , B^-) in Int(𝒞)Int(\mathcal{C}) is given by a morphism of the form A +B A B +A^+\otimes B^- \longrightarrow A^- \otimes B^+ in 𝒞\mathcal{C}, and composition of two such morphisms (A +,A )(B +,B )(A^+ , A^-) \to (B^+ , B^-) and (B +,B )(C +,C )(B^+ , B^-) \to (C^+ , C^-) is given by tracing out B B^- from the composite

A +B C f1A B +C 1gA B C +. A^+ \otimes B^- \otimes C^- \xrightarrow{f\otimes 1} A^- \otimes B^+ \otimes C^- \xrightarrow{1\otimes g} A^- \otimes B^- \otimes C^+.

Note that 𝒞\mathcal{C} embeds fully-faithfully in Int(𝒞)Int(\mathcal{C}) by sending AA to (A,I)(A,I), where II is the unit object of the monoidal structure.

Furthermore, a traced monoidal category that is *\ast-autonomous must already be compact closed; see HH13.

In cartesian monoidal categories

For a cartesian monoidal category, the existence of a trace operator is equivalent to the existence of a “parameterized” fixed point operator satisfying certain properties (Hasegawa 1997). When the category is a Lawvere theory, this is related to the notion of iteration theory.

Adding traces

Since any full monoidal subcategory of a traced monoidal category inherits a trace, not every monoidal category can be fully embedded into a traced monoidal category, and hence also not into a compact closed category. In fact, Plotkin observed that there are monoidal categories that cannot even be faithfully mapped into a traced monoidal category. This can be seen from the fact that a traced monoidal category has the “cancellation property” that if fid XX=gid XXf\otimes id_{X\otimes X} = g \otimes id_{X\otimes X} then fid X=gid Xf\otimes id_X = g\otimes \id_X (since the latter is a trace of the former with one of the copies of XXX\otimes X transposed), but not all monoidal categories have this property.

Categorical semantics

Traced monoidal categories serve as an “operational” categorical semantics for linear logic, known as Geometry of Interactions. See there for more.

In this context the free compact closure Int(𝒞)Int(\mathcal{C}) from above is sometimes called the Geometry of Interaction construction and denoted 𝒢(𝒞)\mathcal{G}(\mathcal{C}) (Abramsky-Haghverdi-Scott 02, def. 2.6).


The concept was introduced in

A characterization of trace structures on cartesian monoidal categories is given in

  • Masahito Hasegawa, Recursion from Cyclic Sharing: Traced Monoidal Categories and Models of Cyclic Lambda Calculi, Proc. 3rd International Conference on Typed Lambda Calculi and Applications (TLCA 1997). Springer LNCS1210, 1997 (citeseer)

The equivalence between traces and parameterized fixed point operators appears as Theorem 3.1 (the author notes that this theorem was also proved independently by Martin Hyland).

Comprehensive discussion as a source for categorical semantics of the Geometry of Interactions is in

The combination with star-autonomous structure was discussed in

  • Tamás Hajgató and Masahito Hasegawa, Traced *\ast-autonomous categories are compact closed, TAC, 2013

Last revised on August 19, 2022 at 17:58:09. See the history of this page for a list of all contributions to it.