String diagrams are a formal graphical language for representing morphisms in monoidal categories, or more generally 2-cells in
2-categories
In category theory, a strict 2-category is a category with "morphisms between morphisms", that is, where each hom-set itself carries the structure of a category. It can be formally defined as a category enriched over Cat (the category of catego ...
. They are a prominent tool in
applied category theory
Applied category theory is an Discipline (academia), academic discipline in which methods from category theory are used to study other fields including but not limited to computer science, physics (in particular Categorical quantum mechanics, quant ...
Günter Hotz
Günter Hotz (born 16 November 1931) is a German pioneer of computer science. His work includes formal languages, digital circuits
and computational complexity theory. In 1987, he received the Gottfried Wilhelm Leibniz Prize of the Deutsche Forschu ...
gave the first mathematical definition of string diagrams in order to formalise
electronic circuit
An electronic circuit is composed of individual electronic components, such as resistors, transistors, capacitors, inductors and diodes, connected by conductive wires or traces through which electric current can flow. It is a type of electrical ...
s, but the article remained confidential because of the absence of an English translation. The invention of string diagrams is usually credited to
Roger Penrose
Sir Roger Penrose (born 8 August 1931) is an English mathematician, mathematical physicist, philosopher of science and Nobel Laureate in Physics. He is Emeritus Rouse Ball Professor of Mathematics in the University of Oxford, an emeritus fello ...
Ross Street
Ross Howard Street (born 29 September 1945, Sydney) is an Australian mathematician specialising in category theory.LaTeX and PGF/TikZ made the publication of string diagrams more wide-spread.
The existential graphs and diagrammatic reasoning of Charles Sanders Peirce are arguably the oldest form of string diagrams, they are interpreted in the monoidal category of finite sets and
relations
Relation or relations may refer to:
General uses
*International relations, the study of interconnection of politics, economics, and law on a global level
*Interpersonal relationship, association or acquaintance between two or more people
*Public ...
with the
Cartesian product
In mathematics, specifically set theory, the Cartesian product of two sets ''A'' and ''B'', denoted ''A''×''B'', is the set of all ordered pairs where ''a'' is in ''A'' and ''b'' is in ''B''. In terms of set-builder notation, that is
: A\ti ...
. The lines of identity of Peirce's existential graphs can be axiomatised as a Frobenius algebra, the cuts are unary operators on homsets that axiomatise
logical negation
In logic, negation, also called the logical complement, is an operation that takes a proposition P to another proposition "not P", written \neg P, \mathord P or \overline. It is interpreted intuitively as being true when P is false, and false ...
complete
Complete may refer to:
Logic
* Completeness (logic)
* Completeness of a theory, the property of a theory that every formula in the theory's language or its negation is provable
Mathematics
* The completeness of the real numbers, which implies t ...
String diagrams are made of boxes , which represent
processes
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
, with a list of wires coming in at the top and at the bottom, which represent the input and output
systems
A system is a group of interacting or interrelated elements that act according to a set of rules to form a unified whole. A system, surrounded and influenced by its environment, is described by its boundaries, structure and purpose and express ...
being processed by the box . Starting from a collection of wires and boxes, called a signature, one may generate the set of all string diagrams by induction:
* each box is a string diagram,
* for each list of wires , the identity is a string diagram representing the process which does nothing to its input system, it is drawn as a bunch of parallel wires,
* for each pair of string diagrams and , their tensor is a string diagram representing the parallel composition of processes, it is drawn as the horizontal concatenation of the two diagrams,
* for each pair of string diagrams and , their composition is a string diagram representing the sequential composition of processes, it is drawn as the vertical concatenation of the two diagrams.
Definition
Algebraic
Let the Kleene star denote the free monoid, i.e. the set of lists with elements in a set .
A monoidal signature is given by:
* a set of generating objects, the lists of generating objects in are also called types,
* a set of generating arrows, also called boxes,
* a pair of functions which assign a domain and codomain to each box, i.e. the input and output types.
A morphism of monoidal signature is a pair of functions and which is compatible with the domain and codomain, i.e. such that and . Thus we get the category of monoidal signatures and their morphisms.
There is a forgetful functor which sends a monoidal category to its underlying signature and a
monoidal functor
In category theory, monoidal functors are functors between monoidal categories which preserve the monoidal structure. More specifically, a monoidal functor between two monoidal categories consists of a functor between the categories, along with two ...
to its underlying morphism of signatures, i.e. it forgets the identity, composition and tensor. The free functor , i.e. the left adjoint to the forgetful functor, sends a monoidal signature to the free monoidal category it generates.
String diagrams (with generators from ) are arrows in the free monoidal category . The interpretation in a monoidal category is a defined by a monoidal functor , which by freeness is uniquely determined by a morphism of monoidal signatures . Intuitively, once the image of generating objects and arrows are given, the image of every diagram they generate is fixed.
Geometric
A
topological graph
In mathematics, a topological graph is a representation of a graph in the plane, where the ''vertices'' of the graph are represented by distinct points and the ''edges'' by Jordan arcs (connected pieces of ''Jordan curves'') joining the corres ...
closed
Closed may refer to:
Mathematics
* Closure (mathematics), a set, along with operations, for which applying those operations on members always results in a member of the set
* Closed set, a set which contains all its limit points
* Closed interval, ...
discrete subset
]
In mathematics, a point ''x'' is called an isolated point of a subset ''S'' (in a topological space ''X'') if ''x'' is an element of ''S'' and there exists a neighborhood of ''x'' which does not contain any other points of ''S''. This is equiv ...
of nodes and a set of Connected component (topology), connected components called edges, each homeomorphic to an open interval with boundary in and such that .
A plane graph between two real numbers with is a finite topological graph embedded in such that every point is also a node and belongs to the closure of exactly one edge in . Such points are called outer nodes, they define the domain and codomain of the string diagram, i.e. the list of edges that are connected to the top and bottom boundary. The other nodes are called inner nodes.
A plane graph is progressive, also called recumbent, when the vertical projection is injective for every edge . Intuitively, the edges in a progressive plane graph go from top to bottom without bending backward. In that case, each edge can be given a top-to-bottom orientation with designated nodes as source and target. One can then define the domain and codomain of each inner node , given by the list of edges that have source and target.
A plane graph is generic when the vertical projection is injective, i.e. no two inner nodes are at the same height. In that case, one can define a list of the inner nodes ordered from top to bottom.
A progressive plane graph is labeled by a monoidal signature if it comes equipped with a pair of functions from edges to generating objects and from inner nodes to generating arrows, in a way compatible with domain and codomain.
A deformation of plane graphs is a continuous map such that
* the image of defines a plane graph for all ,
* for all , if is an inner node for some it is inner for all .
A deformation is progressive (generic, labeled) if is progressive (generic, labeled) for all . Deformations induce an equivalence relation with if and only if there is some with and . String diagrams are equivalence classes of labeled progressive plane graphs. Indeed, one can define:
* the identity diagram as a set of parallel edges labeled by some type ,
* the composition of two diagrams as their vertical concatenation with the codomain of the first identified with the domain of the second,
* the tensor of two diagrams as their horizontal concatenation.
Combinatorial
While the geometric definition makes explicit the link between
category theory
Category theory is a general theory of mathematical structures and their relations that was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Nowadays, cate ...
and low-dimensional topology, a combinatorial definition is necessary to formalise string diagrams in
computer algebra systems
A computer algebra system (CAS) or symbolic algebra system (SAS) is any mathematical software with the ability to manipulate mathematical expressions in a way similar to the traditional manual computations of mathematicians and scientists. The de ...
and use them to define computational problems. One such definition is to define string diagrams as equivalence classes of well-typed formulae generated by the signature, identity, composition and tensor. In practice, it is more convenient to encode string diagrams as formulae in generic form, which are in bijection with the labeled generic progressive plane graphs defined above.
Fix a monoidal signature . A layer is defined as a triple of a type on the left, a box in the middle and a type on the right. Layers have a domain and codomain defined in the obvious way. This forms a
directed multigraph
In mathematics, and more specifically in graph theory, a multigraph is a graph which is permitted to have multiple edges (also called ''parallel edges''), that is, edges that have the same end nodes. Thus two vertices may be connected by mor ...
, also known as a quiver, with the types as vertices and the layers as edges. A string diagram is encoded as a path in this multigraph, i.e. it is given by:
* a domain as starting point
* a length ,
* a list of
such that and for all . In fact, the explicit list of layers is redundant, it is enough to specify the length of the type to the left of each layer, known as the offset. The whiskering of a diagram by a type is defined as the concatenation to the right of each layer and symmetrically for the whiskering on the left. One can then define:
* the identity diagram with and ,
* the composition of two diagrams as the concatenation of their list of layers,
* the tensor of two diagrams as the composition of whiskerings .
Note that because the diagram is in generic form (i.e. each layer contains exactly one box) the definition of tensor is necessarily biased: the diagram on the left hand-side comes above the one on the right-hand side. One could have chosen the opposite definition .
Two diagrams are equal (up to the axioms of monoidal categories) whenever they are in the same equivalence class of the
congruence relation
In abstract algebra, a congruence relation (or simply congruence) is an equivalence relation on an algebraic structure (such as a group, ring, or vector space) that is compatible with the structure in the sense that algebraic operations done wi ...
generated by the interchanger:That is, if the boxes in two consecutive layers are not connected then their order can be swapped. Intuitively, if there is no communication between two parallel processes then the order in which they happen is irrelevant.
The word problem for free monoidal categories, i.e. deciding whether two given diagrams are equal, can be solved in
polynomial time
In computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations performed by ...
. The interchanger is a confluentrewriting system on the subset of boundary connected diagrams, i.e. whenever the plane graphs have no more than one connected component which is not connected to the domain or codomain and the
Eckmann–Hilton argument
In mathematics, the Eckmann–Hilton argument (or Eckmann–Hilton principle or Eckmann–Hilton theorem) is an argument about two unital magma structures on a Set (mathematics), set where one is a homomorphism for the other. Given this, the stru ...
does not apply.
Extension to 2-categories
The idea is to represent structures of dimension ''d'' by structures of dimension ''2-d'', using Poincaré duality. Thus,
* an object is represented by a portion of plane,
* a 1-cell is represented by a vertical segment—called a ''string''—separating the plane in two (the right part corresponding to ''A'' and the left one to ''B''),
* a 2-cell is represented by an intersection of strings (the strings corresponding to ''f'' above the link, the strings corresponding to ''g'' below the link).
The parallel composition of 2-cells corresponds to the horizontal juxtaposition of diagrams and the sequential composition to the vertical juxtaposition of diagrams.
A monoidal category is equivalent to a 2-category with a single 0-cell. Intuitively, going from monoidal categories to 2-categories amounts to adding colours to the background of string diagrams.
Examples
The snake equation
Consider an
adjunction
In mathematics, the term ''adjoint'' applies in several situations. Several of these share a similar formalism: if ''A'' is adjoint to ''B'', then there is typically some formula of the type
:(''Ax'', ''y'') = (''x'', ''By'').
Specifically, adjoin ...
between two categories and where is left adjoint of and the natural transformations and are respectively the unit and the counit. The string diagrams corresponding to these natural transformations are:
The string corresponding to the identity functor is drawn as a dotted line and can be omitted.
The definition of an adjunction requires the following equalities:
:
The first one is depicted as
A monoidal category where every object has a left and right adjoint is called a rigid category. String diagrams for rigid categories can be defined as non-progressive plane graphs, i.e. the edges can bend backward.
In the context of categorical quantum mechanics, this is known as the snake equation.
The category of
Hilbert space
In mathematics, Hilbert spaces (named after David Hilbert) allow generalizing the methods of linear algebra and calculus from (finite-dimensional) Euclidean vector spaces to spaces that may be infinite-dimensional. Hilbert spaces arise natural ...
s is rigid, this fact underlies the proof of correctness for the quantum teleportation protocol. The unit and counit of the adjunction are an abstraction of the
Bell state
The Bell states or EPR pairs are specific quantum states of two qubits that represent the simplest (and maximal) examples of quantum entanglement; conceptually, they fall under the study of quantum information science. The Bell states are a fo ...
and the
Bell measurement
The Bell states or EPR pairs are specific quantum states of two qubits that represent the simplest (and maximal) examples of quantum entanglement; conceptually, they fall under the study of quantum information science. The Bell states are a form ...
respectively. If Alice and Bob share two qubits Y and Z in an entangled state and Alice performs a ( post-selected) entangled measurement between Y and another qubit X, then this qubit X will be teleported from Alice to Bob: quantum teleportation is an identity morphism.The same equation appears in the definition of pregroup grammars where it captures the notion of information flow in natural language semantics. This observation has led to the development of the DisCoCat framework and
quantum natural language processing
Quantum natural language processing (QNLP) is the application of quantum computing to natural language processing (NLP). It computes word embeddings as parameterised quantum circuits that can solve NLP tasks faster than any classical computer. It ...
.
Hierarchy of graphical languages
Many extensions of string diagrams have been introduced to represent arrows in monoidal categories with extra structure, forming a hierarchy of graphical languages which is classified in Selinger's ''Survey of graphical languages for monoidal categories.''
* Braided monoidal categories with 3-dimensional diagrams, a generalisation of braid groups.
* Symmetric monoidal categories with 4-dimensional diagrams where edges can cross, a generalisation of the symmetric group.
* Ribbon categories with 3-dimensional diagrams where the edges are undirected, a generalisation of knot diagrams.
* Compact closed categories with 4-dimensional diagrams where the edges are undirected, a generalisation of Penrose graphical notation.
*
Dagger categories
In category theory, a branch of mathematics, a dagger category (also called involutive category or category with involution) is a category equipped with a certain structure called ''dagger'' or ''involution''. The name dagger category was coined b ...
where every diagram has a horizontal reflection.
List of applications
String diagrams have been used to formalise the following objects of study.
* Concurrency theory
*
Artificial neural networks
Artificial neural networks (ANNs), usually simply called neural networks (NNs) or neural nets, are computing systems inspired by the biological neural networks that constitute animal brains.
An ANN is based on a collection of connected unit ...
*
Game theory
Game theory is the study of mathematical models of strategic interactions among rational agents. Myerson, Roger B. (1991). ''Game Theory: Analysis of Conflict,'' Harvard University Press, p.&nbs1 Chapter-preview links, ppvii–xi It has appli ...
quantum error correction
Quantum error correction (QEC) is used in quantum computing to protect quantum information from errors due to decoherence and other quantum noise. Quantum error correction is theorised as essential to achieve fault tolerant quantum computing that ...
, see
ZX-calculus
The ZX-calculus is a rigorous graphical language for reasoning about linear maps between qubits, which are represented as string diagrams called ''ZX-diagrams''. A ZX-diagram consists of a set of generators called ''spiders'' that represent speci ...
*
Natural language processing
Natural language processing (NLP) is an interdisciplinary subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to pro ...
Quantum natural language processing
Quantum natural language processing (QNLP) is the application of quantum computing to natural language processing (NLP). It computes word embeddings as parameterised quantum circuits that can solve NLP tasks faster than any classical computer. It ...
See also
*
Proof net In proof theory, proof nets are a geometrical method of representing proofs that
eliminates two forms of ''bureaucracy'' that differentiate proofs: (A) irrelevant syntactical features of regular proof calculi, and (B) the order of rules applied in ...
s, a generalisation of string diagrams used to denote proofs in
linear logic
Linear logic is a substructural logic proposed by Jean-Yves Girard as a refinement of classical and intuitionistic logic, joining the dualities of the former with many of the constructive properties of the latter. Although the logic has also be ...
*
Existential graphs
An existential graph is a type of diagrammatic or visual notation for logical expressions, proposed by Charles Sanders Peirce, who wrote on graphical logic as early as 1882,Peirce, C. S., " n Junctures and Fractures in Logic (editors' title for ...