Interactive proofs for BQP via self-tested graph states

Using the measurement-based quantum computation model, we construct interactive proofs with non-communicating quantum provers and a classical verifier. Our construction gives interactive proofs for all languages in BQP with a polynomial number of quantum provers, each of which, in the honest case, performs only a single measurement. Our techniques use self-tested graph states. In this regard we introduce two important improvements over previous work. Specifically, we derive new error bounds which scale polynomially with the size of the graph compared with exponential dependence on the size of the graph in previous work. We also extend the self-testing error bounds on measurements to a very general set which includes the adaptive measurements used for measurement-based quantum computation as a special case.


Introduction
We seek to find interactive proofs between quantum provers and classical verifiers, both limited to polynomial-time calculations. That is to say, we would like to have a procedure where a classical computer (the "verifier"), limited to a polynomial number of operations, can query a quantum computer (the "prover"), also limited to a polynomial number of operations, and tap into its resources in order to perform some computation. Additionally, if the verifier unhappily interacts with a malicious quantum computer it should be able to detect this and abort the calculation, even if the prover has unlimited computational resources. To make the challenge less trivial, there should exist interactive proofs for problems that are harder than the verifier could solve by itself and ideally there should exist interactive proofs for any problem that the prover can solve by itself.
This problem is interesting for a variety of reasons. First, as a complexity theoretic question it has obvious value in further developing the theory of how powerful quantum computers are. From a practical computing point of view, it would be nice to know whether it would be possible to have cheap classical computers interact with large (and presumably more expensive) quantum "servers," paying for services as required. Of course the users would like to know that they get their money's worth, and interactive computations can confirm this. As well, from an experimental point of view, interactive proofs can be used to verify the operation of some experimental apparatus. This is of particular importance for quantum experiments since it may well be that, for large experiments, it is impossible (in practical terms) to classically compute what the predictions of the quantum model are, leading to questions about the falsifiability of the quantum formalism [AV12].
Very little is known about this problem as stated. Clearly the set of languages recognizable by a poly-time classical verifier and poly-time quantum prover lies somewhere between P and BQP since on one hand the verifier can ignore the prover, and on the other hand the verifier and honest prover together form a poly-time quantum machine. As well, there do exist interactive proofs for all of BQP since BQP ⊆ PSPACE and PSPACE = IP [Sha92,LFKN90], but the known constructions require the prover to solve PSPACE-complete problems. Constructions for particular problems are known ( [McK12] for example) and of course anything in NP has a trivial interactive proof, but beyond this little is known.
Current techniques [ABG + 07, BLM + 09, MMMO06, MY04, MY98, MYS12, McK10b, MS12, PAB + 09, PAM + 10, RUV12] for probing the behaviour of adversarial quantum systems all rely on entanglement and hence in order to make use of them we must introduce more provers. Reichardt et al. [RUV12] considered the case of two provers. Here we will consider the case of a polynomial number of provers, but each limited to a single operation, and show that we can recognize all of BQP with this model. Our construction uses two major components. One is self-testing and the other is measurement-based quantum computation. Self-testing allows us to confirm that the provers hold onto a graph state and perform certain measurements on this state when instructed to do so. Measurement-based quantum computation allows us to use these verified resources to perform the desired calculation.

Previous work
Self-testing was introduced by Mayers and Yao [MY98,MY04]. Their goal was to establish that a pair of devices share a maximally entangled pair of qubits, and that the devices implement some specific measurements, all while making a minimum of assumptions on the devices. Specifically they make no assumptions about the dimension of the Hilbert space associated with the devices. Meanwhile, van Dam et al. [vMMS00] considered testing gates in the context of known Hilbert space dimension. Magniez et al. [MMMO06] combined the two approaches, allowing testing of entire quantum circuits. Further refinements, including simpler proof techniques and extension to complex measurements appear in [McK10a] and [MM11]. Self-testing of graph states, critical for our application, appears in [McK10b]. Miller and Shi [MS12] also give a general construction for self-testing states based on any XOR game.
These works all require additional assumptions. In particular, they assume that devices can be used repeatedly in an independent and identical manner in order to gather necessary statistics. As well, [MMMO06] assumes that certain states are in a product form. McKague and Magniez (in preparation) remove these assumptions for quantum circuits using techniques similar to those used here.
Stemming from a different heritage, Broadbent et al. [BFK09] considered a semi-quantum verifier who only prepares single qubit states, and a fully quantum prover. They give a construction for an interactive proof for any language in BQP. Additionally, they describe (without rigorous proof) an ex-tension using two quantum provers and a classical verifier. Their construction uses measurement-based quantum computation. Aharonov et al. [ABOE08] also describe a semi-quantum protocol using a constant sized quantum verifier and a polynomial-time quantum prover.
In the context of quantum cryptography, Acín et al.
[ABG + 07] introduced device independent quantum key distribution. This model is very similar to that used here. However, rather than computation the goal is to expand a private shared key. From a physics perspective, Bardyn et al. [BLM + 09] and McKague et al. [MYS12] consider self-testing type entanglement tests from the perspective of Bell inequalities.
Most recently, Reichardt et al. [RUV12] proved a very general result allowing two non-communicating quantum provers along with a classical verifier to recognize all of BQP. The core of their result is a self-test, using only two provers, for multiple EPR pairs and measurements. Using this tool they show how to test individual gates and perform measurements via teleportation. Finally, they combine the results to give an interactive proof for entire quantum circuits.
Measurement-based quantum computation, also known as one-way quantum computation or graph state computation, was introduced by Raussendorf and Briegel [RB01,RBB03]. In this model of computation we begin with a graph state and perform measurements on each vertex, with the sequence of vertices and the measurement bases used determined by the calculation we wish to make. The outcome of the calculation is then derived from the measurement outcomes. One important aspect of the measurements is that they are adaptive -the measurement basis for a particular vertex can depend on the outcomes of measurements on previous vertices. This allows us to perform any calculation in BQP. The particular variety of graph-state computation that we use is due to Mhalla and Perdrix [MP12]. The advantage of this model is that it requires measurements in the X-Z plane only.

Contributions
We make several important contributions. First, we modify the proof for the graph state self-test from [McK10b], allowing a tighter error analysis. as in [McK10b]. This exponential improvement in the error scaling in n makes it possible to self-test with a polynomial number of trials to achieve a constant error. We also analyse the error in the case of adaptive measurements, which are required for measurement-based quantum computing. Additionally we extend the graph state test to X-Z plane measurements in order to achieve universal computation. Finally we show how to use the self-test in order to test the provers for honesty in the interactive proof scenario. Combining this test for honesty with measurement-based quantum computation we achieve the following theorem: Theorem 1. For every language L ∈ BQP and input x there exists a poly(|x|)time verifier V which interacts with a poly(|x|) number of non-communicating quantum provers such that • If x ∈ L then there exists 1 a set of honest quantum provers, each of which performs a single operation, for which V accepts with probability at least c = 2/3.
• If x / ∈ L then, for any set of provers, V accepts with probability no more than s = 1/3.
Along the way we we also prove several results which may be of independent interest. In particular our error analysis for triangular cluster states can be applied to general graph states and stabilizer states enabling self-testing of these states with robust error bounds. As well, our error bounds for adaptive measurements are quite general, applying to general quantum circuits which incorporate the untrusted measurements performed by the provers.
Compared with the result of Reichardt et al. [RUV12] our contribution is to provide a different construction with different underlying computational model, that of measurement-based quantum computation. While they use a constant number of provers, each of which runs in polynomial time, we use a polynomial number of provers, each of which runs in constant time (indeed, each prover only performs a single measurement). The advantage of our technique is that, since only measurements are used, there is no need for any process tomography. As well, the provers are very easy to implement, requiring only the ability to measure in four different bases (once an appropriate graph state is prepared). Finally, there is a very nice conceptual advantage, which is that the measurement-based calculation that is performed is exactly what would be done with trusted devices, whereas the Reichardt et al. construction requires qubits to be teleported between the two provers at each gate.

Overview of construction
We can divide our interactive proof into two distinct units: the calculation and the test for honesty. The calculation is exactly the same measurementbased quantum computation that would be performed for trusted devices. The test for honesty is derived from self-testing.
We give some technical details of measurement-based quantum computation in section 2.1. The procedure can be summarized as: 1. Prepare a universal graph state 2. Perform measurements to obtain a computation-specific graph state 3. Measure vertices in sequence, adapting bases according to outcomes from previous measurements

Calculate final outcome
In order to perform the computation we need the provers to share a graph state and be able to measure vertices. The verifier performs all the classical computation, including deriving the measurement patterns, the required graph state, and the final outcome.
Our main contributions lie in constructing a test for honesty. Here we must define some test such that if the provers were to cheat on the calculation then they will fail the test. Our test for honesty is based on the graph state self-test, originally presented in [McK10b]. It allows the verifier to establish that the provers have access to high quality copies of the desired graph state and X and Z Pauli measurements. We give details for this test, including our improved proof in section 3.1.
In addition, for the measurement-based quantum computation we also need measurements covering the entire X-Z plane. This is a simple extension of the graph-state test, which we present in section 3.2.
The graph-state test, with extensions, define a set of subtests, each of which the provers must pass. To administer the entire test, the verifier just chooses one of these subtests at random. If the provers actually hold the required graph state and perform the measurements faithfully then they will pass the test with high probability, and if their behaviour deviates too much from the honest provers then they will pass with a lower probability. The gap is 1/poly(n) for a constant error bound and is calculated in section 3.4.
With all of this in place we obtain a simple statement: if the provers deviate from the honest behaviour by more than δ (see section 2.4 for a definition), then they will pass the test with probability at most c test −ǫ, where ǫ is a function of δ and c test is the probability of honest provers passing the test. Hence if the provers attempt to cheat we will catch them. The details are given in section 3.4.
Having shown how to test whether the provers are honest, and how to perform the desired calculation, we must put these two components together to form the interactive proof. The structure is quite simple: randomly decide whether to check for honesty or perform the calculation and then proceed. The critical observation is that, for an individual prover, the queries received look the same whether the verifier is testing or calculating. More specifically, every query that appears as part of a calculation also appears as part of the test for honesty. Hence the test for honesty catches provers who wish to cheat on the calculation.
The final technical piece of the puzzle is to determine with what probability to test for honesty. We give the derivation in section 4.

Technical introduction
In this section we present some notation and definitions used in the construction and proof. Further technical results are collected in appendix A for convenience.

Measurement-based Quantum Computation
Here we give a general overview of measurement-based quantum computation. Our goal is to provide sufficient background for readers to understand the major features of measurement-based quantum computation. For more detail we refer the reader to [RB01,RBB03].
Let us start with a basic teleportation circuit as in figure 1. Rather than performing entanglement swapping with an EPR pair held in memory, as in the usual case, we entangle the input and output qubits directly using a CTRL-X gate. The classical result of the measurement in the X basis is used to control a Z gate, which applies a necessary correction. Direct calculation shows that the input state appears in the output register after the circuit is applied. In the second circuit in figure 1, we convert the CTRL-X gate to a CTRL-Z gate and two Hadamard gates. In the third circuit in figure 1, the left Hadamard simply changes the initial state from |0 to |+ . We move the right Hadamard past the Z correction, which then becomes an X correction gate. Figure 1: Three equivalent basic teleportation circuits. In the second circuit the CTRL-X gate is replaced with a CTRL-Z gate sandwiched between two Hadamard gates. In the third circuit the left Hadamard gate changes |0 to |+ and the right Hadamard gate moves past the Z correction, changing it to an X. Now suppose that we apply a unitary U to the qubit as in figure 2. For this construction we suppose that U(θ) = exp( iθZ 2 ) so that it commutes with the CTRL-Z as in the second circuit of figure 2. Now we can see U as a modification of the measurement basis as in the final circuit. Since we originally measured in the X basis the new measurement basis will be in the X-Y plane of the Bloch sphere: U † XU = R(θ) = cos θ X + sin θ Y . In the second circuit the fact that U(θ) = exp i θZ 2 is diagonal means that it commutes with the CTRL-Z gate. In the third circuit the U(θ) gate has modified the measurement basis to R(θ) = cos θ X + sin θ Y .
Next we consider how multiple teleportations work together. First we consider the case of two cascaded teleportations as in figure 3. Using measurement angles θ 1 and θ 2 , the overall unitary applied by the circuit is HU(θ 2 )HU(θ 1 ). In the second circuit of figure 3 we have moved the second CTRL-Z gate, used to entangled the second and third qubits together, to the left past the X correction on the second qubit. This induces a Z correction on the third qubit, controlled along with the X correction. Finally, in the third circuit we incorporate the X correction into the measurement angle on the second qubit. Indeed, since XR(θ)X = R(−θ), the angle θ 2 becomes −θ 2 whenever an X correction is needed.
We have seen how to convert X corrections into changes in the measurement angle. Z corrections are even easier to apply. Since ZR(θ)Z = −R(θ), a Z correction corresponds to simply inverting the output of a measurement. Figure 3: Two cascaded teleportations. The first circuit teleports the first qubit to the third, applying HU(θ 2 )HU(θ 1 ). In the second circuit we have moved the CTRL-Z to the left past the X correction, inducing a Z correction on the third qubit, but allowing all the CTRL-Z gates to be applied before any measurements are made. Finally, since XR(θ)X = R(−θ) the X correction can be omitted in favour of a change of measurement basis. Figure 4 shows how X and Z corrections together modify the behaviour of the measurement. So far our construction has the following features: we can apply a sequence of unitaries HU(θ n ) . . . HU(θ 1 ) to a qubit by repeatedly teleporting the qubit and varying the measurement angle used in the teleportation. The necessary corrections from the teleportation can be incorporated into subsequent measurement angles and outcomes, and all the entangling CTRL-Z Figure 4: Incorporating X and Z corrections into measurements. We have X and Z corrections according to some previous measurement results x, z ∈ {±1}. The X correction is incorporated into the measurement as a change in the angle. The Z correction is incorporated by flipping the outcome of the measurement.
gates can be pushed to the start of the procedure. Hence we can perform a single qubit circuit by first building a large entangled state using |+ states and CTRL-Z gates, and then measuring the qubits in sequence, adapting measurement angles as we go. Note that the gates HU(θ) form a universal set.
In order to perform general circuits we need one more piece of the puzzle, which is two-qubit gates. In this case we obtain universality by including CTRL-Z gates. These can be applied at any time during the circuit and appear as additional CTRL-Z gates on target qubits when we translate into the teleportation scheme. These can be treated similarly to the CTRL-Z gates which are used to entangle input and output qubits for teleportation. In particular, we can push the CTRL-Z gates back to the beginning of the circuit, past X and Z corrections. This induces extra corrections which must be taken into account on subsequent measurements. Now we have the complete picture. A calculation begins by preparing many |+ states and entangling them with CTRL-Z gates. Then they are measured one at a time, and measurements are adjusted to incorporate X and Z corrections as required.
The initial state, prepared by applying CTRL-Z gates to qubits in the |+ state, is called a graph state and will play an important role in our results here. Our construction will use a slightly different model of measurement-based quantum computation. Although the usual and most easily understood method utilises measurements in the X-Y plane, we will instead use a different model, due to Mahalla and Perdrix [MP12], which requires only X-Z plane measurements. In particular they prove the following theorem: Theorem 2 (Mahalla and Perdrix [MP12]). Triangular cluster states are universal resources for measurement-based computation based on X-Z plane measurements.
Triangular cluster states are graph states where the underlying graph is a triangular lattice. As we shall see, these particular graph states are particularly easy to self-test since every vertex is in a triangle. The proof of their theorem consists of two parts: showing that triangular cluster states can be converted into other graph states using measurements alone, and showing that X-Z measurements suffice for universal computation. The details of the proof are not important for our results here. What is important is that their construction introduces a small overhead, so that a given quantum circuit gets translated into a graph state with size polynomial in the size of the original circuit.

Operators, isometries, bit strings
We will frequently deal with a tensor product of operators over several subsystems. To make this easier we use the following notation: Definition 1. Given some collection of operators {M j : j = 1 . . . n} with M j operating on the j-th subsystem, and a vector x ∈ {0, 1} n define (1) This notation is quite frequently used with Pauli operators, but here we do not assume that the M j operators are all the same. Instead, we merely suppose that there is some common label "M", which may refer to different operators on different subsystems.
Another set of objects that we will deal with frequently is isometries.
Definition 2. An isometry is a linear operator Φ : X → Y that preserves inner products.
Isometries are a natural generalization of unitaries where the image space of ⊕ is not necessarily the same as X , and may in general have a larger dimension. As a concrete and pertinent example, adding an ancilla prepared in a particular state and applying a unitary are both isometries, as is their composition. Isometries are naturally extended to the dual space by Φ( ψ|) = Φ(|ψ ) † and to operators by Φ(|x y|) = Φ(|x )Φ( y|), plus linearity.
As we shall see, we will need to address the state spaces of provers individually, se we will need the concept of a local isometry.
Definition 3. A local isometry on n subsystems is an isometry of the form where Φ j operates on the j-th subsystem only.
Here a tensor product of isometries is evaluated in a way analogous to how a tensor product of unitaries is applied: decompose the state into a sum of product states and apply the operator to the appropriate vector in the tensor product. That is to say, (3) From this it is easy to derive the following properties of local isometries.
Lemma 1. Let Φ = Φ 1 ⊗ Φ 2 be a local isometry, |ψ 1,2 be a bipartite state, and M 1 be a local operator on the first subsystem. Then We make extensive use of bit strings. For an n-bit string t the j-th bit is t j . Inner products of bit strings are given by We will, at times, consider the inner product as an integer, and at other times as a bit (i.e. over Z or Z 2 ). Where the difference is important we will specify. For example, t · t taken over Z gives the number of ones in t but when taken over Z 2 it is the parity of the number of ones. Finally, we define the bit string 1 v to have a one only in the v position and zeros elsewhere, i.e. (1 v ) j = δ vj .

Graph states
We assume that the reader is familiar with the basics of graph theory. A good resource is [Die10]. We now fix some notation for our convenience. Let In other words, the induced subgraph is the maximal subgraph of G on vertices in S.
The graph state |G is an n-qubit state, with qubits labelled by vertices, which is stabilized by the operators That is, S v has X on vertex v and Z on each of its neighbours and Equivalently, To explain, let us write Now since A u,v = A u,v = 1 whenever (u, v) ∈ E, we are counting edges. The summation and A are symmetric, so we are double counting and we always get an even number (hence the 1 2 appearing in the exponent above). Let T x = {v|x v = 1}, then we are summing over all the vertices in T x , double counting the edges in the induced subgraph.
For completeness we show that the above two definitions are equivalent by showing that |G is stabilized by S v : where we have re-indexed the summation by x → x ⊕ 1 v . The ± in the exponent of the −1 represents the fact that we only care about the parity of the exponent, so we can add or subtract as we please.
There are two cases. First, if v ∈ T x then T x⊕1v does not contain v. The subgraph on T x is obtained from the induced subgraph on T x⊕1v by adding v and all the associated edges, x · A1 v of them, and the total number of edges in the induced subgraph on T x is In the other case v / ∈ T x , so we obtain T x by removing v and all associated edges from T x⊕1v , so Hence We have shown that the operators S v stabilize |G . It is also easy to see that the S v operators are independent: any one cannot be obtained by multiplying together others. They also commute with each other. We then have n independent, commuting n-qubit Pauli operators which stabilize a 1-dimensional space [Got97].
Operationally, graph states are constructed by beginning with the qubits in the state |+ ⊗n and applying CTRL-Z gates on vertices u, v whenever (u, v) ∈ E.
The above reasoning will be important later on. In particular, we can apply (13) and (14) repeatedly over all v such that y v = 1 to prove the following lemma.

Definition for "closeness"
We will need to establish that the state held by the provers is "close to" a given graph state and that the measurements they perform are "close to" the ideal X-Z plane observables. However, there are many transformations that the provers can apply to both states and measurements which are invisible to the verifier. In particular, the provers may add an ancilla or apply a local change of basis (simultaneously to both the state and measurements). In fact, we will see that for the states and observables we use these are the only undetectable transformations that they can apply 2 . We can account for such transformations by allowing an arbitrary isometry which undoes these transformations and presents us with the required graph state plus some arbitrary ancilla state. We also allow for some noise by comparing states in the usual vector norm.
Definition 4. 3 We say that a multi-partite state |ψ ′ and observables {M ′ } are ǫ-equivalent to |ψ and {M} if there exists a local isometry Φ and a state |junk such that for every M Here we are thinking of "M" as both the ideal operation on |ψ and as a label for the operation M ′ .
Evidently this definition guarantees that the two systems behave like each other since isometries preserve inner products, and hence outcome probabilities. As we shall see, it is also a necessary condition for states and measurements to behave close to the ideal graph states and X-Z plane measurements. Hence any other definition we could choose is at most a different characterization of the errors and in the exact case is equivalent. The error bound used here has an operational meaning since we can quickly bound the error in outcome distributions from it.
There is one shortcoming of this definition, which is that it is impossible to test states or operators which contain any imaginary component in the ideal case (this restriction does not apply to the states and operators held by the provers, only to the ideal that we compare them to.) The simple reason is that the provers may apply a complex conjugation to everything without changing the distribution of their responses to the verifier. This transformation is not an isometry, and hence it is impossible to conclude that any system satisfies the above definition based on classical interaction alone. It is, however, possible to extend the definition to account for this case [MM11]. We do not need to use this extended definition here since all our ideal operators and states are real.

Modelling the provers
An important argument in our work is that we can model the provers, even in the dishonest case, by a pure joint state held by the provers, and a collection of observables for each prover, one per possible query to that prover.
First, it should be clear that it is not a restriction to consider pure states. Any mixed state can be purified and the purification given to any one of the provers. This only increases the power of the provers by giving them additional information held in the purification.
Next, since our provers will only receive one query and respond with one message, we can model their actions by a measurement. Any pre-processing done before the measurement can be incorporated into the choice of measurement along with any post-processing. Further, since we are not making any assumptions on the dimension of the state held by the provers, their measurements can be taken to be projective and, since the provers will always respond with ±1 the projectors can be combined into an observable without any loss of information or generality.
Finally, we must consider how the provers will behave knowing that some of the time they will be tested and some of the time they will be asked to perform the calculation. As well, in certain cases the provers will know for certain that they are being tested, although they will never be able to conclude that they are certainly taking part in the calculation. The provers know in advance the list of possible query strings (there are only four) and whatever their strategy, they use some physical processes to decide on their output. We then roll this process into the measurement observable, so that each possible query string corresponds to a single observable which represents the entire strategy of the prover.

Test for honesty
In order to develop a test for honesty we go through several steps. The first step is to develop a test for graph states. This is the foundation on which we build the test for honesty. After showing how we can verify that the provers hold onto a particular graph state we then show how to test measurements in the X-Z plane. Adaptive measurements built on measurements in the X-Z plane are the next step. Finally, we put all of the tests together into a single test and show how the probability of passing this test relates to the amount of error in an adaptive measurement performed on the same state and using the same measurements.

Self-test for triangular cluster states
In this section we develop a self-test for triangular cluster states. The techniques used are similar to those in [McK10b]. However, we make some modifications which allow for a tighter error analysis and clearer notation. Although we give the construction for triangular cluster states only, the same techniques can be extended to work with any stabilizer state, as in [McK10b].
Theorem 3. Let G be a triangular grid graph on n vertices with adjacency matrix A and let ǫ > 0. Further, suppose that for an n-partite state |ψ ′ with local measurements and for each triangle then there exists a local isometry Φ and state |junk such that We may interpret Theorem 3 as follows: for each triangular cluster state there exists a set of non-local correlations that uniquely identifies that graph state and X and Z measurements, up to local unitaries and additional ancillas.
The proof can be divided into several sections. The final goal is to construct an isometry Φ and prove that it takes the state close to the desired graph state. The construction for the isometry is given in terms of the X ′ and Z ′ operators on each vertex. To bound the error we need to know how these operators behave and in particular that they approximately anti-commute. This is done in Lemma 3 and corollary 1. For the final proof we will also need to get rid of some X ′ operators. In the ideal case we can use the stabilizers: In Lemma 4 we show that this, and a generalization to many X's, is also approximately true for the primed operators. With these estimations in place we the proceed with the proof of Theorem 3.

Preliminary technical estimations
Our graph G is a triangular lattice, so every vertex lies in a triangle. For self-testing this gives a nice advantage, since it is particularly easy to show that X ′ and Z ′ anti-commute for vertices in a triangle.
Proof. First, let T = {u, v, w} be a triangle containing v. The first part of Lemma 9, together with the conditions of Theorem 3, tell us for x ∈ {u, v, w}, and from triangle τ Applying the second part of Lemma 9 three times to combine these, we find The Z ′ s operating on vertices outside T all cancel since they appear in S ′ x and in Z ′A1u for some x ∈ {u, v, w} and there are no X ′ operators outside the triangle. We are left with Examining how the operators commute with each other, we can pair up and cancel the X ′ x and Z ′ x for x ∈ {u, w}, resulting in Rearranging by multiplying by Z ′ v X ′ v , we obtain our result. Note that it is sufficient to consider a set of triangles that covers the set of vertices and hence Theorem 3 holds for all graphs in which each vertex is contained in a triangle. In fact, as in [McK10b], it is sufficient to consider one triangle or just one edge in a connected graph, but this will give a less robust result. Lemma 2 in [McK10b] shows that if X ′ v and Z ′ v approximately anti-commute, then so do X ′ u and Z ′ u for some neighbour u of v. Using this one can induct along paths to all vertices in a connected component. For our purposes this is unnecessary since all vertices lie in at least one triangle.
The above lemma can be generalized to products of operators, as in the following corollary.
Corollary 1. Let s, t ∈ {0, 1} n . Under the conditions of Theorem 3, where s · t is taken over Z.
This can be seen by repeatedly applying Lemma 3, once for every v such that s v = 1 = t v , and using the triangle inequality. If s x = 1 but t x = 0, or vice versa, for some x ∈ V , then the single operator on vertex x commutes with all other operators. Now we consider the physical "stabilizer generators" S ′ v . The conditions of Theorem 3 establish that they really are (close to) stabilizers of |ψ ′ . Next we consider products of these generators and show that they too almost stabilize |ψ ′ .
Lemma 4. Let t ∈ {0, 1} n . Under the conditions of Theorem 3, where At is evaluated over Z 2 and t · At and t · t are evaluated over Z.
Proof. First, by Lemma 9 we find The right term can be expanded as v∈V tv=1 We fix an ordering < on V , and evaluate the product according to that ordering. Thus if t v = t u = 1 and u < v then S ′ u appears in the product to the left of S ′ v . Now suppose that A uv = 1. Then Z ′ u in S ′ v appears to the right of the only occurrence of X ′ u in S ′ u . We may commute Z ′ u to the right past all remaining operators on the u system, so that Z ′ u appears to the right of all X ′ operators. The opposite is true if v > u, in which case we may commute Z ′ u to the left, and it appears to the left of all X ′ operators. Thus we may write the above as Let A L be the lower triangular part of A (with 0s elsewhere) and A U the upper triangular part. Then we may rewrite the above as Using corollary 1 we obtain Noting that A U t + A L t = At and t · A L t = 1 2 (t · At) since A is symmetric, we apply the triangle inequality along with (31) to find which is readily transformed into the desired result by multiplying by X ′t .

Proof of Theorem 3
We are now in a position to prove Theorem 3. This is done by giving a construction for Φ and using the above lemmas to prove that it has the necessary properties. Figure 5: Circuit for Φ v Proof. We will use Φ v as defined in figure 5. The circuit is modified from that used in [McK10b,MYS12] and earlier works, differing in the state of the ancilla. Whereas we use an entangled pair of qubits |φ + , previous works used |0 . We also add an initial CTRL-X gate which was not needed when the initial state was |0 . When X ′ v and Z ′ v are the Pauli X and Z gates the circuit is clearly a SWAP gate. The idea is to swap the hidden qubit in the input wire with an explicit qubit. As we shall see, the use of a maximally entangled pair of qubits in the ancilla wires allows for a tighter robustness analysis than is possible with the earlier version of the circuit.
The structure of the proof is a sequence of chained inequalities between states |ψ j and |ψ j+1 for j = 1 . . . 4 defined below. We then use the triangle inequality to find the total distance. We define Φ = v∈V Φ v , and |ψ 1 = Φ (Z ′p X ′q |ψ ′ ) to be the state after the isometry Φ is applied. Using Lemma 12 this becomes where s, t, u ∈ {0, 1} n . The first step is to move Z ′p to the left using corollary 1, obtaining Next we move the combined Z ′ s back to the right using corollary 1 again: Moving Z ′ to the left past the combined X ′ s using corollary 1 one last time, we define |ψ 4 by Now make two changes of variable, t → t ⊕ p and u → u ⊕ q, arriving at 1 √ 2 3n s,t,u (−1) t·s (−1) p·u Z ′t X ′u⊕s |ψ ′ |s |u ⊕ q .
after which the state factorizes: In the case where ǫ = 0 the above essentially gives the entire proof. The remainder of the proof estimates the error at each step.
First we note that all the states above are normalized. In all cases this is easy to prove. We show the calculation for |ψ 2 , with the others proceeding similarly. We find The su|s ′ u ′ factor implies that u ′ = u and s ′ = s for all non-zero terms so The X ′u operators square to the identity, and subsequently so do the Z ′p s.
We then make a change of variable t ′ → t ′ ⊕ t and break (−1) t·(s⊕u) into (−1) t·s (−1) t·u . The summand no longer depends on t ′ so we can omit it from the summation, multiplying by 2 n instead. We also bring the summation over u inside, forming an inner sum.
1 2 2n Lemma 10 says that the inner sum is 0 except when t = 0, so we can drop the Z ′t s and the summation over t, and t·s = 0. Then the X ′s⊕q s then square to the identity. We are left with 1 2 n s ψ ′ |ψ ′ = 1. Now we estimate the distances between successive states starting with |ψ 1 and |ψ 2 . From the definition of the 2-norm, Next we determine ψ 1 |ψ 2 : From the su|s ′ u ′ term, we see than s = s ′ and u = u ′ in all non-zero terms. This allows us to cancel X ′u X ′u ′ and remove the u ′ and s ′ variables. We also pull the sum over u in as an inner sum 1 2 3n (52) Next we use Lemma 10 to see that the inner sum is zero except when t⊕t ′ = 0. The terms (−1) (t⊕t ′ )·s) and Z ′t⊕t ′ then become 1 and the identity, leaving the summand independent of t and t ′ . We remove them from the sum, multiplying by 2 n instead. Finally, we make the change of variable s → s ⊕ q to get 1 2 n s (−1) p·s ψ ′ |Z ′p X ′s Z ′p X ′s |ψ ′ .
Next set ǫ p,s = ψ ′ |Z ′p X ′s Z ′p X ′s |ψ ′ − (−1) p·s ψ ′ |Z ′p X ′s X ′s Z ′p |ψ ′ , with the second term becoming just (−1) p·s , so that the above becomes Corollary 1 and the third part of Lemma 9 give |ǫ p,s | ≤ 4(p·s) √ 2ǫ. Lemma 11 tells us how to deal with the sum over s, and we write and plugging this back into the definition of the 2-norm gives Using similar estimates we find where the final sum is over s and t rather than s with the fixed string p. We appeal to the second part of Lemma 11 as the last step.
The remaining distance to calculate is |||ψ 4 − |ψ 5 ||. Again we proceed by way of the definition of ||·|| and the inner product.
For non-zero terms s = s ′ and u = u ′ . Re-indexing by s → s ⊕ u we find that the above is equal to where we have pulled all the terms dependent on u into the inner sum. Lemma 10 says that this inner sum is zero except where t ⊕ t ′ = 0 when it is 2 n . Substituting these in, the above becomes Now let us bound the inner product: To obtain the second line above we have used the triangle inequality. The third line comes from applying Lemma 4 and Lemma 9. We then use Lemma 11 to obtain the last line. Finally we find Adding all the bounds using the triangle inequality we obtain

Error bounds for non-Pauli measurements
In order to achieve universal computation we need to have measurements other than just X and Z. It suffices to have X-Z plane measurements. Let us define We use the symbol R ′ u (θ) to denote the ±1 eigenvalue observable that the prover uses when queried with the angle θ. We do not make any prior assumption on how R ′ u (θ) is related to X ′ u or Z ′ u . Instead we will derive said relationship via the graph-state test and further measurements.
Lemma 5. Under the conditions of Theorem 3, if we have measurements R ′ v (θ) and an edge (u, v) such that then with Φ and |junk set to those in Theorem 3, where δ is the bound in Theorem 3 Proof. From Theorem 3 we obtain Φ and |junk so that for M ′ ∈ {Z ′A1v , X ′ u Z ′A1u⊕1v } in particular. From the stabilizer generators S u and S v we find X u Z A1u⊕1v |ψ = Z v |ψ and Z A1v |ψ = X v |ψ , hence linearity of Φ and the triangle inequality give Using cos θ X v + sin θ Z v = R v (θ) and cos θ + sin θ ≤ 2 this becomes Now since || ψ ′ |R ′ v (θ)|| ∞ = 1, and Φ preserves inner products, we have Using the triangle inequality and (69) we find We now apply Lemma 9 to obtain the desired bound.
The lemma says that if we can estimate the expected value for a certain operator we can bound the error on R ′ u (θ). Later in section 3.4 we will show how we can estimate said expected value.

Error bounds for measurement patterns
Our bounds in the previous section show that we can bound the error when applying a measurement of the form M 1 ⊗ · · · ⊗ M n , which gives a single bit of output. However, for graph state computation we need something much more substantial since we will need to measure the subsystems in a sequence, with each basis chosen as a function of the previous outcomes. In fact we will prove something even stronger than this.
We will consider a stronger situation where instead of trusted classical computation and classical interaction, we have some trusted quantum computation and quantum interaction with the provers. The provers allow the basis to be chosen quantumly and they similarly return the result coherently. We can model this by specifying that, when queried with a quantum register, prover j applies where M ′ j,k corresponds to the observable that prover j uses when queried with input k ∈ {0 . . . m j }. The prover then passes the control register back to the verifier and the result of the query is stored as a ±1 phase. We will require that the prover's actions are all of this form, although they are free to choose the M ′ j,k as they like. As well, the ideal operator V j has this form, using observables M j,k .
Assuming 4 M ′ j,0 = I we can retrieve the outcome for measurement M ′ j,k by preparing the state 1 √ 2 (|0 + |k ) and observing the relative phase change in the prover's response. Hence this model includes the original classical behaviour as a particular case.
A general circuit for the verifier-prover interaction in this stronger model is given in figure 6. The verifier first applies some unitary U 0 to prepare its initial state, and then performs the first query to prover 1, V ′ 1 . The verifier then applies some unitary U 1 to its internal state and performs the second query to prover 2, V ′ 2 , and so on. The combined operation is U n V ′ n . . . U 1 V ′ 1 U 0 . We require that each V ′ j is applied at most once and for convenience we suppose that they are numbered in the order in which they are applied. In this circuit we have always used the same the control wire, which is a q-dit with dimension equal to the maximum m j + 1. This is not a limitation since we can always use the same control wire by incorporating swaps into the U's if necessary.
. . . Figure 6: Semi-trusted circuit incorporating untrusted measurements by the provers, That is, W ′ j represents running the circuit until the point after U j has been applied. Similarly, let W j be the ideal circuit where we substitute in the ideal V j (constructed from the ideal M j,k ).
Lemma 6. Let |ψ , |ψ ′ , |junk , and Φ = Φ 1 ⊗ . . . Φ n be given along with M ′ j,k and M j,k (k = 0 . . . m and M ′ j,0 = I) such that Further, let some |φ and U j be given where |φ contains a register of dimension at least m + 1 and U j acts only on the |φ registers, and let, V j , V ′ j , W j and W ′ j be defined as above. Then The intuition is that each V ′ j is the sum of operators |k k| ⊗ M ′ j,k , each of which is close to the corresponding ideal operator. We can then use the triangle inequality to say that V ′ j as a whole is close to its ideal counterpart. Inducting over the depth of the circuit gives the desired result.
Proof. The proof proceeds by induction. For the case n = 0 we have not yet applied any untrusted gates and the conclusion is true by taking inequality (77) and multiplying by the trusted gate U 0 . Now let us suppose that (78) holds for n − 1. We start by using the bound (77) with (j, k) = (1, 0) to get For each k = 0 we multiply by the bound on both sides by Φ n (M ′ n,k ) to obtain inequalities By Lemma 1 Φ n (M ′ n,k )Φ(|ψ ′ ) = Φ(M ′ n,k |ψ ′ ), so the state on the right above is close to |junk M n,k |ψ by (77) with (j, k) = (n, k). Using the triangle inequality we find We introduce the register |φ and apply the ideal unitary W n−1 to both sides in the above estimation without increasing the distance. On the left, since Φ n and M ′ n,k only operate on the nth subsystem, Φ n (M ′ n,k ) operates only on the nth subsystem of |junk |ψ (i.e. on the nth subsystem of |junk together with the nth subsystem of |ψ ). Then since W n−1 operates only on the trusted system and the first n − 1 subsystems of |ψ , it commutes with Φ n (M ′ n,k ) and M n,k so Φ n (M ′ n,k )|junk W n−1 |ψ |φ − |junk M n,k W n−1 |ψ |φ ≤ 2δ (82) Now we apply the projection |k k| (used in the expression for V ′ n ) to both sides, again without increasing the distance. Hence Summing over all k using triangle inequality, we apply the definitions of V j and V ′ j to arrive at Note that it is 2mδ and not 2(m + 1)δ since the case k = 0 has no error by assumption. The state on the right above is almost what we want. Now we invoke the induction hypothesis, (78) with n − 1 and multiply through by and applying the triangle inequality to the above two estimates we get Multiplying by the trusted gate U n finishes the proof.
In order to use this lemma we do not need the full generality of Theorem 3. We only need it to apply for individual measurements rather than the full set X p Z q .
For our purposes we do not need the full strength of the lemma. We need only know that adaptive measurements give correct outcomes.
Corollary 2. Let |ψ , |ψ ′ , |junk , and Φ = Φ 1 ⊗ . . . Φ n be given along with M ′ j,k and M j,k (k = 0 . . . m and M ′ j,0 = I) such that Then for any adaptive measurement made using the M ′ s, the probability of a particular outcome differs from the ideal case by at most 2(2nm + 1)δ.
Proof. We can represent an adaptive measurement as a circuit W n as in Lemma 6. Hence To obtain the classical outcome we perform some measurement on one of the trusted subsystems. Without loss of generality this can be a projective measurement, so let Π x the projector for outcome x, which acts non-trivially only on the trusted subsystem. The probability of outcome x is then Now to estimate this probability we use (88) above in two different ways. First, multiplying on the left by Φ( ψ ′ | φ|W †′ n ) we get Second, multiplying (88) on the right by junk|W † n ψ| φ| and then taking the adjoint of the resulting expression we obtain (91) Adding these together using the triangle inequality and invoking the fact that Φ preserves inner products we find In other words, the probability of finding outcome x differs from the ideal case by at most 2(2mn + 1)δ.

A one-shot test
As stated, the self-testing results are not terribly useful to us. They require knowledge of the expected value of various operators in order to draw any conclusions. The obvious solution is to take some samples and estimate, but this would require either some independence assumptions or additional work with, for example, martingales. Instead we will work with the contrapositive of the self-testing results: if the state and/or some measurements are far away from the ideal, then some measurable expected value will also be far away from the ideal. Although this is logically equivalent, instead of requiring lots of information about the various measurements, we instead are told that we just have to look for one measurement that is misbehaving. As well, we are going to arrange our measurements in a particular way as a test for honesty. For example, the stabilizer measurements will always return 1 for honest provers, so if we perform this measurement and we get a 1 the provers pass the test. If result is -1 then they fail the test. As the expected value gets close to 1, the provers will pass with probability close to 1. If the expected value is far away from 1, the provers will fail the test with some probability. Now with the R(θ) measurements we do not have the same situation, but we do have something just as useful. We can build a compound test so that the ideal honest provers pass with some probability, and no other provers can pass with a higher probability. This is analogous to the CHSH test: the ideal quantum strategy passes with probability ≈ 0.85, and no other strategy achieves any higher success rate. As well, cheating provers will pass the test with a probability that is bounded away from the quantum limit, and so we obtain a gap between the ideal and cheating strategies. The honest provers will fail the test some of the time, but this is no problem: we will later do some repetition so that the ideal provers will pass with an overall probability that can be made arbitrarily close to 1. Now we give the construction for our one-shot test. First, let T be a set of triangles that covers V , i.e. each vertex in V appears in at least one triangle in T . The triangles will be specified by characteristic vectors τ . Let N G = 3|V | + |T |. Note that N G ≤ 4n since we need no more than n triangles to cover V .
For a graph state computation we need only two different measurement angles per vertex, ±θ v . As well, the measurement angle θ v + π can be simulated by measuring with angles θ v and flipping the outcome. Hence there is no loss of generality by assuming that 0 ≤ θ v ≤ π so that cos θ v ≥ 0.
The test procedure is as follows: Procedure 2 (One-shot test for graph states and measurements).
1. Randomly select either "VERTEX" with probability |V | N G , "TRIANGLE" with probability |T | N G , or "RTHETA" with probability 2|V | ii. Accept if the product of the replies is 1, otherwise reject Accept if the product of the replies is 1, otherwise reject.
To clarify, if the basis for a prover is I then we simply ignore that prover, and its "reply" is taken to be 1.
The test is naturally grouped in to N G different subtests. From the graph state test we have |V | subtests testing the "physical stabilizers", and |T | subtests testing the triangles. Additionally, there are 2|V | "RTHETA" subtests, one for each choice of v and t. Each of these consists of two queries chosen according to some random coin.
Lemma 7. Let n non-communicating quantum provers be given that each take one of four measurement bases, labelled X, Z and R v (±θ v ) as inputs and measure joint state |ψ ′ according to operators in Then then procedure 2 accepts with probability at most and if there exist v and then procedure 2 accepts with probability at most Proof. Honest case. First let us derive the maximum probability of passing the test. This is attained in the honest case. The "VERTEX" and "TRI-ANGLE" subtests can all be passed simultaneously with probability 1 in the honest case since the observables are all in the stabilizer group of the graph state.
Let us now consider the "RTHETA" subtests. First, we fix a vertex v. The queries to the in the provers in the test can be seen as one large random variable taking values ±1 and having the expected value Note the similarity to the CHSH correlation, which is obtained for θ v = π 4 . The honest provers will attain an expected value of 1 2(cos θv+| sin θv|) . To see this, we notice that Z A1u |ψ = X u |ψ and X u Z A1u⊕1v = Z v |ψ , which we obtain from the stabilizers S v and S u . Applying the definition of R(θ), the expected value becomes Now we show that this is in fact the maximal quantum expected value. Using a standard technique introduced by Cirel'son [Cir80], the maximum value is the same as 1 2(cos θ v + | sin θ v |) max |ψ 1 ,|ψ 2 ,|φ 1 ,|φ 2 where the maximization is taken over normalized states, all of dimension four. Clearly the maximum is found when |ψ 1 is taken to be in the direction of cos θ v |φ 1 + sin θ v |φ 2 and |ψ 2 is in the direction of cos θ v |φ 1 − sin θ v |φ 2 . In this case the value becomes Expanding using the definition of ||·|| we obtain We next use the identity cos θ sin θ = 1 2 sin 2θ to get which attains the value of 1 cos θv+| sin θv| when φ 1 |φ 2 = 0. We now have the expected value of the honest case and a matching upper bound. The expected value of any ±1 valued random variable X is related to the probability of obtaining 1 (i.e. the "success" probability) by Prob(X = 1) = X 2 + 1 2 .
(103) So the probability of success for the "RTHETA" portion of the test for a specific v is bounded above by Combining this with the maximum probability of success for the "VER-TEX" and "TRIANGLE" subtests, the overall maximum probability of success for any set of quantum provers, attained for honest provers, is The factor 2 in front of the summation represents the fact that for each v the "RTHETA" subtest occurs with probability 2/N G . Dishonest case Now that we have an upper bound, we translate the probability of success into an error bound on the expectation value of each subtest.
From now on fix a set of provers, which fixes the observables and state. Suppose that the provers pass the test with probability c test − ǫ 2N G . Then each "VERTEX" or "TRIANGLE" subtest passes with probability at least 1 − ǫ/2, which is obtained when all the error happens on a single subtest. This means that the expected value for the corresponding random variable is 1−ǫ and the conditions for Theorem 3, (20) and (21) are satisfied. Hence (94) where we have used the estimations p · p ≤ 1, since this is all we need to apply corollary 2, and |E| ≤ 3n, since we are using a triangular cluster state which has a maximum degree of 6. For the "RTHETA" subtests, fix a v. As above, the expected value for the corresponding ±1 random variable is at least c v test − ǫ. Hence the conditions of Lemma 5 are satisfied for each v and ±θ. Then equation (94) where we have used ǫ ≤ ǫ 1 4 for 0 ≤ ǫ ≤ 1. When δ ≤ 1 the error for the R ′ v (±θ v ) will be larger, so we will use this value.
We have just shown that if the provers pass the test with probability at least c test − ǫ 2N G then the left side of (94) is bounded by δ as above (i.e. (94) is false). This is the contrapositive of our desired result which is that, if (94) is true, then the probability of passing is at most c test − ǫ 2N G . So we need only solve for ǫ in terms of δ. We find Now the probability of passing is at most c test − ǫ 2N G , which is bounded above by This one-shot test gives us an error bound on the states and measurements. Combining this with Lemma 6 we can relate the probability of passing the test to the error in an adaptive measurement, i.e. our final measurementbased quantum computation.
Corollary 3. Let a set of quantum provers be given where prover v takes in- For honest provers, procedure 2 accepts with probability For general provers, if for any adaptive measurement pattern the probability of any outcome on the provers' final outcome differs from the ideal by more then δ then procedure 2 accepts with probability no more than Proof. By corollary 2, if we achieve error less than δ ′ = δ 2(8n+1) on equation (87) then we are done, since m = 4 here. Lemma 7 says that we can achieve this if the provers pass with probability no more than ≥ δ 8 10 18.1 n 11 (119) using the pessimistic bounds N G ≤ 4n and 1 ≤ √ n ≤ n. Hence if the provers pass with probability less than we obtain our desired result.

Interactive proofs
We are now in a position to construct an interactive proof for any language in BQP. To this end, let L be a language in BQP. Then from Theorem 2 and the definition of BQP for any input x there exists an adaptive measurement 5 on a polynomially sized triangular graph state such that • If x ∈ L then the measurement outputs "ACCEPT" with probability c calc ≥ 2 3 . • If x / ∈ L then the measurement outputs "ACCEPT" with probability s calc ≤ 1 3 . The adaptive measurement supplies the measurements required for each vertex via angles θ v . It also supplies the functions required for the adaptation.
The interactive proof is given by the following procedure.

(b) Accept if the test accepts
Now we calculate the optimal value of q.
Lemma 8. Let L be a language and x in input. Suppose we are given an adaptive measurement on a triangular cluster state on n vertices which implements a measurement-based computation which decides whether x ∈ L with error at most 1 3 (i.e. c calc ≥ 2 3 and s calc ≤ 1 6 ). Let 0 < δ < 1 3 be given and set • If x ∈ L then for honest provers procedure 3 accepts with probability at least c ip • If x / ∈ L then for any set of provers procedure 3 accepts with probability at most s ip where c ip − s ip ≥ δ 8 10 19.2 n 11 (122) Proof. Let c test be the probability of honest provers passing the test, and let s test be the probability of dishonest provers passing the test, given in corollary 3. Here, by dishonest we mean that the probability of a particular outcome of an adaptive measurement made using the provers differs from the honest case by more than the given δ.
Then we have two cases: • The input is in the language: then we only care about the honest case, in which the probability of accepting is c ip ≥ qc calc + (1 − q)c test .
• The input is not in the language: then there are two cases: -The provers pass the test with probability at least s test . Then by corollary 3 the probability of accepting on the calculation is at most s calc +δ and the probability of accepting on the test is at most c test for an overall probability of at most q(s calc + δ) + (1 − q)c test .
-The provers pass the test with probability less than s test . Then the probability of accepting on the calculation could be as high as 1, since we gain no information from the test. The overall probability of accepting is then less than q + (1 − q)s test .
The two different cases in the x / ∈ L case give two different gaps which are, in the first case and in the second case The overall gap is the minimum of these two. We wish to find q which gives maximizes the minimum. The two equations are just lines in q which cross each other. At the point where they are equal we find the maximum overall gap. The crossing point is easily found to be at which gives a gap of On the first line, we see that the denominator can be no larger than 2, and the first factor in the numerator is at least 1 6 (when δ = 1 6 and c calc − s calc = 1 3 ). So we can lower bound the gap by 1 12 (c test −s test ), which is estimated in 3. We are now in a position to prove our main claim. This is obtained by applying a standard gap amplification procedure. 3. Otherwise reject.
Proof of Theorem 1. Let L ∈ BQP be given along with input x. Theorem 2 tells us that we can find an adaptive measurement on a triangular cluster state on n = poly(|x|) vertices whose outcome tells us whether x ∈ L with error less than 1 3 . From Lemma 8 we have an interactive proof such that if x ∈ L then we accept with probability at least c ip for honest provers, and if x / ∈ L we accept with probability at most s ip . Now we amplify using procedure 4. Provided that we use fresh randomness on each run of the interactive proof, the N trials are all independent, although not necessarily identically distributed.
Let us first consider the case x ∈ L. Then we are interested in the case of honest provers, in which case we have N independent and identical Bernoulli trials with some probability of accepting p ≥ c ip . Using Hoeffding's inequality, the probability that we mistakenly reject is bounded by Setting this equal to 1 3 we solve for N to find the minimum number of trials to achieve our desired error rate.
Subbing in for c ip − s ip as estimated in Lemma 8 we obtain N ≥ 10 38.7 n 22 δ 16 .
The same number of repetitions also suffices to bound the probability of accepting when x / ∈ L to below 1 3 . The analysis is similar, however if the provers are not honest they may vary their behaviour on each trial, so the trials are not necessarily identically distributed. However, since the probability p of accepting satisfies p ≤ s ip for every trial we can still use Hoeffding's inequality.
Note that there is ambiguity in procedure 4. In particular, it does not mention whether the repetition of procedure 3 should be done serially or in parallel. In fact this does not matter. We can add N sets of n provers and query each prover once, or use one set of n provers and query each one N times. Either way the fact that we use fresh randomness keeps each trial independent of other trials. If x / ∈ L then there are no provers, whether entangled with other provers in other trials, retaining memory of past trials, or otherwise, that will force the verifier to accept with probability more than s ip . Hence we can specify that the repetition is accomplished in parallel using nN provers, each of which, in the honest case, performs a single measurement.

Assumptions
For our result to hold, we must assume that the provers behave according to quantum mechanics. This is because we model the provers using the quantum formalism. Currently this appears to be a reasonable assumption since quantum mechanics has been a very successful theory. However, we run into a problem if we wish to use this result in certain circumstances. For example, we may wish to verify that quantum mechanics generates accurate predictions for very complex systems. In this case it becomes infeasible to classically compute predictions from the quantum model. Quantumly, this is still possible, and we might be tempted to use an interactive proof in order to verify that our quantum computer has done the computation correctly. However, if we use the arguments in this paper we run into a problem of circularity since we must assume that quantum mechanics is correct in order for the argument to go through, but quantum mechanics is exactly what we want to verify! Hence it remains an important open question whether it is possible to achieve interactive proofs for problems in BQP where the prover's actions are easy for quantum computers but for which we do not assume a priori that quantum mechanics holds.

Time-space trade-offs
As discussed in the proof of Theorem 1, there are space-time trade-offs. In particular we may perform the gap amplification by repeating in parallel or serially, or some mixture of the two. Hence we could perform N repetitions on n provers, each of which then performs N measurements, or we can repeat in parallel with nN provers, each of which performs a single measurement.
Another factor, which we have not mentioned, is the time required to build the necessary graph states. Graph states are built by applying CTRL-Z gates, one for each edge. At worst this can take no more than O(n 2 ) operations. For triangular cluster states, such as we use here, the degree of each vertex in bounded above by 6 so at most 3n 2-qubit operations are required (plus n single-qubit state preparations). These can be parallelized in a constant depth circuit by exploiting the localized structure of triangular cluster states. Regardless, the state preparation can be accomplished in a polynomial number of steps.

Simplicity
Our construction has a somewhat remarkable property. Since triangular cluster states are universal, the state preparation depends only on the size of the calculation. By choosing a discrete set of operations (X, Z and X ± Z measurements are sufficient for universality) the quantum provers are also constant, requiring only the ability to measure in some fixed set of bases. The self-testing portion of the interactive proof then also only depends on the size of the calculation, since it depends only on the state and the measurements. Amazingly the classical verifier is also rather simple. It can be given a circuit as its input from which it reads off what gates to perform and simply looks up what angle to measure for that gate. The remaining calculations are simply XORs. This is a clear example of where the simplicity of the measurementbased quantum computing model allows for a simple analysis.
Another interesting property is that no single quantum prover has enough power to convince even itself whether the input is in the language. Indeed, all the quantum parts together, including the state preparation, still cannot perform even simple calculations since they can only prepare and measure some fixed state. They lack the capacity to perform the XORs required to perform a full measurement-based calculation. It is only when we combine the verifier, provers, and state preparation together that we obtain enough power to perform any substantial calculations.

X-Y plane measurements
It should be possible, although a bit more involved, to use the usual graph state computation model [RB01,RBB03] involving X-Y plane measurements. There is a complication since it is possible to simulate a complex measurements M by using a M * measurements instead (i.e. complex conjugate everything). In other words, the provers could complex conjugate all their states and operators, and this would preserve the expected values of all operators. However, the complex conjugation cannot be "undone" through an isometry. Hence the complex conjugated provers would not satisfy equation (22).
As far as correctness of the calculation is concerned, complex conjugation poses no problem since the outcome of an adaptive measurement will be identical to the desired case. A workaround is possible through a suitable relaxation of (22), and details are given for the exact case in [MM11]. The remaining points are to make the techniques of [MM11] robust, and generalize to X-Y plane measurements, which can be done analogously to how X-Z plane measurements are handled here.

Future work
Our error bounds are clearly suboptimal. In many places we have made only loose estimates which suffice for our purposes of establishing a polynomial bound, but could be made more robust. Hence one avenue of future improvement is to tighten these bounds.
Currently our construction uses many simple provers, providing a nice complement to Reichardt et al.'s result using a constant number provers. Much of our result could easily be adapted to the case of two provers. The most difficult part is the graph-state test. Likely it is not possible to prove a self-testing theorem for two provers if there are any odd cycles in the graph since it would be necessary at some point to test the entanglement across an edge with both vertices held by a single prover. However, bipartite graph states could yet be self-tested with two provers. helpful discussions. This work is funded by the Centre for Quantum Technologies, which is funded by the Singapore Ministry of Education and the Singapore National Research Foundation, and by the University of Otago.
The first inequality is a straightforward applications of the definition of ||·||. The second inequality is an application of the first, along with the triangle inequality. The last inequality is an application of the inequality ||O|ψ || ≤ ||O|| ∞ |||ψ || 2 where we use the operator O = φ|M.
If t = 0 then the summand is always 1. If t = 0 then half the strings s have inner product 0 with t and the other half have inner product 1, so we get a sum with half the summands 1 and the other half -1.
Lemma 11. Let u ∈ {0, 1} n be given and let A be the adjacency matrix for a graph G = (V, E). For the first one, the average inner product of a vector with u is half the number of 1's in u. The second computes this for an average u, which has n/2 1's. For the last one, t · At counts the number of edges in the induced subgraph on S t = {v ∈ V |t v = 1}. Consider an edge (u, v). Then (u, v) appears in the induced subgraph on S t whenever both ends are in S t , i.e. when t u = t v = 1. This happens for a quarter of all bit strings t. Hence each edge is counted 2 n−2 times for a total of 2 n−2 |E|.
This is a standard result in quantum computing, and can be shown using induction on n.
B Local complementation and self-testing stabilizer states Local Complementation. Let G be a graph. We may form a new graph G ′ by local complementation on a vertex v ∈ V . This operation complements all the edges in the neighbourhood of v, meaning that if a, b ∈ V are neighbours of v and (a, b) ∈ E then (a, b) is removed in G ′ and, conversely, if (a, b) / ∈ E then (a, b) is added in G ′ .
Local complementation is relevant to graph states because |G and |G ′ will be related by local Clifford operations, which simply relabel Pauli measurements and outcomes. The standard stabilizer generators for |G ′ are found from those of |G by replacing S u with S u S v for each neighbour u of v, and exchanging Z v with Y v , and X u with Y u .
Self-testing stabilizer states. First, note that an arbitrary stabilizer state is equivalent to a graph state under local Clifford operations [Sch01]. The local Clifford operations just relabel the Pauli operators (up to ±1), so the problem of testing stabilizer states reduces to that of testing graph states.
To self-test an arbitrary graph we first divide it into connected components. The graph state will a product state where the overall graph state is the product of the graph states on the connected components. We may thus test connected components individually. If a component has only one vertex then the test is trivial. If it has two vertices then the graph state on that component is an EPR pair (up to local unitaries), which can be tested using the Mayers-Yao test [MY04] or the CHSH test [CHSH69,MYS12]. Now we consider a connected component with three or more vertices. We need to show that equation (23) in Lemma 3 holds for each vertex, i.e. the X ′ v and Z ′ v operators approximately anti-commute on the state. It is shown in [McK10b] (Lemma 2) that if equation (23) holds on vertex v then it also holds (with a larger bound) on any neighbour u of v. Hence as long as (23) holds for at least one vertex in a connected component, then it also holds for all other vertices in the component by inducting along paths.
Let us return to our component with three or more vertices. If it contains a triangle then we test using Lemma 3. If not, then let u, v ∈ V be two vertices in the component that are not adjacent. Since they are in the same component, there is a shortest path between them of length at least 2. Look at the first three vertices in this path. The first and third are not adjacent, otherwise the path would be shorter. Hence we have an induced path of length 2. We then locally complement on the middle vertex, obtaining a triangle. The corresponding graph state is equivalent to the original graph state under local Clifford operations, which can be absorbed into the definition of the local isometry Φ. Now we have a graph state with a triangle and we can apply Lemma 3 and [McK10b] (Lemma 2) to obtain the anti-commuting relation for all vertices.
Having tested all components and obtained local isometries Φ j for each component j, we simply form Φ = Φ 1 ⊗ · · · ⊗ Φ k and apply triangle equalities to obtain the final isometry and bound.