Skip to main content
Log in

A Complete Graphical Calculus for Spekkens’ Toy Bit Theory

  • Published:
Foundations of Physics Aims and scope Submit manuscript


While quantum theory cannot be described by a local hidden variable model, it is nevertheless possible to construct such models that exhibit features commonly associated with quantum mechanics. These models are also used to explore the question of \(\psi \)-ontic versus \(\psi \)-epistemic theories for quantum mechanics. Spekkens’ toy theory is one such model. It arises from classical probabilistic mechanics via a limit on the knowledge an observer may have about the state of a system. The toy theory for the simplest possible underlying system closely resembles stabilizer quantum mechanics, a fragment of quantum theory which is efficiently classically simulable but also non-local. Further analysis of the similarities and differences between those two theories can thus yield new insights into what distinguishes quantum theory from classical theories, and \(\psi \)-ontic from \(\psi \)-epistemic theories. In this paper, we develop a graphical language for Spekkens’ toy theory. Graphical languages offer intuitive and rigorous formalisms for the analysis of quantum mechanics and similar theories. To compare quantum mechanics and a toy model, it is useful to have similar formalisms for both. We show that our language fully describes Spekkens’ toy theory and in particular, that it is complete: meaning any equality that can be derived using other formalisms can also be derived entirely graphically. Our language is inspired by a similar graphical language for quantum mechanics called the ZX-calculus. Thus Spekkens’ toy bit theory and stabilizer quantum mechanics can be analysed and compared using analogous graphical formalisms.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others


  1. Bell, J.S.: On the Einstein-Podolsky-Rosen paradox. Physics 1(3), 195–200 (1964)

    Google Scholar 

  2. Spekkens, R.W.: Evidence for the epistemic view of quantum states: a toy theory. Phys. Rev. A 75(3), 032110 (2007). doi:10.1103/PhysRevA.75.032110

    Article  ADS  Google Scholar 

  3. Coecke, B., Edwards, B., Spekkens, R.W.: Phase groups and the origin of non-locality for qubits. Electron. Notes Theor. Comput. Sci. 270(2), 15–36 (2011). doi:10.1016/j.entcs.2011.01.021

  4. Spekkens, R.W.: Quasi-quantization: classical statistical theories with an epistemic restriction (2014). arXiv:1409.5041

  5. Pusey, M.F.: Stabilizer notation for Spekkens’ toy theory. Found. Phys. 42(5), 688–708 (2012). doi:10.1007/s10701-012-9639-7

    Article  ADS  MathSciNet  MATH  Google Scholar 

  6. Gottesman, D.: Stabilizer Codes and Quantum Error Correction. Ph.D. thesis, Caltech (1997). arxiv:quant-ph/9705052

  7. Pusey, M.F., Barrett, J., Rudolph, T.: On the reality of the quantum state. Nat. Phys. 8(6), 476 (2012). doi:10.1038/nphys2309

    Article  Google Scholar 

  8. Abramsky, S., Coecke, B.: Categorical quantum mechanics. In: Handbook of Quantum Logic and Quantum Structures: Quantum Logic, pp. 261–324. Elsevier (2008). doi:10.1016/B978-0-444-52869-8.50010-4

  9. Coecke, B., Edwards, B.: Phase groups and the origin of non-locality for qubits. Electron. Notes Theor. Comput. Sci. 270(1), 29 (2011). doi:10.1016/j.entcs.2011.01.004

    Article  Google Scholar 

  10. Abramsky, S., Coecke, B.: A categorical semantics of quantum protocols In: Proceedings of the 19th Annual IEEE Symposium on Logic in Computer Science (LICS’04), pp. 415–425 (2004). doi:10.1109/LICS.2004.1319636

  11. Coecke, B., Duncan, R.: Interacting quantum observables In: Automata, Languages and Programming, vol. 5126, pp. 298–310. Springer Berlin Heidelberg, Berlin (2008). doi:10.1007/978-3-540-70583-3_25

  12. Coecke, B., Duncan, R.: Interacting quantum observables: categorical algebra and diagrammatics. New J. Phys. 13(4), 043016 (2011). doi:10.1088/1367-2630/13/4/043016

    Article  ADS  MathSciNet  Google Scholar 

  13. Backens, M.: The ZX-calculus is complete for stabilizer quantum mechanics. New J. Phys. 16(9), 093021 (2014). doi:10.1088/1367-2630/16/9/093021

    Article  ADS  Google Scholar 

  14. Coecke, B., Edwards, B.: Spekkens’s toy theory as a category of processes. In: Abramsky, S., Mislove, M. (eds.) Proceedings of Symposia in Applied Mathematics, vol. 71, pp. 61–88. American Mathematical Society, Providence, RI (2012)

  15. Calderbank, A.R., Rains, E.M., Shor, P.W., Sloane, N.J.A.: Quantum error correction and orthogonal geometry. Phys. Rev. Lett. 78(3), 405 (1997). doi:10.1103/PhysRevLett.78.405

    Article  ADS  MathSciNet  MATH  Google Scholar 

  16. Nielsen, M.A., Chuang, I.L.: Quantum Computation and Quantum Information. Cambridge University Press, Cambridge; New York (2010)

    Book  MATH  Google Scholar 

  17. Deutsch, D.: Quantum computational networks. Proc. R. Soc. Lond. A 425(1868), 73 (1989). doi:10.1098/rspa.1989.0099

    Article  ADS  MathSciNet  MATH  Google Scholar 

  18. Joyal, A., Street, R.: The geometry of tensor calculus, I. Adv. Math. 88(1), 55 (1991). doi:10.1016/0001-8708(91)90003-P

    Article  MathSciNet  MATH  Google Scholar 

  19. Coecke, B., Paquette, E.: Categories for the practising physicist. In: Coecke, B. (ed.) New Structures for Physics. Springer, Heidelberg, Berlin (2010). doi:10.1007/978-3-642-12821-9_3

  20. Mac Lane, S.: Categories for the Working Mathematician, 2nd edn. Springer, New York (1998)

    MATH  Google Scholar 

  21. Selinger, P.: Dagger compact closed categories and completely positive maps (extended abstract). Electron. Notes Theor. Comput. Sci. 170, 139 (2007). doi:10.1016/j.entcs.2006.12.018

    Article  MathSciNet  Google Scholar 

  22. Coecke, B., Paquette, E.O.: POVMs and Naimark’s theorem without sums. Electron. Notes Theor. Comput. Sci. 210, 15 (2008). doi:10.1016/j.entcs.2008.04.015

    Article  MathSciNet  Google Scholar 

  23. Van den Nest, M., Dehaene, J., De Moor, B.: Graphical description of the action of local Clifford transformations on graph states. Phys. Rev. A 69(2), 022316 (2004). doi:10.1103/PhysRevA.69.022316

    Article  ADS  Google Scholar 

  24. Duncan, R., Perdrix, S.: Mathematical Theory and Computational Practice, vol. 5635, pp. 167–177. Springer Berlin Heidelberg, Berlin (2009). doi:10.1007/978-3-642-03073-4_18

  25. Quantomatic. Accessed Aug 2015

  26. Ranchin, A.: Depicting qudit quantum mechanics and mutually unbiased qudit theories. Electron. Proc. Theor. Comput. Sci. 172, 68–91 (2014). doi:10.4204/EPTCS.172.6

Download references


The authors would like to thank Dominic Horsman and Matt Pusey for comments on drafts of this paper. MB acknowledges financial support from the EPSRC.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Miriam Backens.


Appendix 1: Proofs of Results About Graph States, GS-LO Diagrams, and rGS-LO Diagrams

Here, we give the proofs for results stated in Sect. 5.3 where they differ significantly from the corresponding proofs in the zx-calculus. The zx-calculus is introduced in [12] and extended in [24]. The completeness proof for the stabilizer zx-calculus can be found in [13].


(Lemma 3, sketch) The proof is similar to the zx-calculus case as given by Duncan and Perdrix [24]. We show here as an example the case of the complete graph on three vertices (rearranged with two inputs at the bottom for ease of reading):

figure bc
figure bd

The first equality uses the decomposition of

figure be

in terms of red and green phase shifts In the second step, the spider rule is used to merge the green phases with their green neighbours. Subsequently, the red and green phased spiders are “pulled apart”, again using the spider law. In the fifth step, the colour change law and the fact that

figure bf

is self-inverse are used to change the green node at the top into a red one. The next step is an application of the bialgebra law. The penultimate step uses the fact that

figure bg

, which is the case \(a=0\) of (49) below. Lastly, the colour change rule is applied again.

The full proof then proceeds by induction over the number of vertices in the graph state. \(\square \)


(Theorem 5, sketch) The proof is analogous to the proof of Theorem 7 in [13], noting the following facts:

  • Let \(a\in \{0,1\}\) and \(\bar{a}=a\oplus 1\), then:


    Here, the first step uses the fact that

    figure bh

    is self-inverse and the second step uses the decomposition of

    figure bi

    into red and green phase shifts. The third step is an application of the spider law to merge the bottom two nodes, which is again used in the fourth step to pull apart the green node. In the fifth step, the bottom red node is copied: this works for both values of a. The penultimate step, involves dropping the scalar diagram on the left and merging the two red nodes in the non-scalar part by the spider law. The last equality is by the colour change law.

  • Any single toy bit operator can be written as

    figure bj

    for some \(a,b,c,d,e,f\in \{0,1\}\).

  • figure bk


    figure bl

    denote the zero scalar.

  • A loop with a

    figure bm

    node in it disappears:


\(\square \)


(Theorem 6) By theorem 5, any state diagram in the toy theory is equal to some GS-LO diagram. Lemma 4 shows that each vertex operator in the GS-LO diagram can be brought into the form:

figure bn

where \(a,b,c,d,e,f,g\in \{0,1\}\). Note that the cases \(c=0=d\) and \(f=0=g\) of the above normal forms correspond exactly to the elements of R as defined in (48). A local complementation about a vertex v pre-multiplies the vertex operator of v with

figure bo

and a fixpoint operation with

figure bp

, so any vertex operator can be brought into one of the above forms by some combination of local complementations and fixpoint operations about the corresponding vertex. The other effects of local complementations are to toggle some of the edges in the graph state and to pre-multiply the vertex operators of neighbouring vertices by

figure bq

, whereas fixpoint operations leave the edges invariant and pre-multiply the vertex operators of neighbouring vertices by

figure br

. The set R is not mapped to itself under repeated pre-multiplication with

figure bs

: this transformation sends the set

figure bt

for \(a,b\in \{0,1\}\) to itself, but it maps:


The normal form of a vertex operator contains at most two red nodes. Once a vertex operator is in one of the forms in R, pre-multiplication by green phase operators does not change the number of red nodes it contains when expressed in normal form. Thus the process of removing red nodes from the vertex operators by applying local complementations must terminate after at most 2n steps for an n-toy bit diagram, at which point all vertex operators are elements of the set R.

With all vertex operators in R, suppose there are two adjacent toy bits u and v which both have red nodes in their vertex operators, i.e. there is a subdiagram of the form:


with \(a,b,\in \{0,1\}\). A local complementation along the edge \(\{u,v\}\) maps the vertex operator of u to:


and similarly for v. After this, if \(a=1\), we apply a fixpoint operation to u and if \(b=1\) we apply a fixpoint operation to v. After this, the vertex operators on both u and v are green phase operators. Vertex operators of toy bits adjacent to u or v are pre-multiplied with some power of

figure bu

, which maps \(R\rightarrow R\). Thus each such operation removes the red nodes from a pair of adjacent toy bits and leaves all vertex operators in the set R. Hence after at most n / 2 such operations, it will be impossible to find a subdiagram as in (52). Thus, the diagram is in reduced GS-LO form. \(\square \)


(Proposition 1, sketch) The effect of the local complementations on the vertex operators of p and q is as follows:


If \(a=1\), we apply a fixpoint operation to p and if \(b=1\), we apply a fixpoint operation to q; then the vertex operators of p and q are in R. The fixpoint operations add

figure bv

to neighbouring toy bits, which maps the set R to itself. As fixpoint operations do not change any edges, we do not have to worry about them when considering whether the rest of the diagram satisfies definition 4.

The rest of the proof is analogous to the stabilizer QM case in [13]. \(\square \)


(Proposition 2) After the local complementation along the edge, the vertex operator of p is given by (53). For the vertex operator of q, we have:


Thus if a or b is 1, we apply a fixpoint operator to the appropriate vertex. From the properties of local complementations along edges it follows that the overall transformation preserves the two properties of rGS-LO states. \(\square \)

Appendix 2: Proof of Completeness Result

The arguments in the following proof closely follow the proof of Lemma 17 in [13]. As the diagrams are complicated and differ in subtle ways from the zx-calculus ones, the proof is nevertheless produced in full here.


(Lemma 5) Let \(D_1\) be the diagram in which p has the red node, \(D_2\) the other diagram. There are multiple cases:

In either diagram, p has no neighbours In this case, the overall state factorises and the two diagrams are equal only if the two states of p are the same. But:


for \(a,b,c\in \{0,1\}\), so the diagrams must be unequal.

p is isolated in one of the diagrams but not in the other We argue in Sect. 5.1 that, as in stabilizer QM, two toy graph states with local operators are equal only if one can be transformed into the other via a sequence of local complementations with corresponding changes to the local operators. As a local complementation never turns a vertex with neighbours into a vertex without neighbours, or conversely, the two diagrams cannot be equal.

p has neighbours in both diagrams Without loss of generality, assume that p is the first toy bit. Let \(N_1\) be the set of all toy bits that are adjacent to p in \(D_1\), and define \(N_2\) similarly. The vertex operators of any toy bit in \(N_1\) must be green phases in both diagrams. In \(D_1\), this is because of the definition of rGS-LO diagrams, in \(D_2\) it is because the pair of diagrams is simplified. Suppose the original diagrams involve n toy bits each. Let G be the graph on n vertices (named according to the same convention as in \(D_1\) and \(D_2\)) whose edges are \(\{\{p,v\} | v\in N_1\}\). Now consider the following diagram:


where the ellipse labelled G denotes the toy graph state corresponding to G, except that each vertex in the graph has not only an output but also an input. Call this diagram U. It is easy to see that U is invertible: composing it with itself upside-down yields the identity. Therefore composing this diagram with \(D_1\) and \(D_2\) will yield two new diagrams which are equal if and only if \(D_1=D_2\). We will denote the new diagrams by \(U\circ D_1\) and \(U\circ D_2\) and show that, no matter what the properties of \(D_1\) and \(D_2\) are (beyond the existence of an unpaired red node on p),

  • in \(U\circ D_1\), the toy bit p is in state

    figure bw


    figure bx


  • in \(U\circ D_2\), p is either entangled with other toy bits, or in one of the states

    figure by

    , where \(a,b\in \{0,1\}\).

By the arguments used in the first two cases, this implies that \(U\circ D_1\ne U\circ D_2\) and therefore \(D_1\ne D_2\).

Let \(n=\left| N_1 \right| \), \(m=\left| N_1\cap N_2 \right| \), and suppose the toy bits are arranged in such a way that the first m elements of \(N_1\) are those which are also elements of \(N_2\), if there are any. Consider first the effect on diagram \(D_1\). The local operator on p combines with the single-toy bit operators from U to:


where \(a\in \{0,1\}\). As green phase shifts can be pushed through other green nodes, the subdiagram involving p and the elements of \(N_1\) in \(U\circ D_1\) is equal to:


Here, \(b_1,\ldots ,b_n,c_1,\ldots ,c_n\in \{0,1\}\). Note that at the end p is isolated and in the state

figure bz

. The fact that we have ignored all toy bits not originally adjacent to p in \(D_1\) does not change that.

Next consider \(U\circ D_2\). As \(N_1\) is not in general equal to \(N_2\), the subdiagram consisting of p and vertices in \(N_1\) looks as follows:

figure ca

where \(l=m+1\) and \(d,e,f_1,\ldots ,f_n,g_1,\ldots ,g_n\in \{0,1\}\). Note that we neglect edges that do not involve p and also edges between p and vertices not in \(N_1\). We will now distinguish different cases, depending on the values of d and e.

If \(d=0,e=1\) apply a local complementation about p. This does not change the edges incident on p:

figure cb
figure cc
figure cd

Now if \(N_1=N_2\), p has no more neighbours and is in the state

figure ce

. This is not the same as the state p has in diagram 1, so the diagrams are not equal. Else, after the application of U, p still has some neighbours in diagram 2. Local complementations do not change this fact. Thus the two diagrams cannot be equal. The case \(d=1,e=0\) is entirely analogous, except that there is a fixpoint operation in addition to the local complementation at the beginning.

If \(d=e=0\), there are two sub-cases. First, suppose there exists \(v\in N_2\) such that \(v\notin N_1\). Apply a local complementation about this v. This operation changes the vertex operator on p to

figure cf

. It also changes the edges incident on p, but the important thing is that p will still have at least one neighbour. Thus we can proceed as in the case \(d=0,e=1\).

Secondly, suppose there is no \(v\in N_2\) which is not in \(N_1\). Since \(N_2\ne \emptyset \) (\(N_2=\emptyset \) corresponds to the case “p has no neighbours in \(D_2\)”, which was considered above), we must then be able to find \(v\in N_1\cap N_2\). The diagram looks as follows, where now \(m>0\) (again, we are ignoring edges that do not involve p):

figure cg

To show that the two diagrams are unequal it suffices to show that in diagram 2 the state of p either factors out, but is not

figure ch


figure ci

, or that it remains entangled with other toy bits. We are thus justified in ignoring large portions of the above diagram to focus only on p, v and the edge between the two. In particular, we will ignore for the moment the edges between p and toy bits other than v, as well as the last

figure cj

on p. Then:

figure ck
figure cl

where for the second equality we have applied a local complementation to v and used the Euler decomposition, the third equality follows by a local complementation on p, and the last one comes from the merging of p with the green node in the bottom left. Note that, in the end, p and v are still connected by an edge. None of the operations we ignored in picking out this part of the diagram will change that. Thus, as before, the state of p cannot be the same as in diagram 1. The two diagrams are unequal.

The case \(d=e=1\) is analogous to \(d=e=0\), except in either sub-case we start with a fixpoint operation on the chosen v.

We have thus shown that a simplified pair of rGS-LO diagrams are not equal if there are any unpaired red nodes. \(\square \)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Backens, M., Duman, A.N. A Complete Graphical Calculus for Spekkens’ Toy Bit Theory. Found Phys 46, 70–103 (2016).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: