A Diagrammatic Axiomatisation of Behavioural Distance of Nondeterministic Processes
The project
Showcase
Wojciech Różowski, Robin Piedeleu, Alexandra Silva and Fabio Zanasi
ICALP 2026 (LIPIcs, vol. 374)DOI 10.4230/LIPIcs.ICALP.2026.190Theoretical computer science: Automata, logic, semantics and theory of programming
- lipics-v2021
- eucal
- xy
- interval
- mathpartir
Compare with TeX's PDFOriginalSource
CC BY 4.0, published at drops.dagstuhl.de. “A Diagrammatic Axiomatisation of Behavioural Distance of Nondeterministic Processes” by Wojciech Różowski, Robin Piedeleu, Alexandra Silva, Fabio Zanasi, arXiv:2604.27268v1 (published in ICALP 2026, LIPIcs vol. 374, 10.4230/LIPIcs.ICALP.2026.190). Licensed under CC BY 4.0. Typeset here by reflowtex from the authors' source, with a recorded patch.
Changed to build here
Removes \usepackage[all,cmtip,2cell]{xy}, which no file of the paper uses (no \xymatrix, \xy or \ar[...]): with these options xy loads xypdf, which stops under LuaTeX. Also: the paper was written for pdfLaTeX: UTF-8 text in an 8-bit font encoding; characters replaced by LaTeX's own definitions (t1enc.dfu, what pdfLaTeX's inputenc gives them), braced where the definition is a command. Under LuaLaTeX these characters reached the 8-bit font unchanged and were lost ("Missing character" in the log). Replaced outside comments, verbatim, listings and URLs: ż (U+017C) -> \.z: 4 in the source (55 missing-character lines in the log before) – (U+2013) -> \textendash: 4 in the source (15 missing-character lines in the log before) ’ (U+2019) -> \textquoteright: 1 in the source (3 missing-character lines in the log before) After the change the plain LuaLaTeX build reports none of these characters missing, and its page count is unchanged. The source is CC BY 4.0, which allows modified copies with the change indicated: this file is that indication.
A Diagrammatic Axiomatisation of Behavioural Distance of Nondeterministic Processes
Wojciech Różowski
Lean FRO, United Kingdom
Robin Piedeleu
Department of Computer Science, University College London, United Kingdom
Alexandra Silva
Department of Computer Science, Cornell University, United States of America
Fabio Zanasi
Department of Computer Science, University College London, United Kingdom
Abstract
Behavioural distances provide a quantitative approach to comparing the states of transition systems, moving beyond traditional Boolean notions of equivalence. In this paper, we develop a sound and complete axiomatisation of behavioural distance for nondeterministic processes using Milner’s charts, a model that generalises finite-state automata by incorporating variable outputs. Charts provide a compelling setting for studying behavioural distances because they shift the focus from language equivalence to bisimilarity. Their axiomatic study lays the groundwork for quantitative analysis of more expressive models, such as weighted transition systems.
To formalise this approach, we adopt string diagrams as our syntax of choice. String diagrams closely mirror the graphical structure of charts, while providing a rigorous formalism that supports inductive reasoning and compositional semantics. Unlike traditional algebraic syntaxes, which require additional mechanisms such as binders and substitution, string diagrams offer a variable-free representation where recursion naturally decomposes into simpler components. This makes them well-suited for reasoning about behavioural distances and aligns with broader efforts to axiomatise automata-theoretic equivalences through a unified diagrammatic framework.
2012 ACM Subject Classification Theory of computation
Keywords and phrases behavioural distance, quantitative equational reasoning, string diagrams
Funding This work was partially supported by ERC grant Autoprobe (no. 101002697; Różowski, Piedeleu and Silva) and ARIA Safeguarded AI programme (Zanasi).
Acknowledgements The authors are grateful to Filippo Bonchi, Florence Clerc, Clemens Kupke, and Ralph Sarkis for valuable discussions that refined the paper’s presentation.
1 Introduction
In Theoretical Computer Science, it is customary to model computations as transition systems. To facilitate formal analysis of such models, considerable effort has been devoted to developing expressive syntaxes and compositional reasoning techniques. Notable examples include Kleene algebra [29] and its extensions [20, 2, 53], as well as a vast body of work on process calculi [34, 8, 52]. A particularly important feature of such approaches is the presence of an axiomatisation—a set of equations that relate syntactic terms that represent semantically equivalent behaviours. When an axiomatisation is available, one may reason about model behaviour via syntactic manipulation of terms, which is particularly well-suited for implementation and automation.
In many contexts, especially when dealing with probabilistic or quantitative models, focussing on exact equivalence of behaviours is too restrictive. Instead, it is often more meaningful to measure how far apart the behaviours of two terms are. This has motivated the development of behavioural distances, which endow the state-spaces of transition systems with (pseudo)metric structures quantifying the dissimilarity of states [51, 16, 7], and quantitative equational theories [32, 35], which replace equational judgements s = t between terms with quantitative ones of the form s =ε t capturing “the distance between s and t is at most ε”.
Behavioural distances have mostly been studied for probabilistic systems [16, 51]. More recently, there has been growing interest in understanding distances in a general categorical framework and how this would yield coarser notions of equivalence for a variety of systems [7]. The instantiations of that framework, and in particular axiomatisations of distances, are largely unexplored, with the exception of one for deterministic automata [41].
In this paper, we take a step further and investigate axiomatisations of behavioural distance for a nondeterministic model of computation, known as charts [34]. Originally introduced by Milner, charts extend finite-state nondeterministic automata (NFA) by replacing the notion of acceptance with variable outputs. Intuitively, the distance between two charts can be quantified by, roughly, the number of steps after which their behaviours disagree—i.e. are no longer bisimilar. This seemingly small generalisation from deterministic finite automata provides a range of challenges, stemming from the fact that the presence of non-determinism moves the semantics from language to bisimilarity, while at the same time representing a crucial step towards weighted transition systems [30], where the general theory of behavioral distances and axiomatisations thereof is relatively underexplored.
The central contribution of this paper is an inference system for reasoning about behavioural distances of behaviours of Milner’s charts. We demonstrate its soundness (Theorem 16) and completeness (Theorem 31). On the way, we gather several contributions of independent interest. First, we instantiate the abstract framework of behavioural distances in the concrete case of charts. We organise such behaviours as a symmetric monoidal category, in which they may be composed sequentially and in parallel. We do so relying on rich structures associated with charts, such as Conway Theories [9, 55]. Second, as one of the steps in the soundness argument, we give a concrete characterisation of behavioural distance between charts via Hennessy and Milner’s stratification of bisimilarity [23]. Finally, the completeness argument makes use of tools from fixpoint theory to simplify the calculation of behavioural distance to the point it can be mimicked via syntactic manipulation.
The syntax and equations of our complete axiomatic theory are given in terms of string diagrams, the two-dimensional language of monoidal categories [44, 40]. The pictorial representation of string diagrams provides an intuitive understanding of how information flows and is exchanged between components within a system. For this reason, they have been increasingly popular as a formal language for computations and processes in areas such as quantum theory [13], concurrency [11], probabilistic programming [38], and digital circuits [17].
Figure 1: Two charts at distance 14 and their corresponding representations as string diagrams. In Milner’s syntax, the chart on the left can be presented as a.(a.0 + b.µv1.a.v1) + b.µv1.a.v1, while the chart on the right corresponds to µv2.(a.v2 + b.µv1.a.a.v1).
There are several reasons to favour string diagrams as our syntax of choice. First, they closely resemble the usual graphical representation of the transition structure of charts, while constituting a formal syntax that supports inductive reasoning and to which we can assign semantics formally. Moreover, as Milner observed [34], the standard algebraic syntax of regular expressions is not expressive enough to capture all chart behaviour [19]. His solution introduced a more complex syntax with binders and names, later studied in the process algebra community for various models, including probabilistic [48] and quantitative [25] ones. In contrast, string diagrams offer a variable-free approach, eliminating the need to define substitution and recursion as a primitive operation (the latter is decomposed into simpler components). Finally, using string diagrams aligns our work with a broader research programme aimed at axiomatising various notions of equivalence in automata theory through a unified diagrammatic syntax [39, 3].
Outline. In Section 2, we introduce charts, as well as their associated notions of behavioural equivalence and distances. Then, in Section 3, we introduce the syntax of our diagrammatic calculus, for which we construct the semantics in Section 4. Next, in Section 5 we present a (quantitative) equational inference system for reasoning about distances of the denotations of the terms of our calculus; we also prove its soundness and study one example in more detail. Section 6 contains the main technical result of the paper, namely completeness for the proposed behavioural distance between charts. We wrap up in Section 7 where we review related literature, and sketch directions for future work.
2 Preliminaries
In this section, we briefly review Milner’s charts [34], whose behaviours are the central semantic object of this paper. Then, we instantiate the abstract framework of coalgebraic behavioural metrics [7] to the concrete case of charts.
(Pre)charts and their algebraic operations. Fix a set V = {v1, v2, . . . } of variables and Σ of letters respectively. A prechart is a triple (Q, E, D), where Q is a set of states, D ⊆ Q × Σ × Q a finite labelled transition relation and E ⊆ Q × V is a finite output relation. Precharts can be thought as a generalisation of nondeterministic automata, where instead of acceptance, we deal with the notion of outputs. Given a q ∈ Q, we will often write D(q) = {(a, q′) | (q, a, q′) ∈ D} and E(q) = {v | (q, v) ∈ E}. Moreover, when D and E are clear from the context, we will write q a − → q′ ⇐⇒ (q, a, q′) ∈ D and q ▷ v ⇐⇒ (q, v) ∈ E. A chart C is a quadruple (Q, s, D, E), where (Q, D, E) is a prechart and s ∈ Q is a distinguished start node. We call a chart finite if Q is finite. There are several operations on charts that will be of interest in this paper.
Empty chart. We set 0 := ({s}, s, ∅, ∅).
Variable. Given v ∈ V, we define v := ({s}, s, ∅, {(s, v)}).
Prefix. Let C = (Q, s, D, E) be a chart and a ∈ Σ. We define a.C := (Q ∪ {s′}, s′, D ∪ {(s′, a, s)}, E), where s′ / ∈ Q.
Nondeterministic choice. Let Ci = (Qi, si, Di, Ei), i ∈ {1, 2}. For simplicity of presentation, we assume Q1, Q2 to be disjoint and s / ∈ Q1 ∪ Q2. We define
C1 + C2 := (Q1 ∪ Q2 ∪ {s}, s, D1 ∪ D2 ∪ D′, E1 ∪ E2 ∪ E′)
where D′ := {s} × (D1(s1) ∪ D2(s2)) and E′ := {s} × (E1(s1) ∪ E2(s2)).
Substitution. Let C = (C1, . . . , Cn) and C be disjoint charts, and let v = (v1, . . . , vn) be distinct variables. We define
C[C/v] = Q ∪ i Qi, {s}, D′ ∪ i Di, E′ ∪ i Ei
where for q ∈ Qi, D′(q) = E′(q) = ∅, while for q ∈ Q, D′(q) = D(q) ∪ i {Di(si) | vi ∈ E(q)} and E′(q) = (E(q) \ v) ∪ i {Ei(si) | vi ∈ E(q)}.
Recursion. If C = (Q, s, D, E), then we define µv.C := (Q, s, D+, E+), where
D+(q) = D(q) ∪ D(s) if v ∈ E(q) D(q) otherwise E+(q) = (E(q) ∪ E(s)) \ {v} if v ∈ E(q) E(q) otherwise
When applied to finite charts, the operations above preserve finiteness. Given a chart C = (Q, s, D, E) we say that a variable v ∈ V is live in C if there exists a path of transitions s a1 − → · · · an − → s′ ▷ v or call it dead otherwise. The canonical notion of (pre)charts having the same observational behaviour is given through the following concept.
▶ Definition 1 (Strong Bisimulation). Let Ci = (Qi, Di, Ei), i ∈ {1, 2} be precharts. A bisimulation between C1 and C2 is a relation R ⊆ Q1 × Q2, such that if (q1, q2) ∈ R, then E(q1) = E(q2), if (q1, q2) ∈ R and q1 a − → q′1, then there exists q′2 ∈ Q2, such that q2 a − → q′2 and (q′1, q′2) ∈ R and symmetrically. If C1 and C2 are charts, we say that they are bisimilar (denoted C1 ∼ C2) if there exists a bisimulation between their underlying precharts that relates their start nodes.
It immediately follows that ∼ is an equivalence relation on the set of finite charts. We call this relation bisimilarity and we will write Ω for the set of all finite charts modulo bisimilarity. We will refer to the elements of this set as regular behaviours. Conveniently, ∼ is a congruence with respect to all operations described above and hence one can unambiguously extend all the mentioned operations to elements of Ω [34, Proposition 3.2]. Let [C1], [C2] ∈ Ω, such that C1 = (Q, s, D, E) and C2 = (Q, s′, D, E). One can make Ω into prechart itself by setting [C1] a − → [C2] ⇐⇒ s a − → C1 s′ and [C1] ▷ v ⇐⇒ s ▷C1 v.
▶ Definition 2 (Prechart homomorphism). Let Ci = (Qi, Di, Ei), i ∈ {1, 2} be precharts. We call a function f : Q1 → Q2 a prechart homomorphism if the graph of f, given by G(f) = {(q, f(q)) | q ∈ Q1} is a bisimulation between C1 and C2.
Fix a prechart C = (Q, D, E). A map taking each state s ∈ Q to the equivalence class [(Q, s, D, E)] in Ω is a homomorphism from C into prechart on Ω. It can be easily observed that bisimulations and homomorphisms preserve the liveness of variables. From now on, we will abuse the notation and omit the quotient brackets when talking about elements of Ω.
Pseudometric spaces. We will formally give the notion of distance between regular behaviours by equipping them with a pseudometric structure, a mild generalisation of metric spaces, where we drop the requirement of points in zero distance having to be strictly equal. This stems from the fact that in precharts we might have two states with identical behaviour (and hence zero distance), which are not strictly equal (but rather bisimilar).
▶ Definition 3. A 1-bounded pseudometric space is a pair (X, dX), where X is a set and dX : X × X → [0, 1] is a function satisfying dX(x, x) = 0 (Reflexivity), dX(x, y) = dX(y, x) (Symmetry) and dX(x, z) ≤ dX(x, y) + dX(y, z) (Transitivity) for all x, y, z ∈ X.
In this paper, all pseudometric spaces are 1-bounded, and hence we will abuse the terminology and simply call them pseudometric spaces. We call a function f : X → Y between pseudometric spaces (X, dX) and (Y, dY) nonexpansive, if dY(f(x), f(y)) ≤ dX(x, y) for all x, y ∈ X. It is called an isometry if it satisfies dY(f(x), f(y)) = dX(x, y). Given two pseudometric spaces (X, dX) and (Y, dY) one can define their product to be (X, dX) × (Y, dY) = (X × Y, dX×Y), where dX×Y((x, y), (x′, y′)) = max{d(x, x′), d(y, y′)} for all x, x′ ∈ X and y, y′ ∈ Y. This can be easily extended to any n-tuple. We define 0-tuples to be given by 1• = ({•}, d•), the unique single point pseudometric space, where d•(•, •) = 0. Given a function of multiple arguments, i.e. X1 → X2 → Y, we will call it nonexpansive, if it is nonexpansive as a function f : (X1, dX1) × (X2, dX2) → (Y, dY). Given a set X, we write DX for the set of all pseudometrics on the set X. This set carries a partial order structure, given by d ⊑ d′ ⇐⇒ ∀x,x′∈X d(x, x′) ≤ d′(x, x′). For any X, (DX, ⊑) is a complete lattice [7, Lemma 3.2], where supremas can be calculated pointwise. The top element of that lattice is given by the discrete pseudometric ⊤ : X × X → [0, 1] such that ⊤(x, y) = 0 if x = y, or ⊤(x, y) = 1 otherwise.
Behavioural distances. We now have all the ingredients to formalise the concept of how much apart two regular behaviours are. Notation wise, we will write Pfin(X) for the set of finite subsets of the set X. Given a prechart (Q, E, D), we can equivalently see it as a pair (Q, β), where β is a combined transition function Q → Pfin(Σ × Q + V) taking each state q ∈ Q, to the set β(q) = D(q) ∪ E(q) of possible successors, that include labelled transitions and variable outputs. Given a pseudometric space defined on a state-space of a prechart, we can lift it to the set of possible transitions through the following construction.
▶ Definition 4 (Transitions lifting). Let (X, d) be a pseudometric space. We write d↑ for the pseudometric on Σ × X + V defined by d↑(m, n) = 12d(x, y) if m = (a, x) and n = (a, y), d↑(m, n) = 0 if m = n or d↑(m, n) = 1 otherwise.
Similarly, we can lift distances over X to distances between elements of Pfin(X).
▶ Definition 5 (Hausdorff lifting). Let (X, d) be a pseudometric space. We can equip Pfin(X) with a distance function H(d)(X, Y) = max{supx∈X infy∈Y d(x, y), supy∈Y infx∈X d(y, x)} making (Pfin(X), H(d)) into a pseudometric.
Given a prechart (Q, β), whose state-space is equipped with a pseudometric dQ, we can define a new pseudometric Φβ(dQ) that calculates the distance between any pair q1, q2 ∈ Q of states, by lifting dQ to the set Pfin(Σ × Q + V) and comparing β(q1) with β(q2), namely Φβ(dQ)(q1, q2) = H d↑Q (β(q1), β(q2)). This is used to define the behavioural distance.
▶ Theorem 6. Let (Q, β) be a prechart. Then, the following properties hold: dQ → Φβ(dQ) is a monotone mapping on the lattice DQ, Φβ has a least fixpoint bdβ, x ∼ y =⇒ bdβ(x, y) = 0 and a homomorphism f : Q → R between precharts (Q, β) and (R, γ) is an isometry between (Q, bdβ) and (R, bdγ).
The theorem above allows one to define a distance between regular behaviours, by calculating the distance in the prechart structure on Ω. We will simply refer to this distance as the behavioural distance and denote it by bd. Since prechart homomorphisms are isometries, given two finite charts C1 and C2, their distance is given by bd([C1], [C2]), the distance between their corresponding regular behaviours. Such distance can be characterised concretely via Hennessy and Milner’s stratification of bisimilarity [23].
▶ Definition 7 (Stratification of bisimilarity). Let Ci = (Qi, Di, Ei) for i ∈ {1, 2} be precharts. We can define a family {∼(n)}n∈N of equivalence relations on Q1 × Q2 given by the following. For all (q1, q2) ∈ Q1 × Q2, we have that q1 ∼(0) q2. Given (q1, q2) ∈ Q1 × Q2, we have that q1 ∼(n+1) q2 if E1(q1) = E2(q2), q1 a − → C1 q′1 implies that there exists q′2 ∈ Q2, such that q2 a − → q′2 and q′1 ∼(n) q′2 and symmetrically.
We can now formally state the correspondence between behavioural distance and stratification of bisimilarity.
▶ Theorem 8. Let Ci = (Qi, si, Di, Ei) for i = {1, 2} be finite charts. We have that bd([C1], [C2]) = 0 if s1 ∼ s2. Otherwise, bd([C1], [C2]) = 2−n, where n ∈ N is the largest such that s1 ∼(n) s2.
3 Monoidal Syntax
We adopt the diagrammatic syntax for NFA that has appeared in a number of previous papers [39, 3]. We refer the reader to Selinger’s classic survey [44], or to Piedeleu and Zanasi’s recent text for a more gentle introduction to the language of string diagrams [40].
This syntax is formalised as a product and permutation category, or prop, a structure which generalises algebraic theories. Formally, a prop is a strict symmetric monoidal category (SMC) whose objects are words over a set of generators and whose monoidal product ⊕ is given by concatenation. More specifically, our syntax is the free prop TS over the signature S = (O, M), given by a set O of generating objects and a set M of generating morphisms g : v → w, with v, w ∈ O∗ (we use ϵ to denote the empty word). Morphisms of TS can be combined in two different ways, using the composition operation (−); (−) : TS(u, v) × TS(v, w) → TS(u, w) or the monoidal product (−) ⊕ (−) : TS(v1, w1) × TS(v2, w2) → TS(v1v2, w1w2). We also have distinguished constants: identities idw : w → w, which are the unit for composition, and symmetries σvw : vw → wv, to reorder the letters of a given object. In summary, morphisms of TS can be described as terms of the (O∗, O∗)-sorted syntax generated from the constants M + {idw : w ∈ O∗} + {σvw : v, w ∈ O∗} using the operations ; and ⊕, quotiented by the axioms of SMCs. However, the terms of this syntax are very cumbersome to work with.
We adopt a more convenient way to represent morphisms of TS, using the graphical notation of string diagrams. In this view, a morphism f : v → w of TS is depicted as a f-labelled box with a v-labelled wire on the left and a w-labelled wire on the right. The operations of composition and monoidal product are represented by connecting two boxes horizontally and juxtaposing two boxes vertically, respectively:
Wires represent identities, the wire crossing represents the symmetry σvw, and the empty diagram the identity idϵ : ϵ → ϵ.
▶ Definition 9. We call Syn the free prop over the signature given by
two generating objects ◀ ("left") and ▶ ("right"), with their identity morphisms depicted respectively as and ;
generating morphisms (a ∈ Σ).
Morphisms of Syn are thus vertical and horizontal composites of the generators above, potentially including wire crossings and identity wires, up to the laws of symmetric monoidal categories—see Section B. The direction of the arrows on the wires denotes the corresponding object: for example, represents an operation of type ▶→▶▶, while has type ◀▶→ ϵ. Note that, when we have n parallel wires of the same type, say ▶, we depict them as a single directed wire labelled by a natural number label, as n. We call inputs the incoming wires of a diagram, and outputs its outgoing wires; formally, the inputs (resp. outputs) of f : v → w are the set of positions of the word v which are ▶ (resp. ◀) and the position of w which are ◀ (resp. ▶).
4 Monoidal Semantics
In order to interpret the string diagrams described in Section 3, we construct an appropriate semantic universe out of regular behaviours. As much as the technical development makes use of category theory, we will keep the description of the formalism high-level. The fine-grained details are relegated to Section C. We will write Vn for the set Vn = {v1, . . . , vn} ⊆ V and Ω(n) for the set of all regular behaviours whose live variables are contained in the set Vn. For any m, n ∈ N, we will write RegBeh(n, m) for the set of n-tuples of elements of Ω(m). There are several operations involving these sets that are of interest:
Identity. For every n ∈ N, we define idn ∈ RegBeh(n, n) as idn = vn = (v1, . . . , vn). When n is clear from the context, we will abuse the notation and simply write v instead.
Sequential composition. Given f ∈ RegBeh(m, n) and g ∈ RegBeh(n, p), we can define their sequential composition f; g ∈ RegBeh(m, p) to be given by (f1[g/v], . . . , fm[g/v]), where v = (v1, . . . , vn). The sequential composition is associative, with identity being a neutral element when composed both on the left and right (see Lemma 56 in the appendix of the full version of the paper).
Initial object. For every n ∈ N, there is a unique element 0n ∈ RegBeh(0, n) given by the empty tuple.
Pairing. Given f ∈ RegBeh(k, m) and g ∈ RegBeh(l, m), we define their pairing ⟨f, g⟩ ∈ RegBeh(k + l, m), by setting ⟨f, g⟩ = (f1, . . . , fk, g1, . . . gl).
Parallel composition. Given f ∈ RegBeh(k, l) and g ∈ RegBeh(m, n), we can define their parallel composition f ⊕ g ∈ RegBeh(k + m, l + n), by setting
f ⊕ g = (f1, . . . , fk, g1[(vl+1, . . . , vl+n)/v], . . . , gm[(vl+1, . . . , vl+n)/v])
Codiagonal. For any n ∈ N, there is a n + n-tuple ∇n ∈ RegBeh(n + n, n) called codiagonal given by ∇n = ⟨idn, idn⟩.
Dagger. For any f ∈ RegBeh(1, p + 1), we can define f† ∈ RegBeh(1, p) to be given by f† = µvp+1.f. Following [55, Remark 3.2], we can inductively extend the dagger to the map taking each f ∈ RegBeh(n, p + n) to f† ∈ RegBeh(n, p).
Categorical structure. We now define a category RegBeh, whose objects are natural numbers and morphisms f : m → n are elements f ∈ RegBeh(m, n). This category has a rich structure that will be useful when defining the semantics of our diagrammatic language.
▶ Theorem 10. The category RegBeh has the following properties:
RegBeh has all finite coproducts.
(RegBeh, ⊕, 0) is a (co-Cartesian) strict symmetric monoidal category.
RegBeh equipped with a dagger is a Conway theory [55].
Each morphism g : p + n → q + n has a trace Trnp,q(g) : p → q defined in terms of (−)†. This equipment makes RegBeh into a traced monoidal category [26].
Pseudometric structure. RegBeh additionally carries a well-behaved pseudometric structure. For all m, n ∈ N each set RegBeh(m, n) can be made into a pseudometric space by equipping it with a distance function, given by dm,n((f1, . . . , fm), (g1, . . . , gm)) = sup1≤i≤m {bd(fi, gi)}. Intuitively, we calculate the distance between m-tuples of regular behaviours, by taking the pointwise behavioural distance of elements of tuples and then taking the maximum. In the corner case, when both tuples are empty, then they are simply at distance zero. This equipment satisfies the following property.
▶ Proposition 11. Equipping each set RegBeh(m, n) of morphisms of RegBeh with a pseudometric defined above makes a sequential composition, pairing, parallel composition, dagger and trace into nonexpansive maps.
▶ Remark 12. Although we do not pursue such a perspective in this paper, a categorically inclined reader may observe that equipping RegBeh with a pseudometric structure yields an enrichment over PMet—the monoidal category of pseudometric spaces with the categorical product as its monoidal product. Since PMet is a concrete category (i.e., it admits a faithful functor to Set), the conditions for enrichment simplify significantly: they reduce to verifying that all the relevant operations (composition, monoidal product, etc.) are nonexpansive on each homset and that the components of the natural transformations that define the monoidal structure are nonexpansive maps, which is exactly what we have shown above. For further details on pseudometric enrichment of monoidal categories and quantitative equational theories, we refer the reader to the recent work of Lobbia et al. [31].
Bidirectional maps and loops. Each morphism f : m → n of RegBeh can be informally thought of as a process that has directionality to it, i.e. it takes m inputs and produces n outputs. Informally speaking, the trace operator provides a global feedback operation. At the same time, the syntax of our diagrammatic language is bidirectional and the notion of feedback is introduced locally by bending the wires. To reconcile these points of view, we rely on the Int construction [26], which takes a traced monoidal category C and completes it into a compact closed category Int(C), a categorical structure with sequential and parallel composition equipped with duals (allowing to swap directionality) and adjoints (allowing to form local loops representing feedback) [27]. Int(C) carries the same information as C, but represents it in an alternative, bidirectional way. We now briefly describe Int(RegBeh) (see Section C.3 for more detail).
The objects of Int(RegBeh) are pairs (m, n) of natural numbers.
A morphism f : (k, l) → (m, n), representing a process with k left inputs, l left outputs, m right outputs and n right inputs is a map f : k + m → l + n in RegBeh, i.e. we group inputs and outputs together. Composition of f : (k, l) → (m, n) and g : (m, n) → (p, q) is defined by forming a trace that resolves the feedback involving m and n.
The parallel composition of f : (m, n) → (p, q) and g : (m′, n′) → (p′, q′) is given by the map f ⊗ g : (m + m′, n + n′) → (p + p′, q + q′) that is defined via parallel composition in RegBeh combined with an appropriate reordering of elements of tuples involved.
A dual of the object (m, n) of Int(RegBeh) is given by (n, m). Intuitively, inputs become swapped with outputs. For each object (m, n) of Int(RegBeh), there is a unit map η(m,n) : (0, 0) → (m + n, m + n) and counit ϵ(m,n) : (m + n, m + n) → (0, 0). These represent the bending of the wires on the right and left respectively. Following [26], one can equip Int(RegBeh) with a trace operator defined in terms of the units and counits.
Int(RegBeh) inherits the pseudometric structure from RegBeh, by setting d(k,l),(m,n) to be given by dk+n,l+n (defined before).
The following theorem intuitively states that on directional processes Int(RegBeh) is exactly the same as RegBeh.
▶ Theorem 13 ([26, Proposition 5.1]). There is a full and faithful traced monoidal functor N : RegBeh → Int(RegBeh) that takes each f : n → m in RegBeh to f : (n, 0) → (m, 0)
Moreover, the pseudometric structure interacts well with the operations of Int(RegBeh).
▶ Proposition 14. The sequential and parallel composition in Int(RegBeh) is nonexpansive. Moreover, the fully faithful functor N : RegBeh → Int(RegBeh) is locally an isometry, i.e. for all f, g : m → n, we have that dm,n(f, g) = d(m,0),(n,0)(N(f), N(g)).
Functorial semantics. We are ready to state the semantics of our diagrammatic language − : Syn → Int(RegBeh) as a symmetric monoidal functor from Syn to Int(RegBeh). Since the syntax is a freely generated prop, in order to interpret arbitrary string diagrams it is enough to just define the interpretation of the generating morphisms of Syn. We have:
= N(v1 + v2) = N(0) = N(()) = N(∇1)
We interpret as nondeterministic choice, as the behaviour of the empty chart, while corresponds to the empty tuple. The generator implements variable substitution: given a pair of processes (t1, t2) with outputs v1 and v2 respectively and composing it with on the right merges the two output variables, replacing v2 with v1 to yield (t1, t2[v1/v2]). For each letter a ∈ Σ of the alphabet, we view as the prefixing operation. Finally, and are interpreted using counit and unit of Int(RegBeh), allowing one to create loops. Such loops correspond to expressions in Milner’s syntax featuring the recursion operator µ.
5 Axiomatisation
Our main aim in this paper is to find a set of (quantitative) equations to reason about semantic distance directly at the level of the diagrams themselves. To do so, we distinguish two different relations on diagrams of the same type:
An equational theory intended to capture (strong) bisimilarity of regular behaviours, allowing us to simplify the diagrams whose distance is being compared.
A quantitative equational theory intended to capture the behavioural distance of Section 4, that is the subject of the completeness theorem (Theorem 31) described in Section 6. Note that this theory contains the equational axioms as rules for distance zero.
Equational theory. Our equational theory is the smallest congruence (w.r.t to vertical and horizontal compositions) that includes the axioms of Fig. 2. In practice, this means that, if we find a sub-diagram that matches one side of an axiom in a larger diagram, we can replace it with the other side of the axiom (the left and right-hand side of any axiom have the same type) [40, Section 2.1].
(A1) = (A2) = (B1) = (B2) = (B3) = (B4) = (B5) = (B6) = (B7) = (B8) = (B9) = (B10) = (B11) = (C1) =
Figure 2: Equational axioms for regular behaviours.
Axioms A1-A2 are those of compact closed categories [27] and allow us to bend and straighten wires at will, only keeping track of their directions. Crucially, they also allow us to manipulate feedback loops; in Milner’s syntax, they are the structural rules that let one rearrange a system of recursive equations without changing its solution.
B1-B3 encode the fact that and form a cocommutative comonoid. These guarantee that nondeterministic choice behaves like a commutative, associative and unital operation in our diagrammatic syntax. B1 corresponds to associativity t1 + (t2 + t3) = (t1 + t2) + t3, B2 to the right unit law t + 0 = t, and B3 to commutativity t1 + t2 = t2 + t1. At the same time, B4-B6 are the dual of the previous three, and make and into a commutative monoid. These guarantee that output wires behave like the variables of our diagrammatic syntax: read in Milner’s notation, B4 states that successive merges associate, so that merging v3 into v2 and then v2 into v1 yields the same result as merging v3 into v2 after v2 has already been merged into v1; B5 states that renaming an empty tuple has no effect; and B6 states that merging is symmetric in the two variables being identified.
B7-B9 make the previous monoid-comonoid pair into a bimonoid expressing how nondeterministic choice and variable-merging interact. Concretely, B7 states that merging two variables and then forming a nondeterministic choice can be expressed as a pair of nondeterministic choices followed by pairwise merging. B8 says that the merging operation followed by a deadlock is the same as a pair of deadlocked processes, and B9 says that the empty tuple of processes is itself unchanged by variable merging. B10 makes nondeterministic choice an idempotent operation t + t = t.
Axiom B11 allows one to remove unguarded loops, capturing the standard equation µv1.v1 = 0. Finally, C1 encodes the fact that merging tuples of variables interacts as expected with prefixing: (a.v1, a.v1) = (a.v1, a.v2[v1/v2]). Note that, if we replace the with , the resulting equality (prefixes distribute over nondeterministic sum) is not valid, which is precisely the law that fails for bisimilarity, but holds for trace equivalence [39].
▶ Lemma 15 (Soundness). For any two diagrams f, g : v → w of Syn, if f = g then f = g.
Quantitative theory. We define Eq to be the set of triples of the form (s, ε, t), where s, t are string diagrams of the same type and ε ∈ Q≥0, to be the least set closed under the rules of Fig. 3. We will call elements of that set derivable equations.
≡ε a ∈ Σm ≡ϵ/2 (Pref) ≡ε ε′ ≥ ε ≡ε′ (Max)
= ≡0 (Refl) ≡ε ≡ε (Sym)
≡ε′ ε′>ε ≡ε (Cont) ≡ε1 ≡ε2 ≡ε1+ε2 (Triang)
≡ε1 ≡ε2 ≡max{ε1,ε2} (Seq) ≡1 (Top)
≡ε1 ≡ε2 ≡max{ε1,ε2} (Tens) n ≡0 (Codel)
Figure 3: Quantitative axioms for regular behaviours.
For any two diagrams f, g : v → w of Syn, we say a quantitative equation f ≡ε g is valid if dv,w(f , g) ≤ ε. Analogously, an inference rule is valid if, whenever all quantitative equations in the premise are valid, then the equation in the conclusion in the equation is also valid.
We now briefly explain each of the rules of our inference system depicted on Figure 3. (Refl), (Sym) and (Triang) respectively capture reflexivity, symmetry and triangle inequality of pseudometric spaces. Importantly, rule (Refl) allows one to state that equal diagrams (modulo strictly equational rules described above) are at distance zero of each other. (Top) allows us to state that any two diagrams are at most within distance 1 of each other, while (Max) allows one to always weaken the bound on the distance at which two diagrams are. (Cont) is the key analytic inference rule here: it allows us to conclude that two diagrams are within distance ε, provided we can show that they are within all distances that are strictly greater than ε, thereby passing to the limit.
Next, (Seq) and (Tens) relate the horizontal and vertical compositions of diagrams to the distance. There are two domain-specific rules that we use. (Pref) witnesses the fact that prefixing by the same actions decreases the distance by half. Note that it applies to diagram ▶m→▶n and that we use to denote the vertical composition of m many generators, for any m ∈ N. We note that the factor 12 used in Definition 4 can be replaced with arbitrary real number k ∈ [0, 1], but this would require appropriately changing the rule (Pref), as it is the case in the quantitative axiomatisation of the behavioural distance of DFA [41]. Finally, (Codel) axiom encodes that any diagram with no initial state has no behaviour and is therefore at distance zero of the empty chart.
Through a straightforward structural induction, one can show the soundness of the proposed quantitative rules.
▶ Theorem 16 (Quantitative soundness). Every derivable equation f ≡ε g is valid.
▶ Example 17. We revisit the charts from Figure 1, which in Milner’s syntax read a.(a.0 + b.µv1.a.v1) + b.µv1.a.v1 on the left and µv2.(a.v2 + b.µv1.a.a.v1) on the right. We show that their distance is bounded by 14, which is the same as showing that they agree up to depth of two. The derivation below shows how this bound is obtained syntactically, by manipulating the diagrammatic representations through the rules of our inference system. We use compositionality to our advantage and break them into two parts which we will compose later with the (Comp) rule. In , we show that a.(a.0 + b.v1) + b.v1 and µv2.(a.v2 + b.v1) are in distance 14. It is the case, as both processes can be distinguished at the depth of three; in particular, taking three successive a-transitions is possible in the right diagram, while in the left one, one reaches a deadlock after two a-transitions. In the proof, we use (Pref) rule twice, as we show that we agree for all prefixes of the depth of two. ≡1 (Top) ≡1/2 (Pref) (B6;B5) = ≡1/2 (Unroll) = (Comp) ≡1/2 (Refl;Triang) ≡1/4 (Pref) (C1) = ≡1/4 (Unroll) = (Comp) ≡1/4 (Refl;Triang)
In the rules labelled with (Refl; Triang) we have used the strict equality of diagrams to simplify the quantitative equations. The equalities marked with (Unroll) follow from Lemma 20, which we state in the next section. Then, for the second part of our diagrams, we show that µv1.a.v1 is bisimilar to µv1.a.a.v1. In , we first show that we can easily conclude that both diagrams are in a distance bounded by 12.
≡1 (Top) ≡1/2 (Pref) (C1) = ≡1/2 (Refl;Triang) ≡1/2 (Refl;Triang) ≡ε ≡0
Then, using the same reasoning, we can inductively show for ε = 1/2n for any n ∈ N, and thus for any ε > 0. Finally, the (Cont) rule allows us to conclude . Finally, combining and together with the (Comp) rule, allows us to recover the equality we wanted to show: ≡1/4
6 Completeness
We finally arrive at the main technical section of the paper, where we gradually present a sequence of results leading to the completeness of our axioms for the behavioural distance. First, we show that we can safely focus solely on ▶m→▶n diagrams. Then, through an analytic proof relying on (Cont) rule, we show that each diagram can be co-copied. Consequently, we can decompose any ▶m→▶n diagram into a collection of ▶→▶n diagrams, which correspond to individual charts. We argue that each of those ▶→▶n diagrams has a normal form from which one can extract a finite prechart structure. The distance between states of this prechart precisely captures the distance between the diagrams being related and very importantly, admits a simple characterisation that can be simulated through the inference rules of our system, eventually leading to the completeness result.
Left-to-right diagrams. The following result allows us to turn any bidirectional diagram into a left-to-right one by appropriately bending the wires using and . We will see later that this process does not change distances between diagrams.
▶ Lemma 18. There are bijections between the sets Syn(v1 ◀ v2, w) and Syn(v1v2, w ▶), and between Syn(v, w1 ◀ w2) and Syn(v ▶, w1w2), i.e. between sets of string diagrams of the form
and as well as between and
where v, w, vi, wi are words over {▶, ◀}.
A block is simply a diagram freely composed from a restricted set of generators (possibly including identities and symmetries). In this paper, we will make use of two special kinds of diagrams that can be factored into blocks:
A matrix-diagram is a diagram ▶m→▶n that factors as a composition of a block of , , another of for a ∈ Σ, and a last one of , . A matrix-diagram is guarded when any path from left to right port encounters at least one . In Lemma 86 in the appendix of the full version of the paper, we show that one can generalise (Pref) inference rule to arbitrary guarded matrix-diagrams, rather than just vectors of . In other words, prepending a guarded matrix-diagram to any pair of diagrams contracts the distance between them.
A relation-diagram is a diagram ▶m→▶n that factors as a composition of a block of , followed by the block of , .
Intuitively, matrix-diagrams are representations of labelled transition relations, while relation-transition diagrams are representations of the output relations. This idea can be captured formally through the notion of a representation. For a diagram d : ▶m→▶n, a representation is a pair (a, o) of a guarded matrix-diagram c : ▶ℓ+m→▶ℓ+m and a relation-diagram o : ▶ℓ+m→▶n, such that
= := (1)
Using the rules of =, we can rearrange the any diagram into the form described above.
▶ Theorem 19. Any diagram ▶m→▶n has a representation.
The matrix-diagram in the representation that is being fed through feedback, can be unrolled.
▶ Lemma 20. For any matrix-diagram d : ▶n→▶n, = .
We informally state the following connection between representations and charts.
▶ Remark 21. The diagrammatic syntax presented in our paper is expressive, that is, the semantics of every chart can be equivalently encoded as an appropriate diagram. More explicitly, to encode a chart (Q, s, D, E) we first define its transition relation D as a matrix-diagram c and its outputs E as a relation diagram o; we then compose them together as in (1) following the definition of representations above. Semantically, this corresponds to taking a dagger (Lemma 68), which solves the system of equations (described by c and o) using µ operation on charts, recovering the original expressivity result for Milner’s operations on finite charts [34, Corollary 5.8], as summarised in Section 2. Co-deleting all input wires except the one corresponding to the initial state s ∈ Q, yields a diagram whose semantics coincides precisely with the semantics of the chart of interest.
Co-copying. Bringing each diagram to a form corresponding to its representation, combined with the usage of unrolling (Lemma 20) and generalisation of (Pref) to guarded matrix-diagrams (Lemma 86) allows to show that the following two diagrams are arbitrarily close and hence by (Cont) are in zero distance
▶ Theorem 22. For any diagram d : ▶m→▶n, we have that ≡0 .
A very important consequence of the above combined with the usage of (Codel) rule is the fact that each ▶m→▶n diagram can be separated to a collection of ▶→▶n intuitively corresponding to individual entries of tuples being manipulated in RegBeh.
▶ Lemma 23. Let f : ▶m→▶n and define fi to be the diagram ▶→▶n obtained by composing all but the i-th input of f with (co-deleting all inputs except the i-th one). We have that
≡0
Moreover, in Lemma 89 in the appendix of the full version of the paper, we show that the behavioural distance between the denotations of arbitrary diagrams f, g : ▶m→▶n is simply the maximum of the component-wise distances between each fi and gi for i ∈ {1, . . . , m}. From now on, we will temporarily shift focus to ▶→▶n diagrams.
One-to-n diagrams. Each of the ▶→▶n diagrams represents a behaviour of the single state of the prechart structure on Ω or equivalently, defines a chart. Turns out that appropriately combining these diagrams corresponds to operations on charts described in Section 2.
▶ Lemma 24. For any two c, d : ▶→▶n, we have that = e + f .
This operation of combining two ▶→▶n string diagrams (that we call convolution) can easily be extended to any finite collection of ▶→▶n diagrams and is well defined up to permutations and removing duplicates, while staying at distance zero; (see Lemma 90). Thanks to the ability to turn each diagram f : ▶m→▶n into its representation (Theorem 19), as well as global co-copying (Lemma 23), we can express each the subdiagrams fi : ▶→▶n as convolution.
▶ Lemma 25. For any diagram f : ▶m→▶n and fi, 1 ≤ i ≤ m defined as above, for all i ∈ {1, . . . , m}, we can derive
≡0
where, for 1 ≤ j ≤ ℓ, each vqj : ▶→▶n is a diagram encoding the output variables to which the i-th input wire of f is directly connected, that is, without going through any generator (in particular, each vqj is a monoidal product of a single identity with n − 1 generators).
The informal intuition is that each of the fi : ▶→▶n diagrams represents a state of a prechart and the behaviour of each such state is the union of all possible labelled transitions to other states and variable outputs. This can be made formal, by extracting a prechart over the set Qf = {f1, . . . , fm}, whose transition function β is given by the following; we define fi a − → fj iff contains and similarly fi ▷ vs iff contains . The behavioural distance between states of this prechart, precisely captures the behavioural distance between each of the fi diagrams.
▶ Lemma 26. For all fi, fj ∈ Qf, we have that bdβ(fi, fj) = bd(fi , fj)
Completeness. The behavioural distance between states of finite charts, including those derived from the normal form of diagrams (Lemma 25), can be given a simpler characterisation via a decreasing chain of approximants.
▶ Lemma 27. Let (Q, β) be a finite prechart. The behavioural distance between any pair q1, q2 ∈ Q of states can be calculated by bdβ(q1, q2) = infp∈N Φ(p)β(q1, q2), where Φ(0)β is a discrete pseudometric and for any p ∈ N, we define Φ(p+1)β = Φβ Φ(p)β.
The proof of the fact above makes use of the fact that the map Φβ has a unique fixpoint and when dealing with finite precharts, we can establish necessary preconditions allowing to use Kleene’s fixpoint theorem for the greatest fixpoint. Details of these arguments can be found in Section A.2. The characterisation described above is particularly useful, as upper bounds on each of the approximants can be derived syntactically through the means of axiomatic manipulation.
▶ Lemma 28. Let f : ▶m→▶n, fi, 1 ≤ i ≤ m and (Qf, β) be defined as above. For all fg, fh ∈ Qf, all p ∈ N and any ε ≥ Φ(p)β(fg, fh), we have that ≡ε is derivable.
The key idea of the lemma above is that the behaviour of lifting of pseudometric from states to edges (Definition 4) and Hausdorff lifting (Definition 5) used in the definition of Φ can be simulated using the rules of our deduction system. Using (Cont) rule and characterisation from Lemma 27, we obtain a completeness result for distances between fi : ▶→▶n components of f : ▶m→▶n.
▶ Lemma 29. Let f : ▶m→▶n and fi, 1 ≤ i ≤ m be defined as above. For all g, h ∈ {1, . . . , m}, any valid equation ≡ε is derivable.
Relying on Lemma 23, we can reduce the problem of deriving distance between arbitrary ▶m→▶n diagrams, to the case of ▶→▶n solved above. This yields completeness result for left-to-right diagrams.
▶ Theorem 30. Let f, g : ▶m→▶n. Any valid equation ≡ε is derivable.
Since arbitrary diagrams can be turned into ▶m→▶n diagrams by appropriately composing and , while preserving distances between diagrams, we arrive at the desired result.
▶ Theorem 31 (Quantitative completeness). Let f, g : v → w be two arbitrary diagrams. Any valid equation ≡ε is derivable.
7 Discussion
In this paper, we presented a sound and complete quantitative axiomatisation of the behavioural distance of Milner’s charts [34]. We have relied on a compositional, string diagrammatic syntax [39, 3] and equipped it with a quantitative inference system for reasoning about bounds on behavioural distance, inspired by recent advances in metric universal algebra [32, 33, 35].
Originally introduced for probabilistic systems [51, 16], behavioural distances have recently been generalised to a broad range of systems modelled via the abstract framework of universal coalgebra [42], leveraging pseudometric liftings of functors [7]. The notion of behavioural distance for charts used in the paper is an instance of this coalgebraic framework. Our concrete characterisation closely resembles the metric on trees studied by Nivat [36]. A similar characterisation was studied by Golson and Rounds [18], who instead examined de Bakker and Zucker’s metric domain for nondeterministic processes [15], also derived via a fixpoint construction involving the Hausdorff distance.
The idea of reasoning about distances between string diagrams has been explored before in quantum theory [28, 12, 24] and probability theory [37]. However, in contrast with the growing body of work on cartesian quantitive algebra [32, 35, 6], a systematic foundation to axiomatising distances between string diagrams appeared only very recently, in the work of Lobbia et al [31]. Besides the basic examples provided in [31], our work is the first to propose a complete axiomatisation of a quantitative calculus of string diagrams. The approach of [31] is based on enriched category theory: similarly, one could observe that the equipment of our semantic category with pseudometric structures making sequential and parallel composition nonexpansive yields the enrichment in the category of pseudometric spaces. However, our axiomatisation relies on the domain-specific implicational rule (Pref) and an axiom schema (Codel) that cannot be expressed in the framework of Lobbia et al [31], which only supports quantitative equations. Reconciling those rule formats with the general framework of Lobbia et al [31] is an interesting direction for future research.
Axiomatising behavioural distances have been originally studied through ad-hoc inference systems [30, 14]. The introduction of quantitative equational theories made more principled approaches possible, leading to axiomatisations of behavioural distance for probabilistic systems [4, 5]. In recent work, Różowski [41] extended these results within a coalgebraic framework, focusing on the simple case of DFA, which enjoys a straightforward algebraic representation via the syntax of Kleene Algebra. While we rely here on the general pattern of the completeness proof from that work, the case of Milner’s charts was significantly more involved, requiring the ability to simulate the behaviour of Hausdorff lifting syntactically.
In constructing the semantic category, we have used the fact that charts form a Conway theory [55], studied in the literature on parametrised fixpoint operators [21, 46, 1], and which can be seen as a relaxation of iteration theories [9]. The connection between charts and these structures was previously investigated by Bloom et al [10] and Sewell [45], while the interplay of parametrised fixpoint operators with traced monoidal categories was studied by Hasegawa [22], Haghverdi [21], and Simpson and Plotkin [46] independently.
Our work constitutes a necessary first step towards a similar diagrammatic treatment of behavioural distance for quantitative automata, such as probabilistic and weighted systems, for which distances are a more suitable way of reasoning rather than Boolean equivalences. The string diagrammatic point of view would enable a desirable, compositional treatment that reflects well the underlying operational models, in a way that is not available through conventional syntaxes. Another promising direction for future work would be to consider Guarded Kleene Algebra with Tests (GKAT) [47, 43], an efficiently decidable language for reasoning about equivalence of uninterpreted programs. The completeness proof of GKAT relies on a metric argument that could be internalised within an inference system like the one introduced in this paper. Moreover, the syntax of GKAT is insufficiently expressive, as it can only describe a part of the behaviours of its underlying operational model – in fact there is no finite purely algebraic syntax that could do so [49]. A string diagrammatic treatment could allow us to express all such behaviours and obtain a simpler yet more expressive completeness result, that would in turn enable axiomatic reasoning about decompilation algorithms, that were recently shown to be expressible via GKAT automata (but not in GKAT) [54].
References
1 Samson Abramsky, Esfandiar Haghverdi, and Philip J. Scott. Geometry of interaction and linear combinatory algebras. Math. Struct. Comput. Sci., 12(5):625–665, 2002. doi:10.1017/S0960129502003730.
2 Carolyn Jane Anderson, Nate Foster, Arjun Guha, Jean-Baptiste Jeannin, Dexter Kozen, Cole Schlesinger, and David Walker. Netkat: semantic foundations for networks. In Suresh Jagannathan and Peter Sewell, editors, The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’14, San Diego, CA, USA, January 20-21, 2014, pages 113–126. ACM, 2014. doi:10.1145/2535838.2535862.
3 Thibaut Antoine, Robin Piedeleu, Alexandra Silva, and Fabio Zanasi. A complete diagrammatic calculus for automata simulation. In Jörg Endrullis and Sylvain Schmitz, editors, 33rd EACSL Annual Conference on Computer Science Logic, CSL 2025, February 10-14, 2025, Amsterdam, Netherlands, volume 326 of LIPIcs, pages 27:1–27:22. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2025. URL: https://doi.org/10.4230/LIPIcs.CSL.2025.27, doi:10.4230/LIPICS.CSL.2025.27.
4 Giorgio Bacci, Giovanni Bacci, Kim G. Larsen, and Radu Mardare. A complete quantitative deduction system for the bisimilarity distance on markov chains. Log. Methods Comput. Sci., 14(4), 2018. doi:10.23638/LMCS-14(4:15)2018.
5 Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. An algebraic theory of markov processes. In Anuj Dawar and Erich Grädel, editors, Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, Oxford, UK, July 09-12, 2018, pages 679–688. ACM, 2018. doi:10.1145/3209108.3209177.
6 Giorgio Bacci, Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. Sum and tensor of quantitative effects. Log. Methods Comput. Sci., 20(4), 2024. URL: https://doi.org/10.46298/lmcs-20(4:9)2024, doi:10.46298/LMCS-20(4:9)2024.
7 Paolo Baldan, Filippo Bonchi, Henning Kerstan, and Barbara König. Coalgebraic behavioral metrics. Log. Methods Comput. Sci., 14(3), 2018. doi:10.23638/LMCS-14(3:20)2018.
8 Jan A. Bergstra, Alban Ponse, and Scott A. Smolka, editors. Handbook of Process Algebra. North-Holland / Elsevier, 2001. URL: https://doi.org/10.1016/b978-0-444-82830-9.x5017-6, doi:10.1016/B978-0-444-82830-9.X5017-6.
9 Stephen L. Bloom and Zoltán Ésik. Iteration Theories - The Equational Logic of Iterative Processes. EATCS Monographs on Theoretical Computer Science. Springer, 1993. doi:10.1007/978-3-642-78034-9.
10 Stephen L. Bloom, Zoltán Ésik, and Dirk Taubner. Iteration theories of synchronization trees. Inf. Comput., 102(1):1–55, 1993. URL: https://doi.org/10.1006/inco.1993.1001, doi:10.1006/INCO.1993.1001.
11 Filippo Bonchi, Joshua Holland, Robin Piedeleu, Pawel Sobocinski, and Fabio Zanasi. Diagrammatic algebra: from linear to concurrent systems. Proc. ACM Program. Lang., 3(POPL):25:1–25:28, 2019. doi:10.1145/3290338.
12 Spencer Breiner, Carl A. Miller, and Neil J. Ross. Graphical Methods in Device-Independent Quantum Cryptography. Quantum, 3:146, May 2019. doi:10.22331/q-2019-05-27-146.
13 Bob Coecke and Ross Duncan. Interacting quantum observables. In Luca Aceto, Ivan Damgård, Leslie Ann Goldberg, Magnús M. Halldórsson, Anna Ingólfsdóttir, and Igor Walukiewicz, editors, Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part II - Track B: Logic, Semantics, and Theory of Programming & Track C: Security and Cryptography Foundations, volume 5126 of Lecture Notes in Computer Science, pages 298–310. Springer, 2008. doi:10.1007/978-3-540-70583-3\_25.
14 Pedro R. D’Argenio, Daniel Gebler, and Matias David Lee. Axiomatizing bisimulation equivalences and metrics from probabilistic SOS rules. In Anca Muscholl, editor, Foundations of Software Science and Computation Structures - 17th International Conference, FOSSACS 2014, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2014, Grenoble, France, April 5-13, 2014, Proceedings, volume 8412 of Lecture Notes in Computer Science, pages 289–303. Springer, 2014. doi:10.1007/978-3-642-54830-7\_19.
15 J. W. de Bakker and Jeffery I. Zucker. Processes and the denotational semantics of concurrency. Inf. Control., 54(1/2):70–120, 1982. doi:10.1016/S0019-9958(82)91250-5.
16 Josée Desharnais, Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden. Metrics for labelled markov processes. Theor. Comput. Sci., 318(3):323–354, 2004. URL: https://doi.org/10.1016/j.tcs.2003.09.013, doi:10.1016/J.TCS.2003.09.013.
17 Dan R. Ghica, George Kaye, and David Sprunger. Full abstraction for digital circuits. CoRR, abs/2201.10456, 2022. URL: https://arxiv.org/abs/2201.10456, arXiv:2201.10456.
18 William G. Golson and William C. Rounds. Connections between two theories of concurrency: metric spaces and synchronization trees. Inf. Control, 57(2–3):102–124, May 1984. doi:10.1016/S0019-9958(83)80039-4.
19 Clemens Armin Grabmayer. Milner’s proof system for regular expressions modulo bisimilarity is complete: Crystallization: Near-collapsing process graph interpretations of regular expressions. In Christel Baier and Dana Fisman, editors, LICS ’22: 37th Annual ACM/IEEE Symposium on Logic in Computer Science, Haifa, Israel, August 2 - 5, 2022, pages 34:1–34:13. ACM, 2022. doi:10.1145/3531130.3532430.
20 Niels Bjørn Bugge Grathwohl, Dexter Kozen, and Konstantinos Mamouras. KAT + b! In Thomas A. Henzinger and Dale Miller, editors, Joint Meeting of the Twenty-Third EACSL Annual Conference on Computer Science Logic (CSL) and the Twenty-Ninth Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), CSL-LICS ’14, Vienna, Austria, July 14 - 18, 2014, pages 44:1–44:10. ACM, 2014. doi:10.1145/2603088.2603095.
21 Esfandiar Haghverdi. A categorical approach to linear logic, geometry of proofs and full completeness. PhD thesis, University of Ottawa, Canada, 2000. URL: https://ruor.uottawa.ca/items/80895bb8-8e36-4f26-b08f-2726f8d2a581.
22 Masahito Hasegawa. Models of sharing graphs : a categorical semantics of let and letrec. PhD thesis, University of Edinburgh, UK, 1997. URL: https://hdl.handle.net/1842/15001.
23 Matthew Hennessy and Robin Milner. Algebraic laws for nondeterminism and concurrency. J. ACM, 32(1):137–161, January 1985. doi:10.1145/2455.2460.
24 Nicholas Gauguin Houghton-Larsen. A Mathematical Framework for Causally Structured Dilations and its Relation to Quantum Self-Testing. Phd thesis, University of Copenhagen, Copenhagen, Denmark, February 2021. URL: https://arxiv.org/abs/2103.02302, arXiv:2103.02302.
25 Mathias Claus Jensen and Kim Guldstrand Larsen. A complete axiomatization of weighted branching bisimulation. Acta Informatica, 57(3-5):689–725, 2020. URL: https://doi.org/10.1007/s00236-020-00375-6, doi:10.1007/S00236-020-00375-6.
26 André Joyal, Ross Street, and Dominic Verity. Traced monoidal categories. Mathematical Proceedings of the Cambridge Philosophical Society, 119(3):447–468, 1996. doi:10.1017/S0305004100074338.
27 G.M. Kelly and M.L. Laplaza. Coherence for compact closed categories. Journal of Pure and Applied Algebra, 19:193–213, 1980. URL: https://www.sciencedirect.com/science/article/pii/0022404980901012, doi:10.1016/0022-4049(80)90101-2.
28 Aleks Kissinger, Sean Tull, and Bas Westerbaan. Picture-perfect quantum key distribution, 2017. URL: https://arxiv.org/abs/1704.08668, arXiv:1704.08668.
29 Dexter Kozen. A completeness theorem for kleene algebras and the algebra of regular events. Inf. Comput., 110(2):366–390, 1994. URL: https://doi.org/10.1006/inco.1994.1037, doi:10.1006/INCO.1994.1037.
30 Kim G. Larsen, Uli Fahrenberg, and Claus R. Thrane. Metrics for weighted transition systems: Axiomatization and complexity. Theor. Comput. Sci., 412(28):3358–3369, 2011. URL: https://doi.org/10.1016/j.tcs.2011.04.003, doi:10.1016/J.TCS.2011.04.003.
31 Gabriele Lobbia, Wojciech Różowski, Ralph Sarkis, and Fabio Zanasi. Quantitative Monoidal Algebra: Axiomatising Distance with String Diagrams. In Paweł Gawrychowski, Filip Mazowiecki, and Michał Skrzypczak, editors, 50th International Symposium on Mathematical Foundations of Computer Science (MFCS 2025), volume 345 of Leibniz International Proceedings in Informatics (LIPIcs), pages 68:1–68:21, Dagstuhl, Germany, 2025. Schloss Dagstuhl – Leibniz-Zentrum für Informatik. URL: https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.MFCS.2025.68, doi:10.4230/LIPIcs.MFCS.2025.68.
32 Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. Quantitative algebraic reasoning. In Martin Grohe, Eric Koskinen, and Natarajan Shankar, editors, Proceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’16, New York, NY, USA, July 5-8, 2016, pages 700–709. ACM, 2016. doi:10.1145/2933575.2934518.
33 Stefan Milius and Henning Urbat. Equational axiomatization of algebras with structure. In Mikolaj Bojanczyk and Alex Simpson, editors, Foundations of Software Science and Computation Structures - 22nd International Conference, FOSSACS 2019, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2019, Prague, Czech Republic, April 6-11, 2019, Proceedings, volume 11425 of Lecture Notes in Computer Science, pages 400–417. Springer, 2019. doi:10.1007/978-3-030-17127-8\_23.
34 Robin Milner. A complete inference system for a class of regular behaviours. J. Comput. Syst. Sci., 28(3):439–466, 1984. doi:10.1016/0022-0000(84)90023-0.
35 Matteo Mio, Ralph Sarkis, and Valeria Vignudelli. Universal quantitative algebra for fuzzy relations and generalised metric spaces. Log. Methods Comput. Sci., 20(4), 2024. URL: https://doi.org/10.46298/lmcs-20(4:19)2024, doi:10.46298/LMCS-20(4:19)2024.
36 Maurice Nivat. Infinite words, infinite trees, infinite computations. Foundations of computer science III, 2:3–52, 1979.
37 Paolo Perrone. Markov categories and entropy. IEEE Trans. Inf. Theory, 70(3):1671–1692, 2024. doi:10.1109/TIT.2023.3328825.
38 Robin Piedeleu, Mateo Torres-Ruiz, Alexandra Silva, and Fabio Zanasi. A complete axiomatisation of equivalence for discrete probabilistic programming. CoRR, abs/2408.14701, 2024. URL: https://doi.org/10.48550/arXiv.2408.14701, arXiv:2408.14701, doi:10.48550/ARXIV.2408.14701.
39 Robin Piedeleu and Fabio Zanasi. A finite axiomatisation of finite-state automata using string diagrams. Log. Methods Comput. Sci., 19(1), 2023. URL: https://doi.org/10.46298/lmcs-19(1:13)2023, doi:10.46298/LMCS-19(1:13)2023.
40 Robin Piedeleu and Fabio Zanasi. An introduction to string diagrams for computer scientists. CoRR, abs/2305.08768, 2023. URL: https://doi.org/10.48550/arXiv.2305.08768, arXiv:2305.08768, doi:10.48550/ARXIV.2305.08768.
41 Wojciech Różowski. A complete quantitative axiomatisation of behavioural distance of regular expressions. In Karl Bringmann, Martin Grohe, Gabriele Puppis, and Ola Svensson, editors, 51st International Colloquium on Automata, Languages, and Programming, ICALP 2024, July 8-12, 2024, Tallinn, Estonia, volume 297 of LIPIcs, pages 149:1–149:20. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2024. URL: https://doi.org/10.4230/LIPIcs.ICALP.2024.149, doi:10.4230/LIPICS.ICALP.2024.149.
42 J.J.M.M. Rutten. Universal coalgebra: a theory of systems. Theoretical Computer Science, 249(1):3–80, 2000. Modern Algebra. URL: https://www.sciencedirect.com/science/article/pii/S0304397500000566, doi:10.1016/S0304-3975(00)00056-6.
43 Todd Schmid, Tobias Kappé, Dexter Kozen, and Alexandra Silva. Guarded kleene algebra with tests: Coequations, coinduction, and completeness. In Nikhil Bansal, Emanuela Merelli, and James Worrell, editors, 48th International Colloquium on Automata, Languages, and Programming, ICALP 2021, July 12-16, 2021, Glasgow, Scotland (Virtual Conference), volume 198 of LIPIcs, pages 142:1–142:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2021. URL: https://doi.org/10.4230/LIPIcs.ICALP.2021.142, doi:10.4230/LIPICS.ICALP.2021.142.
44 P. Selinger. A Survey of Graphical Languages for Monoidal Categories, pages 289–355. Springer Berlin Heidelberg, 2010. URL: http://dx.doi.org/10.1007/978-3-642-12821-9_4, doi:10.1007/978-3-642-12821-9_4.
45 Peter Michael Sewell. The Algebra of Finite State Processes. PhD thesis, University of Edinburgh, 1995.
46 Alex K. Simpson and Gordon D. Plotkin. Complete axioms for categorical fixed-point operators. In 15th Annual IEEE Symposium on Logic in Computer Science, Santa Barbara, California, USA, June 26-29, 2000, pages 30–41. IEEE Computer Society, 2000. doi:10.1109/LICS.2000.855753.
47 Steffen Smolka, Nate Foster, Justin Hsu, Tobias Kappé, Dexter Kozen, and Alexandra Silva. Guarded kleene algebra with tests: verification of uninterpreted programs in nearly linear time. Proc. ACM Program. Lang., 4(POPL):61:1–61:28, 2020. doi:10.1145/3371129.
48 Eugene W. Stark and Scott A. Smolka. A complete axiom system for finite-state probabilistic processes. In Gordon D. Plotkin, Colin Stirling, and Mads Tofte, editors, Proof, Language, and Interaction, Essays in Honour of Robin Milner, pages 571–596. The MIT Press, 2000.
49 Balder ten Cate and Tobias Kappé. Algebras for deterministic computation are inherently incomplete. Proc. ACM Program. Lang., 9(POPL):718–744, 2025. doi:10.1145/3704861.
50 Franck van Breugel. On behavioural pseudometrics and closure ordinals. Information Processing Letters, 112(19):715–718, 2012. URL: https://www.sciencedirect.com/science/article/pii/S0020019012001706, doi:10.1016/j.ipl.2012.06.019.
51 Franck van Breugel and James Worrell. Towards quantitative verification of probabilistic transition systems. In Fernando Orejas, Paul G. Spirakis, and Jan van Leeuwen, editors, Automata, Languages and Programming, 28th International Colloquium, ICALP 2001, Crete, Greece, July 8-12, 2001, Proceedings, volume 2076 of Lecture Notes in Computer Science, pages 421–432. Springer, 2001. doi:10.1007/3-540-48224-5\_35.
52 Rob J. van Glabbeek. The linear time - branching time spectrum I. In Jan A. Bergstra, Alban Ponse, and Scott A. Smolka, editors, Handbook of Process Algebra, pages 3–99. North-Holland / Elsevier, 2001. URL: https://doi.org/10.1016/b978-044482830-9/50019-9, doi:10.1016/B978-044482830-9/50019-9.
53 Jana Wagemaker, Nate Foster, Tobias Kappé, Dexter Kozen, Jurriaan Rot, and Alexandra Silva. Concurrent netkat - modeling and analyzing stateful, concurrent networks. In Ilya Sergey, editor, Programming Languages and Systems - 31st European Symposium on Programming, ESOP 2022, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2022, Munich, Germany, April 2-7, 2022, Proceedings, volume 13240 of Lecture Notes in Computer Science, pages 575–602. Springer, 2022. doi:10.1007/978-3-030-99336-8\_21.
54 Cheng Zhang, Tobias Kappé, David E. Narváez, and Nico Naus. CF-GKAT: efficient validation of control-flow transformations. Proc. ACM Program. Lang., 9(POPL):600–626, 2025. doi:10.1145/3704857.
55 Z Ésik. Group axioms for iteration. Information and Computation, 148(2):131–180, 1999. URL: https://www.sciencedirect.com/science/article/pii/S0890540198927468, doi:10.1006/inco.1998.2746.
A Appendix
A.1 Algebra of Regular Behaviours
In the appendix, we rely on a slightly different, but equivalent [34], characterisation of the set Ω of all regular behaviours. In this section, we elaborate on this characterisation and related conventions. In particular, we will write Exp/∼ instead of Ω, as we will view this set as a bisimilarity quotient of a certain specification language that can be given operational semantics by equipping it with a prechart structure. The syntax of the language corresponds to operations described in Section 2 and is given by the following syntax
e, f ∈ Exp ::= 0 | v ∈ V | a.e | e + f | µv.e
where V = {v1, v2, . . . } and Σ be sets of variables and letters respectively. Given an expression f containing a variable v, we say that v is free in f, if it appears outside of the scope of the µv.e operator or say that it is bound otherwise. Given an expression e ∈ Exp, we write fv(e) ⊆ V for the set of its free variables. Given a set X, we define BX to be Pfin(V + Σ × X). Recall that each prechart can be equivalently seen as a pair (X, β : X → BX). Given a prechart (X, β), we write x a − → β y ⇐⇒ (a, y) ∈ β(x) and x ▷β vi ⇐⇒ vi ∈ β(x). When β is obvious from the context, we will omit writing it in the subscript. One can easily verify that ∼β is a prechart bisimulation itself and we will refer to it as the greatest bisimulation on (X, β). When β is obvious from the context we will omit writing it in the subscript.
▶ Definition 32. Let (X, β) be a prechart and let Y ⊆ X. We call (Y, β) a subprechart of (X, β), if the canonical inclusion map i : Y → X is a prechart homomorphism.
Given a prechart (X, β) and a state x we write ⟨x⟩β ⊆ X for the set of states reachable from x (note that this definition can be easily extended to sets of states). Equipping in with β restricted to ⟨x⟩β defines a subprechart (⟨x⟩β, β) of (X, β).
▶ Definition 33 ([34]). Given vectors v of binders and e of expressions of the same size, we define a syntactic substitution operator [e/v] : Exp → Exp by the following
v[e/v] = ei if v = vi v otherwise (a.e)[e/v] = a.(e[e/v])
▶ Definition 34 ([34]). Let (Exp, ∂) be a prechart whose transition function (called derivative) is a least one satisfying the following inference rules
e a − → e′ a.e a − → e′ v ▷ v e a − → e′ e + f a − → e′ f a − → f′ e + f a − → f′
The syntactic prechart ⟨e⟩∂ is locally finite.
▶ Lemma 35 ([34, Proposition 5.1]). For all e ∈ Exp, ⟨e⟩∂ is finite.
▶ Lemma 36 ([45, Proposition 7]). ∼ is a congruence on Exp with respect to all operations of the algebra of regular behaviours.
▶ Lemma 37 ([42, Proposition 5.8]). We can equip Exp/∼ with a transition function given by
e a − → ∂ e′ [e]∼ a − → ∂ [e′]∼ e ▷∂ vi [e]∼ ▷∂ vi
This map is a unique transition function on Exp/∼ that makes the quotient map [−]∼ : Exp → Exp/∼ into prechart homomorphism.
From now on, we will overload the notation and simply write e for the equivalence class [e]∼. Note that because of Lemma 36 all operations of algebra of regular behaviours are well defined on that quotient.
▶ Remark 38. The quotient prechart on Exp/∼ and corresponding operations of algebra of regular behaviours are in one-to-one correspondence with the prechart structure on Ω and operations defined in Section 2 in the main body of the paper.
▶ Remark 39 ([45]). The last rule (that defines the transition behaviour of the µ recursion operator) can be replaced by the following:
e[µv.e/v] a − → e′ µv.e a − → e′
▶ Remark 40 ([34, Proposition 5.4.]). Syntactic substitution can be described operationally using the following rules
e ▷ v f a − → f′ e[f/v] a − → f′ e a − → e′ e[f/v] a − → e′[f/v]
▶ Lemma 41. For all e, f1, . . . , fm, g1, . . . , gm ∈ Exp and vectors v = (vi1, . . . , vim), w = (vj1, . . . , vjn), such that all free variables of e are contained in v and all free variables of f are contained in w, we have that
(e[f/v])[g/w] = e[(f1[g/w], . . . , fm[g/w])/v]
Proof. Let ∆ = {(e, e) ∈ Exp} be the diagonal relation. We define a relation R ⊆ Exp × Exp, given by the following:
R = ∆ ∪ {((e[f/v])[g/w], e[(f1[g/w], . . . , fm[g/w])/v])
We claim that R is a bisimulation. For pairs (e, e) ∈ ∆, the conditions of bisimulation are immediately satisfied.
For the remaining pairs, assume that (e[f/v])[g/w] ▷ u. In such a case at least one of the following is true:
e[f/v] ▷ u
e[f/v] ▷ wj for wj ∈ w and gj ▷ u
Since all free variables of e are contained in v and all free variables of f are contained in w, we have that all free variables of e[f/v] are also contained in w, which makes the first case impossible. Through a similar line of reasoning, we can deduce that e ▷ vi for some vi ∈ v and fi ▷ wj. Since gj ▷ u, we have that fi[g/w] ▷ u. Finally, we have that e[(f1[g/w], . . . , fn[g/w]), v] ▷ u.
Assume that (e[f/v])[g/w] a − → h. Then, at least one of the following is true:
e[f/v] ▷ wj and gj a − → h.
h = h′[g/w], such that e[f/v] a − → h′
In the first case, through a similar line of reasoning as before, we can conclude that e ▷ vi for some vi ∈ v and fi ▷ wj. Hence, fi[g/w] a − → h. Finally, we can deduce that e[(f1[g/w], . . . , fm[g/w])/v] a − → h. Obviously, (h, h) ∈ R.
In the second case, we have that e[f/v] a − → h′. There are two subcases, that need to be considered
e ▷ vi and fi a − → h′
h′ = h′′[f/w] and e a − → h′′
In the first subcase, we have that fi[g/w] a − → h′[g/w] and hence
e[(f1[g/w], . . . , fm[g/w])/v] a − → h′[g/w]
or equivalently e[(f1[g/w], . . . , fm[g/w])/v] a − → h. As before, of course (h, h) ∈ R.
Finally, moving on to the second subcase, we have that e a − → h′′ and hence
e[(f1[g/w], . . . , fm[g/w])/v] a − → h′′[(f1[g/w], . . . , fm[g/w])/v]
Recall that (e[f/v])[g/w] a − → h and h = (h′′[f/v])[g/v]. Both of those reachable expressions are actually in the relation R. The remaining conditions of bisimulation, can be shown via a symmetric argument. ◀
A.2 Behavioural distance of precharts
▶ Theorem 6. Let (Q, β) be a prechart. Then, the following properties hold: dQ → Φβ(dQ) is a monotone mapping on the lattice DQ, Φβ has a least fixpoint bdβ, x ∼ y =⇒ bdβ(x, y) = 0 and a homomorphism f : Q → R between precharts (Q, β) and (R, γ) is an isometry between (Q, bdβ) and (R, bdγ).
Proof. H and (−)↑ are liftings for the functors Pfin and Σ × (−) + V respectively, that preserve isometries [7, Theorem 5.8]. The rest follows from [7, Theorem 5.2]. ◀
▶ Remark 42 ([7, Example 5.31]). Let (X, d) be a pseudometric space and let A, B ∈ Pfin(X). Let Γ(A, B) denote the set of relational couplings of A and B, namely elements R ∈ Pfin(A × B), such that π1(R) = A and π2(R) = B. The Hausdorff distance between A and B can be alternatively presented as:
H(d)(A, B) = inf sup (x,y)∈R d(x, y) | R ∈ Γ(A, B)
We will make use of the fact that the set of pseudometrics can be equipped with a norm. We write R = [−∞, ∞] for the set of extend reals. For any set X, the set of functions RX×X, which is the superset of DX, can be seen as a Banach space by means of the sup norm ∥d∥ = supx,y∈X |d(x, y)|.
▶ Lemma 43 ([50]). Hausdorff lifting H : DX → DPfin(X) is nonexpansive with respect to the metric induced by the sup norm. Namely,
∥H(d) − H(d′)∥ ≤ ∥d − d′∥
▶ Lemma 44. (−)↑ : DX → DΣ×X+V, the lifitng for Σ × (−) + V is contractive with respect to the metric induced by the sup norm. Namely, ∥d↑ − d′↑∥ ≤ 12∥d − d′∥
Proof. For the sake of simplicity, assume that d′ ⊑ d, and hence d′↑ ⊑ d↑. It suffices that we show that for all u, w ∈ Σ × X + V, we have that d↑(u, w) − d′↑(u, w) ≤ 12∥d − d′∥. Recall that in all cases, except when u = (a, x) and w = (a, y) for some a ∈ Σ and x, y ∈ X, d↑(u, w) = d′↑(u, w) and hence d↑(u, w) − d′↑(u, w) = 0 ≤ 12∥d − d′∥. In the remaining case, we have that
d↑((a, x), (a, y)) − d′↑((a, x), (a, y)) = 12d(x, y) − 12d′(x, y)
which completes the proof. ◀
▶ Lemma 45. Φβ : DX → DX is contractive with respect to the metric induced by the sup norm, namely
∥Φβ(d) − Φβ(d′)∥ ≤ 12∥d − d′∥
Proof. For the sake of simplicity, assume that d′ ⊑ d and hence Φβ(d′) ⊑ Φβ(d). It suffices to show that for all x, y ∈ X, we have that H(d↑)(β(x), β(y)) − H(d′↑)(β(x), β(y)) ≤ 12∥d − d′∥. We can combine the previous results and for arbitrary x, y ∈ X obtain the following
H(d↑)(β(x), β(y)) − H(d′↑)(β(x), β(y)) ≤ ∥H(d↑) − H(d′↑)∥
◀
As a consequence, we have the following
▶ Corollary 46. Φβ has a unique fixpoint.
We will argue that for (locally) finite precharts we can give a simpler characterisation of the behavioural distance relying on Kleene’s theorem for the greatest fixpoint. Recall that ω-cochain is a sequence {di}i∈N, such that for all i ∈ N, we have that di ⊒ di+1.
▶ Theorem 47 (Kleene fixpoint theorem). Let (L, ⊑) be a partial order where every ω-cochain has an infimum and let f : L → L be an endomap that is cocontinuous, namely for all ω-cochains {li}i∈N, we have that f (infi∈N li) = infi∈N f(li). The greatest fixpoint of f can be characterised as
gfp(f) = inf i∈N f(i)
where f(0) = ⊤ and f(n+1) = f(n)(f)
▶ Lemma 48. For a finite prechart (X, β), Φβ is cocontinuous.
Proof. Identical proof to [41, Lemma 20]. ◀
We can combine the above results into the following statement.
▶ Lemma 27. Let (Q, β) be a finite prechart. The behavioural distance between any pair q1, q2 ∈ Q of states can be calculated by bdβ(q1, q2) = infp∈N Φ(p)β(q1, q2), where Φ(0)β is a discrete pseudometric and for any p ∈ N, we define Φ(p+1)β = Φβ Φ(p)β.
Proof. Since Φβ has a unique fixpoint, we can rely on a Kleene fixpoint theorem for the greatest fixpoint (Theorem 47), which is preconditioned on Φβ being cocontinuous, which is true for finite precharts (Lemma 48). The final formula is given by the fact that in the lattice of pseudometrics, the infima of ω-cochains can be calculated pointwise [41, Lemma 6]. ◀
Moreover, this can be extended beyond finite charts to the locally finite ones.
▶ Corollary 49. For any locally finite prechart (X, β), the distance between x, y ∈ X, can be calculated by:
bdβ(x, y) = inf i∈N Φ(i)β(x, y)
Proof. Let β′ denote β restricted to ⟨x, y⟩β. Since (X, β) is locally finite, then its subprechart (⟨x, y⟩β, β′) is finite. Since homomorphisms are isometries, calculating distance between x and y in (X, β) is the same as calculating it in (⟨x, y⟩β, β). Because of Lemma 48, Φβ is cocontinuous (when restricted to ⟨x, y⟩β′) and hence we can employ Theorem 47. Since the infima in the lattice of pseudometrics can be calculated pointwise [41, Lemma 6], we have that
bdβ(x, y) = bdβ′(x, y) = inf i∈I Φ(i)β′(x, y)
Since β′ is a restriction of β to ⟨x, y⟩β and each Φ(i)β′ makes only use of the states in ⟨x, y⟩β, we can rewrite the above as bdβ(x, y) = infi∈N Φ(i)β(x, y) as desired. ◀
▶ Lemma 50. Let (X, β) be a locally finite prechart. For all x, y ∈ X, i ∈ N, either Φ(i)β = 0 or there exists k ∈ N, such that Φ(i)β(x, y) = 2−k
Proof. Let x, y ∈ X. We proceed by induction on i.
If i = 0, then Φ(0)β(x, y) = 1 = 20, if x = 0 or Φ(0)β(x, y) = 0, otherwise.
If i = j + 1, then unrolling the definition of Φ(j+1)β yields the following:
Φj+1β(x, y) = max sup u∈β(x) inf w∈β(y) Φ(j)β↑(u, w), sup w∈β(y) inf u∈β(x) Φ(j)β↑(w, u)
For any two transitions u = (a, x′) and w = (a, y′) with the same prefix, the following holds:
Φ(j)β↑(u, w) = 12Φ(j)β(x′, y′)
We can apply the induction hypothesis, which states that one of the following is true:
Φ(j)β(x′, y′) = 0, which entails that Φ(j)β↑(u, w) = 0.
There exists a k ∈ N, such that Φ(j)β(x′, y′) = 2−k. This implies that Φ(j)β↑(u, w) = 2−(k+1).
Since the infima range over finite sets, their values are either 1 = 20 if the sets are empty or are one of the values from the set, which we have shown to be of the desired form. Similarly, suprema range over finite sets and are either 0 for empty sets or are on of the values from the set, which are in the desired form. Taking the maximum of values in the desired form, still results in a value in the desired form. ◀
▶ Lemma 51. Let (X, β) be a locally finite prechart and let x, y ∈ X, such that ¬(x ∼ y). There exists i ∈ N, such that Φ(i)β(x, y) = Φ(i+1)β(x, y)
Proof. Assume that for all i ∈ N, Φ(i)β(x, y) = Φ(i+1)β(x, y). Essentially, that means we have an infinite, strictly decreasing ω-cochain {Φ(i)β(x, y)}i∈I. By Lemma 50, we know that the values of the chain are either 0 or 2−k. Since all the values of the chain are nonegative, if any of it is equal to zero 0, we reach a contradiction, as the chain would have to contain values strictly below 0. Hence, we can safely assume that the chain is in the form {1, 12, 14, . . . }. But in such a case its infimum is 0, contradicting the assumption. ◀
▶ Corollary 52. Let (X, β) be a locally finite prechart and let x, y ∈ X. If bdβ(x, y) > 0, then there exists an i ∈ N, such that bdβ(x, y) = Φ(i)β(x, y)
Proof. If bdβ(x, y) > 0, we have that ¬(x ∼ y) and using Lemma 51, we know that the chain of approximants stabilises and hence the infimum of the chain is equal to the point where it stabilises. ◀
▶ Lemma 53. Let (X, β) be a prechart. For any x, y ∈ X, we have that
x ∼(k) y ⇐⇒ bdβ(x, y) ≤ 2−k
Proof. By induction on k. The base case is trivial, as we immediately have that x ∼(0) y and bdβ(x, y) ≤ 20 = 1.
For the inductive step assume that for some k′ ∈ N, the induction hypothesis holds. First, assume that x ∼(k′+1) y. Unrolling the definition of stratification of bisimilarity, we have that
If x ▷ v, then y ▷ v
If x a − → x′, then there exists y′ such that y a − → y′ and x ∼(k′) y.
and symmetrically.
We want to show that bdβ(x, y) ≤ 2−(k′+1). We can unroll the definition of bdβ and rewrite the desired result as
sup u∈β(x) inf w∈β(y) bd↑β(u, w) ≤ 2−(k′+1) ∧ sup w∈β(y) inf u∈β(x) bd↑β(w, u) ≤ 2−(k′+1)
We focus on the left hand side of the conjunction above, as the right hand side is symmetric. We are aiming to show that
∀u ∈ β(x). inf w∈β(y) bd↑β(u, w) ≤ 2−(k′+1)
Let u ∈ V. By the assumption, we know that also u ∈ B(y), which means that
inf w∈β(y) bd↑β(u, w) = 0 ≤ 2−(k′+1)
Now, let u ∈ Σ × X, i.e. u = (a, x′). By the assumption, we know that there exists y′ ∈ X, such that (a, y′) ∈ β(y) and x′ ∼(k′) y′. By induction hypothesis, we know that bdβ(x′, y′) ≤ 2−k′. Hence, we have that bd↑β((a, x′), (a, x′)) ≤ 12 · 2−k′ = 2−(k′+1). Hence, we again have that
∀u ∈ β(x). inf w∈β(y) bd↑β(u, w) ≤ 2−(k′+1)
Now, for the converse assume that bdβ(x, y) ≤ 2−(k′+1). Through a similar line of reasoning, as before, we have that
∀u ∈ β(x). inf w∈β(y) bd↑β(u, w) ≤ 2−(k′+1)
Assume that x ▷ v, i.e. v ∈ β(x). Assume that ¬(y ▷ v). That means that for all w ∈ β(y), we have that bd↑β(v, w) = 1 and hence infw∈β(y) bd↑β(v, w) = 1, which contradicts the assumption as 1 > 2−(k′+1). Hence, y ▷ v.
Now, assume that x a − → x′, i.e. (a, x′) ∈ β(y). Through a similar argument as before, we know that there must exist (a, y′) ∈ β(y), such that bd↑β((a, x′), (a, y′)) ≤ 2−(k′+1). Unrolling the definitions of bd↑β, we obtain 12 · bdβ(x′, y′) ≤ 2−(k′+1) and hence bdβ(x′, y′) ≤ 2−k′. Using the induction hypothesis, we get that x′ ∼(k′) y′ as desired. The remaining part of the proof is symmetric and hence is omitted. ◀
▶ Theorem 54. Let (X, β) be a locally finite prechart and let x, y ∈ X. The behavioural distance between x and y is given by:
bdβ(x, y) = 0 if x ∼ y 2−n if n is the largest number such that x ∼(n) y
Proof. For the first case, because of Theorem 6, if x ∼ y, then bdβ(x, y) = 0. For the converse, if bdβ(x, y) = 0, we have that x ∼(k) y for all k ∈ N and hence by [23, Theorem 2.1], it holds that x ∼ y.
In the second case, because of Lemma 51, we know that if bdβ(x, y) > 0, then the behavioural distance is equal to some element of the chain of approximants. By Lemma 50, we know that all non-zero elements of that chain are equal to 2−k, for some k ∈ N. Combining it with Lemma 53 yields the desired result. For the converse, if n ∈ N is the largest number such that x ∼(n) y, then because of Lemma 53, we have that bdβ(x, y) ≤ 2−n. Assume that bdβ(x, y) = 0. In such a case, using Lemma 53, we could conclude that x ∼(n+1) y, which would lead to contradiction. Hence, bdβ(x, y) > 0. Because of Lemma 51, we have that bdβ(x, y) is equal to some power of two. Combining that with Lemma 53 again yields the desired result. ◀
▶ Lemma 55. Let (X, β), (Y, γ) and (Z, ζ) be arbitrary precharts, such that there exist homomorphisms f : X → Z and g : Y → Z. For all p ∈ N, (x, y) ∈ X × Y, we have that if x ∼(p) y then f(x) ∼(p) g(y).
Proof. Recall that if f : X → Y is a homomorphism, then G(f) = {(x, f(x)) | x ∈ X} is a bisimulation, which implies that for all p ∈ N, x ∈ X we have that x ∼(p) f(x) [23, Theorem 2.1]. Similarly, for all p ∈ N, y ∈ Y, we have that y ∼(p) g(y). Since relations constituting the stratification of bisimilarity are all equivalence relations [23], we know that if x ∼(p) y, x ∼(p) f(x) and y ∼(p) g(y) jointly imply that f(x) ∼(p) g(y) for all p ∈ N and (x, y) ∈ X × Y, which completes the proof. ◀
▶ Theorem 8. Let Ci = (Qi, si, Di, Ei) for i = {1, 2} be finite charts. We have that bd([C1], [C2]) = 0 if s1 ∼ s2. Otherwise, bd([C1], [C2]) = 2−n, where n ∈ N is the largest such that s1 ∼(n) s2.
Proof. Immediately follows from Theorem 54 and Lemma 55. ◀
B Axioms of SMCs
= = = = = = = = =
C Semantics
▶ Lemma 56. Let f : m → n, g : n → p, h : p → q. We have that:
1. (f; g); h = f; (g; h)
2. idm; f = f
3. f; idn = f
Proof. We respectively prove each of the properties.
1.
(f; g); h = (f1[g/v], . . . , fm[g/v]); h
2. idm; f = (v1[f/v], . . . , vm[f/v]) = (f1, . . . , fm) = f
3. f; idn = (f1[v/v], . . . , fm[v/v]]) = (f1, . . . , fm) = f
◀
▶ Lemma 57. RegBeh has binary coproducts. In particular, given k, l ∈ N, the inclusions inlk,l : k → k + l and inrk,l : l → k + l are given by inlk,l = (v1, . . . , vk) and inrk,l = (vk+1, . . . , vk+l) respectively, while the mediating map is given by pairing.
Proof. Let f : k → m and g : l → m. We can safely assume that f = (f1, . . . , fk) and g = (g1, . . . , gl). Recall that inlk,l = (v1, . . . , vk) and inrk,l = (vk+1, . . . , vk+l). For the existence proof, define ⟨f, g⟩ : k + l → m as a k + l-tuple (f1, . . . , fk, g1, . . . , gl). We show that that the coproduct diagram commutes. We start from the left triangular subdiagram.
inlk,l; ⟨f, g⟩ = (v1, . . . , vk); (f1, . . . fk, g1, . . . , gl)
Similarly, for the right subdiagram, we have that:
inrk,l; ⟨f, g⟩ = (vk+1, . . . , vk+l); (f1, . . . fk, g1, . . . , gl)
For the uniqueness proof, assume that there exists a map h : k + l → m, which makes the coproduct diagram commute. We can safely assume that h = (h1, . . . , hk+l). Since inlk,l; h = f and inrk,l; h = g, we have that:
(f1, . . . , fk) = f
Similarly, we have that:
(g1, . . . , gl) = f
Hence, h = (f1, . . . , fk, g1, . . . , gl) = ⟨f, g⟩ as desired. ◀
▶ Lemma 58. 0 is the initial object of RegBeh.
Proof. For any n ∈ N, the unique universal arrow is given by 0n, which immediately completes the proof. ◀
Given f : k → l and g : m → n, we can define their separated sum f ⊕ g : k + m → l + n given by the unique mediating arrow in the following diagram
We can define f ⊕ g concretely by setting f ⊕ g = ⟨f, g[(vl+1, . . . , vl+n)/(v1, . . . , vn)]⟩.
▶ Proposition 59. (RegBeh, ⊕, 0) is a strict monoidal category.
Proof. We verify that associators and unitors are strict equalities. Let f ∈ RegBeh(k, l), g ∈ RegBeh(m, n), h ∈ RegBeh(o, p). For the left unitor, we have the following:
0 ⊕ f = () ⊕ (f1, . . . , fk) (def. of 0 and ⊕)
Similarly, for the right unitor, we have that:
f ⊕ 0 = () ⊕ (f1, . . . , fk) (def. of 0 and ⊕)
Finally, for the associator we have that:
(f ⊕ g) ⊕ h
The intermediate steps in the calculation above follow from the definition of ⊕. ◀
C.1 Conway Theories
Let C be a category with finite coproducts, whose objects are natural numbers. We call C a preiteration theory if for every morphism f : n → p + n, there exists a morphism f†n,p : n → p called dagger. We will often omit the subscripts and write f†, when n and m are clear from the context. Note that the definition does not impose any conditions on the dagger. However, f : 0 → p, when always we have that f†0,p = 0p.
▶ Definition 60 ([55, Definition 3.1]). A Conway Theory is a preiteration theory, in which the following conditions are satisfied
(Scalar parameter identity)
(f; (g ⊕ id1))† = f†; g
for all f : 1 → p + 1, g : p → q
(Scalar composition identity)
(f; ⟨idp ⊕ 01, g⟩)† = f; ⟨idp, (g; ⟨idp ⊕ 01, f⟩)†⟩
for all f, g : 1 → p + 1
(Scalar double dagger identity)
f†† = (f; (idp ⊕ ∇1))†
for all f : 1 → p + 2
(Scalar pairing identity)
⟨f, g⟩† = ⟨f†; ⟨idp, h†⟩, h†⟩
for all f : n → p + 1 + n, g : 1 → p + 1 + n where
h = g; ⟨idp+1, f†⟩ : 1 → p + 1
▶ Remark 61 ([55, Remark 3.2]). Note that in order to define a Conway theory it suffices to define f† : 1 → p for all f : 1 → p + 1 that satisfies first three axioms of Definition 60 and use scalar pairing identity to inductively define (−)†.
Because of the above, we can define a dagger on RegBeh through the following:
▶ Definition 62. Given f : 1 → p + 1 in RegBeh, we define
f† = µvp+1.f
▶ Lemma 63 ([45, Theorem 2]). Terms of Milner’s Algebra of Regular Behaviours (modulo bisimilarity) satisfy the following rules:
1. µvz. (e[(vz, vz)/(vj, vk)]) = µvj.µvk.e for any vz not free in e
2. µvj. (e[f/vj]) = e[µvx. (f[e/vj]) /vj]
▶ Corollary 64. The dagger on RegBeg satisfies scalar composition and scalar double dagger identities.
Proof. Follows from Lemma 63. ◀
▶ Lemma 65. Let f : 1 → 1 + p, g : p → g be morphisms in RegBeh. Then,
(f; (g ⊕ id1))† = f†; g
Proof.
(f; (g ⊕ id1))† = (f[(g1, . . . , gp, vq+1)/(v1, . . . , vp, vp+1)])† (Def. of ⊕)
▶ Lemma 66. Let f, g : 1 → 1 + p be morphisms of RegBeh. Then,
(f; ⟨idp ⊕ 01, g⟩)† = f; ⟨idp, (g; ⟨idp ⊕ 01, f⟩)†⟩
Proof.
(f; ⟨idp ⊕ 01, g⟩)† = f[(v1, . . . , vp, g)/v]†
And the scalar double dagger identity.
▶ Lemma 67. Let f : 1 → 2 + p be a morphism of RegBeh. Then,
f†† = (f; (idp ⊕ ∇1))†
Proof.
f†† = µvp+1.(µvp+2.f)
▶ Lemma 68. RegBeh is a Conway Theory.
Proof. Follows from Corollary 64, Lemma 66 and Lemma 67. ◀
C.2 Trace-fixpoint correspondence
Turns out, that having a category C with finite coproducts and equipped with a dagger operator satisfying the axioms of Conway Theories is synonymous with C being traced symmetr ic monoidal category. This is captured by the following theorem that was independently proved by Hasegawa [22] and Haghverdi [21]. The formulation of Hasegawa is phrased dually via the setting of products and cartesian categories.
▶ Theorem 69 ([21, Proposition 3.1.9]). For any category with finite coproducts, to give a Conway operator is to give a trace (where finite coproducts are taken as the monoidal structure).
That bijective correspondence is concretely given by the following:
f : n → p + n f† = Trnn,p(∇n; f) : n → p g : p + n → q + n Trnp,q(g) = inlp,n; (g; ⟨idq, inrq+p,n⟩)† : p → q
C.3 Int construction
Given a traced symmetric monoidal category C, we can construct a compact closed category Int(C). The objects of Int(C) are the pairs (A+, A−) of objects of C. Morphisms f from (A+, A−) to (B+, B−) are the morphisms f : A+ ⊗ B− → A− ⊗ B+ of C. The identity of any object (A+, A−) is given by the symmetry of C, namely id(A+,A−) = σA+,A−. The composition f; g : (A+, A−) → (C+, C−) of morphisms f : (A+, A−) → (B+, B−) and g : (B+, B−) → (C+, C−) is defined as
TrB−⊗B+A+⊗C−,A−⊗C+(α; (f ⊗ g); β)
in C, where α = (idA+ ⊗ σC−,B− ⊗ idB+); (idA+ ⊗ idB− ⊗ σC−,B+) and β = (idA− ⊗ idB+ ⊗ σB−,C+); (idA− ⊗ σB+,C+ ⊗ idB−); (idA− ⊗ idC+ ⊗ σB+,B−).
Int(C) is equipped with the monoidal structure. The tensor product of (A+, A−) and (B+, B−) is given by taking the tensor product of C pointwise, namely (A+ ⊗ B+, A− ⊗ B−). The unit of that monoidal product is given by (I, I), where I is the unit of the monoidal product on C. The tensor product f ⊗ g : (A+ ⊗ C+, B− ⊗ D−) → (A− ⊗ C−, B+ ⊗ D+) of f : (A+, A−) → (B+, B−) and g : (C+, C−) → (C+, C−) → (D+, D−) is given by:
f ⊗ g = (idA+ ⊗ σC+,B− ⊗ idD−); (f ⊗ g); (idA− ⊗ σB+,C− ⊗ idD+)
The dual (A+, A−)∗ of (A+, A−) is given by exchanging the components, that is by (A−, A+). Then, the unit η(A+,A−) : (I, I) → (A+, A−) ⊗ (A+, A−)∗ is a morphism σA−,A+ : A− ⊗ A+ → A+ ⊗ A−. The counit ϵ(A+,A−) : (A+, A−)∗ ⊗ (A+, A−) → (I, I) can be similarly given by σA−,A+ : A− ⊗ A+ → A+ ⊗ A− in C. Int(C) is equipped with a canonical trace, which takes a morphism f : (A+, A−) ⊗ (U+, U−) → (B+, B−) ⊗ (U+, U−) to
Tr(U+,U−)(A+,A−),(B+,B−)(f) = id(A+,A−) ⊗ η(U+,U−) ; f ⊗ id(U+,U−)∗ ; id(B+,B−) ⊗ ϵ(U+,U−)
C.4 Pseudometric structure on the semantic category
▶ Lemma 70. Let i1, . . . , im ∈ N. For all n ∈ N and for all e, f, g1, . . . , gm, h1, . . . , hm ∈ Exp/∼, we have that
e ∼(n) f ∧ j≤m j=1 gj ∼(n) hj =⇒ e[(g1, . . . , gm)/(vi1, . . . vim)] ∼(n) f[(h1, . . . , hm)/(vi1, . . . vim)]
Proof. Base case holds immediately, since we always have that e[(g1, . . . , gm)/(vi1, . . . vim)] ∼(0) f[(h1, . . . , hm)/(vi1, . . . vim)] for all e, f, g1, . . . , gj, h1, . . . , hj ∈ Exp/∼
Assume that e ∼(n+1) f, gj ∼(n+1) hj for all j ∈ {1, . . . , m}. For the successor case assume that e[(g1, . . . , gm)/(vi1, . . . vim)] ∼(n) f[(h1, . . . , hm)/(vi1, . . . vim)]. We will argue that
e[(g1, . . . , gm)/(vi1, . . . vim)] ∼(n+1) f[(h1, . . . , hm)/(vi1, . . . vim)]
To do so, we will study the operational semantics of both (equivalence classes of) expressions.
Assume that e[(g1, . . . , gm)/(vi1, . . . vim)] ▷ vk. Using Remark 40, we can observe that it is the case if any of the following is true:
e ▷ vk and vk / ∈ {vi1, . . . vij}
e ▷ vil for some vil ∈ {vi1, . . . , vij} and gl ▷ vk
Consider the first subcase. Since e ▷ vk (for some k / ∈ {vi1, . . . , vij}) and by assumption e ∼n+1 f, we have that f ▷ vk and hence f[(h1, . . . , hj)/(vi1, . . . , vij)] ▷ vk. Now, consider the second subcase. By a similar line of reasoning, we can obtain f ▷ vl and hl ▷ vk. Hence, again we have that f[(h1, . . . , hj)/(vi1, . . . , vij)] ▷ vk. In other words, we have shown that e[(g1, . . . , gm)/(vi1, . . . vim)] ▷ vk implies f[(h1, . . . , hj)/(vi1, . . . , vij)] ▷ vk. One can easily obtain a reverse implication through a symmetric proof.
Now, assume that e[(g1, . . . , gm)/(vi1, . . . vim)] a − → s. Using Remark 40, we know that such transition can be made only if any of the following is true:
s = e′[(g1, . . . , gm)/(vi1, . . . vim)], for some e′ such that e a − → e′
For some vil, such that vil ∈ {vi1, . . . , vim}, we have that e ▷ vl and gl a − → s
Consider the first subcase. We know that f a − → f′ and e′ ∼(n) f′. Using the induction hypothesis, we can conclude that
e[(g1, . . . , gm)/(vi1, . . . , vim)] ∼(n) f[(h1, . . . , hm)/(vi1, . . . , vim)]
Hence, there exists a t, such that f[(h1, . . . , hm)/(vi1, . . . , vim)] a − → t, such that s ∼(n) t.
Now, consider the second subcase. We can easily conclude that f ▷ vl and hl a − → t, with s ∼(n) t.
In other words, we have show that e[(g1, . . . , gm)/(vi1, . . . , vim)] a − → s, then there exists t, such that f[(h1, . . . , hm)/(vi1, . . . , vim)] a − → t, such that s ∼(n) t. The reverse implication can be again shown via a symmetric argument. Combining all of the above, we can conclude that
e[(g1, . . . , gm)/(vi1, . . . , vim)] ∼(n+1) f[(h1, . . . , hm)/(vi1, . . . , vim)] a − → t
◀
▶ Corollary 71. Let e, f, g1, . . . , gm, h1, . . . , gm ∈ Exp/∼. Then,
bd∂ (e[(g1, . . . , gm/(vi1, . . . vim)], f[(h1, . . . , hm/(vi1, . . . vim)]) ≤ max{bd∂(e, f), max j∈{1,...,m}{bd∂(gj, hj)}}
Proof. If the right hand side of the inequality is equal to zero, then we have that e ∼ f and gj ∼ hj for j ∈ {1, . . . , m}. We can use Lemma 36, to conclude that e[(g1, . . . , gm/(vi1, . . . vim)] ∼ f[(h1, . . . , hm/(vi1, . . . vim)] and hence bd∂(e[(g1, . . . , gm/(vi1, . . . vim)], f[(h1, . . . , hm/(vi1, . . . vim)]) = 0, which implies nonexpansivity.
If the right hand side is greater than zero, we can employ the characterisation of bd∂ from Theorem 54 and use Lemma 70 to conclude the desired result. ◀
▶ Lemma 72. Let e, f ∈ Exp/∼∂. Then, for all n ∈ N, we have that
e ∼(n) f =⇒ µvx.e ∼(n) µvx.f
Proof. Base case holds immediately, as µvx.e ∼(0) µvx.f for all e, f ∈ Exp/∼.
Assume that e ∼(n+1) f. For the successor case assume that µvx.e ∼(n) µvx.f. We will argue that µvx.e ∼(n+1) µvx.f.
Assume that µvx.e ▷ vk. It is only the case, when e ▷ vk and vk = vx. Since e ∼(n+1) f, then f ▷ vk and hence µvx.f ▷ vk. In other words, µvx.e ▷ vk implies µvx.f ▷ vk. The reverse implication can be easily obtained via a symmetric proof.
Now, assume that µvx.e a − → s. It is the case, when e a − → e′ and s = e′[µvx.e/vx]. Since e ∼(n+1) f, then there exists f′, such that f a − → f′ and e ∼(n) f. We can now use induction hypothesis and Lemma 70 and conclude that e′[µvx.e/vx] ∼(n) f′[µv.f/vx]. Moreover, we have that µv.xf a − → f′[µvx.f/vx]. Hence, if µvx.e a − → s, then there exists t, such that µvx.f a − → t and s ∼(n) t. A reverse implication can be obtained via a symmetric proof.
Combing the above, allows us to conclude that µvx.e ∼(n+1) µvx.f. ◀
▶ Corollary 73. Let e, f ∈ Exp/∼. We have that
bd∂(µvx.e, µvx.f) ≤ bd∂(e, f)
Proof. Analogous proof to Corollary 71, but utilising Lemma 72 instead. ◀
▶ Lemma 74. Let e, f ∈ Exp/∼. Then for all n ∈ N, a ∈ Σ, we have that
e ∼(n) f =⇒ a.e ∼(n+1) a.f
Proof. a.e does not output anything and so does a.f. Now, assume that a.e a − → e′. Then, the only possibility is that e′ = e. We can match that transition with an expression a.f that performs an a-labelled transition to f. Since e ∼(n) f, then a.e ∼(n+1) a.f. The remaining condition works through a symmetric line of reasoning. ◀
▶ Corollary 75. Let e, f ∈ Exp/∼. Then for all n ∈ N, a ∈ Σ, we have that bd∂(a.e, a.f) ≤ 12bd∂(e, f)
Proof. We employ the characterisation from Theorem 54. If e ∼ f, then by Lemma 36 we are done. Otherwise, we have that bd∂(e, f) = 2−k and e ∼(k)∂ f for some k ∈ N. By applying Corollary 75, we get that a.e ∼(k+1) a.f and hence bd∂(e, f) ≤ 2−(k+1) = 122−k = 12bd∂(e, f), as desired. ◀
▶ Lemma 76. Sequential composition in RegBeh is nonexpansive.
Proof. Let f, h ∈ RegBeh(n, m) and g, i ∈ RegBeh(m, k).
dn,k(f; g, h; i) = sup 1≤j≤n bd∂ (⟨fj[(g1, . . . , gm)/(v1, . . . , vm)], hj[(i1, . . . , im)/(v1, . . . , vm)])
◀
▶ Lemma 77. Let f, f′ : m → k, g, g′ : n → k be morphisms of RegBeh. We have that dm+n,k(⟨f, g⟩, ⟨f′, g′⟩) ≤ max{dm,k(f, f′), dn,k(g, g′)}
Proof.
dm+n,k(⟨f, g⟩, ⟨f′, g′⟩) = dm+n,k((f1, . . . , fm, g1, . . . , gn), (f′1, . . . , f′m, g′1, . . . , g′n))
◀
▶ Lemma 78. The coproduct in RegBeh is nonexpansive.
Proof. Let f, h ∈ RegBeh(k, m) and g, i ∈ RegBeh(l, n). Given j ∈ N, such that 1 ≤ j ≤ l, we define
g′j = gj[(vm+1, . . . , vm+n)/(v1, . . . , vn)]
Similarly, we write
i′j = ij[(vm+1, . . . , vm+n)/(v1, . . . , vn)]
Using Corollary 71 one can easily obtain that for all j ∈ N, such that 1 ≤ j ≤ l, we have that
bd∂(g′j, i′j) ≤ bd∂(gj, ij)
Using that fact, we can prove the following
dk+l,m+n(f ⊕ g, h ⊕ i) = dk+l,m+n(⟨f1, . . . , fk, g′1, . . . , g′l⟩, ⟨h1, . . . , hk, i′1, . . . , i′l⟩)
◀
▶ Lemma 79. The dagger on RegBeh is nonexpansive.
Proof. Let f, g : n → p + n be morphisms in RefBeh. We proceed by induction on n. If n = 0, then f† = f = 0p = g = g† and hence d0,p(f†, g†) ≤ d0,p(f, g).
If n = 1, then we have the following
d1,p(f†, g†) = bd∂(µvp+1.f, µvp+1.g) ≤ bd∂(f, g) (Corollary 73)
Let n = n′ + 1. Recall, that we can represent f and g in the following way
f = ⟨f1, . . . , fn′, fn′+1⟩ = ⟨⟨f1, . . . , fn′⟩, fn′+1⟩ g = ⟨g1, . . . , gn′, fg′+1⟩ = ⟨⟨g1, . . . , gn′⟩, gn′+1⟩
We can apply the induction hypothesis and obtain the following:
dn′,p+1(⟨f1, . . . , fn′⟩†, ⟨g1, . . . , gn′⟩†) ≤ dn′,n′+p+1(⟨f1, . . . , fn′⟩, ⟨g1, . . . , gn′⟩)
Using it, one can show that:
dp+1+n′,p+1 ⟨idp+1, ⟨f1, . . . , fn′⟩†⟩, ⟨idp+1, ⟨g1, . . . , gn′⟩†⟩ = dn′,p+1(⟨f1, . . . , fn′⟩†, ⟨g1, . . . , gn′⟩†)
For the sake of simplicity, let k = fn′+1; ⟨idp+1, ⟨f1, . . . , fn′⟩†⟩ and l = gn′+1; ⟨idp+1, ⟨g1, . . . , gn′⟩†⟩. Using Corollary 71 we know that:
d1,p+1(k, l) ≤ max d1,p+1(fn′+1, gn′+1), dp+n′,p+1 ⟨idp+1, ⟨f1, . . . , fn′⟩†⟩, ⟨idp+1, ⟨g1, . . . , gn′⟩†⟩
Because of the above, we can use Corollary 73 and obtain:
d1,p(k†, l†) ≤ d1,p+1(k, l) ≤ dn′,p+1+n′(f, g)
Recall the scalar pairing identity, which states that:
f† = ⟨⟨f1, . . . , fn′⟩†; ⟨idp, k†⟩⟩, k†⟩ and g† = ⟨⟨g1, . . . , gn′⟩†; ⟨idp, l†⟩⟩, l†⟩
We have that
dn′+1,p(f†, g†) ≤ max{dn′,p+1(⟨f1, . . . , fn′⟩†; ⟨idp, k†⟩, ⟨g1, . . . , gn′⟩; ⟨idp, l†⟩), d1,p(k†, l†)}
which completes the proof. ◀
▶ Corollary 80. The trace on RegBeh is nonexpansive.
Proof. Immediate consequence of Theorem 69, Lemma 76 and Lemma 79. ◀
▶ Proposition 81. Equipping each set RegBeh(m, n) of morphisms of RegBeh with a pseudometric defined above makes a sequential composition, pairing, parallel composition, dagger and trace into nonexpansive maps.
Proof. Follows from Lemma 76, Lemma 77,Lemma 78, Lemma 79, Corollary 80. ◀
Every homset Int(RegBeh)((A+, A−), (B+, B−)) of Int(RegBeh) can be equipped with a pseudometric space dA++B−,A−+B+ associated with the homset RegBeh(A+ + B−, A− + B+) of RegBeh.
▶ Corollary 82. The fully faithful functor N : RegBeh → Int(RegBeh) is an isometry on homsets.
Proof. Let f, g ∈ RegBeh(m, n). From, the definition of N, we immediately have that
dN(m),N(n)(N(f), (N(g)) = dm,n(f, g)
◀
▶ Proposition 83. The sequential and parallel composition in Int(RegBeh) is nonexpansive. Moreover, the fully faithful functor N : RegBeh → Int(RegBeh) is locally an isometry, i.e. for all f, g : m → n, we have that dm,n(f, g) = d(m,0),(n,0)(N(f), N(g)).
Proof. Immediate consequence of Corollary 80, Lemma 76, Lemma 78 and Corollary 82. ◀
D Soundness
▶ Lemma 15 (Soundness). For any two diagrams f, g : v → w of Syn, if f = g then f = g.
Proof. We verify that all equations defining Syn are satisfied. When dealing with left-to-right diagrams, we will make use of the fact that RegBeh fully faithfully embeds into Int(RegBeh) (Theorem 13) and hence it suffices to verify the axioms in RegBeh, rather then in their completion to Int(RegBeh). (A1) is satisfied because of the yanking property of trace operation defined on RegBeh, while (A2) is its dual in Int(RegBeh) and can be verified similarly. (B1), (B2) and (B3) are satisfied because + defined on Exp/≡ is a commutative monoid with 0 being its identity. Similarly, (B4), (B5) and (B6) are satisfied because of the universal property of coproduct on RegBeh and ∇1 being the codiagonal morphism. For (B8) we rely on the fact that ∇1; ⟨v1 + v2⟩ = ⟨v1, v1⟩; ⟨v1 + v2⟩ = ⟨v1 + v2, v1 + v2⟩. (B8) holds because ∇1; ⟨0⟩ = ⟨v1, v1⟩; ⟨0⟩ = ⟨0, 0⟩. (B9) is satisfied because + is idempotent. Finally, (B10) corresponds to taking the dagger of ⟨v1 + v2⟩ and captures the identity µv2.(v1 + v2) = v1 of Milner’s Algebra of Regular Behaviours. Finally, (C1) holds, because ∇1; ⟨a.v1⟩ = ⟨v1, v1⟩; ⟨a.v1⟩ = ⟨a.v1, a.v1⟩. ◀
▶ Lemma 84. All the inference rules defining the distance on Syn are satisfied in Int(RegBeh).
Proof. For most of the rules, the proof is straightforward. The soundness of (Top) follows from the fact that the distance on morphisms of Int(RegBeh) is 1-bounded, while (Max) captures the transitivity of partial order on the rational numbers. (Refl), (Sym) and (Triang) are satisfied because the distance function on each hom-set of Int(RegBeh) is a pseudometric space. (Cont) captures the Cauchy completeness of reals, while (Seq) and (Tens) are immediate consquence of Proposition 83, stating that Int(RegBeh) is PMet-enriched symmetric monoidal category. For the remaining two rules, we will make use of the fact that the fully faithful embedding N : RegBeh → Int(RegBeh) is an isometry (Section C.4), hence for the left-to-right diagrams it suffices to check the rules in RegBeh. The soundness of (Pref) is an immediate consequence of Corollary 75. Finally, (Codel) follows from the uniqueness of maps from the initial object in RegBeh. ◀
▶ Theorem 16 (Quantitative soundness). Every derivable equation f ≡ε g is valid.
Proof. Induction on the length of derivation and the usage of Lemma 84. ◀
E Completeness
▶ Lemma 85 (Trace canonical form). For any diagram d : ▶m→▶n, we can always find a relation-diagram c : ▶ℓ+m→▶ℓ+n such that
=
where ℓ denotes a vertical composite of ℓ-many generators.
Proof. The proof is the same as [39, Lemma 4.11] which only uses the axioms of SMCs. ◀
▶ Lemma 86. For any guarded matrix-diagram c : ▶ℓ→▶m and any two diagrams d1, d2 : ▶m→▶n such that
≡ϵ
we have
≡ϵ/2
Proof. We rely on the definition of guarded matrix diagrams. Recall that since c is guarded, we can factor it as
=
where c0 is a diagram composed only of , , a is a vertical composite of k generators, and c1 is a diagram composed only of , . Hence,
≡ϵ ≡0 ≡ϵ a ∈ Σk (Seq) ≡ϵ/2 ≡0 (Pref) ≡ϵ/2 (Seq)
The last line is what we wanted to show. ◀
▶ Theorem 19. Any diagram ▶m→▶n has a representation.
Proof. The proof is the same as [39, Proposition 4.7]. All axioms used in that proof are in our theory. ◀
▶ Lemma 87. For any matrix-diagram d : ▶m→▶n, we have
=
Proof. See [39, Lemma 4.9] (co-cpy). It is a simple structural induction. For the base cases, all the generators of matrix-diagrams satisfy the equality of the lemma, by axioms (B5), (B7),(B8), and (C1). The inductive cases are straightforward. ◀
▶ Lemma 20. For any matrix-diagram d : ▶n→▶n, = .
Proof.
(B7) = (A1) =
◀
▶ Theorem 22. For any diagram d : ▶m→▶n, we have that ≡0 .
Proof. First, by Theorem 19, we can find a matrix-diagram, a : ▶ℓ+m→▶ℓ+m and a relation-diagram o : ▶ℓ+m→▶ such that
=
We will show that
≡0
from which the statement of the lemma immediately follows, by pre-composing with .
Since c : m + ℓ → m + ℓ is a guarded matrix-diagram, so is
Therefore, by Lemma 86, we get
≡1/2
and thus,
We also have
≡0 ≡0 ≡0
where the last step uses Lemma 87 and (Refl) to merge the two occurrences of the matrix-diagram c. Resuming, we get
≡0 ≡0 ≡0
We can show in the same way that
≡0
Thus, we have shown that
≡1/2
In the same way, we can show that
≡2−n
for any n ∈ N and thus, by the continuity axiom (Cont), we conclude that
≡0
as we wanted to show. ◀
▶ Lemma 88. Let e, f : ▶→▶n, such that e = N(s) and f = N(d), where s, t ∈ RegBeh(1, n). We have that
= N (⟨s, t⟩)
Proof.
= (N(s) ⊕ N(f)); N(∇1)
◀
▶ Lemma 89. Let e1, e2, f1, f2 : ▶→▶n. We have that
dN(2),N(n) ,
Proof. Since e1, e2, f1, f2 are left-to-right diagrams, we can safely assume that there exist s1, s2, t1, t2 ∈ RegBeh(1, n) such that c1 = N(s1),c2 = N(s2),d1 = N(t1). We have the following
dN(2),N(n) ,
◀
Let F = {fi : ▶→▶n}i∈I be an indexed collection of string diagrams. Given a finite indexed collection A = {fi1, . . . , fik}k∈K ⊆ F of string diagrams from the set F, we define its convolution to be the string diagram RA : ▶→▶n given by
If two finite indexed collections A and B of elements of F are equivalent modulo ACI (Associativity, Commutativity, Idempotence) then their convolutions are at distance zero from each other. Hence, given a finite subset of F we can unambiguously talk about its convolution.
▶ Lemma 90. Any two finite indexed collections A = {fi1, . . . , fik}k∈K and B = {gi1, . . . , gik}k∈K that are equal as sets, then their convolution are at distance zero from each other.
Proof. It is enough to show that the convolution of two string diagrams is an associative, commutative and idempotent operation (up to ≡0).
Associativity: For any f1, f2, and f3, we have
=
Commutativity:
=
Idempotence:
≡0 (Lemma 22)
◀
▶ Lemma 24. For any two c, d : ▶→▶n, we have that = e + f .
Proof. First, since c and d are left-to-right, there exists expressions s, t ∈ RegBeh(1, n), such that c = N(s) and d = N(t). Then,
= ; (c ⊕ d);
◀
▶ Lemma 91. For any diagram f : ▶m→▶n, if
≡0
for some guarded matrix-diagram c : ▶ℓ+m→▶ℓ+m and a relation-diagram o : ▶ℓ+m→▶n, then, for all i ∈ {1, . . . , m} we can find {aj, fij}1≤j≤k, and {vqj}1≤j≤ℓ such that
≡0
where fi, 1 ≤ i ≤ m and vqj, 1 ≤ i ≤ ℓ are defined as above.
Proof. First, by unrolling (Lemma 20),we have
≡0 ≡0
Thus, for any i ∈ {1, . . . , m}, say i = m for simplicity, we get
≡0 ≡0
where cim is either for some a ∈ Σ, when there is an a-transition connecting its only input wire to some fj, or otherwise (recall that c is guarded), and oim is either an identity, when the only input of om is connected to some output wire, or otherwise. Since all fj connected to some can be removed (using co-deleting), we get the equality we wanted. ◀
▶ Lemma 25. For any diagram f : ▶m→▶n and fi, 1 ≤ i ≤ m defined as above, for all i ∈ {1, . . . , m}, we can derive
≡0
where, for 1 ≤ j ≤ ℓ, each vqj : ▶→▶n is a diagram encoding the output variables to which the i-th input wire of f is directly connected, that is, without going through any generator (in particular, each vqj is a monoidal product of a single identity with n − 1 generators).
Proof. Follows from Theorem 19 and Lemma 91. ◀
▶ Lemma 92. For any f : ▶m→▶n and fi, 1 ≤ i ≤ m defined as above, for all i ∈ {1, . . . , m}, we have that
fi = k j=1 aj. fij + ℓ j=1 vqk if ≡0
where, for 1 ≤ j ≤ ℓ, each vqj : ▶→▶n is a diagram encoding the output variables, as defined in Lemma 25.
Proof. This is a consequence of Lemma 24. ◀
▶ Remark 93. Let F be a set of string diagrams of the type ▶→▶n. The set Σ × F + Vn is isomorphic to the set
G = | a ∈ Σ, fj ∈ F ∪ | 1 ≤ s ≤ n
▶ Lemma 94. Let F be a set of string diagrams of the type ▶→▶n that is equipped with a 1-bounded pseudometric dF : F × F → [0, 1]. Assume that for all fi, fk ∈ F, ε ∈ Q≥0, such that dF(fi, fk) ≤ ε, we have that ≡ε is derivable. For all gu, gv ∈ G, with G defined as above and all ε ∈ Q≥0, such that d↑F(gu, gv) ≤ ε, we have that ≡ε is derivable.
Proof. Let ε ≥ d↑F(gu, gv). First, consider the case, when = and = . We have that d↑F(gu, gv) = 12dF(fi, fk) and hence 2ε ≥ dF(fi, fk). By the assumption, we know that ≡2ε is derivable. Using (Pref), we can derive ≡ε , which is the same as ≡ε . In all the remaining cases, d↑F behaves like a discrete pseudometric, hence there are two remaining subcases. In the situation when = , we have that d↑F(gu, gv) = 0 and hence we can derive ≡ε by first applying (Refl) and then (Max). Othwerise, when = , we have that d↑F(gu, gv) = 1 and hence we can derive ≡ε by first applying (Top) and then (Max). ◀
▶ Lemma 95. Let F be a finite set of string diagrams of the type ▶→▶n that is equipped with a 1-bounded pseudometric dF : F × F → [0, 1]. Assume that for all fi, fk ∈ F, ε ∈ Q≥0, such that dF(fi, fk) ≤ ε, we have that ≡ε is derivable. Then, for all A, B ⊆ F and all ε ∈ Q≥0, such that H(dF)(A, B) ≤ ε, we have that ≡ε is also derivable.
Proof. Pick an arbitrary ε ∈ Q≥0, such that H(dF)(A, B) ≤ ε. If A = B = ∅, then by the usage of (Refl) and (Max) we are done. Similarly, when only one of A and B is empty, that we can immediately obtain the desired result using (Top) and (Max) rules. From now on, we can safely assume that A and B are nonempty. Recall the characterisation of Hausdorff distance from Remark 42. One can easily observe that in the case when A and B are nonempty, the set Γ(A, B) of relational couplings between A and B is nonempty and hence
H(dF)(A, B) = min sup (fi,fk)∈R dF(fi, fk) | R ∈ Γ(A, B) ≤ ε
There must exist some optimal coupling Rmin ∈ Γ(A, B), which witnesses the above minimum. Hence, we have that sup(fi,fk)∈Rmin dF(fi, fk) ≤ ε, which in turn implies that dF(fi, fk) ≤ ε for all (fi, fk) ∈ Rmin. Using the assumption, we know that for all pairs (fi, fk) ∈ Rmin, we have that
≡ε
For the sake of simplicity, assume that Rmin = {(fi1, fk1), . . . , (fij, fkj)}. Using the (Tens) rule we can stack in parallel all these pairs and obtain:
≡ε
Using the (Seq) rule, we can derive that
≡ε
From the definition of relational couplings, we have that π1(Rmin) = A and π2(Rmin) = B and hence the diagrams above are convolutions of the sets A and B respectively. This allows us to conclude that ≡ε is derivable. ◀
▶ Lemma 28. Let f : ▶m→▶n, fi, 1 ≤ i ≤ m and (Qf, β) be defined as above. For all fg, fh ∈ Qf, all p ∈ N and any ε ≥ Φ(p)β(fg, fh), we have that ≡ε is derivable.
Proof. Pick an arbitrary fg, fh ∈ Qf. By induction on p. When p = 0, Φ(p)β is a discrete pseudometric on the set Qf and hence for all ε ≥ Φ(p)β(fg, fh), we can derive ≡ε using (Refl), (Top) and (Max) rules, similarly to the proof of Lemma 94. For the induction step, when p = p′ + 1. Recall that Φp′+1β(fg, fh) = H Φ(p′)β↑ (β(fg), β(fh)). Pick an arbitrary ε ≥ H Φ(p′)β↑ (β(fg), β(fh)). In order to derive that ≡ε , we will rely on Lemma 95. In order to use it, we need to be able to derive approximations to the distance given by Φ(p′)β↑ on the string diagrams representing the elements of the set Σ × Qf + Vn (see Remark 93). For this we will use Lemma 94, which requires that for all fg′, fh′ ∈ Qf, ε′ ≥ Φ(p′)β one can derive that ≡ε′ . This in turn is guaranteed by the induction hypothesis, which completes the proof. ◀
▶ Corollary 96. A function mapping each state fi ∈ Qd to fi is a prechart homomorphism from (Qd, β) to Ω
Proof. Immediately follows from Lemma 92 and the definition on transition structure on Exp/∼ (given by Lemma 37). Essentially, homomorphisms are maps that preserve and reflect prechart transitions [42, Example 2.1] and (Qd, β) is precisely defined to satisfy this. ◀
▶ Lemma 26. For all fi, fj ∈ Qf, we have that bdβ(fi, fj) = bd(fi , fj)
Proof. Follows from Corollary 96 and Theorem 6. ◀
▶ Lemma 29. Let f : ▶m→▶n and fi, 1 ≤ i ≤ m be defined as above. For all g, h ∈ {1, . . . , m}, any valid equation ≡ε is derivable.
Proof. Let ≡ε be valid, that is bd∂(fg , fh) ≤ ε. We will rely on (Cont) rule. In order to deduce that ≡ε we need to show that for all ε′ > ε, we have that ≡ε′ is derivable. Since ε′ > ε, we have that bd∂(fg , fh) < ε′. Because of Lemma 26 and Corollary 49, we have that
inf p∈N Φ(p)β(fg, fh) < ε′
We will argue that there exists p ∈ N, such that Φ(p)β(fg, fh) < ε′. For the sake of an argument, assume that for all p ∈ N, we have that Φ(p)β(fg, fh) ≥ ε′. This would make ε′ into the lower bound of the ω-cochain Φ(p)β(fg, fh)p∈N and hence ε′ ≤ infp∈N Φ(p)β(fg, fh) < ε′, which leads to contradiction. Combining that argument with Lemma 28 allows us to conclude that ≡ε′ is derivable, which completes the proof. ◀
▶ Theorem 30. Let f, g : ▶m→▶n. Any valid equation ≡ε is derivable.
Proof. Assume that ≡ε is valid. Recall that because of Lemma 23, we have that
≡0 and ≡0
Assume that fi = N(si) and gi = N(ti) for 1 ≤ i ≤ m. Because of Lemma 89, we have that d1,n(si, ti) ≤ ε. We will consider the following diagram
≡0
Using Lemma 25, we can show that each of the ▶→▶m subdiagrams is in the form allowing to use Lemma 29. In turn, that lemma allows to derive any valid equations between the subdiagrams mentioned above. In particular, we can derive that ≡ε for all 1 ≤ i ≤ m. We can use (Tens) rule to derive
≡ε
We can then apply (Seq) to postcompose co-copying to the diagrams above to obtain
≡ε
By previous reasoning and (Triang) rule this is the same as
≡ε
which completes the proof. ◀
▶ Lemma 18. There are bijections between the sets Syn(v1 ◀ v2, w) and Syn(v1v2, w ▶), and between Syn(v, w1 ◀ w2) and Syn(v ▶, w1w2), i.e. between sets of string diagrams of the form
and as well as between and
where v, w, vi, wi are words over {▶, ◀}.
Proof. The lemma holds in any compact closed category and relies on the ability to bend wires using and . Explicitly, given a diagram of the first form, we can obtain one of the second form as follows:
→
The inverse mapping is given by the same wiring with the opposite direction. That they are inverse transformations follows immediately from the defining axioms of compact closed categories (A1-A2).
→ (A1) =
The other bijection is constructed analogously. ◀
Intuitively, Lemma 18 tells us that we can always bend incoming wires to the left and outgoing wires to the right to obtain a ▶m→▶n diagram from any given diagram. Let S(f) : ▶m→▶n be the diagram obtained by applying the bijections of Lemma 18 to a diagram f : v → w until all the objects occurring in its domain and codomain are ▶.
▶ Lemma 97. Given two diagrams f, g : v → w, S(f) = S(g) iff f = g.
Proof. The idea is that, if S(f) = S(g), we can always show that f = g using a similar derivation, by simply applying the transformation of Lemma 18 before using the derivation that S(f) = S(g), and then recover the original orientation of the wires by bending them back into their original place afterwards; and the same idea applies to show that f = g implies S(f) = S(g). ◀
▶ Theorem 31 (Quantitative completeness). Let f, g : v → w be two arbitrary diagrams. Any valid equation ≡ε is derivable.
Proof. It is not too hard to see that a mapping f → S(f) is an isometry. Namely, given a pair f, g : v → w we obtain S(f) and S(g) by postcomposing (or precomposing ) which because of Proposition 83 preserves distances. Hence, if ≡ε is valid, so is ≡ε . The rest follows as a consequence of Theorem 30. ◀