Sequential random access codes and self-testing of quantum instruments

Quantum Random Access Codes (QRACs) are key tools for a variety of protocols in quantum information theory. These are commonly studied in prepare-and-measure scenarios in which a sender prepares states and a receiver measures them. Here, we consider a three-party prepare-transform-measure scenario in which the simplest QRAC is implemented twice in sequence based on the same physical system. We derive optimal trade-off relations between the two QRACs. We apply our results to construct semi-device independent self-tests of quantum instruments, i.e. measurement channels with both a classical and quantum output. Finally, we show how sequential QRACs enable inference of upper and lower bounds on the sharpness parameter of a quantum instrument.


I. INTRODUCTION
Random Access Codes (RACs) are an important class of communication tasks with a broad scope of applications. In a RAC, a party Alice holds a set of randomly sampled data and another party Bob attempts to recover some randomly chosen subset of Alice's data. This is made possible by Alice communicating with Bob. Therefore, this corresponds to a prepareand-measure scenario in which Alice encodes her data into a message that she sends to Bob who aims to decode the relevant information. Naturally, this task would be trivial if Alice is allowed to send unlimited information. Therefore, a RAC requires that the message is restricted in its alphabet, so that it cannot encode all of Alice's data. Interestingly however, the probability of Bob to access the desired information can be increased if Alice substitutes her classical message with a quantum message of the same alphabet. Such Quantum Random Access Codes (QRACs) have been introduced and developed for qubit systems [1, 2] as well as higher-dimensional quantum systems [3]. They are primitives for network coding [4], random number generation [5] and quantum key distribution [6]. QRACs are also common in foundational aspects of quantum theory; examples include the comparison of different quantum resources [7,8], dimension witnessing [9], selftesting [10][11][12] and attempts at characterising quantum correlations from information-theoretic principles [13].
Here, we present RACs beyond standard prepare-andmeasure scenarios. Specifically, we consider a 'preparetransform-measure' scenario involving three parties, Alice, Bob and Charlie, in a line configuration. In our scenario, both Bob and Charlie are interested in randomly accessing some information held by Alice, i.e. they individually implement a RAC with Alice. In a classical picture, such sequential RACs are trivial since any information made available to Bob via Alice's communication also can be relayed by Bob to Charlie. In this sense, there is no trade-off between how well Bob and Charlie can perform their RACs. In a quantum picture however, Alice communicates a qubit system that is first sent to Bob who applies a quantum instrument (a completely positive trace-preserving map with both a classical and quantum output) whose classical output is recorded and whose quantum output is relayed to Charlie who performs a measurement. Importantly, Bob's instrument disturbs the physical state of Alice's qubit, and therefore he cannot relay Al-ice's original quantum message to Charlie. In other words, Charlie's ability to access the desired information depends on Bob's preceding interaction. Consequently, one expects a trade-off in the ability of Bob and Charlie to perform their separate QRACs. Here, we consider Bob and Charlie the simplest RAC for qubits (sometimes referred to as a 2 → 1 RAC) in sequence, and derive the optimal trade-off relation between the two QRACs. In particular, we find that both QRACs can outperform the best possible classical RAC.
Subsequently, we apply our results to self-test a quantum instrument. Self-testing [14] is the task of inferring physical entities (states, channels, measurements) solely from correlations produced in experiments i.e. identifying the unique physical entities that are compatible with observed data. Selftesting is typically studied in Bell experiments where notably methods for self-testing quantum instruments have been developed [15,16]. Recently however, self-testing was introduced in the broad scope of prepare-and-measure scenarios [10], and was further developed using QRACs to robustly self-test both preparations and measurements [10][11][12]. Notably however, prepare-and-measure scenarios do not enable self-tests of general quantum operations. In particular, it does not enable self-tests of quantum instruments since the quantum system after the measurement is irrelevant to the outcome statistics produced in the experiment. We show that our prepare-transform-measure scenario overcomes this conceptual limitation. We find that optimal pairs of sequential QRACs self-test quantum instruments. However, such optimal correlations require idealised (noiseless) scenarios which are never the case in a practical implementation. Therefore, we also show how sequential QRACs allow for inference of noise-robust bounds on the sharpness parameter in a quantum instrument. This is makes our results applicable to experimental demonstrations. Finally, we discuss relevant generalisations of our results.

II. SEQUENTIAL RANDOM ACCESS CODES
We focus on a prepare-transform-measure scenario that involes three parties. The first party (Alice) receives a uniformly random four-valued input x = (x 0 , x 1 ) ∈ {0, 1} 2 . For a given input, she prepares a quantum state ρ x . This state is uncharacterised, up to the assumption of it being of Hilbert space FIG. 1: A three-party prepare-transform-measure scenario. Alice samples qubit states from an ensemble of four preparations. Bob performs one of two instruments with a binary classical register and qubit output. Charlie performs one of two binary-outcome measurements.
dimension two, i.e. it is a qubit. The state is transmitted to the second party (Bob) who receives a random binary input y ∈ {0, 1}. Depending on his input, Bob applies an instrument characterised by Kraus operators {K b|y } to ρ x which produces a classical binary outcome b ∈ {0, 1} and a qubit post-measurement state (1) Notably, since the instrument realises a measurement, the Kraus operators of Bob must satisfy the completeness relation ∀y : M 0|y + M 1|y = 1 1, where M b|y = K † b|y K b|y are the corresponding elements of the positive operator-valued measures (POVMs). The post-measurement state ρ y,b x is relayed to the third party (Charlie) who receives a random binary input z ∈ {0, 1} to which he associates POVMs {C c|z } with a binary outcome c ∈ {0, 1}. The scenario is illustrated in Figure 1.
In the limit of repeating the experiment many times, the results are described by the probability distribution p(b, c|x, y, z) = tr K b|y ρ x K † b|y C c|z . (2) To enable a simple and qualitative treatment of the information stored in the distribution, one may employ a correlation witness, i.e. a map from p(b, c|x, y, z) to a single real number. We are interested in two separate correlation witnesses, each corresponding to a RAC. The first RAC is considered between Alice and Bob. In this task, the partners are collectively awared a point if and only if Bob can guess the y'th bit of Alice input (x 0 , x 1 ). The correlation witness is the average success probability. It reads where in the second step we have assumed a quantum description. In a classical picture (in which all states are diagonal in the same basis), this witness obeys W AB ≤ 3/4 (which we further discuss later). The physical properties of {ρ x } and {M b|y } when the QRAC exceeds its classical bound were studied in Ref [10]. It was shown that an optimal QRAC for qubits self-tests that Alice's four preparations form a square in some disk of the Bloch sphere. Up to a choice of reference frame these are written where σ = (σ x , σ y , σ z ) denotes the Pauli matrices. Moreover, an optimal QRAC also self-tests Bob's observables (defined as M y = M 0|y − M 1|y ) to be anticommuting. In the stated frame, the observables are written Evidently however, the QRAC (3) is independent of both Charlie and of the choice of instrument for realising the POVMs {M b|y }. To also take these into account, we consider an additional QRAC implemented between Alice and Charlie. Analogously, the partners are awarded a point if and only if Charlie can guess the z'th bit of Alice's input (x 0 , x 1 ). The correlation witness corresponding to this QRAC reads This QRAC is not independent of Bob since he applies an instrument to the preparation of Alice before they arrive to Charlie. In a quantum model, the effective stateρ x received by Charlie is the post-measurement state of Bob averaged over Bob's inputs and classical outputs, i.e., Therefore, we have (9) We are interested in the values attainable for the pair of QRACs (W AB , W AC ). We remark that the interesting range is when 1/2 ≤ (W AB , W AC ) ≤ (1 + 1/ √ 2)/2 since either witness being 1/2 − for some > 0 is equivalent to a witness value of 1/2 + by classically bit-flipping the outcomes.
Typically, we expect there to be a trade-off between the two QRACs. The reason is as follows. In order for W AB to be large, Alice must prepare states that are close to the ones in Eq (5) and Bob must implement instruments that realise POVMs that are close to the ones in Eq (6). This means that Bob's measurements must be reasonably sharp. This leads to a large disturbance in the state of the measured system which causes the effective ensemble of states {ρ x } arriving to Charlie to lesser reflect the ensemble {ρ x } originally prepared by Alice. Therefore, the value of W AC is expected to be small. Conversely, if Bob makes a very unsharp measurement (almost noninteracting), he could almost completely avoid disturbing the state of Alice's system and thus we would find that {ρ x } closely approximates {ρ x } which allows Charlie to find a large value of W AC . However, the weak interaction of Bob then would imply a correspondingly small value of W AB .
In view of the above, characterising the set of pairs (W AB , W AC ) that can be attained in quantum theory is a nontrivial matter. By finding such a characterisation and by understanding the trade-off between the two QRACs, we enable self-tests of Bob's instrument, along with self-tests of Alice's preparations and Charlie's measurements. Note that one may also consider alternative generalisations of QRACs to sequential scenarios [17].

III. QUANTUM CORRELATIONS IN SEQUENTIAL RANDOM ACCESS CODES
Which values of the pair of QRACs (W AB , W AC ) can be realised in a quantum model based on qubit systems? Before addressing this matter, let us first examine the substantially simpler situation in which the physical devices are classical, i.e. the state at all times is diagonal in the same basis. In such situations, Bob can interact with the preparations of Alice without disturbing their state. Therefore, a large value of W AB constitutes no obstacle for also finding a large value of W AC . Classically, one can optimally achieve W AB = 3/4. Clearly, as the interaction with Bob cannot contribute towards increasing the value of W AC , it also holds that W AC ≤ 3/4. This value is saturated by Alice sending x 0 to Bob who outputs b = x 0 and relays x 0 to Charlie who outputs c = x 0 . Thus, the set of classically attainable correlations is 1/2 ≤ (W AB , W AC ) ≤ 3/4. This classically attainable set is illustrated in Figure 2. Notice that there is no trade-off between W AB and W AC in a classical picture.
In a quantum model, the characterisation of the attainable set of witnesses is less straightforward. We phrase the problem as follows: for a given value (denoted α) of W AB , what is the maximal value of W AC possible in a quantum model? Answering this question for every α ∈ [1/2, 1 + 1/ √ 2 /2] provides the optimal trade-off between the two QRACs. Equivalently, it can be viewed as the nontrivial part of the boundary of the quantum set of correlations in the space of (W AB , W AC ). Formally, the optimisation problem reads i.e. it is an optimisation of Charlie's witness over all preparations, instruments and measurements that can model the ob- servation of W AB = α. In the above, we have used the polar decomposition to write the Kraus operators as K b|y = U yb M b|y for some unitary operator U yb and some POVM {M b|y }. Kraus operators of this form correspond to extremal quantum instruments in the considered scenario [18].
We solve the problem (10) by first giving a lower bound on W α AC and then matching it with an upper bound. To this end, consider a quantum strategy in which Alice prepares the ensemble of states given in Eq (5) and Charlie performs the measurements in Eq (6). We let Bob perform an unsharp Lüders measurement (the Kraus operators have U yb = 1 1) of the observables in Eq (6), i.e. his observables correspond to M 0 = ησ x and M 1 = ησ z for some sharpness parameter η ∈ [0, 1]. Evaluating the pair of witnesses with this quantum strategy gives Parameterising the latter in terms of the former returns a lower bound on W α AC . Importantly, this bound is optimal since it can be saturated with an upper bound on W α AC , thus solving the optimisation problem (10). This leads us to our first result.
Result 1. The optimal trade-off between the pair of QRACs (W AB , W AC ) corresponds to where α ∈ [1/2, (1 + 1/ √ 2)/2]. That is, the optimal witness pairs are of the form (W AB , W AC ) = (α, W α AC ). This characterises the nontrivial boundary of the quantum set in the space of witness pairs.
The proof is analytical, of technical character and detailed in Appendix A. It relies on i) treating the maximisation in (10) over the tuple (U, C) as an eigenvalue problem, ii) using the Bloch sphere parameterisation for the preparations and instruments, and iii) noticing that the maximisation over the preparations can be relaxed to a maximisation over two pairs of antipodal pure states in some disk of the Bloch sphere.
In Figure 2, we have illustrated the set of sequential QRACs attainble in a quantum model. Notice that a maximal value (4) of W AB does not imply that W AC is no better than what is obtained by random guessing. In contrast, one can achieve . The reason is that the ensemble relayed to Charlie corresponds to that originally prepared by Alice but with Bloch vectors of half the original length. In addition, there exists a subset of the quantum set in which both W AB and W AC exceed the classical bound.

IV. SELF-TESTING
Finding the optimal trade-off between the two QRACs (Result 1) allows for self-testing. To obtain a self-test, one must additionally show that the optimal QRAC pairs only admit a realisation with unique preparations, instruments and measurements (up to collective unitary transformations). That is, we need to identify the unique physical entities {ρ x }, {K b|y }, and {C c|z } necessary for optimal correlations. Such a self-testing argument can be established largely from the proof of Result 1 (see Appendix A). The reason is that our approach to deriving Result 1 successively identifies the form of the physical entities required for optimality. To turn the statement into a self-test, we identify key inequalities used to upper bound W α AC and instead impose strict equality constraints. This allows us to pinpoint the states, measurements and instruments one by one. These additional arguments are discussed in Appendix A. This leads us to the following self-test statement based on optimal sequential QRACs.
Result 2. An optimal pair of QRACs (W AB , W AC ) = (α, W α AC ), as in Eq. (10), self-tests that • Alice's states are pure and pairwise antipodal on the Bloch sphere, on which they form a square. These correspond to the states given in Eq. (5).
• Bob's instruments are Kraus operators K b|y = U yb M b|y that correspond to unsharp measurements along the diagonals of Alice's square of preparations followed by a collective unitary. Specifically, ∀y, b : • Charlie's measurements are rank-one projective along the diagonals of the square formed by Alice's preparations, up to the unitary of Bob. That is, C 0 = U σ x U † and C 1 = U σ z U † .
The self-tests are valid up to a collective choice of reference frame.
This result applies to optimal pairs of QRACs (highlighted by a solid red line in Figure 2). An interesting question is how to make this result noise-tolerant so that it applies to suboptimal pairs of QRACs that nevertheless lack a classical model. Naturally, when the QRACs are suboptimal, one can no longer pinpoint the physical entities as done in Result 2. However, it is possible to give qualitative statements about the quantum strategies that in principle could model the observed correlations. We consider this matter for the sharpness parameter in Bob's instruments. Since any binary-outcome qubit observable can be written on the form M y = c y0 1 1 + c y · σ, we define the sharpness parameter of Bob's instrument as the length of the Bloch vector c y . For simplicity, we take both his instruments to have the same sharpness η ≡ | c 0 | = | c 1 |.
We can place a lower bound on η from the witness W AB ; it corresponds to the smallest η for which there exists preparations and instruments that can model W AB . In Appendix B, we show that this lower bound reads This lower bound is nontrivial whenever W AB > 1/2. Notice also that an optimal QRAC (4) necessitates a sharp measurement (η = 1). Similarly, we can place an upper bound on η from the witness W AC , corresponding to the largest η for which there exists preparations, instruments and measurements that can model W AC . In Appendix B we show that such a bound reads The lower bound (13) and the upper bound (14) are tight, i.e. they can be saturated with an explicit quantum strategy. Notice that the upper bound (14) conincides with the lower bound (13) for optimal W AC (i.e. when W AC = W α AC ) as given in Eq (12). In addition, the bound (14) reduces to the trivial η ≤ 1 when W AC = 4 + √ 2 /8 ≈ 0.6767. As a simple example, consider an experiment that attempts to implement the quantum strategy (11) for the optimal witness pair (W AB , W AC ) corresponding to η = 1/ √ 2. However the experiment is subject to losses. For example, take a 95% visibility 1 in Alice's preparations, 90% visibility in Bob's instruments, and 95% visibility in Charlie's measurements. Instead of finding the optimal witness pair (W AB , W AC ) = (3/4, (5 + √ 2)/8), one finds (W AB , W AC ) ≈ (0.7138, 0.7826). Therefore, we find that η must be confined to the interval 0.6047 ≤ η ≤ 0.8010. The interval is fairly wide, which emphasises the need for high-quality practical realisations in order to confine η to a reasonably small interval.

V. GENERALISATIONS
Above, we have thoroughly considered the scenario in which a sequence of three observers implement a pair of the simplest QRAC. This is arguably the simplest scenario in which to study sequential QRACs. It would be interesting to consider more general scenarios; both involving higherdimensional [3] and many-input QRACs, as well as sequences of more than three observers.
Consider for example the above considered RAC played between Alice and a sequence of N parties. We denote the RAC between Alice and sequential party number k by W k . Let Alice prepare the optimal states in Eq. (5). We know that if the first party performs optimal projective measurements (6) (with Kraus operators K b|y = M b|y ), he will find the optimal QRAC given in Eq. (4). Moreover, if the second party performs the same Kraus operators we find W 3 = 1 + 1/(2 √ 2) /2. The reason is that the effective state ensemble (8) relayed by the first party is identical the the preparations of Alice except that their Bloch vectors have shrunk to half the unit lenght. Similarly, the effective ensemble relayed by the second party will be identical to that relayed by the first party, except that the Bloch vectors will again by shrunk to a quarter of unit length. Continuing the sequence in this manner, the square formed in the Bloch sphere by the effective post-measurement ensemble will at each step have its half-diagonal reduced by a factor 1/2, and we find Moreover, one can ask what is the longest sequence of QRACs such that all of them can exceed the classical bound. The number is at least two, since we found W AB = W AC = 5+2 √ 2 10 ≈ 0.7828 > 3/4. However, a third sequential violation is unlikely to be possible, i.e. to find W 1 = W 2 = W 3 > 3/4. The reason is based on the possibility of relating witnesses in dimension-bounded prepare-and-measure scenarios to Bell inequalities [19][20][21]. Via such methods, the considered RAC can be related to the CHSH inequality [19]. However, sequential violations of the CHSH inequality were studied in Ref. [22] and it was found that no more than two CHSH inequality violations are possible when inputs are uniformly distributed [23,24].

VI. CONCLUSIONS
We have studied sequential Quantum Random Access Codes and characterised their optimal trade-off. This ties in with the recent interest in sequential quantum correlations obtained in various forms of tests of nonclassicality [22,[24][25][26][27][28][29][30]. We applied our results to show that quantum instruments can be semi device-independently self-tested. Notably, since all quantum instruments also realise some POVM, our results trivially implies a certification of unsharp measurements. Our results complement the many recent self-tests of preparations and measurements in standard prepare-and-measure scenarios with a method for self-testing quantum instruments. In addition, we showed how to robustly certify the sharpness parameter of quantum instruments based on noisy correlations. This makes our results readily applicable to experimental applications. Such tests are well within the state-of-the-art experiments [30][31][32]. Moreover, we notice that the class of quantum instruments self-tested in this work are precisely those implemented by the experimental realisations in Ref. [30][31][32].
We conclude with some open questions. Firstly, it would be interesting to generalise our results to cover higherdimensional QRACs and longer sequences of observers. Secondly, a possible further development is to characterise the optimal trade-off between sequential QRACs encountered in tests of preparation contextuality [30]. Thirdly, in the spirit of Ref. [15], it would be interesting to develop noise-robust self-testing of quantum instruments. Typically, such a robust self-test address the closeness (based on observed witness values) between the unknown laboratory instrument and the ideal instrument that would have been self-tested in case correlations were optimal. Finally, one could consider the task of self-testing quantum instruments based on the sequential correlation experiments in the fully device-independent scenario (see Ref. [22]).
Note added.-During the completion of this work, we became aware of the related work of Ref. [33].

VII. ACKNOWLEDGEMENTS
We thank Denis Rosset and Jędrzej Kaniewski for discussions. This work was funded by the Swiss National Science Foundation (Starting grant DIAQ, NCCR-QSIT).
To contend with this, we first use the polar decomposition K b|y = U yb M b|y , where U yb are arbitrary unitary operators. We can then use the cyclicity of the trace along with the substitution C 1|z = 1 1 − C 0|z to write Eq (A1) as (A3) The sum over x can be moved inside the trace; we define γ z = x (−1) xz ρ x . Moreover, we also define A zyb = U † yb C 0|z U yb . We can now consider the optimisation over {U yb } and {C c|z } as a single optimisation over A zyb . To this end, we note that the set of measurements {C c|z } is convex. Therefore, every nonextremal (interior point) measurement can be written as a convex combination of extremal measurements (on the boundary). Due to linearity, no nonextremal POVM can lead to a larger value of W AC than some extremal POVM. The extremal binary-outcome qubit measurements are rank-one projectors. Therefore, we can consider the optimisa-tion over A zyb as an optimisation over general rank-one projectors. where we have made the optimal choice of letting A zyb project onto the eigenvector of M b|y γ z M b|y with the largest eigenvalue (denoted by λ max ).
To proceed further, we make use of the fact that qubit operations can be parameterised on the Bloch sphere. We write the preparations as ρ x = (1 1 + n x · σ) /2 for some Bloch vectors n x ∈ R 3 with | n x | ≤ 1. This leads to γ z = [( n 00 − n 11 ) + (−1) z ( n 01 − n 10 )] · σ. (A5) We define the effective (unnormalised) Bloch vectors m z = ( n 00 − n 11 ) + (−1) z ( n 01 − n 10 ). Consequently, the dependence of W AC on the preparations can be reduced to its dependence on ( m 0 , m 1 ). However, given any set of preparations { n x }, we can consider other preparations { n x } choosen such that n 00 = − n 11 and n 01 = − n 10 with 2 n 00 = n 00 − n 11 and 2 n 01 = n 01 − n 10 . The both ensembles { n x } and { n x } imply the same vectors ( m 0 , m 1 ). Moreover, it is evident that if not all preparations are pure, one cannot obtain optimal correlations (since impurity corresponds to decreasing the magnitude of ( m 0 , m 1 )). This means that the Bloch vectors are of unit lenght and therefore that the optimal preparations must be of the type { n x } (i.e. two antipodal pairs). Notice that purity also implies that m 0 · m 1 = 0. W.l.g. we can choose a reference frame in which m 0 ∝ (1, 0, 0) and m 1 ∝ (0, 0, 1). We denote the relative angle between the two pairs of antipodal preparation pairs by θ ∈ [0, π/2]. This gives √ 1 − c 2 . Thus, we have arrived to the upper bound As shown in the main text, this upper bound could be saturated with an explicit quantum strategy. This proves Result 1.
Let us now extend this to a proof of Result 2 by more closely examining the above steps needed to arrive at Eq (A19). Firstly, we have already shown that the preparations must be pure, pairwise antipodal and by lemma 1 they must have a relative angle of π/2. Thus, this corresponds to a square in a disk of the Bloch sphere. The above arguments fully characterise Alice's preparations up to a reference frame.
For Bob's instrument, we have shown that the Bloch vectors ( c 0 , c 1 ) only can have non-zero components in the xand zdirections respectively and that the length of the Bloch vector is given by Eq (A18). This fully characterises the Bloch vectors. Moreover, in Eq (A4) we required that A zyb is aligned with the eigenvector of M b|y γ z M b|y corresponding to the largest eigenvalue. However, we now have that γ 0 = σ x and γ 1 = σ z whereas M 0 ∝ σ x and M 1 ∝ σ z . Therefore, we have that ∀y, b : A 0yb = |+ +| and ∀y, b : A 1yb = |0 0|. Therefore, we have that ∀yb : U † yb C 0|0 U yb = |+ +| (A20) ∀yb : This implies that all unitaries are equal; U yb = U . Therefore, Charlie's observables C z = C 0|z − C 1|z satisfy C 0 = U σ x U † and C 1 = U σ z U † .