## Introduction

The advent of quantum theory has not just changed the understanding of physics but has also given rise to new phenomena that would have never been possible in the classical world. Arguably, one of the most interesting features of quantum theory is the existence of quantum correlations, which cannot be explained by any local hidden-variable model, a phenomenon commonly referred to as Bell nonlocality1,2. It has been understood that apart from its fundamental significance, nonlocality is a powerful resource for certain device-independent applications such as quantum cryptography3, randomness generation4,5, or, more recently, for device-independent certification methods3,4,5,6.

The strength of the device-independent (DI) certification methods lies in the fact that given an unknown quantum system, one can make nontrivial statements on some of its key features based solely on the nonlocal correlations obtained from it. They are advantageous over standard certification methods such as those based on quantum tomography (cf. Ref. 7) because they do not require making assumptions on the system under study, apart from that, it is governed by quantum mechanics. An example of such a DI-certification scheme would be verifying whether a quantum device produces entanglement8 or certification of the dimension of a quantum system9, both based on a violation of some Bell inequality by the corresponding quantum system.

The strongest form of DI certification is self-testing. First introduced in6, it allows one to provide a full description, up to certain well-understood equivalences, of the considered quantum system and also the measurements performed on it based on observing the maximal violation of some Bell inequality. Such a form of certification is particularly interesting from the application point of view as it provides a way of verifying that a given quantum device functions properly without the need of knowing its internal working.

A lot of attention has thus been devoted to proposing self-testing schemes for entangled quantum states10,11,12,13,14. However, most of the obtained results focus on states that are locally qubits, such as, for instance, the self-testing statement for any two-qubit entangled state11,12 based on a violation of the tilted version of the famous Clauser–Horne–Shimony–Holt (CHSH) Bell inequality15,16. At the same time, quantum systems of higher local dimension remain mostly unexplored and, in fact, few results are devoted to them11,17,18,19. In particular, in Ref. 17, the two-qubit results11,12 were combined to design a self-testing protocol for any entangled state of arbitrary local dimension. Still, these results are based on a violation of many two–outcome Bell inequalities and the question whether one can design a self–testing statement for qudit quantum systems relying on violation of a single and truly d-outcome Bell inequality remains open. Moreover, the self–testing statement of Refs. 11,17 is not optimal in terms of the number of measurements that the observers need to perform (three and four, respectively) to certify the state and the corresponding measurements. Taking into account the possibility of experimental implementations of self–testing, it is a highly relevant question whether alternative protocols can be derived, which rely on the minimal number of two measurements per observer.

The main aim of this work is to address the above questions. We provide a self–testing statement for a maximally entangled state of local dimension d:

$$\left|{\phi }_{d}^{+}\right\rangle =\frac{1}{\sqrt{d}}\mathop{\sum }\limits_{i=0}^{d-1}\left|ii\right\rangle$$
(1)

from a violation of a truly d-outcome Bell inequality exploiting the minimal possible number of measurements per party, which is two. To this end, we use the Bell inequality introduced in Ref. 20 as a generalization of the well–known CHSH Bell inequality to d-outcome Bell scenarios. A straightforward implication of our self–testing statement is a novel and simpler, as compared with the previous approaches21,22, scheme for parallel self–testing of N copies of the two–qubit maximally entangled state $$\left|{\phi }_{2}^{+}\right\rangle$$. Another implication is that the outcomes of local measurements maximally violating the respective Bell inequality are perfectly random, which allows us to propose a quantum protocol for unbounded expansion of quantum randomness.

## Results

### Preliminaries

Before presenting our results, let us set up the scenario and introduce the relevant notions.

#### Bell scenario

The simplest experimental setup exhibiting quantum nonlocality, namely, the bipartite Bell setup, comprises one preparation and two measurement devices. The latter are possessed by distant and noncommunicating parties, Alice and Bob, and can in general perform one of m measurements, denoted by Mx and Ny with x, y = 1, …, m. In each run of the experiment, a bipartite quantum system ρAB is prepared by the preparation device and subsequently each measurement device performs a measurement on one of its subsystems, yielding an outcome a and b, respectively, with a, b {0, …, d − 1}.

Correlations obtained in this experiment are captured by a vector of probability distributions

$${{{\bf{p}}}}=\{p(a,b| x,y)\}\in {{\mathbb{R}}}^{{(md)}^{2}}.$$
(2)

Here, p(a, bx, y) is the probability of obtaining outcomes a and b by Alice and Bob after performing measurements Mx and Ny, respectively, and it is given by the well–known formula

$$p(a,b| x,y)={{{\rm{Tr}}}}\left[{\rho }_{{{{\rm{AB}}}}}({M}_{x}^{(a)}\otimes {N}_{y}^{(b)})\right],$$
(3)

where $${M}_{x}^{(a)}$$ and $${N}_{y}^{(b)}$$ are the measurement operators defining the measurements Mx and Ny, respectively. In what follows, we also refer to the vector p as correlations.

In a fixed Bell scenario with md-outcome measurements, such quantum correlations, that is, those obtained by performing local measurements on composite quantum systems, form a convex set $${{{\mathcal{Q}}}}$$. For further purposes, it is important to recall that any point $${{{\bf{p}}}}\in {{{\mathcal{Q}}}}$$ can be achieved with a pure state $$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$, whose local dimensions might in general be higher than those of ρAB, and projective measurements $${M}_{x}=\{{P}_{x}^{(a)}\}$$ and $${N}_{y}=\{{Q}_{y}^{(b)}\}$$.

It turns out that the quantum set $${{{\mathcal{Q}}}}$$ contains correlations that even if obtained from a quantum state, can be simulated by Alice and Bob in a purely classical way. Such correlations are said to admit a local–realistic description, and for brevity, we refer to them as local or classical. More formally, local correlations are those for which p(a, bx, y) can be represented as a convex combination of product–deterministic correlations

$$p(a,b| x,y)=\mathop{\sum}\limits_{\lambda }\mu (\lambda )p(a| x,\lambda )p(b| y,\lambda ),$$
(4)

where λ is a random variable distributed according to a distribution μ(λ) and p(ax, λ), p(by, λ)  {0, 1} for every x, y, a, b. For any m and d, such local correlations form a convex polytope that we denote $${{{\mathcal{L}}}}$$.

#### Bell inequalities

As proven by Bell, the local set $${{{\mathcal{L}}}}$$ is a proper subset of $${{{\mathcal{Q}}}}$$1 and those quantum points that are outside $${{{\mathcal{L}}}}$$ are termed nonlocal. The most natural way to show that a given point $${{{\bf{p}}}}\in {{{\mathcal{Q}}}}$$ is not an element of $${{{\mathcal{L}}}}$$, is to use Bell inequalities. Recall their generic form to be

$${{{\mathcal{I}}}}:={{{\bf{t}}}}\cdot {{{\bf{p}}}}\ \le \ {\beta }_{{{{\rm{L}}}}},$$
(5)

where t = {tabxy} is a collection of some real coefficients tabxy and $${\beta }_{{{{\rm{L}}}}}=\mathop{\max }\limits_{{{{\bf{p}}}}\in {{{\mathcal{L}}}}}{{{\mathcal{I}}}}$$ is the local bound of inequality (5). Analogously, the quantum or the Tsirelson bound of (5) is defined as $${\beta }_{{{{\rm{Q}}}}}={\sup }_{{{{\bf{p}}}}\in {{{\mathcal{Q}}}}}{{{\mathcal{I}}}}$$.

Clearly, violation of a Bell inequality by correlation p implies that it is nonlocal. Moreover, any point p violating maximally some Bell inequality (or, equivalently, achieving its Tsirelson bound) necessarily belongs to the boundary of the quantum set $${{{\mathcal{Q}}}}$$.

#### Correlation picture

Let us finally notice that it is often beneficial to describe correlations obtained in the Bell experiment by expectation values instead of probability distributions. A convenient way to do so in Bell scenarios involving d-outcome measurements is to consider the two–dimensional Fourier transform of the conditional probabilities p(a, bx, y)

$$\langle {A}_{x}^{(k)}{B}_{y}^{(l)}\rangle =\mathop{\sum }\limits_{a,b=0}^{d-1}{\omega }^{ak+bl}p(a,b| x,y),$$
(6)

where ω is the dth root of unity $$\omega =\exp (2\pi {\mathbb{i}}/d)$$ and k, l = 0, …, d − 1. Importantly, for any quantum point p, the expectation values (6) can be represented as $$\langle {A}_{x}^{k}{B}_{y}^{l}\rangle =\langle {\psi }_{{{{\rm{AB}}}}}| {A}_{x}^{(k)}\otimes {B}_{y}^{(l)}| {\psi }_{{{{\rm{AB}}}}}\rangle$$ with $$\{{A}_{x}^{(k)}\}$$ and $$\{{B}_{y}^{(l)}\}$$ being collections of unitary operators with eigenvalues ωi(i = 0, …, d − 1) defined as the Fourier transforms of the corresponding projective measurements

$${A}_{x}^{(k)}=\mathop{\sum }\limits_{a=0}^{d-1}{\omega }^{ak}{P}_{x}^{(a)},\qquad {B}_{y}^{(l)}=\mathop{\sum }\limits_{b=0}^{d-1}{\omega }^{bl}{Q}_{y}^{(b)}.$$
(7)

It is not difficult to see that $${A}_{x}^{(k)}$$ is simply the kth power of Ax (and similarly for Bob’s operators), and thus, in what follows, we simply write $${A}_{x}^{k}$$. In this correlator picture, the unitary operators Ax and By are d-outcome observables measured in the Bell setup.

#### Self–testing

We are now ready to present our main result: the self–testing statement for the two–qudit maximally entangled state and certain d-outcome measurements usually referred to as Collins–Gisin–Linden–Massar–Popescu (CGLMP) measurements23,24,25 (see Supplementary Methods for their explicit form).

To recall the task of self–testing, or more generally, DI certification, let us consider a quantum device performing a Bell experiment on some state $$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle \in {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}$$ with some quantum d-outcome observables Ax and By, where the dimensions of the $${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}$$ and $${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}$$ are unknown but finite. The only information accessible to the user about how this device functions is the observed correlation p. The aim of DI certification is to reveal the form of the state and observables from violation of some Bell inequality by p (given that the observed correlations violate some Bell inequality). However, there are two degrees of freedom, which can never be detected from the observed statistics. One is the set of local unitaries UA, UB that act on $${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}},{{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}$$, that is, the state $${U}_{{{{\rm{A}}}}}\otimes {U}_{{{{\rm{B}}}}}\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$ together with $$\{{U}_{{{{\rm{A}}}}}{A}_{x}{U}_{{{{\rm{A}}}}}^{{\dagger} }\},\{{U}_{{{{\rm{B}}}}}{B}_{y}{U}_{{{{\rm{B}}}}}^{{\dagger} }\}$$ will generate the same p. Another one is the presence of an auxiliary system on which the measurements act trivially. A particular instance of such DI certification, termed self–testing, infers a unique state and two sets of unique measurements up to these equivalences.

Clearly, a necessary condition to derive an exact self–testing statement for a state and measurements is that the obtained correlation p lies on the boundary of $${{{\mathcal{Q}}}}$$, and thus violates some Bell inequality maximally. Consequently, in order to derive a self–testing statement for $$\left|{\phi }_{d}^{+}\right\rangle$$ for any d, the first task is to identify a class of Bell inequalities in the bipartite scenario with the minimum number of measurements for which βQ is achieved by it for any d. The only known Bell inequality meeting these requirements is the Salavrakos–Augusiak–Tura–Wittek–Acín–Pironio (SATWAP) Bell inequality20, which in the correlator picture reads

$$\begin{array}{ll}{{{{\mathcal{I}}}}}_{d}:=\,\mathop{\sum }\limits_{k=1}^{d-1}\left({a}_{k}\langle {A}_{1}^{k}{B}_{1}^{d-k}\rangle +{a}_{k}^{* }{\omega }^{k}\langle {A}_{1}^{k}{B}_{2}^{d-k}\rangle \right.\\ \,\left.\ \ \qquad +{a}_{k}^{* }\langle {A}_{2}^{k}{B}_{1}^{d-k}\rangle +{a}_{k}\langle {A}_{2}^{k}{B}_{2}^{d-k}\rangle \right)\le {\beta }_{L},\end{array}$$
(8)

where $${a}_{k}=(1-{\mathbb{i}}){\omega }^{k/4}/2$$ and the classical value is given by $${\beta }_{{{{\rm{L}}}}}=(1/2)[3\cot (\pi /4d)-\cot (3\pi /4d)]-2$$.

As proven in Ref. 20, the maximal quantum value of this inequality is βQ = 2(d − 1) and it is achieved by the maximally entangled state of two qudits $$\left|{\phi }_{d}^{+}\right\rangle$$ and the aforementioned optimal CGLMP measurements (cf. Supplementary Methods). In what follows, we show that this is in fact the only quantum system, up to additional freedoms as discussed above, realizing the maximal quantum violation of inequality (8) (Fig. 1).

### Self–testing of maximally entangled state of arbitrary local dimension

Let us first introduce Zd = diag[1, ω, …, ωd−1] to be the d-dimensional generalization of the σz-Pauli matrix in the standard basis and Td to be the following matrix:

$${T}_{d}=\mathop{\sum }\limits_{i=0}^{d-1}{\omega }^{i+\frac{1}{2}}\left|i\right\rangle \ \left\langle i\right|-\frac{2}{d}\mathop{\sum }\limits_{i,j=0}^{d-1}{(-1)}^{{\delta }_{i,0}+{\delta }_{j,0}}{\omega }^{\frac{i+j+1}{2}}\left|i\right\rangle \ \left\langle j\right|,$$
(9)

where δi,j is the Kronecker delta: δi,j = 1 for i = j and δi,j = 0 otherwise. It is not difficult to see that both matrices are unitary and have eigenvalues ωi(i = 0, …, d − 1) (see Supplementary Methods) and thus represent d-outcome quantum observables.

Now, we can state our main theorem.

### Theorem 1

Assume that the SATWAP Bell inequality (8) is maximally violated by a state$$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle \in {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}$$and unitary observablesAi, Bi(i {1, 2}). Then, for anyd, $${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}={{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$as well as$${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}={{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$with some auxiliary Hilbert spaces$${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$and$${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$of unknown but finite dimensions. Moreover, there exist local unitary transformations$${U}_{{{{\rm{A}}}}}:{{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }\to {{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$and$${U}_{{{{\rm{B}}}}}:{{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }\to {{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$, such that

$${U}_{{{{\rm{B}}}}}{B}_{1}{U}_{{{{\rm{B}}}}}^{{\dagger} }={Z}_{d}\otimes {{\mathbb{1}}}_{{{{\rm{B}}}}^{\prime} },\qquad {U}_{{{{\rm{B}}}}}{B}_{2}{U}_{{{{\rm{B}}}}}^{{\dagger} }={T}_{d}\otimes {{\mathbb{1}}}_{{{{\rm{B}}}}^{\prime} },$$
(10)

and

$$\begin{array}{lll}{U}_{{{{\rm{A}}}}}{A}_{1}{U}_{{{{\rm{A}}}}}^{{\dagger} }\,=\,({a}_{1}^{* }{Z}_{d}+2{({a}_{1}^{* })}^{3}{T}_{d})\otimes {{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} },\\ {U}_{{{{\rm{A}}}}}{A}_{2}{U}_{{{{\rm{A}}}}}^{{\dagger} }\,=\,\left({a}_{1}{Z}_{d}-{a}_{1}^{* }{T}_{d}\right)\otimes {{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} },\end{array}$$
(11)

where$${a}_{1}=(1+{\mathbb{i}}){\omega }^{1/4}/2$$, ZdandTdare defined above, and$${{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} },{{\mathbb{1}}}_{{{{\rm{B}}}}^{\prime} }$$are identity matrices acting on$${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$and$${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$. Finally, the state$$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$is equivalent to$$\left|{\phi }_{d}^{+}\right\rangle$$in the following sense:

$${U}_{{{{\rm{A}}}}}\otimes {U}_{{{{\rm{B}}}}}\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle =\left|{\phi }_{d}^{+}\right\rangle \otimes \left|{{{{\rm{aux}}}}}_{{{{\rm{A}}}}^{\prime} {{{\rm{B}}}}^{\prime} }\right\rangle ,$$
(12)

where$$\left|{{{{\rm{aux}}}}}_{A^{\prime} B^{\prime} }\right\rangle$$is some auxiliary state from$${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$.

Before proving this theorem, a few comments are in order. First, as proven in Supplementary Methods, the observables Zd and Td are unitarily equivalent to the CGLMP measurements. Second, our self–testing statement exploits a single Bell inequality involving the minimal number of two measurements per observer for which one can observe nonlocality in quantum systems. The number of local observables one needs to measure in order to self–test a state is of key importance from the application point of view. Finally, in the case of d = 2N, the theorem implies a parallel self-testing protocol for $${\left|{\phi }_{2}^{+}\right\rangle }^{\otimes N}$$, i.e., N copies of maximally two-qubit entangled state (see Refs. 21,22 for the previous approaches).

### Proof

The proof is quite technical and thus is deferred to the Supplemental Information (cf. Supplementary Methods). Here we only sketch its main ingredients. Let a state $$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$ and observables Ax and By maximally violate the SATWAP Bell inequality. Without loss of generality, we can assume that the reduced states of $$\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$ are full rank. Exploiting the sum-of-squares decomposition of the corresponding Bell operator, we can establish that Alice’s and Bob’s observables satisfy

$${{{\rm{Tr}}}}({A}_{x}^{n})={{{\rm{Tr}}}}({B}_{y}^{n})=0$$
(13)

for x, y = 1, 2 and any n < d, which is a divisor of the number of outcomes d. These conditions imply that the multiplicities of the eigenvalues of all the observables Ax and By are equal, which has two consequences. First, their matrix dimensions are a multiple of d, meaning that they act on, respectively, $${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}={{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$ and $${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}={{\mathbb{C}}}^{d}\otimes {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$ with $${{{{\mathcal{H}}}}}_{{{{\rm{A}}}}^{\prime} }$$ and $${{{{\mathcal{H}}}}}_{{{{\rm{B}}}}^{\prime} }$$ being some auxiliary Hilbert spaces of unknown but finite dimensions. Second, there exist unitary operations $${U}_{{{{\rm{A}}}}}:{{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}\to {{{{\mathcal{H}}}}}_{{{{\rm{A}}}}}$$ and $${U}_{{{{\rm{B}}}}}:{{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}\to {{{{\mathcal{H}}}}}_{{{{\rm{B}}}}}$$ which allow us to bring Alice’s and Bob’s observables to the form given in Eqs. (10) and (11).

Finally, to obtain an analogous statement for the state we again employ the sum-of-squares decomposition, which in virtue of relations (10) and (11), imposes the following conditions on the state $${\left|\psi \right\rangle }_{{{{\rm{AB}}}}}$$:

$$\begin{array}{rcl}&[{({Z}_{d}^{* })}^{k}\otimes {Z}_{d}^{k}\otimes {{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} {{{\rm{B}}}}^{\prime} }]\left|{\hat{\psi }}_{{{{\rm{AB}}}}}\right\rangle =\left|{\hat{\psi }}_{{{{\rm{AB}}}}}\right\rangle ,&\\ &[{({T}_{d}^{* })}^{k}\otimes {T}_{d}^{k}\otimes {{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} {{{\rm{B}}}}^{\prime} }]\left|{\hat{\psi }}_{{{{\rm{AB}}}}}\right\rangle =\left|{\hat{\psi }}_{{{{\rm{AB}}}}}\right\rangle ,&\end{array}$$
(14)

where we have denoted $$\left|{\hat{\psi }}_{{{{\rm{AB}}}}}\right\rangle ={U}_{{{{\rm{A}}}}}\otimes {U}_{{{{\rm{B}}}}}\left|{\psi }_{{{{\rm{AB}}}}}\right\rangle$$. These conditions can easily be solved, leading to Eq. (12), which completes the proof.□

### Applications to randomness expansion

An interesting application of our self-testing statement is DI randomness certification5. Let us consider the distrustful scenario where one of the observers performing the Bell test, say Bob, wants to generate random bits from the outcomes of his measurements, and Eve who supplies the measurement devices wants to access that outcome.

We show with the aid of the above self-testing result that the maximal violation of the SATWAP Bell inequality certifies $${{{\mathrm{log}}}\,}_{2}d$$ bits of perfect randomness in the outcomes of Alice’s and Bob’s measurements. Without loss of generality, we can focus on Bob’s measurements. One quantifies the randomness obtained in a Bell experiment as $$-{{{\mathrm{log}}}\,}_{2}G(x,{{{\bf{p}}}})$$, where G(x, p) is the local guessing probability defined through the following formula:

$$G(y,{{{\bf{p}}}})=\mathop{{{{\rm{sup}}}}}\limits_{S\in {S}_{{{{\bf{p}}}}}}\mathop{\sum}\limits_{b}\left\langle {\psi }_{{{{\rm{ABE}}}}}\right|{\mathbb{1}}\otimes {Q}_{y}^{(b)}\otimes {E}^{(b)}\left|{\psi }_{{{{\rm{ABE}}}}}\right\rangle ,$$
(15)

where $$\left|{\psi }_{{{{\rm{ABE}}}}}\right\rangle$$ is a three-partite state shared by Alice, Bob, and Eve, $$\{{Q}_{y}^{(b)}\}$$ is a projective measurement performed by Bob, and E = {E(c)} is a d-outcome measurement on $${{{{\mathcal{H}}}}}_{{{{\rm{E}}}}}$$ whose result is Eve’s best guess of Bob’s outcome. Finally, Sp is the set of all possible strategies that Eve implements to guess the outcome of Bob’s measurements, consisting of the state $$\left|{\psi }_{{{{\rm{ABE}}}}}\right\rangle$$ and the measurement E, which reproduce the correlation p observed by Alice and Bob, i.e.,

$$p(a,b| x,y)=\langle {\psi }_{{{{\rm{ABE}}}}}| {P}_{x}^{(a)}\otimes {Q}_{y}^{(b)}\otimes {{\mathbb{1}}}_{{{{\rm{E}}}}}| {\psi }_{{{{\rm{ABE}}}}}\rangle .$$
(16)

Assume now that inequality (8) is maximally violated by p. This means that, up to local unitary operations, $$\left|{\psi }_{{{{\rm{ABE}}}}}\right\rangle =\left|{\phi }_{d}^{+}\right\rangle \left|{{{{\rm{aux}}}}}_{{{{\rm{A}}}}^{\prime} {{{\rm{B}}}}^{\prime} {{{\rm{E}}}}}\right\rangle$$ as well as $${P}_{x}^{(a)}={\bar{P}}_{x}^{(a)}\otimes {{\mathbb{1}}}_{{{{\rm{A}}}}^{\prime} }$$ and $${Q}_{y}^{(b)}={\bar{Q}}_{y}^{(b)}\otimes {{\mathbb{1}}}_{{{{\rm{B}}}}^{\prime} }$$, where $${\bar{P}}_{x}^{(a)}$$ and $${\bar{Q}}_{y}^{(b)}$$ are eigenprojectors of the observables in Eqs. (10) and (11), respectively. Taking all this into account along with the fact that Bob’s observables are traceless, one finally finds that G(y, p) = 1/d.

Thus, $$-{{{\mathrm{log}}}\,}_{2}G(x,{{{\bf{p}}}})={{{\mathrm{log}}}\,}_{2}d$$ bits of randomness can be certified using our self-testing statement. This is the maximum randomness that could be extracted from a system of local dimension d, whereas it requires one bit of randomness to encode the inputs. This gives rise to unbounded randomness expansion as d can be arbitrarily large.

## Discussions

We propose a self-testing statement for quantum system of arbitrary local dimension that unlike the previous approaches11,17 does not rely on self-testing results for qubit states and exploits a truly d-outcome Bell inequality. Moreover, our self-testing result exploits only two measurements per party, which is the minimal number allowing the parties to observe nonlocal correlations. This makes our results interesting from the experimental point of view. In fact, violation of the SATWAP Bell inequality has already been experimentally tested in Ref. 26.

Several follow-up questions arise from our work. The robustness of the above self-testing statement has been previously studied numerically in20 for local dimension three. However, there does not exist any analytical method for deriving robustness bounds for local dimension greater than two. Finding a general methodology for deriving analytical robustness bounds for any arbitrary local dimension and then comparing it to that of the scheme of11,17 could be an interesting follow-up question. Another interesting direction is to explore whether the d-outcome SATWAP Bell inequality can be modified to be maximally violated by a partially entangled state and whether the resulting modifications can be used to make self-testing statements for those states, again with the minimal number of measurements per observer. Finally, it is also interesting to investigate whether, analogously to Refs. 27,28, our self-testing statement can be used to establish certification of the optimal amount of $$2{{{\mathrm{log}}}\,}_{2}d$$ bits of local or global randomness from the maximally entangled state of two qudits with the aid of a local POVM or two projective measurements, respectively. From a more general perspective, our self-testing result might provide nontrivial insights into the structure of the set of quantum correlations along the lines of29, or might find applications in delegated quantum computation30.

Note added—While working on this project, we became aware of the work31 exploring parallel self-testing with minimal number of measurements.