Graphical Language with Delayed Trace: Picturing Quantum Computing with Finite Memory
aa r X i v : . [ qu a n t - ph ] F e b Graphical Language with Delayed Trace:Picturing Quantum Computing with Finite Memory
Titouan Carette
Universit´e de Lorraine,CNRS, Inria, LORIAF 54000 Nancy, FranceEmail: [email protected]
Marc de Visme
Universit´e de Lorraine,CNRS, Inria, LORIAF 54000 Nancy, FranceEmail: [email protected]
Simon Perdrix
Universit´e de Lorraine,CNRS, Inria, LORIAF 54000 Nancy, FranceEmail: [email protected]
Abstract —Graphical languages, like quantum circuits or ZX-calculus, have been successfully designed to represent (memory-less) quantum computations acting on a finite number of qubits.Meanwhile, delayed traces have been used as a graphical way torepresent finite-memory computations on streams, in a classicalsetting (cartesian data types). We merge those two approachesand describe a general construction that extends any graphicallanguage, equipped with a notion of discarding, to a graphicallanguage of finite memory computations. In order to handlecases like the ZX-calculus, which is complete for post-selectedquantum mechanics, we extend the delayed trace formalismbeyond the causal case, refining the notion of causality forstream transformers. We design a stream semantics based onstateful morphism sequences and, under some assumptions, showuniversality and completeness results. Finally, we investigate thelinks of our framework with previous works on cartesian datatypes, signal flow graphs, and quantum channels with memories.
I. I
NTRODUCTION
Motivations.
Several graphical languages have been success-fully developed for representing finite dimension quantumprocesses. The quantum circuits and the ZX-calculus arethe main examples of such graphical languages. The ZX-calculus is equipped with a complete equational theory [1],[2], that allows, among other applications, to perform circuitoptimization [3], [4], and to design fault tolerant computations[5], [6]. These graphical languages have been designed forfinite-dimension quantum mechanics: each wire represents afinite system – generally a qubit – as a consequence, a finitediagram can only represent a finite dimension quantum evolu-tion. Notice that using the scalable construction [7], one canrepresent finite registers, with the possibility to split and mergeregisters. This construction makes the representation morecompact but it remains a representation of finite dimensionquantum computations.There is a fundamental reason for this restriction: finitedimension Hilbert spaces, contrary to infinite dimension ones,form a compact closed category, and the compact closure isthe cornerstone of graphical languages like the ZX-calculus.To go beyond finite registers, we explore in this paper thedesign of graphical languages for quantum stream transforma-tions, i.e. , computations taking (infinite) sequences of quantuminputs to (infinite) sequences of quantum outputs. Intuitively atransformation acting on a stream of qubits, inputs a qubit and | i ... | i Fig. 1:
Left:
A cascade of CNots on a stream of qubits.At the first tick, a CNot is applied: the control qubit is inthe | i state, the target qubit is the first qubit of the inputstream. The control qubit is then outputted and the targetqubit stored in the memory. At the second tick the stored qubitbecomes the control qubit and the second qubit of the inputstream becomes the target qubit and so on. Right:
An informalunfolded version of the cascade of CNots. outputs a qubit at each clock tick. In order to allow interactionsbetween systems inputted at distinct clock ticks, a memorymechanism is required to store some data across the ticks.Such a quantum transformation is called a quantum channelwith memory in [8].We choose to graphically represent the memory mechanismusing delayed traces , i.e. , feedback loops that store qubits fromclock tick to the next. The example consisting in applying aCNot gate on consecutive qubits of a stream is given in Fig.1. Delayed traces have been studied [9] as a constructionwhich can be applied to any cartesian category. We explorethe extension of this construction to the quantum case, sincea quantum graphical language, from a category point ofview, form a category which is symmetric monoidal but notcartesian.Depicting finite memory quantum computations on streamsdoes not provide a universal model of quantum computation.It is however an interesting fragment to explore, strictly moreexpressive than memory-free languages designed for finiteregisters, and an intermediate scale model potentially easier toimplement using quantum technologies available in the shortterm, than a universal quantum computer. Contributions.
We introduce a general construction that ex-tends any (not necessarily quantum) graphical language G equipped with a discarding map, to a graphical language ω with finite memory acting on streams. The constructionconsists in adding a delayed trace to model the memory, aswell as stream constructors and destructors.A key property of the construction is that the delay onlycommutes with causal transformations. Indeed, applying a noncausal transformation before storing a system can producesome side effect on the output at tick k which would occuronly at tick k + 1 if the transformation is applied later on.Moreover, the infinite nature of the computation requires theintroduction of a coinduction principle, to show for instancethat storing forever a system in a memory and never use it, isequivalent to discard this system right away.We introduce the finite approximations of a G ω -diagram D as a sequence of G -diagrams: the k th diagram of the sequencerepresents the behavior of D from the initial to the k th tick.The semantics of a G ω -diagram is then defined as the sequenceof interpretations of its finite approximations.When an evolution is causal ,its k th approximation can be obtained from the ( k + 1) th approximation by discard the last outputs. This property wit-nesses the fact that the state of the first k outputs should onlydepends on the first k inputs. This is however not the case withnon-causal evolutions, and in particular post-selected quantumevolutions ( i.e. , quantum evolutions where one can freelychoose the classical outcomes of the measurements). Post-selected evolutions can be represented in several graphicallanguages including the ZX-calculus. As a consequence, weintroduce a new monotonicity condition for finite approxima-tions.The monotonicity conditions allow us to identify the finiteapproximations that can be represented in G ω . In particular,these evolutions should satisfies some additional regularitycondition, which corresponds to the fact that they can beimplemented with a finite memory.Finally, we also show the completeness of the language,up to some additional assumptions which are satisfied in thequantum case. Related works.
In [9], a delayed trace construction is intro-duced for the classical case (cartesian data type), we extendthe construction to the non cartesian case. Moreover weaxiomatize, using a graphical language, the delayed traceconstruction. A categorical formulation of delayed traces asinfinite combs as also been proposed by [10] but again, onlyin the cartesian or semi-cartesian case.In categorical quantum mechanics, ! -boxes [11] and thescalable construction [7] can be used to represent an infinitefamily of diagrams at once, and thus a computation acting ona finite but unbounded number of qubits. There is howeverno notion of stream or memory. Since infinite dimensionHilbert spaces are not compact closed there are few attemptsof graphical languages in infinite dimensions [12], [13] –notice the work of [14] based on non standard analysis.Nevertheless, our construction preserves compact structures.There is no contradiction here, our scalars are not complexnumbers but sequences of complex numbers. Thus, the relevant way to interpret our construction in the categorical quantummechanic setting would be to consider finitely generated C N -modules instead of infinite dimensional vector spaces over C .In quantum computing, quantum channels with memoryand quantum cellular automata [15], [16] are examples ofcomputational models with an infinite number of qubits.Notice that typical results in this field are structure theoremswhich state for instance that that if an evolution is translationinvariant and causal then it can be decomposed into a series oflocal operations. In section VI-C, we discuss the connectionbetween the structure theorem of [8] and the diagrams of G ω .Delayed traces as been used in [17] to axiomatized rationalstreams. They rely heavily on the properties of linear streamsproviding a semantics in terms of formal Laurent series. Thisis the only example we know of previous works on delayedtrace in the compact closed, hence non semi-cartesian, setting.We discuss the links with our formalism in VI-E. Structure of the paper.
We present in Section II some pre-liminaries on quantum computation, describing how quantumstates are represented and the preexisting graphical languageof quantum circuits. We then explore the different notions thatnaturally arise when we add memory to quantum circuits.In Section III, we rely on the intuitions coming from thequantum case and work at a much greater level of generality:for every graphical language G , we define the graphicallanguage G ω which manipulates both single inputs and streamsof inputs, and allows for the storage of information throughtime.While diagrams of G ω are finite, we study in Section IVtheir infinite unfoldings into stateful morphisms sequences[9], and show an equivalence between those sequences thatare ultimately constants, and the diagrams of G ω . Thoseunfoldings are a major intermediate step for the definition ofthe semantics of diagrams of G ω .In Section V, we explain how to build a semantics for G ω from a semantics for G , and show that under somereasonable assumptions, this semantics is complete , meaningthat the rewriting rules of our language generate all the soundrewriting rules, and universal , meaning that the generators ofour language generate all the (regular) stream processes.At last, in Section VI, we explore the applications of theconstruction, in particular for the ZX-calculus. We also presenta fragment of our graphical language, G ω , which matches moreclosely with the preexisting works. In this fragment, one isforced to behave uniformly through time, and operations suchthat “changing the third element of a stream” are not possible.All the proofs can be found in Appendix A.II. F INITE M EMORY Q UANTUM C OMPUTING
In this section, we review various notions of quantumcomputing and motivate by examples the kind of computationsthe language presented in the next section is designed torepresent. . Completely Positives Maps
We use the density matrix formalism of finite dimensionalquantum mechanics over qubits, see [18] for a more completepresentation. We have a symmetric monoidal category
CPM of generalized quantum processes over qubits. The objects arethe sets of linear operators of the form M n × n ( C ) represent-ing systems of n qubits. The morphisms are the linear mapsthat are completely positive. Among those maps only the tracepreserving ones correspond to real physical transformations,we write this subcategory CPTP . The state of a n -qubit sys-tem is a density matrix i.e. a map C → M n × n ( C ) , whichis positive semi-definite Hermitian and has unit trace. Usingthe Dirac notations | i := (cid:18) (cid:19) , | i := (cid:18) (cid:19) , h | := (cid:0) (cid:1) , and h | := (cid:0) (cid:1) , the two classical states of a qubit are the densitymatrices | ih | and | ih | .The monoidal product is the tensor product of vectorspaces M n × n ( C ) ⊗ M m × m ( C ) ≃ M n + m × n + m ( C ) .The symmetry maps are the exchange maps ρ ⊗ ν ν ⊗ ρ .We denote f † the Hermitian adjoint of a completely positivemap. A map is said to be an isometry if f † ◦ f = id .A quantum process is said pure if it is of the form ρ V ρV † with V ∈ M m × n ( C ) . A measurement whichmaps ρ to | ih | ρ | ih | + | ih | ρ | ih | , is an example of non-pure evolution. In CPM , we can also represent post-selected measurements, those are non physical processes where weassert that a measurement gave a chosen outcome. For in-stance, choosing the outcome | ih | corresponds to the postselected measurement ρ
7→ h | ρ | i . Let the discard map be def = ρ T r ( ρ ) , which corresponds to measuring a qubitand forgetting the result. A quantum evolution f is causal if ◦ f = , intuitively causal evolutions are side-effect free.This discard is not pure and can even be seen as the essenceof all impurity in the following sense: for any completelypositive map f : A → B there is a system C and a puremap p : A → B ⊗ C such that f = ( id B ⊗ C ) ◦ p . In thissituation p is said to be a purification of f . Purifications arenot unique, in fact they are up to isometries: Theorem 1 (Stinespring dilation [19]) . Given two purifica-tions p : A → B ⊗ C and p ′ : A → B ⊗ C ′ of the samecompletely positive map f : A → B , then, either there is anisometry v : C → C ′ such that p ′ = ( id A ⊗ v ) ◦ p , either thereis an isometry v ′ : C ′ → C such that p = ( id A ⊗ v ′ ) ◦ p ′ .B. Quantum Gates We represent the maps of
CPTP as gates in circuits. This isan example of graphical language that will be formally definedin the next section. The composition corresponds to plugginggates and the tensor product to putting them side by side. Notethat usually quantum circuits cannot represent CPM in fullgenerality, other graphical language like the ZX-calculus havebeen designed for this. We only present a few gates, takenboth from the quantum circuits and ZX-calculus, that we willuse in examples. = | ih | = ρ T r ( ρ )= (cid:18) (cid:19) = ρ
7→ h | ρ | i The first gate takes no input and produce the pure state | ih | . The second is the discard map and the third producesthe maximally mixed states. The fourth gate is the post-selected measurement selecting the outcome | ih | . We alsohave gates acting on more than one qubit: = 12 = ρ ⊗ ν ν ⊗ ρ = ρ ρ The first state is a
Bell pair . This state is entangled, meaningit cannot be written as the tensor product of two one-qubitstates. We can even say that it is the maximally entangledstate in the sense that discarding one qubit of the pair turns theother into the maximally mixed state. The swap exchanges twoqubits and the CNot gate is a pure map acting as | x i ⊗ | y i 7→| x i ⊗ | x ⊕ y i on the computational basis. We are now readyto provide concrete examples of quantum computation withmemory. C. Quantum Computation with Memory
In order to go beyond quantum computation acting on afinite register of qubits, it is natural to consider streams ofqubits: we consider a global clock, such that at each clocktick some qubits are inputted. For allowing interactions acrossclock ticks, like applying a CNot on two qubits inputted atdistinct clock ticks, a memory mechanics is required to storea qubit and intuitively wait for another qubit to be available.Quantum channels with memory, introduced by Kretschmannand Werner [8], can be informally depicted as follows: f f f c l o c k ti k s inputs outputs . . . memory ...... Thus the behavior of the computer at clock tick k > is a quantum process f k : A k ⊗ M k − → B k ⊗ M k , with M def = C . Following the terminology for such processes inthe classical case [9], we call such collection of processesa stateful morphism sequence . We give the example of acascade of CNots gates (see Fig. 1). At first clock tick the In [8], the authors mainly consider the case of a clock without initializa-tion, i.e. , clock ticks in Z rather than N ≥ emory is initialized with | ih | . At each clock tick, a CNotis applied, the control qubit being the memory qubit and thetarget being the input qubit. Finally, the memory qubit isoutputted and the input qubit is stored in the memory. Thecorresponding stateful morphism sequence is:...... A A A ... B B B f : f : f : ...In practice, one cannot access the whole infinite computa-tion at once, but only what has been computed up to someclock tick k . To stop the computation of a stateful morphismat clock tick k , we discard the memory system M k and obtain,by plugging the memories, a process k N i =1 A i → k N i =1 B i calledthe finite approximation at clock tick k . For the cascade ofCNot the sequence of finite approximations is: A B B A A B B A A A B B A k B k B A A ... B k A stateful morphism sequence leads to a unique sequenceof finite approximations. However, two different stateful mor-phism sequences can have the same sequence of finite ap-proximations, they are then said observationally equivalent .In Section IV, we characterize the observationally equivalentstateful morphism sequences.
D. Finite Approximations and Causality
An other important question is to characterize the sequenceof finite approximations that can be produced by a statefulmorphism sequence. A first guess is that there are exactly thesequences for which the behavior at clock tick k does notdepend on what happens at the clock ticks k < n . In otherwords, the present only depends on the past and not on thefuture. More formally, given a sequence of finite approxima-tions ( f k ) k> with f k : A ⊗ . . . ⊗ A k → B ⊗ . . . ⊗ B k , thecondition is, for any k > , f k +1 ... ... = f k ... ... This condition is called causality in the classical setting [9],and one-way signaling in the context of categorical quantummechanics [20] since causality as a different meaning (seesection V-A). This condition is also at the heart of the quantumchannels with memory in [8].This one-way signaling condition characterizes the se-quences of finite approximations produced by sequences of causal stateful morphisms. In particular, this notion is welladapted to
CPTP where all morphisms are causal. However,we aim at considering sequences of non causal stateful mor-phisms, like in CPM . As a consequence, we need to introducea weaker monotonicity condition to encounter the non causalcase. Useful examples of non-causal evolutions are the post-selected quantum evolutions.In post-selected quantum mechanics the present can dependon the future in a very specific way. It might happen thatwaiting gives us more information on a given state, forexample turning a mixed state into a pure one. An example isgiven by the following post-selection protocol (see Example2 in Section III-D for a pictorial description using a delayedtrace): at each clock tick, a post selected measurement of thememory is performed (except at the very first clock tick), thena new Bell pair is produced. One of the qubit of the pair isdirectly outputted while the other one is stored in the memory.The corresponding stateful morphism sequence is:...... A A A ... B B B f : f : f : ...Notice that we have = , indeed the post selectedmeasurement is actually implemented by a linear map, hencethe scalar = 1 / which is witnessing the fact that anactual measurement produces this particular outcome withprobability / .The finite approximations of this protocol are: B B B B B B B ... B k − B k (cid:0) (cid:1) k − k We see that if we stop at tick k , we have no informationon the k th output, it is the maximally mixed state. Howeverat tick k + 1 , the post-selection will force the k th output tobe | ih | . In a sense, the future can precise the present. Toformalize this we use the Loewner order defined on densitymatrices as ρ ⊑ ν if ν − ρ is positive semi-definite. It can beextended naturally to maps by f ⊑ g if g − f is completelypositive. The Loewner order characterizes what it means for astate to be more precise than another. Since the morphisms of CPM can also be trace increasing, we consider a lax-versionof the Loewner order: f (cid:22) g if ∃ λ ∈ R such that f ⊑ λg . Wewill show in Section V that the monotone sequences of finitepproximations, i.e. , such that ∀ k > , f k +1 ... ... (cid:22) f k ... ... are exactly the ones that approximate the stateful morphismsequences in CPM . E. Regularity and Finite Memory
Among all the possible stateful morphism sequences, wefocus on the regular ones, i.e. , those that are eventuallyconstant: a stateful morphism sequence ( f k ) k> is regularif ∃ n, ∀ k > n, f k = f n . Notice in particular that regu-lar stateful morphism sequences use a bounded amount ofmemory. Hence, it represents quantum computations actingon an unbound number of inputs but with a finite memory.This model is not a universal model of quantum computation,it is however an interesting fragment to explore, and anintermediate scale model potentially easier to implement thana universal quantum computer using technologies which willbe available in a near future.Intuitively, regular stateful morphism sequences can befinitely described as they are eventually constant. In the nextsection, we introduce a graphical construction which turns anygraphical language equipped with a discard, and acting onfinite registers, into a graphical language for regular statefulmorphism sequences, i.e. , in the quantum case, a languagefor representing and reasoning about finite-memory quantumstream computation.III. T HE C OLORED G RAPHICAL L ANGUAGE G ω In this section we define the syntax of our language. Wefirst set the string diagram notation and then, starting witha graphical language G describing computations we define acolored prop G ω which depicts computation with memory. A. String Diagrams
We use the framework of props. A prop is a small sym-metric strict monoidal category whose monoid of objects isfreely spanned by one element denoted . Representing thetensor additively, every object is then of the form · · · + 1 and therefore denoted n . The unit of the tensor is . Thecategories CPTP and CPM from the previous section areequivalent to props . A colored prop is a small symmetricstrict monoidal category whose monoid of objects is freelyspanned by a set C of colors. Each object can then be writtenas a list c + · · · + c k of colors. The string diagram notationrepresents arrows as boxes with colored wires as inputs andoutputs. Given a {• , • , • , •} -colored prop P with the arrows F : • + • → • + • , G : • → • , H : • → • and the swap map σ • , • : • + • → • + • we write: CPTP and CPM can be turned into props by defining the objectsto be natural numbers and the morphisms n → m to be the linear maps M n × n ( C ) → M m × m ( C ) . F HG GHF H ◦ G G ⊗ H σ • , • We say that a colored prop has a compact structure whenfor each color • there are two arrows : 0 → • + • and : • + • → , satisfying the following equations: = = = = The monochromatic prop
CPM admits a compact structurebut not CPTP . Referring to string diagrams we will often say graphical language for a monochromatic prop and coloredgraphical language for a colored prop. We write Γ ⊢ D = K when we can rewrite the diagram D into the diagram K usingthe rewriting rules Γ .To define the finite approximations, we need a way toexpress the lost of the data stored in the memory when westop the computation, in other words we need a discard map. Definition 1 (Discard) . A discard prop is a prop P wherewe fix a discard map : 1 → . We denote def = id and a + b def = a ⊗ b . In a discard prop a morphism C : a → b is said causal if: C = In what follows we consider only monochromatic discardprops.
CPTP and CPM are both discard. In CPTP allmaps are causal while in CPM the causal maps are exactlythe ones from CPTP . Let G be a monochromatic discardgraphical language defined by generators and equations. Webuilt a colored graphical language G ω representing streamtransformers. B. Type System
The colors of the colored prop G ω are given by: C def = 1 | ω | ♦ C A way to interpret the types is to consider a global clockthat starts at the beginning of the computation. The typerepresents the basic data processed by G . We keep in G ω allthe generators and equations of G . This yields an inclusionfunctor ι : G → G ω that we will keep implicit most of thetime. A wire of type sends one unit of data at tick andnothing after. The tensor unit is denoted .The ω type represents a stream of basic data. A wire oftype ω sends one unit of data at each tick. We write nω for astream of n -tuples of data, i.e. , ω + . . . + ω n -times, with theconvention ω def = ω and ω def = 0 . For each generator g : n → m in G we define a generator ωg : nω → mω in G ω . This givesa functor ω : G → G ω .The delay modality ♦ can be applied on any color toproduce a delayed color. We write ♦ n C for the color C delayed n times: ♦ C = C , ♦ n def = 0 and ♦ n +1 C = ♦ ( ♦ n C ) .A wire of type ♦ n sends one unit of data at tick n + 1 butothing before or after that tick. A wire of type ♦ n ω sendsnothing until tick n +1 and then sends one unit of data at eachtick. The delay modality is extended to tensors of colors bysetting ♦ ( S + T ) = ♦ S + ♦ T . For each generator g : a → b we have a delayed generator ♦ g : ♦ a → ♦ b . This then extendsto an endofunctor ♦ : G ω → G ω .We see that G is a subcategory of G ω in various ways givenby the functors ♦ n ◦ ι : G → G ω and ♦ n ◦ ω : G → G ω .As an example of how the type system works, a finite streamof size sending two units of data at each tick for the first ticks would have type: ♦ ♦ ♦ ♦ ♦ ♦ . Here we see that the tensor is used to encodeat the same time spatial and temporal juxtaposition. C. Initialization and Derivative
To manipulate streams we add to G ω two dual operators: : ω → ♦ ω : 1 + ♦ ω → ω stream derivative stream initialization The derivative decomposes a stream into one data at firsttick and a delayed stream which corresponds to the usualstream derivative. The initialization takes a delayed streamand add a data at the beginning to make it undelayed. Theyinteract according to: ( ⊲⊳ ) = and ( ⊳⊲ ) = .They also satisfy a distribution rule with all the delayedomega generators: ωG ......... ... ( ◮ ) = ......... ιG ♦ ωG ......The dual equation ( ◭ ) for derivatives is also true andfollows from ( ⊳⊲ ) , ( ⊲⊳ ) and ( ◮ ) . Like all generators in G ω ,initialization and derivative admit delayed versions of types ♦ n ω → ♦ n ♦ n +1 ω and ♦ n ♦ n +1 ω → ♦ n ω satisfyingthe same equations. Those generators and equations are similarto the ones used in the scalable notations of [7]. There, suchtriangles were used to represent finite spatial juxtaposition ofdata while our generators deal with infinite temporal juxtapo-sition. Derivatives and initializations are natural isomorphismsin G ω . Example 1.
Example of quantum circuit stream diagram withno input/output. This diagram has side effects. At each clocktick the scalar = 1 / is produced. ω ( ⊳⊲ ) = ω ( ◭ ) = ω ( ◮ ) = ♦ ω D. Delayed Trace
An important ingredient to the construction is the delayedtrace . It is not strictly speaking a new generator but aconstructor similar to the trace in traced monoidal categories.Given a map D : a + ♦ c → b + c we can trace it to constructa new map Dtr a,bc ( D ) : a → b represented by: D It allows a process to take as an input at tick k + 1 one ofits own outputs at tick k . In other words it allows to representthe memories of a stateful morphism sequence. It satisfies thefollowing trace-like axioms: D K = D K D K = D K D K = D K D = D The axiom for the tensor unit is here a tautology:
Dtr a,b ( D ) = D . For typing reason we cannot obtain theidentity if we trace the swap. Instead we get the delay : : c → ♦ c . def = The delay holds its input at tick k and releases it at tick k + 1 . When G has a symmetric compact structure we canrecover the delayed trace from the delay: D = D = D = D = D = D Example 2.
The protocol described in Section II-D canbe depicted as follows. At each clock tick, a post selectedmeasurement of the memory is performed and a new Bell pairis produced. One of the qubit of the pair is directly outputtedwhile the other one is stored in the memory. = =
E. Causal Maps
Another axiom of the trace that we do not have is theanalog of dinaturality. In fact this would imply that everythingcommutes with the delay:
D K = D ♦ K ⇒ K = ♦ K Intuitively, it means that we do not make any differenceif we apply K on the memory data at tick k or at tick k + 1 . We want this to be true only if K has no sideeffect, otherwise, we would identify processes that are notobservationally equivalent. Thus we require this from swaps,derivatives and initializations: ( ⊳ ) = D D ( ⊲ ) = DD ( σ ) = D and from all causal maps C of G : C = ⇒ D ♦ n +1 ιC = D ♦ n ιC ( ) .Using the upcoming rule ( ♦ N ) , we are able to derive thesame equation with ♦ n ωC instead of ♦ n ιC . Example 3.
The rules defined so far can be used to unfoldthe first step of the cascade of CNots: ( ⊳⊲ ) = ( ◮ ) = CPTP = ( ⊲ ) = F. Idempotents
Another identification we want to make with respect toobservational equivalence concerns idempotents. Indeed, if anidempotent is applied on the memory data before sending themto the next tick then it does not matters to apply it again after.So it is possible to send a copy of an idempotent through thedelay. π π = π ⇒ D ♦ n ιπ = D ♦ n ιπ ♦ n +1 ιπ ( π ) Using the upcoming rule ( ♦ N ) , we are able to derive thesame equation with ♦ n ωπ instead of ♦ n ιπ . We note that theaxiom ( π ) implies: ♦ n ιπ = ♦ n ιπ ♦ n +1 ιπ . G. Coinduction
We now introduce the final elements of the streamed propconstruction. We denote by (Ax) all the axioms that have beenpresented so far: ( ⊲ ) , ( ⊳ ) , ( ◮ ) , ( ◭ ) , ( ⊲⊳ ) , ( ⊳⊲ ) , ( σ ) , ( ) , ( π ) ,and the four trace-like axioms.To obtain the final axiomatization of G ω we quotient by acoinduction meta rule. Provided two sequences of diagrams ( S i ) i ∈ N and ( T j ) j ∈ N in G ω : ∀ n ∈ N (Ax) , [ ♦ S n +1 = ♦ T n +1 ] ⊢ S n = T n (Ax) ⊢ S = T ( ♦ N ) In practice we will use a weaker form which corresponds tothe constant case where for all i, j ∈ N , S i = S and T j = T :(Ax) , [ ♦ S = ♦ T ] ⊢ S = T (Ax) ⊢ S = T ( ♦ ) Note that the weak form is also equivalent to the strong onein the case of eventually constant sequences of diagrams. We provide an example of the coinduction principle in action. Wecan show that discarding is the same as storing forever in amemory: = By applying ( ♦ ) to show the equality, we can assume thatits delayed version holds. ( ◮ ) = ( ♦ ) = ( ) = With a similar proof we can also derive the rules ( ) and ( π ) for the ω generators. Our definition of G ω is now complete.IV. G ω AND S TATEFUL M ORPHISM S EQUENCES
We aim to describe every diagram D ∈ G ω with statefulmorphism sequences, i.e. , a sequence of diagrams of G , thek th diagram of the sequence representing the behavior of D atclock tick k . A. Stateful Morphism Sequences
We start by defining the stateful morphism sequences over G . Definition 2. A stateful morphism sequence f over a prop G is given by three sequences of objects ( a i ) ≤ i , ( b i ) ≤ i and ( m i ) ≤ i with m def = 0 together with a sequence of maps f i : a i ⊗ m i − → b i ⊗ m i with ≤ i . f i is called the i th layer of f . A stateful morphism sequence f can be (informally) de-picted as follows: Layers are separated by dash lines and weconnect in red the memory of consecutive layers. f f f d ... ............ ...Following [9] we define a category St ( G ) of stateful mor-phism sequences over G . The objects are the sequences ( a i ) ≤ i of objects in G . When the types match, g ◦ f is defined as: ( g ◦ f ) k = f k g k and g ⊗ f as: ( f ⊗ g ) k = f k g k We define a delay operator on stateful sequence morphismas ( ♦ f ) def = id and ( ♦ f ) k def = f k − .learly, all diagrams in G ω being finite we cannot representarbitrary sequences. In fact we will see that we can onlyrepresent RegSt ( G ) , the subcategory of St ( G ) restricted to regular stateful morphism sequences in which we consideronly eventually constant sequences. B. Finite Approximations A finite aproximation sequence over a discard prop G is given by two sequences of objects ( a i ) ≤ i and ( b i ) ≤ i ,together with a sequence of maps f k : k N i =1 a i → k N i =1 b i . f k iscalled the k th approximation of f . We postpone to Definition8 the precise conditions that those sequences must satisfy.Given a stateful morphism sequence we define its finiteapproximation sequence FA ( f ) by:FA f f f d ... ............ ... k def = f f f k ... ...... There is also a category FA ( G ) of finite approximationsequences over G where composition and tensor are definedapproximation wise. We have a symmetric monoidal functorFA : St ( G ) → FA ( G ) . Two stateful sequences with the sameimage by FA are said observationally equivalent. We design G ω towards the goal to be universal and complete for FA ( G ) .we will see that if we do not achieve this goal in full generality,we can get close enough in some particular cases. C. Stratified Types
The types of G ω are much richer than the one of RegSt ( G ) ,so we need to quotient them. We call the degree of a type thehigher delay appearing in it. A type a is said stratified if itis of the form: n + ♦ n + ♦ n + · · · + ♦ k − n k − + ♦ k n k ω .We see here that a has degree k (if n k ≥ ). Given astratified type a of degree d we define the derivative δ k a with k > d as: δ k (cid:0) n + · · · + ♦ d − n d − + ♦ d n d ω (cid:1) def = n + · · · + ♦ d n d + · · · + ♦ k − n d + ♦ k n d ω . δ k a is a stratified type ofdegree k if a contains ω types and d otherwise.We say that two types are disjoint if there is no tickwhen they both send data. Formally, we inductively define adisjointness symmetric relation ∗ on types as: ∗ a ⇔ a = 0 , ♦ i ∗ ♦ j ⇔ i = j , ♦ i ∗ ♦ j ω ⇔ i < j and a ∗ ( b + c ) ⇔ ( a ∗ b ) ∧ ( a ∗ c ) .A disjoint map is a map made of initializations, derivativesand swaps of disjoint types. All disjoint maps are isomor-phisms. Given two types a and b , if there is a disjoint map a → b then it is unique. Given any type a of degree d , thereis a unique stratified type a of same degree as a and a uniquedisjoint map a → a . There is also always a disjoint map a → δ k a with k > d . The equivalence relation ∼ s on types is defined as a ∼ s b ifthere exists a disjoint map a → b , in fact, if such a map existsthen it is unique. So if a ∼ s c and b ∼ s d there is a naturalbijection between G ω ( a, b ) and G ω ( c, d ) whose componentsare the disjoint maps a → c and b → d . This impliesthat we have a well defined monoidal category G ω (cid:14) ∼ s . Wewrite D ∼ s D ′ whenever two diagrams are identified by thisquotient.From the properties of disjoint maps we have that for anytype a of degree d the equivalence class of a is the set { b | ∃ k, b = δ k a } . Those equivalence classes are in bijectionwith the eventually constant sequences of types in G . Thus,the objects of G ω (cid:14) ∼ s and RegSt ( G ) are in bijection.We define a functor G : RegSt ( G ) → G ω (cid:14) ∼ s from afunctor RegSt ( G ) → G ω which maps a sequence of objects in G that is eventually constant from tick d to the correspondingstratified type of degree d in G ω . A stateful morphism sequenceis then mapped to a diagram as follows: f f f d ... ............ ... f ♦ f ♦ d − ωf d ... In fact all diagrams of G ω (cid:14) ∼ s can be written in such form. Lemma 1. G : RegSt ( G ) → G ω (cid:14) ∼ s is full.D. Correspondence with RegSt ( G ) / ≡ We add the following rewriting rules ≡ to RegSt ( G ) tomatch the rewriting rules of G ω . We define D ≡ D ′ as:(CM) , (IM) ⊢ D = D ′ with ⊢ admitting the usual deduction rules of a congruence together the coinduction rule: ∀ n ∈ N Γ , [ ♦ S n +1 = ♦ T n +1 ] ⊢ S n = T n Γ ⊢ S = T ( ♦ N ) and with the axioms (CM) and (IM) being the following, for c causal and π idempotent:(CM) ⊢ f k f k +1 ......... c ... ...... = f k f k +1 ............ ...... c The rules for reflexivity, symmetry, and transitivity, together with thepreservation under contexts of the form ( S ⊗ − ) , ( − ⊗ S ) , ( S ◦ − ) and ( − ◦ S ) . IM) ⊢ f k f k +1 ............ ...... π = f k f k +1 ............ ...... ππ We write RegSt ( G ) / ≡ for the quotient RegSt ( G ) by thiscongruence. Lemma 2. f ≡ g ⇔ G ( f ) = G ( g ) This implies that G factorizes into the projectionRegSt ( G ) → RegSt ( G ) / ≡ followed by a full and faithfulfunctor G : RegSt ( G ) / ≡ → G ω (cid:14) ∼ s . ( G ω ) (cid:14) ∼ s RegSt ( G ) / ≡ RegSt ( G ) G G It follows that we can completely characterize G ω by the ≡ relation on stateful morphism sequences. Theorem 2.
For any discard monochromatic prop G : RegSt ( G ) / ≡ ≃ G ω (cid:14) ∼ s . V. T HE S EMANTICS OF G ω In this section, we define the semantics of our language G ω . We assume given a semantics J − K : G → C of G ,and will extend it into a semantics L − M for diagrams of G ω .The semantics of D ∈ G ω will be its finite approximationsequences, i.e. , a sequence of morphisms of C , with the k -thmorphism corresponding to the computations done up untilthe k -th tick of the clock. We prove that our semantics issound. We also prove universality and completeness up tosome additional requirements on G and C . A. Discard Category
The only required assumption for the definition of G ω is that G is a discard prop . The category C should enjoy the sameproperty. As a consequence, we introduce a straightforwardextension of the notion of discard prop to the symmetricmonoidal case: Definition 3 (Discard) . A discard category is a symmetricmonoidal category ( C , ⊗ , I ) together with, for every object A , a discard map A : A → I such that I = id I and A ⊗ B = A ⊗ B . We write C causal its subcategory of causal morphisms , i.e. ,morphisms f such that B ◦ f = A . We say that a monoidalfunctor F between discard categories is discard-preserving if F ( A ) = F ( A ) . We say that it is discard-reflecting ifwhenever F ( f ) = F ( A ) we have f = A . Those propertiesare equivalent to F respectively preserving or reflecting causalmorphisms. From now on, we assume that C is a discard category andthe functor J − K is monoidal and discard-preserving, as thoseproperties are required for soundness. For completeness, wewill additionally expect J − K to be discard-reflecting. B. Semantics
To define the semantics of a diagram D ∈ G ω ( a, b ) , werely on the fact that G ω (cid:14) ∼ s and RegSt ( G ) / ≡ are equivalentcategories (Theorem 2), and write ∂D the equivalence classof stateful morphism sequences associated to D (cid:14) ∼ s . Wethen apply J − K to each layer: we write J − K St for the functorfrom RegSt ( G ) / ≡ to RegSt ( C ) / ≡ which simply applies J − K to every layer of the sequence. This functor inherits all theproperties of J − K , and is in particular monoidal and discard-preserving.We then collect all the operations happening up until the k -th tick for k ≥ . For α = ( α n ) n ≥ ∈ RegSt ( C )( A, B ) wedefine FA ( α ) k ∈ C ( FA ( A ) k , FA ( B ) k ) as follows:FA ( A ) k def = A ⊗ · · · ⊗ A k FA ( α ) k def = α k · · · ...... α We note that while stateful morphism sequences of a diagramare defined up to the observational equivalence ≡ , FA ( − ) k issound with respect to this congruence: Lemma 3 (Soundness) . Whenever α ≡ β , for every k ≥ wehave FA ( α ) k = FA ( β ) k . So FA ( − ) k can be see as a functorfrom RegSt ( C ) / ≡ to C . We then collect all of the ( FA ( α ) k ) k ≥ into a morphismFA ( α ) of the category of morphism sequences Seq ( C ) definedbelow, which we will latter refine into the category of finiteapproximation sequences FinApp ( C ) . Definition 4.
For C a discard category, we define the discardcategory of sequences of C , written Seq ( C ) , as follows: • Its objects are sequences ( A k ) k ≥ with A k ∈ Obj ( C ) . • Its morphisms are sequences ( f k ) k ≥ such that f k ∈C ( A k , B k ) • The composition (resp. monoidal product, resp. discard)is the composition (resp. monoidal product, resp. discard)component-wise.
Using Lemma 3, we can now define L − M as the compositionof previously defined functors: L − M def = FA (cid:0) J ∂ − K St (cid:1) : G ω → Seq ( C ) It is a discard-preserving monoidal functor.
C. Examples of Semantics
To illustrate this semantics, we detail in Fig. 2 the semanticsof some morphisms of G ω : the ι -morphisms, the ω -morphisms,the delayed morphisms, the stream initialization, the ι -delayand the ω -delay. Another interesting case is one of our firstexamples in CPM (see Example 1), which generate a scalarat each tick of the clock: L ω M k = (cid:0) (cid:1) k L D M L D M L D M k ι ( F ) J F K J F K J F K ω ( F ) J F K ... J F KJ F K J F KJ F K ♦ F ... ... J F K J F K k − ∅ ... ... ... ...... ♦ ω ω ♦ ... ω ♦ ω Fig. 2: Semantics of Generators
D. Universality
While this semantics is sound, Seq ( C ) contains significantlymore behaviors than G ω , as Seq ( C ) does not constrain anyrelation between the states of the computation at ticks k and k + 1 . To obtain universality, we need to restrict Seq ( C ) to amore realistic category. As presented previously in section II-Din the quantum case, we start by adding a condition of monotonicity : • An object ( A k ) k ≥ is monotone if for every k ≥ , thereexists an object A ′ k of C such that A k +1 = A k ⊗ A ′ k . • A morphism ( f k ) k ≥ is monotone if for every k ≥ , wehave f k +1 ... ... (cid:22) f k ... ... for (cid:22) defined below.Decreasing along (cid:22) means adding additional observable ef-fects. In particular, whenever C is the category CPTP , orany other category in which every morphism is causal, then (cid:22) is nothing but the equality. In the general case, we take (cid:22) to be the following: Definition 5.
For f, g ∈ C ( A, B ) , we have f (cid:22) g wheneverthere exist g ∈ C ( A, B ⊗ X ) and f ∈ C ( X, I ) such that f = g f g = g In the case of C = CPM , (cid:22) is tightly linked to the Loewnerorder, as we have f (cid:22) g ⇐⇒ ∃ λ > , ( g − λ · f ) ∈ CPM We note that without additional restrictions on C , (cid:22) mightnot be transitive. To ensure transitivity, we require for C tohave a notion of purification . From a programming point ofview, each time the morphism is “dumping” some informationthrough the use of a discard, we want to intercept this discardand instead output those information on a secondary output sothat they can be used for latter computations. Definition 6.
In a discard category ( C , ⊗ , I, ) , a morphism p ∈ C ( A, B ⊗ X ) is said to be a purification of f ∈ C ( A, B ) ,and we write p ∈ Pur ( f ) , if for every g ∈ C ( A, B ⊗ Y ) f = g = ⇒ ∃ c causal , g = p c In particular, whenever p ∈ Pur ( f ) we always have f = p and given two purifications p , p ∈ Pur ( F ) there exist twocausal morphisms c and c such that p = p c p = p c The uniqueness of purification up to a causal morphism isan analogue to Stinespring’s dilatation (Theorem 1), that weadapted to account for the possible absence of a notion ofisometry.
Definition 7.
A discard category ( C , ⊗ , I, ) is said purifiable whenever every morphism has a purification, and moreover for f ∈ C ( A , B ⊗ C ) , f ∈ C ( C ⊗ A , B ) , p ∈ Pur ( f ) and p ∈ Pur ( f ) we have: p p ∈ Pur (cid:18) f f (cid:19) In particular for C = I we obtain that: p p ∈ Pur ( f ⊗ f ) Lemma 4.
The categories
CPM and CPTP are purifiablecategories. Moreover, the purification of a morphism is alwaysa pure quantum computation, for the usual notion of purity(see Section II-A). Lemma 5.
Every cartesian category ( C , × , I ) is purifiable,and for every f ∈ C ( A, B ) , the pairing ( f, id A ) ∈ C ( A, B × A ) is a purification of f . Using the uniqueness of purification up to a causal mor-phism, one can deduce that (cid:22) is indeed a pre-order, and formsin fact a pre-order enrichment of C .ith monotonicity defined, we are one step closer to uni-versality. However, monotone sequences still contain behaviorsthat are not captured by our language. More precisely, mono-tone sequences contain behaviors that would be representableby an infinitely-sized diagram, but cannot be represented in ourfinitary language. We restrict ourselves to regular monotonesequences, which we call finite approximations and define asfollows: Definition 8.
For C a purifiable category, we define the discardcategory of finite approximation sequences FinApp ( C ) as Seq ( C ) restricted to • Objects ( A k ) k ≥ that are monotone (see above) andregular, i.e. , there exists n ≥ and A ′ such that forall k ≥ n we have A k = A n ⊗ A ′⊗ ( k − n ) . • Morphisms ( f k ) k ≥ that are monotone (see above) andregular, i.e. , there exists n ≥ , f irreg ∈ C ( A n , B n ⊗ M ) and f reg ∈ C ( M ⊗ A ′ , B ′ ⊗ M ) such that for all k ≥ nf k = f reg · · · ...... f reg M M f irreg M M ( k − n ) copies . Proposition 1.
For every f ∈ G ω , L f M ∈ FinApp ( C ) . Theorem 3 (Universality) . If C is purifiable and the functor J − K : G → C is full, then L − M : G ω → FinApp ( C ) is full too. This follows from the fullness of ∂ , J − K St and FA ( − ) . E. Completeness
The discard allows us to discard “future computation” andonly keep what happens before a given tick. However, inthe proof of completeness, we will need to act dually andhave a way to undo the first computations to only keep whathappens in later ticks. Ideally, we would want morphisms tobe surjections (or epimorphisms), as a surjection f satisfiesthe following: g ◦ f = h ◦ f ⇐⇒ g = h Unfortunately, the category
CPM contains non-surjetive mor-phisms, and even contains morphisms that cannot be decom-posed into a surjection followed by an injection . However,for every f ∈ CPM ( A, B ) there always is an idempotentmorphism π (the projector over the image of f ) such that: g ◦ f = h ◦ f ⇐⇒ g ◦ π = h ◦ π We formalize a slight generalization of this property in theconcept of shadow category.
Definition 9.
A symmetric monoidal category ( C , ⊗ , I ) is ashadow category if for every morphism f ∈ C ( M ⊗ A, B ⊗ X ) there exists an idempotent morphism π : X → X such that Though if one allows every Hilbert space instead of restricting ourselvesto only Hilbert spaces of dimension a power of two, every morphism becomesdecomposable. f g = f h ⇐⇒ π g = π h Lemma 6.
The categories
CPM and CPTP are shadowcategories. Theorem 4 (Completeness) . If C is a shadow purifiablecategory and the functor J − K : G → C is faithful and discard-reflecting, then L − M is faithful too. This follows from the faithfulness of G ω ∂ −→ RegSt ( G ) / ≡ J − K St −−−→ RegSt ( C ) / ≡ FA ( − ) −−−→ FinApp ( C ) VI. A
PPLICATIONS
A. The ZX-calculus
The ZX-calculus is known to be universal and completefor various fragments of quantum mechanics [21], [22], [23],including the most general case: the ZX-calculus – equippedwith a discard map – is universal and complete for
CPM [2]. Furthermore Lemmas 4 and 6 gives us that CPM isa purifiable shadow category. As a consequence ZX ω isuniversal and complete for monotone regular sequences over CPM . Similar results hold for variants of the ZX-calculuslike the ZW- or the ZH-calculi which are also universal andcomplete for CPM [2]. One the other hand, quantum circuits,equipped with a discard map, are universal for CPTP but noaxiomatization is known to be complete. B. The Fragment G ω of Initialised Delays Using delayed trace for process with memory is not a newidea. It has appeared in various context [17], [9], [24], [10],usually in the cartesian case and with an initialized delayedtrace restricting the expressivity to sequences which are regularfrom the beginning. In this subsection we present the fragmentof our language that corresponds to this situation and thenin the following subsections compare our results to selectedexamples from the literature providing an overview of thegenerality of our construction and its limitations.In G ω , the need for delayed types ♦ n +1 ω arises from thefact that the delay morphism on streams takes as an inputa stream but outputs a stream with an undefined behavior forthe first tick. However, adding delayed types ♦ n +1 ω is not theonly solution to this problem. Indeed, most preexisting worksinstead chose to use an initialized delay . Those initializeddelays can be encoded in G ω as follows: given a a type of G and F ∈ G (0 , a ) we defined the delay initialized by F as: F · · · · · · def = · · · · · · ι ( F ) We note that in the cartesian case, every morphisms F ∈C (0 , a ) can be decomposed into a product of morphisms on (0 , , so one only needs to define the initialized delayedtrace on single wires rather than collection of those.We consider G ω the sublanguage of G ω where every delayhas to be initialized: • Most of the objects of G ω are unnecessary, we only takeObj ( G ω ) def = { n · ω | n ∈ N } = ω ( Obj ( G )) • G ω is a prop, with for generators the morphisms ω ( D ) for D a morphism of G , and the delayed trace initializedby F ∈ G (0 , c ) : Dtr [ F ] a,bω ( c ) ( D ) ∈ G ω ( a, b ) for D ∈ G ω ( a + ω ( c ) , b + ω ( c )) The stateful morphism sequences associated to G ω aresequences ( f k ) k ≥ for which the regularity condition starts atthe second tick: ∀ k ≥ , f k = f . Similarly, on the semanticsside, the corresponding finite approximations ( f k ) k ≥ areregular starting from the first tick: f k = f reg · · · ...... f reg M M f irreg M M ( k − copiesNote that all diagrams in G ω can be rewritten into the form: ωSιR C. Quantum Channels with Memory
The first inspiration of this work was the quantum channelswith memory of [8]. This corresponds to the case where wetake G to be the the category of quantum circuits with discard.There are still not known complete finite axiomatization ofthe full language. Assuming a free axiomatization matchingthe semantics in CPTP we can construct G ω . CPTP is apurifiable discard shadow category thus G ω is complete anduniversal for monotone finite approximations regular from tick . CPTP is also a semi-cartesian category, meaning that allits morphism are causal. In such situation, we can significantlysimplify the definition of G ω by fusing the ( ) and ( π ) rules.Moreover, the order (cid:22) then collapses to the identity, leading toa clear interpretation of the monotone sequences as processeswhere the present does not depend on the future.Applying quantum mechanics to those stream transformersusually requires infinite dimensional Hilbert spaces. In [8],quasi local algebras are used to represent those processes inthe Heisenberg picture, a quantum analog of the predicatetransformer point of view. The authors require from therechannels a causality condition that matches precisely ourmonotonicity requirement. The main difference with our workis that they consider streams on Z (so an infinity of tickshappened before the tick ) while we consider streams on N ≥ . However, given a fixed quantum state for the ticks ( −∞ , ,their condition of translational invariance corresponds to ourcondition of regularity on finite approximations. They obtaina structure theorem that corresponds precisely to the generalform of diagrams in G ω . D. The Cartesian Case
The stateful morphism sequences were first defined by [9]in the cartesian case. A cartesian category is always purifiableand semi-cartesian.In [9], the authors build a category very similar to G ω byquotienting stateful morphism sequences by an observationalequivalence relation corresponding to ours in the cartesiancase. They define the exact same initialized delayed trace andstudy in more details the category of stateful sequences ofmorphisms. However they do not show any universality orcompleteness results, focusing instead on differentiability.Note that taking G to be boolean circuits with semantics in Set (which is a cartesian shadow category) we can deduce from [ ] that G ω has the expressive power of Mealy machines. Inthis direction, further work will focus on understanding exactlywhich kind of synchronous circuits can be represented by ourconstruction in connection to the work of [24]. E. Signal Flow Graphs
Another work similar to ours is the work of [17] onsignal flow graphs. Similarly to [8], they consider streamson Z while we consider streams on N ≥ . There is howeveranother major difference in approach: they represent streamsand their operations as a whole (using power series) ratherthan through their finite approximations. This leads to a setof axioms incompatible to ours, in particular the rule (S5) oftheir Definition 3 would translate to the following: (S5) = which is unsound for finite approximations. Indeed, the lefthand side is interpreted by us as follows: the information i received at the tick n is not immediately outputted, insteadthe system generates a “blank” output (the transposed of ),which retroactively changed to be equal i at tick n + 1 . Thisbehavior is fundamentally non-causal, but is expected as theco-unit of a compact closure is not a causal morphism.However, when considering the fragment SF of circuitsthat only contain initialized guarded traces (which they callfeedbacks), we recover a correspondence. In fact there calculusseems to be exactly G ω when we take G to be the graphicallanguage HA .Taking the same example as in their paper, we can describethe Fibonacci sequence as a morphism of G ω , with G beingthe prop of linear operations on tuples of integers: here ∈ G (0 , being the integer zero, white dots represent-ing the addition and black dots representing the copy. On theinput stream , , , etc this circuit will output the Fibonaccisequence , , , , , etc .Another interesting connection with this line of work is totake G to be IH , a graphical calculus which have been shownto be complete for linear relations [25]. The order relation (cid:22) then coincides with the subspace relation for vector spaces.More work has still to be done along this line to unravel allthe connections between the two formalisms.R EFERENCES[1] R. Vilmart, “A near-optimal axiomatisation of ZX-calculus for purequbit quantum mechanics,” in
Proceedings of the 34th AnnualACM/IEEE Symposium on Logic in Computer Science (LICS) , 2019.[Online]. Available: https://arxiv.org/abs/1812.09114[2] T. Carette, E. Jeandel, S. Perdrix, and R. Vilmart, “Completenessof graphical languages for mixed states quantum mechanics,” in
In-ternational Colloquium on Automata, Languages, and Programming(ICALP’19) , 2019.[3] R. Duncan, A. Kissinger, S. Perdrix, and J. van de Wetering,“Graph-theoretic Simplification of Quantum Circuits with the ZX-calculus,”
Quantum , vol. 4, p. 279, Jun. 2020. [Online]. Available:https://doi.org/10.22331/q-2020-06-04-279[4] A. Kissinger and J. van de Wetering, “Reducing the number of non-Clifford gates in quantum circuits,”
Physical Review A , vol. 102, no. 2,p. 022406, 2020.[5] M. Hanks, M. P. Estarellas, W. J. Munro, and K. Nemoto, “Effectivecompression of quantum braided circuits aided by ZX-calculus,”
Phys. Rev. X , vol. 10, p. 041030, Nov 2020. [Online]. Available:https://link.aps.org/doi/10.1103/PhysRevX.10.041030[6] N. de Beaudrap and D. Horsman, “The ZX calculus is a languagefor surface code lattice surgery,”
Quantum , vol. 4, p. 218, Jan. 2020.[Online]. Available: https://doi.org/10.22331/q-2020-01-09-218[7] T. Carette, D. Horsman, and S. Perdrix, “SZX-calculus: Scalable graph-ical quantum reasoning,” in
MFCS 2019-44th International Symposiumon Mathematical Foundations of Computer Science , vol. 138, 2019, pp.55–1.[8] D. Kretschmann and R. F. Werner, “Quantum channels with memory,”
Physical Review A , vol. 72, no. 6, p. 062323, 2005.[9] D. Sprunger and S.-y. Katsumata, “Differentiable causal computationsvia delayed trace,” in . IEEE, 2019, pp. 1–12.[10] M. Rom´an, “Comb diagrams for discrete-time feedback,” arXiv preprintarXiv:2003.06214 , 2020.[11] A. Kissinger and D. Quick, “A First-order Logic for StringDiagrams,” in , ser. Leibniz InternationalProceedings in Informatics (LIPIcs), L. S. Moss and P. Sobocinski,Eds., vol. 35. Dagstuhl, Germany: Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, 2015, pp. 171–189. [Online]. Available:http://drops.dagstuhl.de/opus/volltexte/2015/5533[12] S. Abramsky and C. Heunen, “H*-algebras and nonunital frobeniusalgebras: First steps in infinite-dimensional categorical quantum me-chanics,” in
Clifford Lectures, AMS Proceedings of Symposia in AppliedMathematics , vol. 71, 2012.[13] B. Coecke and C. Heunen, “Pictures of complete positivity in arbitrarydimension,”
Information and Computation , vol. 250, pp. 50–58, 2016.[14] S. Gogioso and F. Genovese, “Infinite-dimensional categorical quantummechanics,” in Proceedings 13th International Conference on
QuantumPhysics and Logic,
Glasgow, Scotland, 6-10 June 2016, ser. ElectronicProceedings in Theoretical Computer Science, R. Duncan and C. He-unen, Eds., vol. 236. Open Publishing Association, 2017, pp. 51–69.[15] B. Schumacher and R. F. Werner, “Reversible quantum cellular au-tomata,” arXiv preprint quant-ph/0405174 , 2004.[16] P. Arrighi, V. Nesme, and R. Werner, “Unitarity plus causality implieslocalizability,”
Journal of Computer and System Sciences , vol. 77, no. 2,pp. 372–378, 2011.[17] F. Bonchi, P. Soboci´nski, and F. Zanasi, “A categorical semantics ofsignal flow graphs,” in
International Conference on Concurrency Theory .Springer, 2014, pp. 435–450. [18] M. A. Nielsen and I. Chuang, “Quantum computation and quantuminformation,” 2002.[19] W. F. Stinespring, “Positive functions on C*-algebras,”
Proceedings ofthe American Mathematical Society , vol. 6, no. 2, pp. 211–216, 1955.[20] A. Kissinger and S. Uijlen, “A categorical semantics for causal struc-ture,” in . IEEE, 2017, pp. 1–12.[21] M. Backens, “The ZX-calculus is complete for stabilizerquantum mechanics,”
New Journal of Physics , vol. 16,no. 9, p. 093021, sep 2014. [Online]. Available:https://doi.org/10.1088%2F1367-2630%2F16%2F9%2F093021[22] E. Jeandel, S. Perdrix, and R. Vilmart, “A complete axiomatisation ofthe ZX-calculus for Clifford+T quantum mechanics,” in
Proceedings ofthe 33rd Annual ACM/IEEE Symposium on Logic in Computer Science(LICS) . ACM, 2018, pp. 559–568.[23] A. Hadzihasanovic, K. F. Ng, and Q. Wang, “Two completeaxiomatisations of pure-state qubit quantum computing,” in
Proceedingsof the 33rd Annual ACM/IEEE Symposium on Logic in ComputerScience , ser. LICS ’18. New York, NY, USA: ACM, 2018, pp. 502–511.[Online]. Available: http://doi.acm.org/10.1145/3209108.3209128[24] D. R. Ghica, A. Jung, and A. Lopez, “Diagrammatic semantics for digitalcircuits,” in . Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2017.[25] F. Zanasi, “Interacting hopf algebras: the theory of linear systems,” arXivpreprint arXiv:1805.03032 , 2018. A PPENDIX
A. Equivalence of G ω and RegSt ( G ) Lemma 1. G : RegSt ( G ) → G ω (cid:14) ∼ s is full.Proof. Let D : a → b be a diagram of G ω where a and b arestratified types. Let d be the biggest integer such that there is awire of type ♦ d or ♦ d ω appearing in D . The degree of a and b must be less than d so there is a diagram D ′ : δ d a → δ d b such that D ∼ s D ′ .Using the axioms of delayed trace we take them out of thediagrams to obtain something of the form: K We use ( ⊳⊲ ) and ( ⊲ ) until all the delayed trace on types ♦ k +1 ω and ♦ k ω becomes on types ♦ d +1 ω and ♦ d ω . K ( ⊳⊲ ) = K ( ⊲ ) = K Then since d was the biggest delay appearing in the diagrambefore we know that all the delayed trace on types ♦ k ω arein the situation: H Now using ( ⊳⊲ ) on all wires of type ♦ k ω with k < d , andthen using ( ◮ ) and ( ◭ ) we can ensure that the only generatorsof the form ♦ k ωG are in fact of the form ♦ d ωG . ♦ k ωG ... ... ( ⊳⊲ ) = ♦ k ωG ... ... ( ◮ ) = ♦ k +1 ωG ... ... ♦ k ιG ... ... Then applying ( ⊲⊳ ) we remove all the remaining wires oftype ♦ k ω with k < d . Now the only ♦ k ω wires in the diagramsare the ♦ d ω and the ♦ d +1 ω in the delayed trace, so there are noerivations left in the diagram and the only initialisations leftare the one connected to delayed traces. We can now grouptogether the generators ♦ k ιg and ♦ d ωg of same type. Thisgives a diagram of the form: D ♦ D ♦ d ωD d ...... ...... ... ... ... = D ♦ D ♦ d ωD d ... Which is the image of a regular stateful morphism sequence.So for each diagram D there is a diagram D ′ such that D ∼ s D ′ and D ′ is the image of a stateful morphism sequence. Inother words, G : RegSt ( G ) → G ω (cid:14) ∼ s is full. Lemma 2. f ≡ g ⇔ G ( f ) = G ( g ) Proof.
We want to prove(Ax) ⊢ G ( f ) = G ( g ) ⇐⇒ (CM) , (IM) ⊢ f = g For that, we simply match the set of derivation trees on the lefthand side to the set of derivation trees on the right hand side.We first look at the deduction rules, which are the rules ofa congruence (reflexivity, symmetry, transitivity, composition,monoidal product) plus the coinduction rule. There is a one-to-one correspondence between the rules on both side, relyingon G ( ♦ f ) = ♦ G ( f ) for the correspondence between the twocoinduction rules. We just need to match the axioms: • All the axioms of (Ax) but ( ) , ( π ) , ( σ ) correspond totautologies. • ( ) is exactly matched to (CM). • ( π ) is exactly matched to (IM). • ( σ ) correspond to either a tautology or (CM) dependingon whether the permuted types are disjoints or not. B. Soundness
We note that (CM) , (IM) ⊢ α = β means by definition α ≡ β . Lemma 3 (Soundness) . Whenever (CM) , (IM) ⊢ α = β , forevery k ≥ we have FA ( α ) k = FA ( β ) k Proof.
For n ≥ with define the congruence “equal up untilthe n -th tick” ≈ n on RegSt ( C ) as follows: α ≈ n β ⇐⇒ ∀ k ≤ n, FA ( α ) k = FA ( β ) k In particular we always have α ≈ β . The property we aretrying to prove is equivalent to: ∀ n ≥ , [ (CM) , (IM) ⊢ α = β ] = ⇒ α ≈ n β The start by showing that the axioms (CM) and (IM) areindeed sound: • (CM)Moving a causal from the k -th layer to the ( k +1) -thlayer trivially preserve all the finite approximations but the k -th one. Looking at the k -th finite approximation,and we observe the following:FA ( α ) k = α k · · · ...... α C = α k · · · ...... α = FA ( β ) k • (IM)Duplicating an idempotent from the k -th layer to the ( k + 1) -th layer does not change any of the associatedfinite approximations.We now show that whenever Γ ⊢ α = β , if for all [ α ′ = β ′ ] ∈ Γ we have α ′ ≈ n β ′ then we have α ≈ n β .We take a derivation sequence of Γ ⊢ α = β , and proceedby induction on this derivation sequence. • The initialisation is the axiom rule Γ ⊢ α = β with [ α = β ] ∈ Γ . The result is immediate. • The reflexivity, symmetry, transitivity rules are trivial, andthe composition and tensor rules correspond to the factthat FA ( − ) k is a monoidal functor. • We now consider the coinduction rule ( ∀ k ≥
0) Γ , (cid:2) ♦ α ( k +1) = ♦ β ( k +1) (cid:3) ⊢ α ( k ) = β ( k ) Γ ⊢ α (0) = β (0) We want to show that if for every [ α ′ = β ′ ] ∈ Γ we have α ′ ≈ n β ′ , then we have α (0) ≈ n β (0) for all n ≥ .We assume that we indeed have for every [ α ′ = β ′ ] ∈ Γ we have α ′ ≈ n β ′ . By induction hypothesis we know thatif ♦ α ( k +1) ≈ n ♦ β ( k +1) for some k ≥ and n ≥ , then α ( k ) ≈ n β ( k ) , which implies ♦ α ( k ) ≈ n +1 ♦ β ( k ) . Hence bychaining this property, we obtain that for any k ≥ , n ≥ : ♦ α ( k +1) ≈ n ♦ β ( k +1) = ⇒ α (0) ≈ n + k β (0) Applying it with n = 0 , and using the fact that ≈ is the totalrelation, we obtain for all k ≥ α (0) ≈ k β (0) C. Universality
In this subsection, we prove the fullness of FA ( − ) . Proposition 2. If C is purifiable, then the functor FA ( − ) : RegSt ( C ) → FinApp ( C ) is full.Proof. We take ( f k ) k ≥ ∈ G ω ( FA ( A ) , FA ( B )) . By regularity,there is a n and a f ref and f irreg such that for every k ≥ n wehave f k = f reg · · · ...... f reg M M f irreg M M ( k − n ) copiesince C is purifiable, we can purify its morphisms, so for every k ≥ we write p ( f k ) for an arbitrarily chosen purification of f k .We want to build α ∈ RegSt ( C )( A, B ) such that FA ( α ) =( f k ) k ≥ . We build α inductively, ensuring that at all rank k We assume that for k < n − we have α , . . . , α k already defined and satisfying the hypothesis.By monotonicity, we know that we have f k +1 ... ... (cid:22) f k ... ... So using the definition of (cid:22) we have g ∈C ( FA ( A ) k +1 , FA ( B ) k ⊗ Y ) and h ∈ C ( Y, I ) such that f k +1 ... ... = g h ... ... g ... ... = f k ... ...In those equation, we consider stateful morphisms h ∈C ( In ⊗ M, Out ⊗ M ′ ) which we represent by having theinitial state M and final state M ′ “vertical” while thestandard input and output are “horizontal”. While thiscould be formalise in the context of a double category,we only use it here as a diagrammatic notation: we readdiagrams from up/left to right/down.We choose p ( g ) and p ( h ) two purifications of respectively g and h , and we obtain the following: p ( f k +1 ) ... ... = p ( g ) p ( h ) ... ... p ( g ) ... ... = p ( f k ) ... ...Using uniqueness of purification up to a causal morphism,we obtain two causal morphisms c and d such that p ( f k +1 ) ...... = p ( g ) p ( h ) c ... ... p ( g ) ... ... = p ( f k ) d ... ...It follows that p ( f k +1 ) ...... = p ( h ) cp ( f k ) d ... ...We then define α k +1 = c ◦ ( id ⊗ p ( h )) ◦ d . By construction,it satisfies the hypothesis. • Regular part: for k ≥ n we simply take α k = f reg .By construction, we have FA ( α ) = ( f k ) k ≥ , hence FA ( − ) isfull. D. Completeness In this subsection, we prove the completeness of FA ( − ) . Westart by a few lemmas. Lemma 7. In a shadow category C , if π : X → X is a shadowof f ∈ C ( A, B ⊗ X ) then ( id B ⊗ π ) ◦ f = f Proof. Using the definition of a shadow category, we obtain ( id B ⊗ π ) ◦ f = f ⇐⇒ π ◦ π = π We know that π is idempotent. Lemma 8. In a purifiable category, if f ∈ C ( A, B ) , g ∈C ( A, B ⊗ X ) , p ∈ Pur g , and f = g then we have p ∈ Pur f .Proof. Since f is g composed with the discard, then a pu-rification of G composed with a purification of X gives apurification of f . The identity morphism id X is a purificationof X . Lemma 9. If C is a shadow purifiable category, whenever FA ( α ) = FA ( β ) there exists α ′ , β ′ such that FA ( α ′ ) = FA ( β ′ ) and (CM) , (IM) , [ ♦ α ′ = ♦ β ′ ] ⊢ α = β Proof. We take α, β ∈ RegSt ( C )( A, B ) such that FA ( α ) = FA ( β ) . We take p ( α ) a purification of α , and p ( β ) apurification of β . Using Lemma 8, we note that p ( α ) isalso a purification of f , and so is p ( β ) . So using uniquenessf the purification up to a causal morphisms, there exists c causal such that: α = p ( α ) β = p ( α ) c Since C is a shadow category, we write π for the (idempo-tent) shadow of p ( α ) , and from Lemma 7 we have α = p ( α ) π β = p ( α ) cπ Using the fact that the discard is causal and π is idempotent,we can rewrite α using (IM) and (CM) as follows: α = α πα ... p ( α ) ≡ α πα ... p ( α ) π = ( id B ⊗ ♦ α ′ ) ◦ γ ′ where α ′ and γ ′ are defined as follows: γ ′ γ ′ γ ′ ... def = p ( α ) π ... α ′ α ′ ... def = α πα ...Similarly, using the fact that C and the discard are causal and π is idempotent, we can rewrite β using (IM) and (CM) asfollows: β = β cβ ... p ( α ) π ≡ β cβ ... p ( α ) ππ = ( id B ⊗ ♦ β ′ ) ◦ γ ′ where γ ′ is defined above and β ′ is defined as follows: β ′ β ′ ... def = β πβ ... c So we found α ′ , β ′ , γ ′ such that(CM) , (IM) ⊢ α = ( id B ⊗ ♦ α ′ ) ◦ γ ′ (CM) , (IM) ⊢ β = ( id B ⊗ ♦ β ′ ) ◦ γ ′ This means that(CM) , (IM) , [ ♦ α ′ = ♦ β ′ ] ⊢ α = β We still need to prove that FA ( α ′ ) = FA ( β ′ ) . Since FA ( α ) = FA ( β ) and FA ( − ) is sound with respect to (CM) and (IM)(Lemma 3) we know that we have:FA α πα ... p ( α ) = FA β cβ ... p ( α ) π Since π is a shadow of p ( α ) , then it is equivalent to:FA α πα ... = FA β πβ ... c hence FA ( α ′ ) = FA ( β ′ ) Proposition 3. Whenever FA ( α ) = FA ( β ) we have (CM) , (IM) ⊢ α = β .Proof. We chain the use of lemma 9 and obtain two sequences α ( n ) and β ( n ) such that α (0) = α , β (0) = β and for all n ≥ we have(CM) , (IM) , [ ♦ α ( n +1) = ♦ β ( n +1) ] ⊢ α ( n ) = β ( n ) Using the coinduction rule this implies(CM) , (IM) ⊢ α ==