A dagger category is a Category with an involutive, identity-on-objects functor : every has an adjoint with , , . A morphism is unitary if . The preorder version is a Dagger Preorder (an equivalence relation).
Sources: 7 Sketches §1.2.3 (Definition 1.71, Example 1.72), §4.5 (compact closed categories in quantum theory), §5.2 (Category of Relations); DaoFP §5.2 (“Duality”); Fritz arXiv:1908.07021 (notes) Remark 13.10; Cockett et al. arXiv:1910.07065 (notes) Definition 18, Theorems 41–42.
- Examples: with the converse relation (Category of Relations, Feasibility Relation); ; finite-dimensional Hilbert spaces with the adjoint (conjugate transpose) — the setting of categorical quantum mechanics, a dagger Compact Closed Category; any Groupoid with ; the Prop of signal flow graphs has a dagger reversing all wires.
- A dagger Frobenius Monoid with , is a dagger Frobenius algebra; in a Hypergraph Category such as the dagger turns a cospan around.
Daggers in learning and inference
- Bayesian inversion is a dagger. On the category of probability spaces and measure-preserving kernels, taken modulo almost-sure equality, sending a kernel to its Bayesian Inversion is a symmetric monoidal dagger: and (Fritz, Remark 13.10; Clerc, Danos, Dahlqvist & Garnier 2017).
- Reverse mode is forward mode plus a dagger. A Cartesian Differential Category has reverse derivatives exactly when its linear maps carry a (contextual) dagger — the transpose of the Jacobian (Cockett et al., Theorems 41–42; Reverse Derivative Category).
Docs: FinRelations
using Catlab.CategoricalAlgebra.FinRelations
R = FinRelation((x, y) -> x < y, 3, 3)
Rdag = FinRelation((y, x) -> R(x, y), 3, 3) # the converse relation R†
[Rdag(x, y) for x in 1:3, y in 1:3] # transpose of R's matriximport Mathlib
-- Mathlib has no dagger-category class; the adjoint of a linear map on inner product spaces is the key example
#check @LinearMap.adjoint
#check @ContinuousLinearMap.adjoint-- finite relations with their converse form a dagger category
type Rel a b = [(a, b)]
dagger :: Rel a b -> Rel b a
dagger = map (\(a, b) -> (b, a))