Quantifying magic for multiqubit operations
Abstract
The development of a framework for quantifying “nonstabiliserness” of quantum operations is motivated by the magic state model of faulttolerant quantum computation, and by the need to estimate classical simulation cost for noisy intermediatescale quantum (NISQ) devices. The robustness of magic was recently proposed as a wellbehaved magic monotone for multiqubit states and quantifies the simulation overhead of circuits composed of Clifford+ gates, or circuits using other gates from the Clifford hierarchy. Here we present a general theory of the “nonstabiliserness” of quantum operations rather than states, which are useful for classical simulation of more general circuits. We introduce two magic monotones, called channel robustness and magic capacity, which are welldefined for general qubit channels and treat all stabiliserpreserving CPTP maps as free operations. We present two complementary Monte Carlotype classical simulation algorithms with sample complexity given by these quantities and provide examples of channels where the complexity of our algorithms is exponentially better than previous known simulators. We present additional techniques that ease the difficulty of calculating our monotones for special classes of channels.
numbered,startatroot
The GottesmanKnill theorem showed that circuits comprised of stabiliser state preparations, Clifford gates, Pauli /media/arxiv_projects/500752/measurements, classical randomness and conditioning can be efficiently simulated by a traditional computer Gottesman (1997); Aaronson and Gottesman (2004). If a circuit involves a relatively small proportion of nonClifford operations, simulation may be within the reach of a classical computer, albeit with a runtime overhead that is expected to scale exponentially with the amount of resource required. An important class of devices comprises socalled nearClifford circuits where simulation may be feasible Bennink et al. (2017); Yoganathan et al. (2018).
There are two scenarios where nearClifford circuits are relevant. As we enter the era of Noisy Intermediate Scale Quantum (NISQ) devices Preskill (2018), many experiments proposed as demonstrators of quantum advantage may be nearClifford so it is important to rigorously understand when a classical simulation is available. Furthermore, in the NISQ regime the need for classical simulation tools for benchmarking and verification becomes more pressing. The quantification of nonstabiliser resource is also of interest in the context of the magic state model of faulttolerant quantum computation Knill (2005); Bravyi and Kitaev (2005); Campbell et al. (2017), the second scenario. Any device intended to provide quantum advantage must involve nonstabiliser operations. In circuits employing errorcorrecting codes, however, it is often not possible for the code to ‘natively’ implement nonClifford gates faulttolerantly Campbell et al. (2017). Instead, these gates are implemented indirectly by injection of socalled magic states. These are nonstabiliser states that must be prepared using the experimentally costly process of magic state distillation Knill (2005); Bravyi and Kitaev (2005); Reichardt (2005); Bravyi and Haah (2012); Campbell et al. (2017); Jones (2013); Trout and Brown (2015); Haah et al. (2017); Hastings and Haah (2018); Krishna and Tillich (2018); Campbell and Howard (2018); Wang et al. (2018), which is comprised of Clifforddominated circuits.
Both of these scenarios motivate the development of a resource theory Vidal and Tarrach (1999); Grudka et al. (2014); Horodecki and Oppenheim (2013); Brandão and Gour (2015); Coecke et al. (2016); Napoli et al. (2016); Stahlke (2014); Wang et al. (2018); Takagi and Zhuang (2018); Regula (2018) where the class of free operations is generated by stabiliser state preparations and rounds of stabiliser operations as described above. For the case of odd dimensional qudits this problem is largely solved by the discrete phase space formalism Gross (2006); Mari and Eisert (2012); Veitch et al. (2012, 2014); Ahmadi et al. (2018); Delfosse et al. (2017); odd dimension qudit stabiliser states are characterised by a positive discrete Wigner function. In Ref. Pashayan et al. (2015), the discrete Wigner function was cast as a quasiprobability distribution, making a direct connection between the negativity of the distribution, and the complexity of calculating expectation values via a Monte Carlotype simulation algorithm. However, the discrete phase space approach cannot be applied cleanly to qubits without excluding some Clifford operations from the free operations Delfosse et al. (2015); Raussendorf et al. (2017). To retain all multiqubit stabiliser channels as free operations, then, we must seek alternative approaches.
Howard and Campbell Howard and Campbell (2017) introduced a scheme where density matrices are decomposed as real linear combinations of pure stabiliser state projectors. Nonstabiliser states sit outside the convex hull of the pure stabiliser states, so their decompositions necessarily contain negative terms and can again be viewed as quasiprobability distributions, with norm strictly larger than 1. The robustness of magic for a state, defined as the minimum norm over all valid decompositions, is a monotone under stabiliser operations and has several useful resourcetheoretic properties. Alternative approaches include stabiliser rank methods, where the state vector is decomposed as a superposition of stabiliser states García et al. (2014); Bravyi and Gosset (2016); Bravyi et al. (2016, 2018). Exact and approximate stabiliser rank, and the associated quantity extent, are /media/arxiv_projects/500752/measures of magic for pure states. Here we are interested in /media/arxiv_projects/500752/measures naturally suited for applications to mixed states or general, noisy quantum channels. A stabiliserbased method to simulate noisy circuits by decomposition of states into Pauli operators was recently proposed in Ref. Rall (2018). In this work we characterise the cost of quantum operations with respect to the resource theory of magic. Robustness of magic naturally quantifies the cost for a subclass of nonClifford operations, namely gates from the third level of the Clifford hierarchy. It is less clear how the framework can be extended to more general quantum operations, and formalising this is one of our main aims.
In Ref. Bennink et al. (2017), Bennink et al. presented an algorithm in which completely positive tracepreserving (CPTP) maps are decomposed as quasiprobability distributions over a subset of stabiliserpreserving operations that we will call . This subset supplements the Clifford unitaries with Pauli reset channels, in which /media/arxiv_projects/500752/measurement of some Pauli observable is followed by a conditional Clifford correction, so as to reset a state to a particular +1 Pauli eigenstate. While Bennink et al. showed that spans the set of CPTP maps, there is no guarantee that all stabiliserpreserving CPTP maps can be found within its convex hull. Indeed, we will see in Section IV there exist channels that are stabiliserpreserving, but are nevertheless assigned a nontrivial cost by the algorithm of Ref. Bennink et al. (2017). The implication is that decomposition in terms of elements of is not the best strategy for simulating general nonstabiliser operations. An obvious extension of Ref. Bennink et al. (2017) is to replace by the full set of stabiliserpreserving CPTP maps. The technical question to be answered is then how to correctly and concisely represent this set; how can we be sure that we have captured all possible stabiliserpreserving channels? This issue is addressed in Sections III and IV.
In this paper we introduce two magic monotones for channels: the channel robustness and the magic capacity . Both are closely related to the robustness of magic for states. They are welldefined for general qubit channels and treat all stabiliserpreserving CPTP maps as free operations. We will see that these monotones give the sample complexity of two classical simulation algorithms. Other magic monotones have been proposed Veitch et al. (2014); Ahmadi et al. (2018); Wang et al. (2018) but without known connections to classical simulation algorithms. Furthermore, we give several examples of channels where the simulation complexities of our approaches are exponentially faster (as a function of gate count) than other quasiprobability simulators such as the Bennink et al. simulator Bennink et al. (2017).
The paper is structured as follows. In Section I we review the properties of robustness of magic and give some definitions. Next, we summarise our main results in Section II, before pinning down what we mean by stabiliserpreserving operations in Section III. Sections IV and V are chiefly concerned with proving important properties of our monotones. Two classical simulation algorithms, each related to one of our monotones, are described in Section VI. Finally, in Section VII we calculate the numerical values of our monotones for operations on up to five qubits, using techniques developed in Appendix E.
I Preliminaries
Let be the set of qubit stabiliser states. In an abuse of notation we will use to mean a pure state from this set, and to mean the density matrix of a state taken from the stabiliser polytope, the convex hull of pure stabiliser states. The pure states in form an overcomplete basis for the set of dimensional density matrices . We can therefore write the density matrix for any state as an affine combination of pure stabiliser state projectors where , and . In general, can be negative. The robustness of magic is defined as the minimal norm over all possible decompositions Howard and Campbell (2017):
(1) 
In the definition above, the state of interest is expressed as a decomposition over pure stabiliser states. By collecting together all terms of the same sign, any state can instead be expressed in terms of a pair of mixed stabiliser states (Figure 1). An equivalent definition is then:
(2) 
The robustness of magic is a wellbehaved magic monotone, having the following properties:

Convexity: ;

Faithfulness: If , then . Otherwise ;

Monotonicity under stabiliser operations: If is a CPTP stabiliserpreserving operation, then ;

Submultiplicativity under tensor product: .
The quantity also has a clear operational meaning, quantifying the classical simulation cost in a Monte Carlotype scheme that samples from a quasiprobability distribution over stabiliser states Pashayan et al. (2015); Howard and Campbell (2017); Bennink et al. (2017). These algorithms estimate the expectation value of a Pauli observable after a stabiliser channel is applied to a nonstabiliser input state. The minimum number of samples required to achieve some stated accuracy scales with .
The robustness of magic can be calculated using standard linear programming techniques Boyd and Vandenberghe (2004) (for example using the MATLAB package CVX Grant and Boyd (2014)). The naive formulation of the linear program is practical on a desktop computer for up to five qubits (the number of stabiliser states increases superexponentially with ). It was recently shown by Heinrich and Gross Heinrich and Gross (2018) that when states possess certain symmetries, the original optimisation problem can be mapped to a more tractable one, so that the robustness of magic can be calculated for up to 10 copies of a state.
The framework naturally extends to a subclass of nonstabiliser circuits: those that may be implemented by deterministic state injection Howard and Campbell (2017), including all gates from the third level of the Clifford hierarchy (Figure 2). The canonical example is the Tgate, , which can be implemented by consuming socalled magic states as a resource Bravyi and Kitaev (2005). The classical simulation overhead for implementing a gate is then the robustness of magic for the consumed resource state. Not all nonstabiliser operations can be implemented in this way, however.
Informally we say that an operation is stabiliserpreserving if it always maps stabiliser states to stabiliser states. To make this precise, define to be the set of qubit operations such that for all , where is the identity map for an qubit Hilbert space. The set is then the set of channels that map qubit stabiliser states to qubit stabiliser states. We say a channel is “completely” stabiliserpreserving if for all .
Ii Overview of main results
Our first result is a characterisation of the class of completely stabiliserpreserving operations, making use of the the wellknown ChoiJamiołkowski isomorphism JamioÅkowski (1972); Choi (1975); Jiang et al. (2013).
Theorem 1 (Completely stabiliserpreserving operations).
Given an qubit CPTP channel, for all , if and only if . Furthermore, if and only if the Choistate
(3) 
is a stabiliser state. Here, are the qubit computational basis states.
We prove this in section III . We take this to be the set of free operations in our resource theories.
Our first new monotone is channel robustness . For an qubit CPTP channel this is defined as:
(4) 
where are completely stabiliserpreserving and CPTP maps. To fully enumerate this class of maps, we notice that the associated Choistate must satisfy two conditions: (i) is a stabiliser state, and (ii) satisfies the tracepreservation condition . We can therefore write:
(5) 
This can now be calculated by linear program given access to a list of all stabiliser states (see Appendix C). Channel robustness satisfies the following:

Faithfulness: If is a CPTP channel, then if is completely stabiliserpreserving and strictly larger than otherwise;

Convexity: ;

Submultiplicativity under composition: ;

Submultiplicativity under tensor product: .
As a special case, if is a CPTP stabiliser channel, then
(6) 
and similarly . This combines submultiplicativity under composition and faithfulness, to show that is suitably monotonically nonincreasing under compositions with stabiliser channels. This is the sense in which channel robustness is a magic monotone for channels. We prove submultiplicativity in Section IV, and show convexity and faithfulness in Appendix B.
The approach above is very close to the stabiliser decomposition of channels employed by Bennink et al. in Ref. Bennink et al. (2017). The main difference is that Bennink et al. optimise their decomposition with respect to , the set of Clifford unitaries supplemented by Pauli reset channels, rather than . The set turns out to be a strict subset of the stabiliserpreserving CPTP maps, so is a lower bound to the norm of any decomposition (though the bound is tight in many cases). Just as the norm in Bennink et al. quantifies the sample complexity of a classical simulation algorithm, we can construct a related algorithm where the runtime depends on in a similar way. We give the details of this algorithm in Section VI.1.
Before proceeding, let us reflect on the condition that enforces that the corresponding channels are tracepreserving. Dropping this condition would instead lead to , the robustness of the Choi state. For gates from the third level of the Clifford hierarchy, deterministic state injection is always possible, and hence the resource cost of the gate can be equated with the robustness of magic of the corresponding resource state. These resource states can always (by Cliffordequivalence) be taken to have the form . This is precisely the Choi state, so it is natural to ask if also quantifies nonstabiliserness for more general channels. We find that exhibits faithfulness, convexity and submultiplicativity under tensor product, but lacks submultiplicativity under composition. This arises from the fact that the decomposition of the Choi state corresponds to a decomposition of the channel into maps that are not necessarily tracepreserving. We illustrate this in Appendix A with counterexamples. Despite this shortcoming, we will see that is a useful quantity to compare to more wellbehaved /media/arxiv_projects/500752/measures.
Our second new monotone is the magic capacity. Given an qubit channel , it is natural to consider the largest possible increase in robustness of magic, over any possible input state. By analogy with the resource theories of entanglement Campbell (2010) and coherence Stahlke (2014), we define the magic capacity as:
Note that the definition of capacity involves forming a tensor product of an qubit channel with the qubit identity. This is necessary because there exist qubit channels that generate their maximum robustness when applied to part of an qubit state, where . Nevertheless, the qubit identity suffices for our definition; This is a consequence of Lemma 1 in Section III. The capacity has the following useful properties:

Faithfulness: If is a completely positive, tracepreserving (CPTP) channel, then if is stabiliserpreserving (SP), and strictly larger than otherwise;

Convexity: ;

Submultiplicativity under composition: ;

Submultiplicativity under tensor product: ;

Maximum increase in robustness: .
In Section V we prove properties 35, leaving the proof of convexity and faithfulness to Appendix D. We will also prove the following theorem relating magic capacity to channel robustness and .
Theorem 2 (Sandwich Theorem).
For any CPTP map , the following inequalities hold:
(7) 
We are interested in whether or not these inequalities are tight. In Table 1 we summarise numerical results for a selection of diagonal gates. The results for these gates are presented in full in Section VII.
2  3  4  5  

Multicontrol gates,  
Multicontrol gates,  
Random phase gates   
The magic capacity also quantifies the sample complexity for a Monte Carlotype classical simulation algorithm, presented in Section VI.2. This differs from previous algorithms such as Bennink et al. Bennink et al. (2017) in that a convex optimisation must be solved at each step. While this results in an increase in runtime per sample, it can be the case that , which can lead to an improvement in sample complexity over the algorithm of Section VI.1.
Iii Completely stabiliserpreserving operations
In this section, we justify setting as the class of free operations. We begin with an example channel that fails to be stabiliserpreserving when acting on part of a larger system. Consider the singlequbit channel defined by the Kraus operators , where and . Clearly, applied to any singlequbit state, the output will be some probabilistic mixture of and , and so must have , so . But if is applied to one qubit in a Bell pair, we obtain:
(8) 
where , . From this output state, we can deterministically recover a pure magic state on qubit 2 using only stabiliser operations, by making a /media/arxiv_projects/500752/measurement on qubit 1 and then performing a rotation on qubit 2 conditioned on the outcome. The output state has robustness .
So, there exist channels where but . To call a channel completely stabiliserpreserving, then, we need to be sure remains stabiliserpreserving for all . We now show we only need tensor with the identity of the same dimension as the original channel.
Lemma 1 (Maximum robustness achieved on qubits).
Let be an qubit quantum channel. Then for , for any , there exists some state such that:
(9) 
Proof.
Consider a qubit stabiliser state , with partition between the first and last qubits. Ref. Fattal et al. (2004) shows that the state is local Cliffordequivalent to independent Bell pairs entangled across the partition (here “local” means with respect to the bipartition rather than per qubit). Since there are qubits in partition , is at most . So we have:
(10) 
where is a Clifford operation, and . So writing the channel corresponding to as , for any on qubits, we know that:
(11) 
Since represents a (reversible) Clifford gate, by monotonicity of robustness of magic:
(12)  
(13) 
where in the last line we used the fact that is a stabiliser state, and hence does not contribute to the robustness. The state is a qubit state, so this proves the result. ∎
This lemma allows us to prove the first claim of Theorem 1, which says that is completely stabiliserpreserving if and only if . The inclusion is immediate since the stabiliser states are preserved under tracing out auxiliary systems. The interesting inclusion is . Now suppose that and consider any . By Lemma 1 there exists some stabiliser state such that . But if , then is a stabiliser state, so the robustness is equal to 1. By the faithfulness of robustness of magic, is a stabiliser state. Therefore, implies . Next, we discuss a straightforward test for membership of this set, which does not require mechanically checking all possible input stabiliser states.
We can associate every qubit channel with a unique density operator on qubits Jiang et al. (2013):
(14) 
Here label the computational basis states. We will also use the following property:
(15) 
Consider the robustness of magic of the Choi state, . We mentioned earlier that quantifies simulation cost for gates from the third level of the Clifford hierarchy. This motivates us to consider its properties for more general operations, and it turns out that gives us our first criterion for completely stabiliserpreserving channels.
Lemma 2 (Faithfulness of robustness of the Choi state).
Consider the qubit CPTP channel . If , then . Otherwise, .
Proof.
The fact that implies is easy to see. Since is itself a qubit stabiliser state, guarantees that is a stabiliser state, so must have robustness 1. The implication in the other direction is less obvious; one might imagine there perhaps exist maps that send in particular to a stabiliser state, but are not stabiliserpreserving in general. We show that this is not the case using an argument based on witnesses for nonstabiliser states, in part inspired by the conditions for free operations (SPO) given by Ahmadi et al. Ahmadi et al. (2018) for odd prime dimension qudits and for the single qubit case. The criteria for SPO were based on a class of witness defined by phase point operators. Here we instead consider the following family of witnesses for qubits. We say that is a good witness for qubit nonstabiliser states if:
(16) 
The hyperplane separation theorem Boyd and Vandenberghe (2004) guarantees that such witnesses exist and can be constructed for any nonstabiliser state . That is, for any , there always exists an operator such that and yet is a good qubit witness as defined above.
We first show that for any good qubit witness , the operator , where , is a good witness for qubit nonstabiliser states. For any :
(17) 
so that , where we used cyclicity of the trace and the fact that is a projector. If then the inequality (16) is trivially always satisfied by . Otherwise, is a stabiliser state (nonnormalised) and so too is . Then:
(18) 
The inequality follows because is a good witness and is a stabiliser state. Therefore, is also a valid witness.
Now suppose . Then there is some stabiliser state , such that . By the hyperplane separation theorem, there exists a good qubit witness such that . Since , the Choi state for is . We then use equation (15) to obtain:
(19) 
But is a good witness, so and therefore is a nonstabiliser state. So, by faithfulness of robustness of magic, if then . ∎
Combined the above two lemmas provide a proof of both claims given in Theorem 1. This does not mean the robustness of the Choi state is a reliable monotone, since despite being faithful it fails to be submultiplicative under composition (see Appendix A). Rather, we use the faithfulness of the Choi state as a tool to give an alternative definition of the channel robustness as captured by Eq. (5).
Iv Channel robustness
A natural extension of the algorithm of Bennink et al. Bennink et al. (2017) is to replace (the set of Clifford gates and Pauli reset channels) with . We therefore define the channel robustness as:
(20) 
To calculate this in practice, we decompose the Choi state as per equation (5), adapting the robustness of magic optimisation problem from Ref. Howard and Campbell (2017). The details are given in Appendix C.
The channel robustness is convex and faithful with these properties inherited from the robustness of magic (see Appendix B for details). Here we discuss additional properties.
Submultiplicativity under composition: . The channels and will have an optimal decomposition:
(21) 
where and are CPTP maps and completely stabiliser preserving. Using these decompositions, we obtain that
(22) 
where
(23)  
(24)  
(25) 
The set of CPTP completely stabiliser preserving channels is closed under composition and convex, so both are in this set. Therefore, we have a valid decomposition for that entails . One finds
(26) 
which completes the proof.
Submultiplicativity under tensor product: . We treat tensor product as a special case of composition. For qubit and qubit :
(27) 
To complete the proof we will confirm that
(28) 
As noted earlier, we can write , so that the Choi state for is given by:
(29) 
This state will have some optimal decomposition , where , so that:
(30) 
This is a valid, not necessarily optimal, stabiliser decomposition satisfying the trace condition, so we have
(31) 
This is enough to show submultiplicativity; for completeness, in Appendix B we will also show so that in fact we have equality.
V Magic capacity
We now turn to our second monotone, which quantifies the capacity of a channel to generate magic. Recall:
(32) 
where is the robustness of magic. Notice that we only need optimise over the pure stabiliser states. For mixed states or even nonstabiliser states, the capacity still captures the possible increase in robustness of magic by virtue of the maximum increase in robustness property:
(33) 
Here we prove this property, using similar arguments to those deployed in Campbell (2010). Consider an qubit channel . Any qubit input state will have an optimal stabiliser state decomposition , where , and such that . By linearity we have:
(34) 
By convexity of robustness of magic, we then have:
(35) 
The optimal pure stabiliser state , satisfies:
for any . So we have:
(36) 
Rearranging we obtain inequality (33).
Submultiplicativity under composition: . Take the composition of two linear maps and . There exists some stabiliser state that achieves the optimal robustness:
(37) 
The operator will have some optimal decomposition such that . So by linearity:
(38) 
Then by convexity of robustness of magic:
(39)  
(40)  
(41)  
(42) 
where to go from (40) to (41) we used the fact that since are stabiliser states, can be no larger than . Finally, using the fact that , we have , completing the proof.
Submultiplicativity under tensor product: . This follows directly from submultiplicativity under composition, since
(43) 
We saw in Section III that any gains in robustness achievable by tensoring with the identity and acting on a larger Hilbert space are already taken care of by the in the definition (32), so that and . Substituting this into inequality (43) gives the desired result.
v.1 Sandwich theorem
We will now prove Theorem 2, which stated that , for any CPTP channel .
Proof.
By definition . But is a stabiliser state, so can be no larger than , where is the stabiliser state that achieves the capacity, and so:
(44) 
Now suppose is the optimal decomposition of into CPTP stabiliserpreserving maps, , so that . Then for any input stabiliser state , we can write down a valid stabiliser decomposition of the output state:
(45) 
In particular this is true for the stabiliser state that is optimal with respect to the capacity. But equation (45) could be a nonoptimal decomposition, so its norm is at least as large as . So:
(46) 
completing the proof.
∎
Vi Classical simulation algorithms
Here we propose two classical simulation algorithms. The channel robustness relates to the runtime of our first simulator, which we call the static simulator. The magic capacity relates to the runtime of the second simulator, called the dynamic simulator. In both cases, we consider a circuit composed from a sequence of channels with acting on an initial stabiliser state, which we take to be . The circuit ends with some final state and /media/arxiv_projects/500752/measurement of some Pauli observable . We assume that each channel acts nontrivially on a bounded number of qubits (e.g. 2 or 3) so we can evaluate the relevant monotones. Our goal is to estimate the expectation value to within additive error. In the language of Ref. Pashayan et al. (2017) our simulators will be polyboxes.
Both our algorithms are inspired by previous methods that collect a large number of Monte Carlo samples that scales quadratically with the negativity of some quasiprobability distribution Pashayan et al. (2015); Bennink et al. (2017); Howard and Campbell (2017). The static Monte Carlo simulator uses a precomputed, and therefore static, quasiprobability distribution. The dynamic Monte Carlo simulator recomputes optimal quasiprobability distributions at each step, which can lead to fewer samples required but with a higher runtime per sample. As such, there are subtle tradeoffs in the runtime complexities.
Both our algorithms use that completely stabiliser preserving operations acting on a stabiliser state can be classically efficiently simulated. This follows from the fact that given the Choi state for an qubit channel, the channel may be implemented by performing a Bell /media/arxiv_projects/500752/measurement on , postselecting on the outcome to obtain and then tracing out the last qubits Gottesman and Chuang (1999). This can be simulated using GottesmanKnill when is a stabiliser state and . Curiously, it is unclear whether can be physically realised using Clifford unitaries and Pauli /media/arxiv_projects/500752/measurements but without the use of postselection.
vi.1 Static Monte Carlo
Consider a circuit where for every channel we find that the optimal decomposition w.r.t the channel robustness has the form
(47) 
where optimality means that . Recall that are CPTP and stabiliserpreserving. The output of the computation is
(48) 
where is a vector denoting the different values for each channel, and we introduce the shorthand
(49) 
and also