-
Notifications
You must be signed in to change notification settings - Fork 0
/
cqm.tex
1084 lines (985 loc) · 54.4 KB
/
cqm.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{Structures in Process Theories}
\label{chap:cqm}
\chapabstract{In this chapter we introduce the remaining background on categorical structures for process theories. From this background, we define a quantum-like process theory that comes equipped with a quantum-like interpretation through a generalized Born rule. Many of the properties developed here, while still general, are extensions of ideas from quantum theory, e.g. complementarity. Process theories that possess these properties can be considered quantum-like, and have diagrammatic representations that can be used as more powerful extensions of quantum circuits.}
\section{The Dagger}
\label{sec:dag}
This section introduces concepts that expand categorical diagrams beyond quantum circuits. We see that abstract linear algebra can be introduced by adding a so-called dagger functor. In the case of \cat{FHilb} this corresponds to the familiar notion of adjoint (complex-transpose). The addition of the dagger also allows us to take a perspective on quantum-like symmetric monoidal categories (not just \cat{FHilb}).
\begin{defn}
\label{defn:dagger}
A \textbf{dagger functor} on a category \cat{C} is an involutive contravariant functor $\dagger:\cat{C}\to\cat{C}$ that is the identity on objects. A \textbf{dagger category} is a category equipped with a dagger functor.
\end{defn}
Spelling out this definition, the dagger functor has the following properties for $f,g:\arrs{C}$ with suitable types and $A\in\objs{C}$:
\begin{equation}
\left(f^{\dagger}\right)^{\dagger} = f
\end{equation}
\begin{equation}
(g\circ f)^{\dagger} = f^{\dagger}\circ g^{\dagger}
\end{equation}
\begin{equation}
\idm{A}^{\dagger} = \idm{A}
\end{equation}
Thus for any $f:A\to B$ in a dagger category, its dagger or \textbf{adjoint} $f^{\dagger}:B\to A$ also exists in that category. We use the shorthand $\dagger$-SMC for a dagger symmetric monoidal category. In $\dagger$-SMCs the dagger and the monoidal product are required to cooperate, i.e. $(f\tensor g)^{\dagger}=f^{\dagger}\tensor g^{\dagger}$.\footnote{In general monoidal dagger categories the structural morphisms of unitors and associators are required to be unitary as Definition~\ref{def:dagdefs}.}
The quantum setting of \cat{FHilb} is a dagger category whose canonical dagger is the adjoint, and generalizing it in the manner of Definition \ref{defn:dagger} allows us to generalize many familiar terms, following Abramsky and Coecke~\cite{abramsky2004categorical}:
\begin{defn}
\label{def:dagdefs}
A morphism $f:A\to B$ in a dagger category is:
\begin{itemize}
\item \textbf{self-adjoint} when $f^{\dagger} = f$;
\item a \textbf{projector} when self-adjoint and $f\circ f = f$
\item an \textbf{isometry} when $\dag{f} \circ f = \idm{A}$;
\item \textbf{unitary} when both $\dag{f} \circ f = \idm{A}$ and $f\circ\dag{f} = \idm{B}$;
\item \textbf{positive} when $f = \dag{g}\circ g$ for some morphism $g:H\to K$.
\end{itemize}
\end{defn}
\noindent These concepts both have meaning as mathematical objects in linear algebra and as information theoretic concepts in a process theory. For example, a projector is some process where multiple sequential applications have the same effect as a single application in the broadest possible sense.
Further, the dagger can be intuitively extended to an operation on diagrams: it flips the picture upside-down around the horizontal axes. As a visual aid, morphisms can now be drawn with broken symmetry as follows:
\begin{equation}
\label{eq:daggerPics}
\input{tikz/1_daggerPics.tikz}
\end{equation}
Thus the unitarity condition becomes:
\begin{equation}
\label{eq:unitarityPics}
\input{tikz/1_unitarityPics.tikz}
\end{equation}
The next two definitions, that of scalars and effects, further our understanding of $\dagger$-SMCs with a generalized version of the Born rule that provides a basic notion of measurement.
\begin{defn}
\label{defn:scalar}
A \textbf{scalar} in a SMC is a morphism $a:I\to I$. As these are maps from the empty diagram to the empty diagram they are unsurprisingly represented as:
\begin{equation}
\begin{tikzpicture}[xscale={\tikzxscale}, yscale={\tikzyscale}]
\node [whitedot] (0) at (-1, -0) {$a$};
\end{tikzpicture}
\end{equation}
\end{defn}
This categorical view of scalars was made explicit in \cite{abramsky2004categorical}. To gain perspective on why these properly represent scalars, we consider two facts. Firstly, Kelly~\cite[Prop 6.1]{kelly1980coherence} showed that these scalars form a commutative monoid under categorical composition, as is graphically expressed by:
\begin{equation}
\begin{aligned}
\begin{tikzpicture}[xscale={\tikzxscale}, yscale={\tikzyscale}]
\node [whitedot] (0) at (-1, -0) {$a$};
\node [whitedot] (0) at (-1, -2) {$b$};
\end{tikzpicture}
\end{aligned}
\;=\;
\begin{aligned}
\begin{tikzpicture}[xscale={\tikzxscale}, yscale={\tikzyscale}]
\node [whitedot] (0) at (-1, -0) {$b$};
\node [whitedot] (0) at (-1, -2) {$a$};
\end{tikzpicture}
\end{aligned}
\end{equation}
\noindent Secondly, in $\cat{FHilb}$ they correspond exactly to the complex numbers, as linear maps~$\mathbb{C}\to\mathbb{C}$.
Recall from Definition~\ref{def:effect}, that, in a $\dagger$-SMC, effects on an object $A$ are morphisms $\bra{\psi}:A\to I$.
The dagger gives a method for assigning an effect to every state and vice versa: just as some preparation $p:I\to A$ prepares system $A$ in that state, the effect $\dag{p}:A\to I$ eliminates the system $A$ by the process $\dag{p}$. This duality presents generalized \textbf{inner products} as compositions of states and effects that generalize the usual Dirac notation~\cite{abramsky2004categorical}:
\begin{equation}
\left(
\begin{aligned}
\begin{tikzpicture}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (1) [state] at (0, -0.75) {$\psi$};
\node (2) at (0, 0.75) {};
\draw (1.center) to (2.center);
\end{tikzpicture}
\end{aligned}\right)^{\dagger}
=
\begin{aligned}
\begin{tikzpicture}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (1) at (0, -0.75) {};
\node (2) [state, hflip] at (0, 0.75) {$\psi$};
\draw (1.center) to (2.center);
\end{tikzpicture}
\end{aligned}
\qquad\qquad
\langle\phi|\circ|\psi\rangle = \langle\phi|\psi\rangle =
\begin{aligned}
\begin{tikzpicture}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (1) [state] at (0, -0.75) {$\psi$};
\node (2) [state, hflip] at (0, 0.75) {$\phi$};
\draw (1.center) to (2.center);
\end{tikzpicture}
\end{aligned}
\end{equation}
\section{The generalized Born rule}
\label{sec:bornrule}
Measurement in these process theories comes from a statement connecting probabilities and inner products. For a state $X:I\to A$ and an effect $Y:A\to I$ in a $\dagger$-SMC, the \textbf{amplitude} of outcome $Y$ given preparation $X$ is:
\begin{equation}
a = Y\circ X:I\to I.
\end{equation}
%Diagrammatically this is:
%\begin{equation}
%\mbox{Prob}(X|Y) \;=\;
%\begin{aligned}
%\begin{tikzpicture}[xscale=\tikzxscale, yscale=\tikzyscale]
%\node (1) [state] at (0, -0.5) {$Y$};
%\node (2) [state, hflip] at (0, 0.5) {$X$};
%\draw (1.center) to (2.center);
%\node (3) [state] at (0, 3.5) {$Y^{*}$};
%\node (4) [state, hflip] at (0, 4.5) {$X^{*}$};
%\draw (3.center) to (4.center);
%\end{tikzpicture}
%\end{aligned}
%\;=\;
%\begin{aligned}
%\begin{tikzpicture}[xscale=\tikzxscale, yscale=\tikzyscale]
%\node (1) [state] at (0, -0.5) {$Y$};
%\node (2) [state, hflip] at (0, 0.5) {$X$};
%\draw (1.center) to (2.center);
%\node (3) [state] at (3, -0.5) {$Y^{*}$};
%\node (4) [state, hflip] at (3, 0.5) {$X^{*}$};
%\draw (3.center) to (4.center);
%\end{tikzpicture}
%\end{aligned}
%\end{equation}
\noindent We could then define the operational probability Prob$(X|Y)=|a|^2$. While this clearly makes sense in \cat{FHilb}, where amplitudes are complex numbers, one might ask under what general conditions the scalars $I\to I$ will square to our usual notion of probability. Vicary provides an answer in the following theorem:
\begin{theorem}{\cite[Thm 4.2]{vicary2011completeness}}
In a monoidal dagger-category with simple tensor unit, which has all finite dagger-limits and for which the self-adjoint scalars are Dedekind-complete, the scalars have an involution-preserving embedding into the complex numbers.
\end{theorem}
\noindent For any category satisfying these conditions, this embedding can be used, along with appropriate normalization, to extract real-valued probabilities. Still, even if the scalars do not embed in the complex numbers one can generally handle the needed structure of complex conjugation to obtain a generalized Born rule. This is done using monoidal categories with duals.\footnote{These are sometimes called autonomous categories in the literature \cite{joyal1993braided,selinger2011survey}.}
Duals in a process theory help us define the quantum-like properties of entanglement and conjugation.
\begin{defn}
\label{def:dual}
In a $\dagger$-SMC, a system $A$ has a\footnote{In general, there can be separate left and right duals for an object in any category, where the definition given here corresponds to a left dual. In a \dsmc(in fact in any braided monoidal category with left duals), these are necessarily equal, so we need only speak of one dual~\cite[Prop.~7.2]{joyal1993braided}. } \textbf{dual} system $A^*$ if there exist processes
\begin{align}
e_A:I\to A^*\otimes A \quad \mbox{and}\quad d_A:A\otimes A^*\to I,
\end{align}
such that the following equations hold:
\begin{align}
\label{eq:snakeeq}
(d_A\otimes \idm{A})\circ(\idm{A}\otimes e_A) = \idm{A} \qquad (\idm{A^*}\otimes d_A)\circ(e_A\otimes \idm{A^*})=\idm{A^*}
\end{align}
\end{defn}
When duals are introduced, we can denote them by placing arrows on the objects:
\begin{equation}
\input{tikz/2_arrowdual.tikz}
\end{equation}
Thus the duality maps, commonly called ``cups" and ``caps", and their ``snake equations"~\eqref{eq:snakeeq} have the following diagrammatic form:
\begin{align}
\input{tikz/2_capcup.tikz}
\end{align}
\begin{equation}
\label{eq:snake}
\input{tikz/2_snake.tikz}
\end{equation}
\noindent and are well behaved under the dagger functor, i.e.
\begin{equation}
\input{tikz/2_daggerdual.tikz}
\end{equation}
We can compose these caps and cups to define the dual of any process $f:A\to B$ as $f^*:B^*\to A^*$:
\begin{equation}
\label{eq:dualmorph}
\input{tikz/2_dualmorph.tikz}
\end{equation}
This is called the \textbf{upper-star} of $f$.
\begin{example}
\label{ex:bellduals}
To get a better handle on what duals are, we consider the example of \cat{FHilb}. Given some finite dimensional Hilbert space $A\in\objs{FHilb}$, its dual $A^*$ is the usual dual space, i.e. the space of linear functionals $A\to \mathbb{C}$. Note that in this case $A$ is isomorphic to $A^*$, and thus we can canonically map $\bra{i}\mapsto\ket{i}$. Because of this isomorphism, we will often omit the arrows on wires when working in \cat{FHilb}. Using this and given a basis $\{ \ket{i} \}$ for $A$, the cups and the caps are maps:
\begin{align}
e_A &:: 1\mapsto \sum_i\bra{i}\otimes\ket{i}\cong\sum_i\ket{i}\otimes\ket{i}
\\
d_A &:: \sum_i\ket{i}\otimes\bra{i}\cong\sum_i\bra{i}\otimes\bra{i} \mapsto 1
\end{align}
We then immediately recognize $e_A$ as entangled state preparation. In particular, when $A$ is a two-dimensional Hilbert space, $e_A$ is a Bell state preparation of $\ket{\psi_{00}}=\ket{00}+\ket{11}$ and and $d_A$ is a post-selected Bell measurement for $\ket{\psi_{00}}$. For any process in \cat{FHilb} its dual gives the transpose.
\end{example}
This provides a motivating example for the following, which acts as a generalized conjugation operation:
\begin{defn}
Given a process theory with duals \cat{C}, the \textbf{lower-star} is an involutive map
\begin{align*}
(-)_*:\arrs{C}&\to\arrs{C} \\
\left(f:A\to B\right) &\mapsto f_*:=(\dag{f})^*=\dag{(f^*)}.
\end{align*}
\end{defn}
The lower-star operation introduces abstract probabilities for the generalized Born rule:
\begin{defn}[Generalized Born Rule]
\label{def:bornrule}
For a state $X:I\to A$ and an effect $Y:A\to I$ in a $\dagger$-SMC, the probability of outcome $Y$ given preparation $X$ is:
\begin{equation}
\mbox{Prob}(Y|X) = (Y\circ X)_*\otimes Y\circ X:I\to I.
\end{equation}
\end{defn}
\noindent It is easy to see that this reduces to the usual Born rule in \cat{FHilb}.
The cup and cap maps also provide a general definition for the trace of a process:
\begin{equation}
\label{eq:trace}
\Tr \left(\begin{pic}
\node (0) at (0,0) {};
\node [morphism, wedge] (1) at (0,1) {$f$};
\node (2) at (0,2) {};
\draw [arrow=0.5] (0) to (1.south);
\draw [arrow=0.5] (1.north) to (2);
\end{pic} \right) =
\input{tikz/3_trace.tikz},
\end{equation}
whose correspondence with the usual trace is easily shown~\cite{coecke2015generalised}:
\begin{equation}
\mbox{Tr}(f) = \left(\sum_i\bra{ii}\right)\circ\left(\idm{A}\tensor f\right)\circ\left(\sum_j\ket{jj}\right) = \sum_i\langle i | f |i\rangle = \sum_if_{ii}
\end{equation}
\subsection{Quantum-like process theories}
The addition of states and a generalized Born rule (with further details in this section), give our process theories a notion of measurement and a quantum-like character.
\begin{defn}(Quantum-like Process Theories)
\label{thm:QPT}
A $\dagger$-SMC where all objects have duals is called a \textbf{$\dagger$-compact category}. A \textbf{quantum-like process theory} (QPT) is a \dcc where objects are interpreted as systems and morphisms are interpreted as processes.
\end{defn}
Duals and their ``wire-straightening" equations give diagrams in a quantum-like process theory a lot of power to encode topological equivalences. This is well expressed in the following graphical coherence theorem, whose mathematical details can be traced in Selinger's survey~\cite{selinger2011survey}.
\begin{theorem}[Fundamental Theorem of Diagrams~\cite{coecke2015generalised}]
\label{thm:fund}
Two diagrams in a QPT are considered equal if one can be smoothly transformed to another by bending, stretching, or crossing wires, and by moving boxes around. Given any two QPTs $\cat{C}$ and $\cat{D}$ and a functor $F:\cat{C}\to\cat{D}$, for any two diagrams $d$ and $d'$ in $\cat{C}$, if $d=d'$ as diagrams then $F(d)=F(d')$ in $\cat{D}$.
\end{theorem}
To recap, we have so far introduced the structures of the dagger and duals, allowing us to compute measurement outcomes by manipulation of the diagrams alone. This contrasts with the usual quantum circuit formalism, which provides a representation of a protocol, but whose implementation must ultimately be understood through the matrix mechanics that accompany it. The use of this difference - the operational in operational process theories - can be illustrated with quantum teleportation, which provides a motivating example and was introduced in this form by Abramsky and Coecke~\cite{abramsky2004categorical}.
\begin{example}
\label{ex:teleport}
We saw in Example \ref{ex:bellduals} that caps and cups represent preparation and post-selected measurement of one of the Bell states $\ket{\psi_{00}}$. The other Bell states can be prepared and/or measured by the application of a unitary to one of the entangled systems:
\begin{equation}
\begin{pic}[xscale={\tikzxscale}, yscale={\tikzyscale}]
\node (0) at (-1, -0) {};
\node (1) at (1, -0) {};
\node (2) at (0, -1) {};
\node (r) at (1,3) {};
\node (l) at (-1,3) {};
\node [morphism, wedge] (u) at (-1,1) {$U_i$};
\draw (1.center) to (r);
\draw (u.north) to (l);
\draw [bend right=45, looseness=1.00] (u.south) to (2.center);
\draw [bend right=45, looseness=1.00] (2.center) to (1.center);
\end{pic}
\qquad \qquad
\begin{pic}[xscale={\tikzxscale}, yscale={-1*\tikzyscale}]
\node (0) at (-1, -0) {};
\node (1) at (1, -0) {};
\node (2) at (0, -1) {};
\node (r) at (1,3) {};
\node (l) at (-1,3) {};
\node [morphism, wedge, hflip] (u) at (-1,1) {$U_i$};
\draw (1.center) to (r);
\draw (u.south) to (l);
\draw [bend right=45, looseness=1.00] (u.north) to (2.center);
\draw [bend right=45, looseness=1.00] (2.center) to (1.center);
\end{pic}
\end{equation}
A teleportation protocol can then be represented by the process where Alice and Bob share an entangled system that will be used to teleport from Alice to Bob:
\begin{equation}
\input{tikz/2_teleportation.tikz}
\end{equation}
Here the cup map represents the shared Bell state. Alice performs a Bell measurement on the source system and her half of the entangled system. Bob then performs a unitary that matches Alice's Bell measurement. We can verify the effect of the protocol using purely diagrammatic equivalences:
\begin{equation}
\label{eq:teleportderive}
\input{tikz/2_teleportderive.tikz}
\end{equation}
This protocol provides a good example where space-like and time-like intuition should be applied carefully. The application of the Bell effect and state connects Alice and Bob's systems by a single wire. Thus, the space-like separated pair of Alice and Bob's unitaries become equivalent to their time-like sequential composition, as show in the first step of~\eqref{eq:teleportderive}. In fact, if one is reading the passage of time vertically in the diagrams, then it may be surprising to note that because
\begin{equation}
\begin{pic}[xscale=0.9*\tikzxscale, yscale=\tikzyscale]
\node (0) at (-1, -2) {};
\node (1) at (1, -2) {};
\node (2) at (0, -3) {};
\node [style=morphism, wedge, hflip] (3) at (-3, -1) {$U_{i}$};
\node (4) at (-2, 1) {};
\node (5) at (-3, -0) {};
\node (6) at (-1, -0) {};
\node (7) at (-3, -4) {};
\node [style=morphism, wedge] (8) at (1, 2) {$U_i$};
\node (9) at (1, 3) {};
\draw [bend right=45, looseness=1.00] (0.center) to (2.center);
\draw [in=-90, out=0, looseness=1.00] (2.center) to (1.center);
\draw [bend left=45, looseness=1.00] (5.center) to (4.center);
\draw [in=90, out=0, looseness=1.00] (4.center) to (6.center);
\draw (7.center) to (3.south);
\draw (3.north) to (5.center);
\draw (6.center) to (0.center);
\draw (8.south) to (1.center);
\draw (8.north) to (9.center);
\end{pic}
\quad=\quad
\begin{pic}[xscale=0.9*\tikzxscale, yscale=\tikzyscale]
\node (0) at (-1, -2) {};
\node (1) at (1, -2) {};
\node (2) at (0, -3) {};
\node [style=morphism, wedge, hflip] (3) at (-3, -0.7) {$U_{i}$};
\node (4) at (-2, 1) {};
\node (5) at (-3, -0) {};
\node (6) at (-1, -0) {};
\node (7) at (-3, -4) {};
\node [style=morphism, wedge] (8) at (1, -1.2) {$U_i$};
\node (9) at (1, 3) {};
\draw [bend right=45, looseness=1.00] (0.center) to (2.center);
\draw [in=-90, out=0, looseness=1.00] (2.center) to (1.center);
\draw [bend left=45, looseness=1.00] (5.center) to (4.center);
\draw [in=90, out=0, looseness=1.00] (4.center) to (6.center);
\draw (7.center) to (3.south);
\draw (3.north) to (5.center);
\draw (6.center) to (0.center);
\draw (8.south) to (1.center);
\draw (8.north) to (9.center);
\end{pic}
\end{equation}
the time-ordering of Alice and Bob's unitaries appears to not affect the protocol.
In some sense, the connectivity of the diagram means that Alice's unitary appears to happen first in the compositional sequence regardless of the time ordering in the protocol's implementation. It should be noted that this behavior is only present in the post-selected teleportation protocol that we present here. In general, when some classical communication is required, the time-ordering of course certainly matters.
This presentation of the teleportation protocol is useful in several ways:
\begin{enumerate}
\item The high level structure of the protocol (the teleportation) is immediately manifest without accompanying calculation.
\item It is obvious how to design equivalent teleportation protocols with multiple parties and Bell measurements in more elaborate arrangements, e.g.
\begin{equation}
\input{tikz/2_weirdteleport.tikz}
\end{equation}
\item By specifying the teleportation protocol at the level of QPTs, we can consider models of teleportation in theories other than quantum theory, i.e. categories other than $\cat{FHilb}$. As an example, the QPT $\cat{FRel}$ where systems are sets and processes are relations also has entangled states established by duals, where the dagger functor is the relational converse. All the protocol specifications given in this section apply equally well in the $\cat{FRel}$ setting, just as they will in any other QPT.
\end{enumerate}
\end{example}
Quantum-like process theories already give us some power above and beyond the usual quantum circuit formalism, and we add more structures to the toolbox in the next sections. We have glossed over some of the details of how measurement should be represented in such theories, but the introduction of classical structures in the next section allows us to be more exact in Section~\ref{sec:measurements}.
\section{Classical structures}
\label{sec:observables}
Within a process theory we can construct objects that have the phenomenology of classical information: copying, deleting, etc. These structures become the observables of QPTs that allow us to extract classical information via measurements.
\subsection{Monoids and comonoids}
Monoids and comonoids on systems embody our notions of copying and comparing states. As they are particular kinds of processes, we draw them with distinct pictures. For $A\in\objs{C}$, a monoid $(A,*,\mathbbm{1})$ has states of $A$ as elements and the following maps:
\begin{equation}
\input{tikz/1_monoidPics.tikz}
\end{equation}
\begin{defn}
\label{defn:monoid}
In a monoidal category, a \textbf{monoid} is a triple \whitemonoid{A} of an object $A$, a morphism $\tinymult[whitedot] : A \otimes A \to A $ called the multiplication, and a state $\tinyunit[whitedot] : I \to A$ called the unit, satisfying associativity and unitality equations:
\begin{equation}
\label{eq:monoid}
\input{tikz/1_monoid.tikz}
\end{equation}
\end{defn}
\begin{defn}
\label{defn:comonoid}
In a monoidal category, a \textbf{comonoid} is a triple \whitecomonoid{A} of an object $A$, a morphism $\tinycomult[whitedot] : A \to A \otimes A$ called the comultiplication, and an effect $\tinycounit[whitedot] : A \to I$ called the counit, satisfying coassociativity and counitality equations:
\begin{equation}
\label{eq:comonoid}
\input{tikz/1_comonoid.tikz}
\end{equation}
\end{defn}
\noindent We use differently colored dots to represent different monoids on the same object. In a dagger monoidal category every monoid has a corresponding comonoid formed by applying the dagger functor, i.e. $\left(\tinymult[whitedot]\right)^{\dagger}=\tinycomult[whitedot]$ and $\left(\tinyunit[whitedot]\right)^{\dagger}=\tinycounit[whitedot]$\,. When a monoid and comonoid are the same color, we take this to mean that each is the dagger of the other.
\begin{defn}
In a monoidal category with object $A$, a \textbf{monoid homomorphism} $f:\whitemonoid{A}\to\blackmonoid{A}$ is a map $f:A\to A$ such that
\begin{equation}
\label{eq:monhom}
\input{tikz/1_mon_hom.tikz}
\end{equation}
\end{defn}
\noindent A \textbf{comonoid homomorphism} is defined similarly, but with the dagger of the conditions in~\eqref{eq:monhom}.
In the next section we will ask for the comonoid and monoid to interact in various ways.
\subsection{Generalized observables}
\label{sec:abstractobservables}
When monoids and comonoids combine under certain rules, we obtain the structure of classical information on systems in a QPT. We can think of this as a way of embedding classical information into the systems of an arbitrary QPT.
\begin{defn}
\label{def:frobenius}
In a $\dagger$-SMC, the pair of a monoid \whitemonoid{A} and comonoid \whitecomonoid{A} form a \textbf{dagger-Frobenius algebra} ($\dagger$-FA) when the following equation holds:
\begin{equation}
\label{eq:frobenius}
\input{tikz/1_Frobenius.tikz}
\end{equation}
\end{defn}
When \tinymult[whitedot] is commutative, the $\dagger$-FA is commutative (is a $\dagger$-CFA). The co-commutativity of \tinycomult[whitedot] for a $\dagger$-CFA follows~\cite[Thm 3.2.8]{kissinger2012pictures}.
\begin{defn}
\label{def:classicalstruct}
A \textbf{classical structure} (\dotonly{whitedot}) is a dagger-Frobenius algebra \whitefrob{A} satisfying the \textbf{specialness} \eqref{eq:special} and \textbf{symmetry} \eqref{eq:sym} conditions:
\begin{equation}
\label{eq:special}
\begin{aligned}
\begin{tikzpicture}[xscale={1.5*\tikzxscale}, yscale={1.5*\tikzyscale}]
\draw (0,0.25) to (0,1) node [whitedot] {} to [out=\nwangle, in=down] (-0.5,1.5) to [out=up, in=\swangle] (0,2) node [whitedot] {} to (0,2.75);
\draw (0,1) to [out=\neangle, in=down] (0.5,1.5) to [out=up, in=\seangle] (0,2);
\end{tikzpicture}
\end{aligned}
\quad=\quad
\begin{aligned}
\begin{tikzpicture}[xscale={1.5*\tikzxscale}, yscale={1.5*\tikzyscale}]
\draw (-0.5,0) to (-0.5,3);
\end{tikzpicture}
\end{aligned}
\end{equation}
\vspace{-10pt}
\begin{equation}
\label{eq:sym}
\begin{aligned}
\begin{tikzpicture}[xscale={1.5*\tikzxscale}, yscale={1.5*\tikzyscale}]
\draw (0,-0.5) node [whitedot] {} to (0,0.5) node [whitedot] {} to [out=\nwangle, in=down] (-0.5,1.0) to [out=up, in=down] (0.5,2);
\draw (0,0.5) to [out=\neangle, in=down] (0.5,1) to [out=up, in=down] (-0.5,2);
\end{tikzpicture}
\end{aligned}
\quad=\quad
\begin{aligned}
\begin{tikzpicture}[xscale={1.5*\tikzxscale}, yscale={1.5*\tikzyscale}]
\draw (0,-0.5) node [whitedot] {} to (0,0.5) node [whitedot] {} to [out=\nwangle, in=down] (-0.5,1.0) to [out=up, in=down] (-0.5,2);
\draw (0,0.5) to [out=\neangle, in=down] (0.5,1) to [out=up, in=down] (0.5,2);
\end{tikzpicture}
\end{aligned}
\end{equation}
\end{defn}
\begin{defn}
\label{def:copyables}
The set of \textbf{classical states} $K_{\circ}$ for a classical structure (\dotonly{whitedot}) are all states $j:I\to A$ such that:
\begin{equation}
\label{eq:copy}
\begin{pic}[xscale=\tikzxscale, yscale=-0.8*\tikzyscale]
\node [state] at (1.25,3) {$j$};
\draw (2,0) to [out=up, in=\seangle] (1.25,1.5);
\draw (0.5,0) to [out=up, in=\swangle] (1.25, 1.5);
\draw (1.25,1.5) to (1.25, 3);
\node [whitedot] at (1.25,1.5) {};
\end{pic}
\quad=\quad
\begin{pic}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (a) [state] at (2.5,0) {$j$};
\node (b) [state] at (0,0) {$j$};
\draw (a) to (2.5,2);
\draw (b) to (0,2);
\end{pic}
\end{equation}
\end{defn}
\noindent These classical states will typically be drawn as states that are the same color as the classical structure to which they correspond. It is also easy to determine the behavior of classical states under composition with the (co)unit:
\begin{equation}
\label{eq:unitscalar}
\begin{pic}[xscale=\tikzxscale, yscale=-0.8*\tikzyscale]
\node [state] at (1.25,3) {$j$};
\draw (1.25,0) to (1.25, 3);
\end{pic}
\;\stackrel{\eqref{eq:comonoid}}{=}\;
\begin{pic}[xscale=\tikzxscale, yscale=-0.8*\tikzyscale]
\node [state] at (1.25,3) {$j$};
\draw (2,0) to [out=up, in=\seangle] (1.25,1.5);
\draw (0.5,0) to [out=up, in=\swangle] (1.25, 1.5);
\draw (1.25,1.5) to (1.25, 3);
\node [whitedot] at (1.25,1.5) {};
\node [whitedot] at (0.5,0) {};
\end{pic}
\;\stackrel{\eqref{eq:copy}}{=}\;
\begin{pic}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (a) [state] at (2.5,0) {$j$};
\node (b) [state] at (0,0) {$j$};
\draw (a) to (2.5,2);
\draw (b) to (0,2);
\node [whitedot] at (0,2) {};
\end{pic}
\quad\qquad\Leftrightarrow\qquad\quad
\begin{pic}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (b) [state] at (0,0) {$j$};
\draw (b) to (0,2);
\node [whitedot] at (0,2) {};
\end{pic}
\;=\;1
\end{equation}
\noindent where $1$ is the unit scalar, i.e. $1\circ s = s = s\circ 1$ for all scalars $s$. In this sense the counit ``erases" classical points.
The following theorems by Coecke et al. characterize the relationship between classical structures and observables.
\begin{theorem}[{\cite[Thm 5.1]{coecke2013new}}]
Symmetric dagger Frobenius algebras in \cat{FHilb} are orthogonal bases.
\end{theorem}
\noindent The additional condition of specialness for classical structures acts as a normalizing condition so that:
\begin{theorem}[{\cite[Sec 6]{coecke2013new}}]
\label{thm:cstructBases}
Classical structures in \cat{FHilb} are orthonormal bases.
\end{theorem}
\noindent \noindent Classical structures are bases in \cat{FHilb} and so are recognized as generalized \textbf{observables} in a QPT. The classical states of classical structures (Definition~\ref{def:copyables}) form the elements of these bases, more specifically the eigenvectors of the observables, though we should be careful that in categories other than $\cat{FHilb,}$ they do not necessarily have all the familiar properties of bases for Hilbert spaces. For example, we usually expect to be able to distinguish maps by testing them on basis elements. In general this only holds for certain classical structures:
\begin{defn}
\label{def:enoughclassicalpoints}
A classical structure (\dotonly{graydot}) has \textbf{enough classical states} when for all processes $f,g:A\to B$:
\begin{align}
f=g \qquad \Leftrightarrow \qquad \left(\forall \ket{j}\in K_{\dotonly{graydot}}:f\circ\ket{j}=g\circ\ket{j}\right)\;
\end{align}
\end{defn}
\begin{remark}
The correspondence in Theorem \ref{thm:cstructBases} was modified for the infinite dimensional case in \cite{abramsky2012h}, where it still holds. We will only use the finite dimensional case in this thesis as we are concerned only with algorithms that run on computers of finite size.
\end{remark}
\begin{defn}
\label{def:dimension}
In a QPT, the \textbf{dimension} $d(A)$ of an object $A$ equipped with a dagger-Frobenius algebra \whitefrob{A}, is given by the following composite:
\begin{equation}
\label{eq:dim}
\input{tikz/1_dimension.tikz}
\end{equation}
\end{defn}
\noindent
When the algebra is in fact a classical structure,~\eqref{eq:dim} can be simplified to the composition of the unit and counit:
\begin{equation}
\label{eq:defdim}
d(A) \;= \;
\begin{pic}[xscale={\tikzxscale}, yscale={\tikzyscale}]
\node (t) [whitedot] at (0,1) {};
\node (b) [whitedot] at (0,-1) {};
\draw (t) to (b.center);
\end{pic}
\end{equation}
\begin{remark}
It is important to note that the dimension of a system does not always equal the number of classical states of the associated classical structure. One setting where this does not hold is \cat{FRel}, where this fact plays an important role in its QPT characterization in Chapter~\ref{chap:mermin}.
\end{remark}
An important result of Coecke and Duncan shows that the rules for classical structures can be summarized in a convenient normal form that is in keeping with the sorts of topological equivalences we are used to for diagrams of a QPT. Let the maps $\tinycomult[whitedot]_n:A\to A^{\otimes n}$ be defined recursively by:
\begin{align}
\tinycomult[whitedot]_0:=\tinycounit[whitedot]
\qquad\qquad
\tinycomult[whitedot]_{n+1}:=\left(\tinycomult[whitedot]_{n}\otimes\idm{A}\right)\circ\tinycomult[whitedot]
\end{align}
Let $\tinymult[whitedot]_n$ be similarly defined.
\begin{theorem}[Spider Theorem {\cite[Thm 6.11]{coecke2011interacting}}]
\label{thm:spider}
Given a classical structure, let \newline$f:A^{\otimes n}\to A^{\otimes m}$ be constructed from $\{\tinymult[whitedot],\tinycomult[whitedot],\tinyunit[whitedot],\tinycounit[whitedot]\}$ such that the diagram is connected. Then $f=\tinycomult[whitedot]_m\circ\tinymult[whitedot]_n$.
\end{theorem}
\noindent This normal form has a neat diagrammatic representation.
\begin{proposition}[{\cite[Thm 6.12]{coecke2011interacting}}]
\label{prop:spider}
Given a classical structure on $A$, let
$(\whitedot)_n^m$ denote the `$(n,m)$-legged spider':
\begin{equation}
\input{tikz/2_spiderdef.tikz}
\end{equation}
then any process $A^{\otimes n}\to A^{\otimes m}$ built from $\{\tinymult[whitedot], \tinycomult[whitedot], \tinyunit[whitedot],\tinycounit[whitedot]\}$ which has a connected graph is equal to $(\whitedot)^m_n$. Spider
composition is:
\begin{equation}\label{eq:spidercomp}
\input{tikz/2_spidercomp.tikz}
\end{equation}
\end{proposition}
The spider rule makes it clear that every classical structure on $A$ can be used to make $A$ dual to itself (Definition~\ref{def:dual}) using caps ($\tinycounit[whitedot]\circ\tinymult[whitedot]$) and cups ($\tinycomult[whitedot]\circ\tinyunit[whitedot]$) built from the white dot:
\tikzeq{tikz/2_frobcomp.tikz}
Kissinger provides direct proof of this fact~\cite[Thm 3.2.7]{kissinger2012pictures}.
The upper and lower star operations with respect to this white dot cup and cap corresponds in \cat{FHilb} to transposition and conjugation in the white dot basis respectively. Further it can be shown that transposition with respect to a classical structure is equivalent to the dagger when applied to its classical states:
\begin{equation}
\label{eq:dagfrob}
\input{tikz/2_dagfrobtranspose.tikz}
\end{equation}
\noindent This is of course not true on general states.
\section{Phases}
\label{sec:phases}
Phases for QPTs were introduced by Coecke and Duncan~\cite{coecke2011interacting}. They decorate classical structures with an abelian group in a particular way.
\begin{defn}
\label{def:phases}
A \textbf{phase state} for a Frobenius algebra $\whitecomonoid{A}$ is a state $\ket{\alpha}$ such that:
\begin{equation}
\label{eqn:zphasestate}
\input{tikz/2_phasestate.tikz}
\end{equation}
Each phase state corresponds to a \textbf{phase} that is a unitary map in the following form:
\begin{equation}
\label{eqn:zphase}
\input{tikz/2_phase.tikz}
\end{equation}
\end{defn}
\begin{proposition}[Phase groups]
Given a $\dagger$-FA $\whitefrob{A}$ in a QPT, its phases form a group under the following addition:
\begin{equation}
\input{tikz/2_phasegroups.tikz}
\end{equation}
with unit $\tinyunit[whitedot]$. When the Frobenius algebra is part of a classical structure, then its phases form an abelian group.
\end{proposition}
\begin{proof}
See~\cite[Sec. 7.4]{coecke2011interacting} for proofs.
\end{proof}
Phases can be added to the normal form from Theorem~\ref{thm:spider} to give a decorated spider rule~\cite[Thm 7.11]{coecke2011interacting}:
\begin{equation}
\label{eq:decspider}
\input{tikz/2_decspider.tikz}
\end{equation}
with composition
\begin{equation}
\input{tikz/2_decspidercomp.tikz}
\end{equation}
This normal form is a powerful simplifying tool and will often be used in the analysis of diagrams of processes in QPTs.
\section{Complementarity}
The notion of complementary bases can also be lifted to the general level of classical structures in QPTs~\cite{coecke2011interacting}. This extension is perhaps best presented as emergent from a suitable generalization of mutual unbiasedness.\footnote{Our presentation in this regard is heavily influenced by the approach taken by Coecke et al. in~\cite{coecke2015generalised}.} This means that for two bases $\{\ket{i}\}$ and $\{\ket{j}\}$ on a $D$-dimensional Hilbert space, $|\langle i|j\rangle|^2 = 1/D$ for all $i,j$. In diagrams we then have:
\tikzeq{tikz/2_mub.tikz}
as the mutual unbiasedness condition, where we have assumed that $D$ is invertible (as all dimensions in \cat{FHilb} are) and used \eqref{eq:defdim} and \eqref{eq:unitscalar} to obtain the right hand form.
\begin{defn}[Complementarity]
\label{def:complementarity}
In a QPT, two classical structures (\dotonly{whitedot}) and (\dotonly{graydot}) on the same object are \textbf{complementary} when the following equation holds:
\begin{equation}
\label{eq:complementarity}
\input{tikz/2_antipodehopf.tikz}
\qquad \mbox{where} \qquad
\input{tikz/2_antipode.tikz}
\end{equation}
where $D$ is the dimension of the object and the map $S:A\to A$ is called the \textbf{antipode}.
\end{defn}
The Equation \eqref{eq:complementarity} is equivalent to mutual unbiasedness on classical structures that have enough classical points by Definition \ref{def:enoughclassicalpoints}.
Then by a quick calculation:
\tikzeq{tikz/2_complemub.tikz}
where $(*)$ is an application of Theorem \ref{thm:fund}, and the last step uses the fact that there are enough classical points.
Complementarity relates the classical states of classical structures to their phase groups.
\begin{lemma}
\label{lem:phaseunbiased}
If two classical structures in a QPT are complementary, then, up to an idempotent scalar, a state that is a classical point of one is a phase state for the other.
\end{lemma}
\begin{proof}
We prove this using diagrams, following Coecke and Kissinger~\cite{qcs-notes}:
\begin{equation}
\input{tikz/3_phaseUnbiased.tikz}
\end{equation}
\end{proof}
Though the converse of this lemma holds in \cat{FHilb}, i.e. each phase is also a classical point of the complementary structure, the converse does not hold in general.
%\noindent
%Note that this is not a symmetric condition between the gray and white structures. %However, thanks to the symmetric property of the dagger-Frobenius algebras, %it is equivalent to the following alternative condition:
%\begin{equation}
%\input{tikz/2_complementarity2.tikz}
%\end{equation}
%The daggers of these equations give rise to two further equivalent conditions.
\begin{defn}\label{def:coherence}
In a QPT, two classical structures (\dotonly{whitedot}) and (\dotonly{graydot}) are \textbf{coherent} when the following equations hold:
\begin{equation}
\label{eq:coherence}
\input{tikz/2_coher.tikz}
\end{equation}
\end{defn}
\begin{proposition}[{\cite[Prop.~3]{coecke2015generalised}}]
\label{prop:cohere}
In \cat{FHilb} if we are given two self-adjoint operators corresponding to complementary classical structures, then we can always construct a pair of coherent classical structures with the same classical points.
\end{proposition}
\noindent This means that in the QPT for quantum computation, we can take complementary classical structures to be coherent without loss of generality.
The terminology for the antipode comes from the fact that complementarity is almost enough to make the classical structures a Hopf algebra using this antipode. Some complementary classical structures do indeed form Hopf algebras and these ones are called strongly complementary. They will be discussed in Section~\ref{sec:strcomplFT} in detail.
\begin{example}
\label{ex:cnot}
Complementary observables allow us to construct a generalized form of the controlled-not gate in any QPT. In \cat{FHilb} we can choose classical structures on the two-dimensional Hilbert space that correspond with the usual Z and X observables: \begin{align*}
\tinycomult[whitedot] : &
\begin{array}{rcl}
\ket{0} & \mapsto & \ket{00} \\
\ket{1} & \mapsto & \ket{11}
\end{array}
&
\tinycomult[graydot] : &
\begin{array}{rcl}
\ket{+} & \mapsto & \ket{++} \\
\ket{-} & \mapsto & \ket{--}
\end{array}
\\ \\
\tinycounit[whitedot] : &
\begin{array}{rcl}
\ket{0} & \mapsto & 1 \\
\ket{1} & \mapsto & 1
\end{array}
&
\tinycounit[graydot] : &
\begin{array}{rcl}
\ket{+} & \mapsto & 1 \\
\ket{-} & \mapsto & 1
\end{array}
\\ \\
K_{\dotonly{whitedot}} &= \{\ket{0},\ket{1}\}
&
K_{\dotonly{graydot}} &= \{\ket{+},\ket{-}\}
\end{align*}
These classical structures are coherent and complementary and each have $\mathbb{Z}_2$ as their phase groups, which we will write as $\{0,\pi\}$ where addition is modulo $2\pi$. By Lemma~\ref{lem:phaseunbiased}, we know that the classical points of the $\dotonly{whitedot}$-structure are phases for the $\dotonly{graydot}$-structure. In particular we have:
\begin{equation}
\label{ex:cnottypes}
\begin{pic}
\node [style=state] (0) at (1, -0) {$0$};
\node (1) at (1, 1) {};
\draw (0) to (1);
\end{pic}
\;=\;
\begin{pic}
\node [style=graydot] (0) at (1, -0) {};
\node (1) at (1, 1) {};
\draw (0) to (1);
\end{pic}
\qquad\qquad
\begin{pic}
\node [style=state] (0) at (1, -0) {$1$};
\node (1) at (1, 1) {};
\draw (0) to (1);
\end{pic}
\;=\;
\begin{pic}
\node [style=graydot] (0) at (1, -0) {$\pi$};
\node (1) at (1, 1) {};
\draw (0) to (1);
\end{pic}
\qquad\qquad
\begin{pic}[scale=0.8]
\node [style=graydot] (0) at (1, -0) {$\pi$};
\node (1) at (1, 1) {};
\node (2) at (1, -1) {};
\draw (0) to (1);
\draw (0) to (2);
\end{pic}
\;=\;
X\mbox{-gate}::
\left\{\begin{array}{c}
\ket{0}\mapsto\ket{1} \\
\ket{1}\mapsto\ket{0} \\
\end{array}\right.
\end{equation}
These structures can be used to define the controlled-not $\mbox{CNOT}:H_2\otimes H_2\to H_2\otimes H_2$ whose diagram is:
\begin{align}
\input{tikz/2_cnot.tikz}
\end{align}
\noindent where the right system acts as the control. We can verify that this behaves as usual for qubits using Z (the $\dotonly{whitedot}$-classical structure as their computational basis).
\begin{align}
\begin{pic}[dotpic]
\node [style=whitedot] (0) at (1, -0) {};
\node [style=graydot] (1) at (-1, -0) {};
\node [point] (2) at (1, -1) {$0$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (0);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\draw (0) to (5.center);
\end{pic}
\;&\stackrel{\eqref{ex:cnottypes}}{=}\;
\begin{pic}[dotpic]
\node [style=whitedot] (0) at (1, -0) {};
\node [style=graydot] (1) at (-1, -0) {};
\node [graydot] (2) at (1, -1) {};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (0);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\draw (0) to (5.center);
\end{pic}
\;\stackrel{\eqref{eq:coherence}}{=}\;
\begin{pic}[dotpic]
\node [style=graydot] (0) at (0, -0) {};
\node [style=graydot] (1) at (-1, -0) {};
\node [graydot] (2) at (1, 0) {};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (5.center);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\end{pic}
\;\stackrel{\eqref{eq:decspider}}{=}\;
\begin{pic}[dotpic]
\node [point] (2) at (1, 0) {$0$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (5.center);
\draw (3.center) to (4.center);
\end{pic}
\\
\begin{pic}[dotpic]
\node [style=whitedot] (0) at (1, -0) {};
\node [style=graydot] (1) at (-1, -0) {};
\node [point] (2) at (1, -1) {$1$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (0);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\draw (0) to (5.center);
\end{pic}
\;&\stackrel{\eqref{ex:cnottypes}}{=}\;
\begin{pic}[dotpic]
\node [style=whitedot] (0) at (1, -0) {};
\node [style=graydot] (1) at (-1, -0) {};
\node [graydot] (2) at (1, -1) {$\pi$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1, 1) {};
\draw (2.north) to (0);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\draw (0) to (5.center);
\end{pic}
\,\stackrel{\eqref{eq:coherence}}{=}\,
\begin{pic}[dotpic]
\node [style=graydot] (0) at (0, -0) {$\pi$};
\node [style=graydot] (1) at (-1, -0) {};
\node [graydot] (2) at (1.5, 0) {$\pi$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1.5, 1) {};
\draw (2.north) to (5.center);
\draw (0) to (1);
\draw (3.center) to (1);
\draw (1) to (4.center);
\end{pic}
\;\stackrel{\eqref{eq:decspider}}{=}\;
\begin{pic}[dotpic]
\node [style=graydot] (1) at (-1, -0) {$\pi$};
\node [point] (2) at (1.5, 0) {$1$};
\node (3) at (-1, -1) {};
\node (4) at (-1, 1) {};
\node (5) at (1.5, 1) {};
\draw (2.north) to (5.center);
\draw (3.center) to (1);
\draw (1) to (4.center);
\end{pic}
\end{align}
This shows that on computational basis elements, the control is left unchanged while a $X$-gate (a computational bit flip) is conditionally applied.
\end{example}
This example construction motivates the following definition on any kind of system in any QPT:
\begin{defn}
Given two classical structures (\dotonly{whitedot}) and (\dotonly{graydot}) that are complementary and coherent, the generalized \textbf{controlled-not} is the map:
\begin{equation}
\label{eq:generalizedcnot}
\sqrt{\ud(A)}\,\,
\begin{pic}[xscale=\tikzxscale, yscale=\tikzyscale]
\node (b) [graydot] at (0,0) {};
\node (w) [whitedot] at (1,1) {};
\draw (-0.75,2) to [out=down, in=left] (b.center);
\draw (b.center) to [out=right, in=left] (w.center);
\draw (w.center) to (1,2);
\draw (b.center) to (0,-1);
\draw (w.center) to [out=right, in=up] (1.75,-1);
\end{pic}
\end{equation}
where we have assumed that a scalar equal to the square root of the dimension exists.
\end{defn}
\noindent This scalar is needed to ensure the unitarity of the controlled-not gate, which we discuss in further details in Section \ref{sec:unitaryoracles}.
\section{Enriched QPTs}
\label{sec:enrichedQPTs}
Some QPTs, such as \cat{FHilb}, come equipped with linear structure on their processes. Abstractly these are enriched categories, i.e. categories where hom-sets are replaced with other objects.\footnote{Kelly~\cite{kelly1982basic} can be used as a standard reference for enriched category theory.}
\begin{defn}
\label{def:enrichedcat}
Given a monoidal category $K$, a $K$-enriched category \cat{C} has objects $\objs{C}$ such that:
\begin{itemize}
\item For every pair of $A,B\in\objs{C}$ there is a hom-object:
\begin{align}
\cat{C}(A,B)\in \objs{K}.
\end{align}
\item For all objects $A,B,C\in\objs{C}$ composition is given by a morphism in $\arrs{K}$ of type:
\begin{align}
\circ_{A,B,C}:\cat{C}(B,C)\otimes\cat{C}(A,B)\to\cat{C}(C,A).
\end{align}
\end{itemize}
\end{defn}
Linear maps between Hilbert spaces themselves form a vector space, so \cat{FHilb} is in fact a $\cat{FVect}$-enriched category. Another way of saying this is that \cat{FHilb} is enriched in \cat{FVect}. As diagrams of a process theory are morphisms in a category, diagrams in an enriched category have additional operations. The \cat{FVect} enrichment of \cat{FHilb}, for example, allows us to sum diagrams, as in the following property. In the following definition \cat{Mon} is the category of monoids and monoid homomorphisms.
\begin{defn}
\label{def:resid}
In a \cat{Mon}-enriched QPT, a set of states $\{\ket{x}\}$ on a system $A$ forms a \textbf{resolution of the identity} when:
\begin{equation}
\label{eq:ResolutionId}
\input{tikz/3_multcharresolutionID.tikz}
\end{equation}
\end{defn}
\noindent where the sum operation comes from a monoid structure of the hom-object \cat{C}(A,A). In \cat{FHilb} more specifically, this addition is inherited from the vector space enrichment. In fact, in Hilbert spaces all the classical states of any classical structure form a resolution of the identity. Further, in \cat{FHilb}, we are able to link the classical structure maps to classical states in the following ways~\cite{coecke2015generalised}:
\begin{align}
\label{eq:spidersums}
\input{tikz/3_spider_sums.tikz}
\end{align}
Arbitrary spiders can then be written as:
\begin{align}
\input{tikz/3_spider_sums_n_legs.tikz}
\end{align}
\begin{remark}
We emphasize that this connection between classical states and classical structures does not hold in general QPTs, but merely serves to further motivate abstract constructions that generalize from \cat{FHilb}. We make use of this technique in the following section on measurements.
\end{remark}
Gogioso provides more details on enriched categories, especially in regards to the results of Section~\ref{sec:strcomplFT} of this thesis, in~\cite[Sec. 6]{gogioso2015fourier}.
\section{Measurements}
\label{sec:measurements}
We have already introduced a notion of post-selected measurement in Definition~\ref{def:bornrule}. This section uses Selinger's CPM (completely positive map) construction~\cite{selinger2007dagger}, to present measurement as a process that outputs classical information~\cite{coecke2012strong}. In particular, measurements are maps that decohere pure states into mixed states in a certain basis. We need to be more precise about systems and their duals here so will be more consistent about using wires decorated with the proper arrows.
Using caps and cups, we can construct the unique ``name" of a process $\rho$ as:
\begin{equation}
\label{eq:cj}
\input{tikz/2_mapstateduality.tikz}
\end{equation}
This is the usual Choi-Jamiolkowski isomorphism for map-state duality in quantum information. The ``doubling" that occurs here, provides a natural way to represent measurements as completely positive maps. Suppose we wish to measure a system with respect to a classical structure (\dotonly{graydot}),
whose classical states form an orthonormal basis $\{ \ket{x_i} \}$. The probability
of getting the $i$-th measurement outcome is computed using the Born
rule:
\begin{equation}
\mbox{Prob}(i, \rho) = \mbox{Tr}(\ketbra{x_i}{x_i} \rho)
\end{equation}
We can write this probability distribution as a vector in the basis $\{ \ket{x_i} \}$. That is, a vector whose $i$-th entry is the probability of the $i$-th outcome:
\begin{equation}
M_{\dotonly{graydot}}(\rho) = \sum
\mbox{Tr}(\ketbra{x_i}{x_i} \rho) \ket{x_i}
\end{equation}
So, $M$ defines a linear map from density matrices to probability distributions. Expanding this graphically, we have:
\begin{equation}
\sum_i \mbox{Tr}\left( \input{tikz/2_Prho.tikz} \right)
\begin{pic}
\node [style={gray point}] (m) at (0, 1.25) {$i$};
\draw [diredge] (m) to (0,2.25);
\end{pic}
\;\stackrel{\eqref{eq:trace}}{=}\;
\input{tikz/2_measurementderivation2.tikz}
\end{equation}
\begin{defn}[{\cite{coecke2012strong}}]
\label{def:meas2}
For a classical structure \graycomonoid{A}, a measurement in that classical structure is defined as
the following map:
\begin{equation}
\input{tikz/2_measurement.tikz}
\end{equation}
\end{defn}
While the exact Born rule derivation does not apply in all QPTs (as traces and the linear structures are different in general), we can still consider Definition~\ref{def:meas2} as the abstract version of a QPT measurement.
\begin{example}
We will illustrate this measurement using an example on a qubit. Take the $Z$ and $X$ classical structures to be defined as they were in Example~\ref{ex:cnot}. Here $Z$ is the computational basis and the two classical points of $X$ are $\begin{pic}[scale=0.5]
\node (o) at (0,1) {};
\node (t) [point, fill=gray, scale=0.9] at (0,0) {$0$};
\draw (o) to (t);
\end{pic}=\ket{+}$ and
$\begin{pic}[scale=0.5]
\node (o) at (0,1) {};