                         QPL 2005 Preliminary Version

Dagger compact closed categories and completely positive maps (extended abstract)

Peter Selinger^{1}

Department of Mathematics and Statistics Dalhousie University, Halifax, Nova Scotia, Canada

Abstract

Dagger compact closed categories were recently introduced by Abramsky and Coecke, under the name “strongly compact closed categories”, as an axiomatic framework for quantum mechanics. We present a graphical language for dagger compact closed categories, and sketch a proof of its completeness for equational reasoning. We give a general construction, the CPM construction, which associates to each dagger compact closed category its “category of completely positive maps”, and we show that the resulting category is again dagger compact closed. We apply these ideas to Abramsky and Coecke’s interpretation of quantum protocols, and to D’Hondt and Panangaden’s predicate transformer semantics.

Key words: Categorical model, quantum computing, dagger categories, CPM construction.

1 Introduction

In the last few years, there have been several proposals for axiomatic semantics of quantum programming languages and/or protocols. In [9], I proposed the notion of an “elementary quantum flow chart category” as an abstraction of the category of superoperators. In such a category, one can give a denotational interpretation of first-order quantum programming languages with classical control and finite classical and quantum data types.

At about the same time, Abramsky and Coecke introduced their notion of a “strongly compact closed category” (which will be called “dagger compact closed category” in this paper). This axiomatic framework captures enough of the properties of the category of finite-dimensional Hilbert spaces to be able to express basic quantum-mechanical concepts such as unitary maps, scalars, projectors, inner products etc.

1 Email: selinger@mathstat.dal.ca. Research supported by NSERC.

This is a preliminary version. The final version will be published in Electronic Notes in Theoretical Computer Science

                       URL: www.elsevier.nl/locate/entcs

Selinger

The respective axiomatics of [9] and [1] are at the outset quite different: the former attempts to capture von Neumann’s formulation of quantum mechanics in terms of mixed states, density matrices, and completely positive maps, while the latter formalizes the Hilbert space point of view centered on pure states, unitary maps, and projectors.

The aim of this paper is to demonstrate that, despite these obvious differences, the two approaches actually have a lot in common. We show that the category of completely positive maps considered in [9] is actually a biproduct dagger compact closed category. We further introduce a general construction, called the CPM construction, that associates to any dagger compact closed category C its “category of completely positive maps” CPM(C). In this way, we obtain a canonical and very general way of passing from a “Hilbert-style” to a “von Neumann-style” setting.

As an application of these ideas, we discuss Abramsky and Coecke’s interpretation of quantum protocols. Abramsky and Coecke have argued that biproducts can be used to model classical information flow in their categorical setting. We show that the proper place for such an interpretation is not the category of Hilbert spaces, but its derived category of completely positive maps.

As another application of the dagger structure on the categories of completely positive maps, we also we also briefly discuss D’Hondt and Panangaden’s predicate transformer semantics [4].

An important tool in reasoning about many variants of monoidal categories is the use of graphical languages [5]. Here, we describe a graphical language for dagger compact closed categories. A similar language has already been used, in a more informal manner, in the papers of Abramsky and Coecke. We go into some detail about this language, and sketch a proof of its completeness for equational reasoning in dagger compact closed categories.

2 Dagger compact closed categories

Dagger compact closed categories were introduced, under the name “strongly compact closed categories”, by Abramsky and Coecke in [1]. They extend compact closed categories [6] with a notion of adjoint of a morphism (here the word “adjoint” is used in the sense of linear algebra, not of category theory). Dagger compact closed categories axiomatize many of the structural properties of the category of finite dimensional Hilbert spaces, and therefore they appear to form a suitable framework for axiomatizing quantum mechanics.

2.1 Compact closed categories

Recall that a symmetric monoidal category is a category C together with a bifunctor ⊗, a distinguished object I, and natural isomorphisms α_{A,B,C} : (A ⊗ B) ⊗ C → A ⊗ (B ⊗ C), λ_{A} : A → I ⊗ A, and σ_{A,B} : A ⊗ B → B ⊗ A, subject to standard coherence conditions [7]. As usual, we also write ρ_{A} = σ_{I,A} ∘ λ_{A} : A → A ⊗ I.

A compact closed category is a symmetric monoidal category where each object A is assigned a dual object A^{∗}, together with a unit map η_{A} : I → A^{∗}⊗A and a counit map ϵ_{A} : A ⊗ A^{∗} → I, such that λ_{A}^{−1} ∘ (ϵ_{A} ⊗ A) ∘ α_{A,A^{∗},A}^{−1} ∘ (A ⊗ η_{A}) ∘ ρ_{A} = id_{A} and ρ_{A^{∗}}^{−1} ∘ (A^{∗} ⊗ ϵ_{A}) ∘ α_{A^{∗},A,A^{∗}} ∘ (η_{A} ⊗ A^{∗}) ∘ λ_{A} = id_{A^{∗}}.

Remark 2.1 In any compact closed category, the operation (−)^{∗} extends to a contravariant functor by mapping f : A → B to f^{∗} : B^{∗} → A^{∗}, defined by ρ_{A^{∗}}^{−1} ∘ (A^{∗} ⊗ ϵ_{B}) ∘ (A^{∗} ⊗ f ⊗ B^{∗}) ∘ (η_{A} ⊗ B^{∗}) ∘ λ_{B^{∗}}. This functor preserves the symmetric monoidal structure, and possesses a natural isomorphism A^{∗∗} ≅ A.

2.2 Dagger categories

Definition 2.2 (Dagger category) A dagger category is a category C together with an involutive, identity-on-objects, contravariant functor † : C → C.

Concretely, this means that to every morphism f : A → B one associates a morphism f^{†} : B → A, called the adjoint of f, such that for all f : A → B and g : B → C:

\begin{aligned}id_{A}^{†} = id_{A} & : A → A, \\ (g ∘ f)^{†} = f^{†} ∘ g^{†} & : C → A, \\ f^{††} = f & : A → B, \end{aligned}  (1)

Definition 2.3 (Unitary map, self-adjoint map) In a dagger category, a morphism f : A → B is called unitary if it is an isomorphism and f^{−1} = f^{†}. A morphism f : A → A is called self-adjoint or hermitian if f = f^{†}.

2.3 Dagger symmetric monoidal categories

Definition 2.4 (Dagger symmetric monoidal category) A dagger symmetric monoidal category is a symmetric monoidal category C with a dagger structure, such that the contravariant functor † : C → C coherently preserves the symmetric monoidal structure.

Concretely, the requirement that † “coherently preserves the symmetric monoidal structure” means the following, for all f : A → B and g : C → D:

\begin{aligned}(f ⊗ g)^{†} = f^{†} ⊗ g^{†} & : B ⊗ D → A ⊗ C, \\ α_{A,B,C}^{†} = α_{A,B,C}^{−1} & : A ⊗ (B ⊗ C) → (A ⊗ B) ⊗ C, \\ λ_{A}^{†} = λ_{A}^{−1} & : I ⊗ A → A, \\ σ_{A,B}^{†} = σ_{A,B}^{−1} & : B ⊗ A → A ⊗ B. \end{aligned}  (2)

Remark 2.5 Equivalently, the requirement that † preserves the symmetric monoidal structure “coherently” means that the two natural isomorphisms A^{†} ⊗ B^{†} ≅ (A ⊗ B)^{†} coincide: namely, the one coming from the monoidal functor, and the other one coming from the fact that † is an identity-on-objects functor:

A^{†} ⊗ B^{†}_{id}  _{≅} A ⊗ B _{id} (A ⊗ B)^{†}

Since the vertical and horizontal morphisms are in fact identities, coherence in this case amounts to the requirement that † preserves the symmetric monoidal structure “on the nose”, rather than up to isomorphism.

2.4 Dagger compact closed categories

Definition 2.6 (Dagger compact closed category [1]) A dagger compact closed category is a dagger symmetric monoidal category that is also compact closed, and such that the following diagram commutes for all A:

I ^{ϵ_{A}^{†}}_{η_{A}} A ⊗ A^{∗}_{σ_{A,A^{∗}}} A^{∗} ⊗ A  (3)

Remark 2.7 Abramsky and Coecke coined the term “strongly compact closed category” for a dagger compact closed category. However, a dagger structure can be added to almost any type of category, and so it is useful to have a terminology that can be extended to these cases. Since it would sound silly, for instance, to speak of a “strong category”, we propose the adjective “dagger” as a more distinctive alternative.

Remark 2.8 In any dagger compact closed category, we have f^{∗†} = f^{†∗}. This is a consequence of equation (3). The converse is not true, i.e., a compact closed dagger category in which f^{∗†} = f^{†∗} is not necessarily dagger compact closed. To construct a counterexample, take a dagger compact closed category C in which there is some invertible, but not unitary, scalar ϕ : I → I (for example, the category of finite dimensional Hilbert spaces, with ϕ(x) = 2x). Define a new compact closed structure on C by letting η′_{A} = η_{A} ∘ ϕ and ϵ′_{A} = ϕ^{−1} ∘ϵ_{A}. In the modified compact closed structure, the definition of f^{∗} is unchanged and thus f^{∗†} = f^{†∗} still holds. However, equation (3) is no longer satisfied.

Definition 2.9 (Lower-star operation) Given f : A → B in a dagger compact closed category, we define f_{∗} : A^{∗} → B^{∗} by f_{∗} = f^{∗†} = f^{†∗}. This assignment defines a covariant functor.

2.5 Biproducts

Recall the definitions of a zero object and biproducts. An object is called a zero object if it is initial and terminal. If 0 is a zero object, then there is a distinguished map A → 0 → B between any two objects, denoted 0_{A,B}. If A_{1} and A_{2} are objects, their biproduct is an object A_{1} ⊕ A_{2}, together with morphisms q_{i} : A_{i} → A_{1} ⊕ A_{2} and p_{i} : A_{1} ⊕ A_{2} → A_{i}, for i = 1, 2, such that the pair p_{1}, p_{2} forms a product cone, the pair q_{1}, q_{2} forms a coproduct cone, and p_{i} ∘ q_{j} = δ_{ij}. Here δ_{ii} = id_{A_{i}} and δ_{ij} = 0_{A_{j},A_{i}} when i ≠ j. We say that C has finite biproducts if it has a zero object 0 and a biproduct for any pair of objects.

Recall that a category C is said to be enriched in commutative monoids if each hom-set is equipped with an associative, commutative addition operation with unit 0, such that composition is linear: (f + g) ∘ h = f ∘ h + g ∘ h, h ∘ (f + g) = h ∘ f + h ∘ g, 0 ∘ h = 0, and h ∘ 0 = 0.

If a category C has finite biproducts, then it carries a canonical such enrichment: Given f, g : A → B, we can define f + g : A → B as f + g = [id_{B}, id_{B}] ∘ (f ⊕ g) ∘ ⟨id_{A}, id_{A}⟩. The unit for this addition is 0_{A,B},

Remark 2.10 We have q_{1} ∘ p_{1} + q_{2} ∘ p_{2} = id_{A⊕B}.

Lemma 2.11 Let C, D be categories with finite biproducts, and let F : C → D be a functor. If F has a left or right adjoint (and in particular, if F is an equivalence of categories), then F preserves the biproducts up to isomorphism. Indeed, in this case, the canonical maps

\begin{matrix}[F (q_{1}), F (q_{2})]: F (A) ⊕ F (B) → F (A ⊕ B) \\ ⟨F (p_{1}), F (p_{2})⟩: F (A ⊕ B) → F (A) ⊕ F (B) \end{matrix}

are mutually inverse. □

Two special cases of this lemma are of particular interest: in a compact closed category with biproducts, the tensor is distributive with respect to the biproducts, i.e., there is a canonical distributivity isomorphism (A⊕B)⊗C ≅ A ⊗ C ⊕ B ⊗ C.

Also, if C is a dagger category with biproducts, then the functor † automatically preserves biproducts up to isomorphism. However, in general, preservation “up to isomorphism” is not quite sufficient; a more desirable property is that the biproduct should be preserved “on the nose”. The following lemma gives four equivalent conditions that achieve this.

Lemma 2.12 Let C be a dagger category with biproducts. Then the following conditions are equivalent. Here Δ = ⟨id, id⟩ : A → A ⊕ A, and ∇ = [id, id] : A ⊕ A → A.

(a) p_{i}^{†} = q_{i}, for i = 1, 2,

(b) (f ⊕ g)^{†} = f^{†} ⊕ g^{†} and Δ^{†} = ∇, (c) ⟨f, g⟩^{†} = [f^{†}, g^{†}],

(d) The following diagram commutes.

A^{†} ⊕ B^{†}_{id}  _{[p_{1}^{†},p_{2}^{†}]} A ⊕ B _{id} (A ⊕ B)^{†}

□

Remark 2.13 The diagram in Lemma 2.12(d) can be seen as a coherence diagram, analogous to the diagram in Remark 2.5.

Definition 2.14 (Biproduct dagger compact closed category) A biproduct dagger compact closed category is a dagger compact closed category with biproducts, such that p_{i}^{†} = q_{i} : A_{i} → A_{1} ⊕ A_{2}, for all objects A_{1}, A_{2} and i = 1, 2.

2.6 Examples

Example 2.15 The category Vect of finite dimensional complex vector spaces and linear maps is a compact closed category with biproducts, but it is not dagger compact closed.

Example 2.16 The category FdHilb of finite dimensional Hilbert spaces is biproduct dagger compact closed. The adjoint of f : A → B is defined in terms of the inner product; namely, it is the unique map f^{†} : B → A satisfying ⟨fv|w⟩ = ⟨v|f^{†}w⟩, for all v ∈ A, w ∈ B.

Example 2.17 The category Rel of sets and relations is biproduct dagger compact closed. In this category, A ⊗ B = A × B is the cartesian product of sets, A ⊕ B = A + B is the disjoint union, and A^{∗} = A. For a relation R : A → B, we have R^{∗} = R^{†} = {(y, x) | (x, y) ∈ R} and R_{∗} = R.

3 Graphical languages

The graphical languages for symmetric monoidal categories and for compact closed categories are well-known [5,6]. We briefly recall these languages, and then extend them to dagger symmetric monoidal categories and dagger compact closed categories.

3.1 Symmetric monoidal categories: term language

Before describing the graphical language of symmetric monoidal categories, it is useful to briefly summarize their term language.

We assume given a countable set of object variables, denoted α, β, γ etc. The set of object terms is freely built from object variables and the unit object term I via the binary operation ⊗. Examples of object terms are α, I ⊗ α, (α ⊗ β) ⊗ γ, and so forth. We use the letters A, B, C to denote object terms.

Further, we assume given a countable set of morphism variables, denoted f, g, h etc. We assume that each morphism variable has been assigned a fixed type of the form A → B, and we sometimes write f^{A→B} to indicate the type explicitly. We assume that there are countably many morphism variables for each type. We are further given morphism constants id_{A}, α_{A,B,C}, α_{A,B,C}^{−1}, λ_{A}, λ_{A}^{−1}, σ_{A,B}, with their usual types, parameterized by object terms A, B, C. The set of typed morphism terms is defined recursively: morphism variables and morphism constants are morphism terms, and if t : A → B, s : B → C, and r : C → D are morphism terms, then so are s ∘ t : A → C and t ⊗ s : A ⊗ C → B ⊗ D.

We also consider equations s = t between morphism terms s, t : A → B of matching types. The equational theory of symmetric monoidal categories is the set of equations generated by the axioms of symmetric monoidal categories.

Remark 3.1 As is usual in formal languages, one distinguishes the concept of a variable, such as α or f, from the concept of a term, such as A or t. The symbols “A” and “t” are, of course, variables of the meta-language. We will make a similar distinction in the graphical language described below.

3.2 Symmetric monoidal categories: graphical language

The graphical language of symmetric monoidal categories was first defined in a mathematically rigorous way by Joyal and Street [5]. Before that, it was used informally for many years by physicists, going back to Penrose [8]. In the formulation that we are going to use, an object variable α is represented by a labeled wire

α ,  (4)

A morphism variable f : α_{1} ⊗α_{2} ⊗…⊗α_{n} → β_{1} ⊗β_{2} ⊗…⊗β_{m} is represented by a labeled box

α^{n}  β^{m} …  … α_{2}  β_{2} α_{1} f β_{1}  (5)

The graphical language associates to each object term A in the language of symmetric monoidal categories a certain wiring, and to each morphism term t a certain diagram, made up from wires (4) and boxes (5). We schematically write

A  (6)

for the representation of an object term A, and

A t B  (7)

for the representation of a morphism term t : A → B.

(a) Objects

I := (empty)  A ⊗ B := \begin{matrix}B \\ A \end{matrix}

(b) Morphisms

\begin{aligned}A s ∘ t C & := & A t B s C \\ C  D A t ⊗ s B & := & C s D A t B \end{aligned} \begin{aligned}A id_{A} A & := & A \\ B  A A σ_{A,B} B & := & B  A A  B \end{aligned}

Table 1 The graphical language of symmetric monoidal categories

Definition 3.2 The wiring (6) is defined by recursion on the object term A as in Table 1(a). Note that the object I is represented by zero wires, i.e., by the empty wiring. The diagram (7) is defined by recursion on the morphism term t as in Table 1(b). In addition to the cases shown in Table 1, the maps α_{A,B,C}, λ_{A}, and their inverses are represented in the same way as the identity morphism.

Remark 3.3 Note that the graphical language strictly speaking only uses the notations (4) and (5), where α and f are variables. The more general notations (6) and (7) belong to the meta-language. Therefore, when we speak of properties of diagrams (such as isomorphism) and operations on diagrams (such as composition), we always mean this with respect to the underlying diagram language, and not with respect to the meta-language.

Convention 3.4 When it is convenient to use textual notation, we also write [[A]] and [[t]] for the diagram associated to an object term A and a morphism term t : A → B, respectively. In other words, we write

\begin{aligned}[[A]] & := & A \\ [[t]] & := & A t B \end{aligned}

Remark 3.5 We have marked each wire with a left-to-right orientation, and each box with a square in the upper-left corner. For now, these markings are useless; their significance will become apparent when we introduce additional markings in the graphical languages of compact closed categories and dagger symmetric monoidal categories below.

Example 3.6 The equation

σ_{A′,B′} ∘ (f ⊗ g) = (g ⊗ f) ∘ σ_{A,B}

of symmetric monoidal categories can be translated into a diagrammatic equation, by translating the left-hand-side and the right-hand-side separately:

B g B′  A′ A f A′  B′ = B  A f A′ A  B g B′

The equation evidently “holds” in the graphical language, in the sense that the graphical representation of the left-hand-side and the right-hand-side are isomorphic as graphs, in an obvious sense with respect to a fixed ordering of the input- and output-wires. For a technically rigorous formalization of graph isomorphism in this context, see [5].

Indeed, one has the following theorem, due to Joyal and Street [5]:

Theorem 3.7 (Graphical language of symmetric monoidal categories) A well-typed equation between morphisms in the language of symmetric monoidal categories follows from the axioms of symmetric monoidal categories if and only if it holds, up to graph isomorphism, in the graphical language. □

3.3 Compact closed categories

The graphical language of compact closed categories extends that of symmetric monoidal categories. Individual wires can now be oriented right-to-left or leftto-right. The interpretation of A^{∗} is a wiring obtained by turning the wiring [[A]] “upside down”; this means reversing the orientation of each wire, as well as reversing the bottom-up order of the wires. We schematically write [[A^{∗}]]

as A^{∗} . More formally, we define the following notations in the metalanguage:

\begin{aligned}A^{∗} & := & A \\ A^{∗} & := & A \\ I & := & (empty) \end{aligned} A ⊗ B := \begin{matrix}A \\ B \end{matrix}

Note that the ordering of the wires in a tensor product for the right-to-left orientation is top-to-bottom, not bottom-to-top. Therefore, [[A^{∗}]] is [[A]] turned “upside-down”.

The structural maps η_{A} : I → A^{∗} ⊗ A and ϵ_{A} : A ⊗ A^{∗} → I are represented as follows:

[[η_{A}]] =  \begin{matrix}A \\ A \end{matrix}  [[ϵ_{A}]] = \begin{matrix}A \\ A \end{matrix}

Note that if t : A → B, then the morphism t^{∗} : B^{∗} → A^{∗}, which was defined in Remark 2.1, is given as follows:

[[t^{∗}]] = BA t BA

This is effectively the same as “the diagram of t turned upside down”, and we introduce the special graphical notation

[[t^{∗}]] = B t A

Since we have marked one corner of the box representing t, it is possible to tell when such a box has been turned upside down. Of course, this notation belongs to the meta-language.

Equations in the language of compact closed categories, such as λ_{A}^{−1} ∘(η_{A} ⊗ A) ∘ α_{A,A^{∗},A}^{−1} ∘ (A ⊗ η_{A}) ∘ ρ_{A} = id_{A} translate into graphical equations, such as

\begin{matrix}A \\ A \\ A \end{matrix}  =  A

With the appropriate notion of graph isomorphism, one has the following theorem, which was implicitly proved by Kelly and Laplaza [6]:

Theorem 3.8 (Graphical language of compact closed categories) A well-typed equation between morphisms in the language of compact closed categories follows from the axioms of compact closed categories if and only if it holds, up to graph isomorphism, in the graphical language. □

3.4 Dagger symmetric monoidal categories

The graphical language of dagger symmetric monoidal categories extends that of symmetric monoidal closed categories. There are no additional operations on objects. If f : A → B is a morphism variable

A f B ,

then f^{†} : B → A is represented by a new type of box as follows:

[[f^{†}]] := B f A

We think of this as “reflecting f about the y-axis”. Note that the objects A and B have been exchanged, but the orientation of the wires remains unchanged (in this case, left to right). More generally, if t : A → B is a term, then [[t^{†}]] is obtained by reflecting the entire diagram [[t]] about the y-axis. We use the notation:

[[t^{†}]] = B t A ,

We skip the formal recursive definition of “reflecting” and give an example instead:

Example 3.9 (Reflection of a diagram) Suppose f : A → B ⊗ C and g : E → C ⊗ D, and let

t = (id_{B} ⊗ g^{†}) ∘ α_{B,C,D} ∘ (f ⊗ id_{D}).

Then the respective graphical representations of t and t^{†} are:

t =  D  g E f C A  B

t^{†} =  D E g C  A B  f

The graphical language of dagger symmetric monoidal categories satisfies the usual coherence theorem:

Theorem 3.10 (Graphical language of dagger symmetric monoidal categories) A well-typed equation between morphisms in the language of dagger symmetric monoidal categories follows from the axioms of dagger symmetric monoidal categories if and only if it holds, up to graph isomorphism, in the graphical language.

Proof. Soundness is by induction. For completeness, suppose that the graphs of s, t : A → B are isomorphic. Using equations (1) and (2), we can find terms s′, t′ such that s = s′ and t = t′ holds in the equational theory of dagger categories, and such that the only applications of † in s′, t′ are to morphism variables. Now regard each daggered variable α^{†} as a fresh variable α̃. Since [[s′]] and [[t′]] are isomorphic, s′ = t′ holds in all symmetric monoidal categories by Theorem 3.7. Therefore s = s′ = t′ = t in the language of dagger symmetric monoidal categories. □

3.5 Dagger compact closed categories

The graphical language of dagger compact closed categories is obtained by combining the graphical language of compact closed categories with that of dagger symmetric monoidal categories. We also introduce notations for η_{A}^{†} and ϵ_{A}^{†}:

[[ϵ_{A}^{†}]] =  \begin{matrix}A \\ A \end{matrix}  [[η_{A}^{†}]] = \begin{matrix}A \\ A \end{matrix}

The defining equation of dagger compact closed categories, η_{A} = σ_{A,A^{∗}} ∘ ϵ_{A}^{†}, is then evidently satisfied up to graph isomorphism in the graphical language:

[[η_{A}]] = \begin{matrix}A \\ A \end{matrix} = A  A A  A = [[σ_{A,A^{∗}} ∘ ϵ_{A}^{†}]].

Theorem 3.11 (Graphical language of dagger compact closed categories) A well-typed equation between morphisms in the language of dagger compact closed categories follows from the axioms of dagger compact closed categories if and only if it holds, up to graph isomorphism, in the graphical language.

Proof. The proof is the same as that of Theorem 3.10, only using the additional equation (3) and working relative to Theorem 3.8. □

Remark 3.12 If f : A → B, then f, f^{†} : B → A, f_{∗} : A^{∗} → B^{∗}, and f^{∗} : B^{∗} → A^{∗} are graphically represented as follows:

\begin{matrix}f = A f B & f^{†} = B f A \\ f_{∗} = A f B & f^{∗} = B f A \end{matrix}

Thus, f_{∗} can be viewed graphically as f “reflected about the x-axis”.

3.6 Biproduct dagger compact closed categories

The above approach to graphical languages does not easily generalize to the presence of biproducts. This is due to the presence of two binary operations on objects (A ⊗ B and A ⊕ B). Since one cannot represent both of these operations by juxtaposition of objects, a more structured syntax is needed to represent object terms An approach to a graphical representation for this language, based on Girard’s proof nets, was recently proposed by Abramsky and Duncan [2]. We will not consider the issue further in this paper.

4 Positivity and the CPM construction

Dagger compact closed categories were introduced by Abramsky and Coecke as an axiomatic basis for quantum mechanics, providing an alternative to (and a generalization of) the usual axiomatization in terms of Hilbert spaces. Concepts such as unitary maps, projections, and even measurements and the Born rule can be formulated in this framework [1]. On the other hand, the present author has argued that a suitable framework for the semantics of quantum programming languages is not the category of Hilbert spaces and linear maps, but a category CPM of completely positive operators [9,10]. The advantage of working with completely positive maps is that both quantum features (such as unitary evolution) and classical probabilistic features (such as the different branches of a measurement) can be modeled internally as morphisms within the same category.

The purpose of this section is to show that (1) the construction of CPM from FdHilb generalizes to any dagger compact closed category C in place of FdHilb, and (2) the resulting category of completely positive maps is also dagger compact closed. We call this construction the CPM construction.

4.1 Positive maps

Definition 4.1 (Positive map) A morphism f : A → A in a dagger category is called positive if there exists an object B and a morphism g : A → B such that f = g^{†} ∘ g.

Remark 4.2 If f : A → A is positive, there exist in general many different decompositions of the form f = g^{†} ∘ g. We are only interested in the existence of such a decomposition, not in the particular decomposition.

Example 4.3 In the dagger category FdHilb of finite dimensional Hilbert spaces, the positive morphisms are precisely the positive operators, i.e., those that satisfy ⟨fv|v⟩ ⩾ 0 for all v.

Example 4.4 In the category Rel of sets and relations, the positive morphisms are precisely the relations R : A → A that are symmetric and satisfy xRy ⇒ xRx.

Convention 4.5 In the graphical language, a positive map is a map f : A → A that is of the form

A g B g A

for some B and g. By visual abstraction, we use the notation

A f  A

to denote a generic positive map.

Definition 4.6 (Trace) Given a morphism f : A → A in a compact closed category, its trace tr f : I → I is defined as

tr f = I ⟶^{σ∘η_{A}} A ⊗ A^{∗} ⟶^{f⊗A^{∗}} A ⊗ A^{∗} ⟶^{ϵ_{A}} I.

With the benefit of the graphical language, the trace of f is defined as follows:

tr f = A A f A

Lemma 4.7 (Properties of positive maps) The following properties hold in any biproduct dagger compact closed category:

(a) If f is positive, then h^{†} ∘ f ∘ h is positive, for any h.

(b) The identity morphism id_{A} is positive. Also, if f : A → A and g : B → B are positive, then so are f ⊗g : A⊗B → A⊗B and f ⊕g : A⊕B → A⊕B.

(c) The zero morphism 0_{A,A} : A → A is positive. Also, if f, g : A → A are positive, then so is f + g.

(d) If f is positive, then f^{†} = f.

(e) If f : A → A is positive, then so are f^{∗} : A^{∗} → A^{∗} and tr f : I → I.

(f) If f, g : A → A are positive, then so is tr(f ∘ g) : I → I.

Proof. (a)–(e) are straightforward from the definitions and the structure preserved by (−)^{†}. For (f), let g = h^{†} ∘ h. Then tr(f ∘ g) = tr(h ∘ f ∘ h^{†}), which is positive by (a) and (e). □

Remark 4.8 The converse of Lemma 4.7(d) does not hold: for instance, the symmetry map σ_{A,A} : A ⊗ A → A ⊗ A satisfies σ^{†} = σ, but is not positive in Rel or FdHilb.

4.2 Positive matrices

Definition 4.9 (Name, positive matrix) In a compact closed category, the name of a morphism f : A → B is ⌜f⌝ : I → A^{∗} ⊗ B defined as follows:

[[⌜f⌝]] = A f B A

The name of a morphism is also sometimes called its matrix, by analogy with vector spaces. A positive matrix is a morphism ⌜f⌝ : I → A^{∗} ⊗ A that is the name of a positive map f : A → A.

Remark 4.10 In the graphical language, a positive matrix is a morphism of the form

A f A A  =  A g B g A A  =  B k A B k A

for some B and k = g^{†}. We therefore use the special notation

h A A

for a generic positive matrix.

4.3 Completely positive maps

Definition 4.11 (Completely positive map) Let A, B be objects in a dagger compact closed category. We say that a morphism f : A^{∗} ⊗ A → B^{∗} ⊗ B is completely positive if for all objects C and all positive matrices g : I → C^{∗} ⊗ A^{∗} ⊗ A ⊗ C, the morphism

(C^{∗} ⊗ f ⊗ C) ∘ g = g  C A f B A  B C

is a positive matrix.

Lemma 4.12 Let f : A^{∗} ⊗ A → B^{∗} ⊗ B. Then f is completely positive if and only if

χ_{f} :=  A A f B A  B A

is a positive matrix.

Proof. The left-to-right implication is trivial by choosing C = A^{∗} and g = (η_{A^{∗}})_{∗} ⊗ η_{A^{∗}}. For the right-to-left implication, assume χ_{f} is a positive matrix. Then (C^{∗} ⊗ f ⊗ C) ∘ g is equal to the following matrix, which is seen to be positive by the graphical language:

(C^{∗} ⊗ f ⊗ C) ∘ g = g  C A χ_{f} A B B A A C  .

□

Lemma 4.12 is a categorical version of Choi’s Theorem from linear algebra [3]. We also call the matrix χ_{f} the characteristic matrix of f (cf. [9, Sec. 6.7]).

Corollary 4.13 Using Lemma 4.12 and the graphical language, it immediately follows that the following are equivalent:

(a) f : A^{∗} ⊗ A → B^{∗} ⊗ B is completely positive, (b) the map

A A f B A  B B

is positive.

(c) there exists a positive map g : B ⊗ A^{∗} → B ⊗ A^{∗} such that

f =  A A  A B  g B B

(d) there exists an object C and a morphism h : A → C ⊗ B such that

f =  A  B h C h C A  B

(e) there exists an object C and a morphism k : C ⊗ A → B such that

f =  A  B C k C k A  B
□

Convention 4.14 In light of Corollary 4.13(c)–(e), we will use the notation

A f B A  B

to denote a generic completely positive map f : A^{∗} ⊗ A → B^{∗} ⊗ B.

Remark 4.15 If f : A^{∗} ⊗ A → B^{∗} ⊗ B is completely positive, then f = f_{∗}. The converse does not in general hold, cf. Remark 4.8.

Remark 4.16 A positive matrix g : I → A^{∗} ⊗ A is the same thing as a completely positive map f : I^{∗} ⊗ I → A^{∗} ⊗ A (modulo the isomorphism I^{∗} ⊗ I ≅ I).

Lemma 4.17 (a) The identity map id : A^{∗} ⊗ A → A^{∗} ⊗ A is completely

positive.

(b) If f : A^{∗} ⊗A → B^{∗} ⊗B and g : B^{∗} ⊗B → C^{∗} ⊗C are completely positive, then so is g ∘ f : A^{∗} ⊗ A → C^{∗} ⊗ C.

(c) If f : A^{∗} ⊗A → B^{∗} ⊗B and g : C^{∗} ⊗C → D^{∗} ⊗D are completely positive,

then so is

C^{∗} ⊗ A^{∗} ⊗ A ⊗ C ⟶^{≅} A^{∗} ⊗ A ⊗ C^{∗} ⊗ C

⟶^{f⊗g} B^{∗} ⊗ B ⊗ D^{∗} ⊗ D ⟶^{≅} D^{∗} ⊗ B^{∗} ⊗ B ⊗ D.

(d) If f : A → B is any morphism, then f_{∗} ⊗ f : A^{∗} ⊗ A → B^{∗} ⊗ B is completely positive.

Proof. Immediate, using the graphical language. □

4.4 The CPM construction

Definition 4.18 (CPM construction) Given a dagger compact closed category C, we define a new category CPM(C) whose objects are the same as the objects of C. A morphism f : A → B in CPM(C) is a completely positive map f : A^{∗} ⊗ A → B^{∗} ⊗ B in C. Composition of morphisms is as in C.

Remark 4.19 By Lemma 4.17(a) and (b), CPM(C) is indeed a category. Moreover, Lemma 4.17(d) yields a functor F : C → CPM(C), defined via F (A) = A and F (f) = f_{∗} ⊗ f.

Theorem 4.20 CPM(C) is again dagger compact closed. The tensor product on objects is inherited from C; on morphisms it is given by Lemma 4.17(c). The structural maps α_{A,B,C}, λ_{A}, σ_{A,B}, η_{A} and ϵ_{A} are all given by the images of the respective maps of C under F. If f : A^{∗} ⊗ A → B^{∗} ⊗ B, then f^{†} in CPM(C) is given by f^{†} : B^{∗} ⊗ B → A^{∗} ⊗ A in C. The functor F : C → CPM(C) preserves the dagger compact closed structure.

Proof. The required equations are easy to verify. To aid the task, Table 2 gives a translation of the graphical language of CPM(C) into that of C. We prove one equation as an example: to prove that

C g D  B A f B  D = C  A f B A  C g D

holds in CPM(C), we must prove the following in C:

C  C g D  D  B A  C  D  B  D A  A f B  B  D C  A  B  D  B = C  A  A f B  B A  C  A  B  D A  C  C g D  D C  A  C  D  B

This is evidently true by graph isomorphism. The proof of the other equations is similar. □

In the graphical language of CPM(C):

In the graphical language of C:

f :  A f B  A f B A  B

f^{†} :  B f A  B f A B  A

f^{∗} :  B f A  B  B f A  A B  B  A  A

f_{∗} :  A f B  A  A f B  B A  A  B  B

id_{A} :  A  \begin{matrix}A \\ A \end{matrix}

g ∘ f :  A f B g C  A f B g C A  B  C

f ⊗ g :  C g D A f B  C  C g D  D A  C  D  B A  A f B  B C  A  B  D

σ_{A,B} :  B  A A  B  B  A A  B A  B B  A

and similarly for all constants c ∈ {id_{A}, α_{A,B,C}, α_{A,B,C}^{−1}, λ_{A}, λ_{A}^{−1}, σ_{A,B}, η_{A}, ϵ_{A}}:

c :  X c Y  X c Y X c Y

Table 2 The CPM construction in the graphical language

Example 4.21 The category CPM(FdHilb) has as its objects finite dimensional Hilbert spaces, and as its morphisms completely positive maps f : A^{∗} ⊗ A → B^{∗} ⊗ B. It is the same as the full subcategory of simple objects of the category W of [9]. See also Example 5.4 below. We note that the canonical functor F : FdHilb → CPM(FdHilb) is “almost” faithful: indeed, if f, g : A → B are two morphisms of FdHilb, then F (f) = F (g) if and only if there exists a unit scalar ϕ such that f = ϕg. In other words, the functor F identifies those morphisms that differ only by a global change of phase.

5 Biproducts and the CPM construction

5.1 Biproduct completion of a dagger compact closed category

Let C be a category that is enriched over commutative monoids (see Section 2.5). Recall that one can construct the biproduct completion C^{⊕} of C as follows (cf. [7], Exercise VIII.2.6). The objects of C^{⊕} are finite tuples ⟨A_{1}, …, A_{n}⟩ of objects of C, where n ⩾ 0. Morphisms are given by matrices, and composition by matrix multiplication. Then C^{⊕} is a category with biproducts. Further, the singleton functor F (A) = ⟨A⟩ is an embedding C → C^{⊕}.

Recall moreover that if C is compact closed, and if the tensor operation is linear (i.e., f ⊗ (g + g′) = f ⊗ g + f ⊗ g′ and f ⊗ 0 = 0), then C^{⊕} is also compact closed.

The construction of C^{⊕} extends to dagger compact closed categories:

Proposition 5.1 Suppose C is a dagger compact closed category, enriched in commutative monoids as a compact closed category. Further suppose that the dagger functor is linear, i.e., (g + g′)^{†} = g^{†} + g′^{†} and 0^{†} = 0. Then C^{⊕} is a biproduct dagger compact closed category.

Proof. The adjoints of C^{⊕} are defined by matrix transposition and taking the adjoint of each matrix component. □

5.2 The CPM construction with biproducts

Suppose C is a biproduct dagger compact closed category. In general, the category CPM(C) does not have biproducts. However, as the following lemma shows, CPM(C) is monoid-enriched. Therefore, we can construct its biproduct completion CPM(C)^{⊕}.

Lemma 5.2 In a biproduct dagger compact closed category, if f, g : A^{∗} ⊗A → B^{∗} ⊗ B are completely positive, then so are f + g and 0 : A^{∗} ⊗ A → B^{∗} ⊗ B.□

Corollary 5.3 Let C be a biproduct dagger compact closed category. Then CPM(C) is enriched in commutative monoids as a dagger compact closed category. Therefore, its biproduct completion CPM(C)^{⊕} is well-defined. □

We call the construction of CPM(C)^{⊕} from C the CPM construction with biproducts. Note that the canonical functor C → CPM(C)^{⊕} preserves the dagger compact closed structure, but does not preserve the biproducts. The biproducts of CPM(C)^{⊕} do not resemble those of C.

Example 5.4 Applying the CPM construction with biproducts to C = FdHilb, we obtain the category CPM(FdHilb)^{⊕}, which is identical to the category W of [9, Remark 6.9]. Concretely, the objects are finite tuples of finite dimensional Hilbert spaces, and the morphisms are matrices of completely positive operators. Some special objects of the category CPM(FdHilb)^{⊕} are qbit = ⟨ℂ^{2}⟩, the type of quantum bits, and bit = ⟨ℂ, ℂ⟩, the type of classical bits. Of course, we have bit ≅ I⊕I, where I is the tensor unit, and bit ≅ q̸bit. Composite data types can be constructed by means of the operations ⊗ and ⊕.

6 Applications

6.1 Completely positive maps and the interpretation of quantum protocols

In [1], Abramsky and Coecke argue that the flow of classical information within a quantum protocol, such as the classical information that is the outcome of a measurement operation, can be modeled via the biproducts in the category FdHilb of finite dimensional Hilbert spaces.

In FdHilb, the tensor unit I is just the base field ℂ. Abramsky and Coecke define the type of quantum bits as qbit := I ⊕ I = ℂ^{2}. Initialization base : I ⊕ I → qbit and destructive measurement meas : qbit → I ⊕ I are both modeled as isomorphisms; in fact as the identity function. It follows that the composition

qbit ⟶^{meas} I ⊕ I ⟶^{base} qbit  (8)

is equal to the identity map. This clearly contradicts physical reality, where the outcome of such an experiment would actually be a mixed state. Abramsky and Coecke circumvent this problem by not allowing compositions such as the above to occur in the interpretation of any quantum experiment.

On the other hand, in the category CPM(FdHilb)^{⊕} (see Example 5.4), the initialization and measurement functions base and meas are not isomorphisms, but are given, relative to the canonical bases of qbit^{∗} ⊗ qbit and I ⊕ I, by

meas ( \begin{matrix}a & b \\ c & d \end{matrix} ) = (a, d), base(a, d) = ( \begin{matrix}a & 0 \\ 0 & d \end{matrix} ) .

We see that the composition is not the identity, but correctly maps a pure state (a rank 1 positive matrix) to a possibly mixed state (a positive matrix of rank ⩾ 2).

Recall that the category FdHilb is “embedded” inside CPM(FdHilb)^{⊕} (up to a collapse of global phases, see Example 4.21). Therefore, any construction that can be done in FdHilb can also be done within CPM(FdHilb)^{⊕}. In fact, since the embedding F : FdHilb → CPM(FdHilb)^{⊕} is structure preserving, any such constructions will stay entirely within FdHilb as long as the biproducts are not used.

However, as we have already seen, the biproducts in FdHilb do not at all resemble those of CPM(FdHilb)^{⊕}. In FdHilb, we have I ⊕ I = qbit, whereas in CPM(FdHilb)^{⊕}, we have I ⊕ I = bit. Informally speaking, the scalars of FdHilb correspond to amplitudes, whereas the scalars of CPM(FdHilb)^{⊕} correspond to probabilities. Since the functor F : FdHilb → CPM(FdHilb)^{⊕} maps a linear function f to the completely positive map f_{∗} ⊗ f, it actually carries out the “squaring” operation that maps amplitudes to probabilities. Thus, the fact that the CPM construction does not preserve biproducts can be seen as a categorification of the inequality |x + y|^{2} ≠ |x|^{2} + |y|^{2}.

Note that the axiomatic framework of Abramsky and Coecke, while originally developed to describe the category FdHilb, applies almost without change to the category CPM(FdHilb)^{⊕}. Thus, it is trivial to adapt e.g. the interpretation of quantum protocols to this new setting. Only one small change is necessary: one should drop the condition of [1, Sec. 8.2] that the canonical map I ⊕ I → qbit is an isomorphism, and should instead require only a retraction:

I ⊕ I ^{base}_{id} qbit_{meas} I ⊕ I

6.2 Dagger categories and predicate transformer semantics

We briefly discuss another application of dagger categories. As it turns out, the duality embodied by the dagger operation can be rediscovered in a programming language setting as a duality between “denotational semantics” and “weakest precondition semantics”.

In [9], I described a simple first-order quantum programming language QPL. This language was given a straightforward denotational semantics in the category CPM(FdHilb)^{⊕} as follows. The types of the language are built from basic types I, qbit, and bit via the type constructors ⊗ and ⊕, and they are interpreted as objects of the category CPM(FdHilb)^{⊕} as in Example 5.4 above. Further, each program P : A → B is interpreted as a morphism in the category CPM(FdHilb)^{⊕}:

[[P]] : A → B  (9)

D’Hondt and Panangaden gave a weakest precondition semantics for the same programming language, using the idea of predicate transformers [4]. In summary, types are again interpreted as objects in CPM(FdHilb)^{⊕}, just like in the denotational semantics. D’Hondt and Panangaden define a predicate at a type A to be an element of the object A (more precisely, a morphism I → A). They then associate to each program P : A → B a predicate transformer wp(P), which is a function that associates to each predicate at type B a predicate at type A called its “weakest precondition”. Thus, we have:

wp(P) : B → A  (10)

Both interpretations [[P]] and wp(P) are defined by induction on the program P, starting from simple base cases, and using the categorical structure. It is interesting to note that neither of these interpretations explicitly relies on the dagger structure of the category CPM(FdHilb)^{⊕}. However, we find that the dagger structure plays a crucial role in relating the two semantics: indeed, they are adjoint to each other in the sense that

wp(P) = [[P]]^{†}

for all programs P. Since both semantics are compositional, one can prove this by induction on P. It immediately follows that the two semantics are equivalent, i.e., for two programs P, Q : A → B, we have [[P]] = [[Q]] if and only if wp(P) = wp(Q).

Remark 6.1 Strictly speaking, the target of the original interpretation [[P]] of [9] is not the category CPM(FdHilb)^{⊕} of completely positive maps, but its subcategory Q of superoperators. Superoperators are completely positive maps satisfying an additional trace condition. Similarly, the target of the original interpretation wp(P) of [4] is not CPM(FdHilb)^{⊕}, but rather a certain subcategory of healthy maps. As expected, superoperators are precisely the †-duals of healthy maps.

7 Conclusion

We have shown that Abramsky and Coecke’s framework of dagger (“strongly”) compact closed categories applies to the world of completely positive maps. With the CPM construction, we have provided a general way of constructing a category of completely positive maps out of any dagger compact closed category. This construction corresponds to the passage from “amplitudes” to “probabilities”, or from “purely quantum” to “mixed quantum and classical” systems. The fact that dagger compact closed categories provide a single axiomatic basis for both these settings is remarkable, and shows that dagger compact closed categories are indeed a flexible and unifying framework for the semantics of quantum programming languages and protocols.

References

[1] Abramsky, S. and B. Coecke, A categorical semantics of quantum protocols, in: Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science, LICS 2004, IEEE Computer Society Press, 2004, pp. 415–425.

[2] Abramsky, S. and R. Duncan, A categorical quantum logic, in: Proceedings of the 2nd International Workshop on Quantum Programming Languages, TUCS General Publication No 33, Turku Centre for Computer Science, 2004, pp. 3–20.

[3] Choi, M.-D., Completely positive linear maps on complex matrices, Linear Algebra and its Applications 10 (1975), pp. 285–290.

[4] D’Hondt, E. and P. Panangaden, Quantum weakest preconditions, in: Proceedings of the 2nd International Workshop on Quantum Programming Languages, TUCS General Publication No 33, Turku Centre for Computer Science, 2004, pp. 75–90.

[5] Joyal, A. and R. Street, The geometry of tensor calculus I, Advances in Mathematics 88 (1991), pp. 55–112.

[6] Kelly, G. M. and M. L. Laplaza, Coherence for compact closed categories, Journal of Pure and Applied Algebra 19 (1980), pp. 193–213.

[7] Mac Lane, S., “Categories for the Working Mathematician,” Springer Graduate Texts in Mathematics 5, 1971.

[8] Penrose, R., Applications of negative dimensional tensors, in: D. J. A. Welsh, editor, Combinatorial Mathematics and its Applications, Academic Press, New York, 1971 pp. 221–244.

[9] Selinger, P., Towards a quantum programming language, Mathematical Structures in Computer Science 14 (2004), pp. 527–586.

[10] Selinger, P., Towards a semantics for higher-order quantum computation, in: Proceedings of the 2nd International Workshop on Quantum Programming Languages, TUCS General Publication No 33, Turku Centre for Computer Science, 2004, pp. 127–143.