Certifying dimension of quantum systems by sequential projective measurements

This work analyzes correlations arising from quantum systems subject to sequential projective measurements to certify that the system in question has a quantum dimension greater than some $d$. We refine previous known methods and show that dimension greater than two can be certified in scenarios which are considerably simpler than the ones presented before and, for the first time in this sequential projective scenario, we certify quantum systems with dimension strictly greater than three. We also perform a systematic numerical analysis in terms of robustness and conclude that performing random projective measurements on random pure qutrit states allows a robust certification of quantum dimensions with very high probability.

In order to certify dimension of single quantum systems, one can use outcomes statistics from a realized experiment in a specific scenario relying on sequential measurements [14,[33][34][35] or contextuality [15,36,37]. However, the dimension witnesses in [14,15] are particular cases that are difficult to extend to general cases due to their complexity and the method in [37] uses rank constrained optimization over positive semidefinite matrices that uses heuristic method which does not guarantee the optimality of the objective function. Another direction is to use the so-called Navascués-Pironio-Acín (NPA) hierarchy [38,39] which is a numerical method initially developed to construct a hierarchy of outer approximations which possibly converge to the set of quantum correlations on a Bell nonlocality scenario. More recently, the NPA hierarchy has been adapted to characterize correlations arising quantum systems with a fixed finite dimensional with the socalled Navascues-Vertési (NV) hierarchy [40,41] (see also [42]) providing computational tools to certify quantum dimensions in a Bell nonlocality and prepare-and-measure scenario [41].
In this work we present a systematic compu-tational method to certify dimension of quantum systems subjected to sequential projective measurements which is based on the finite dimensional NPA hierarchy [40,41]. We apply our methods to obtain the required robustness on experiments which may be subjected to noise, identify good scenarios for certifying a particular desired dimension, and show that certifying quantum dimensions by preforming random measurements on random states can be done with considerably high probability. Finally identify the different advantages to use more experimentally challenging scenarios in order to have a more accurate and robust dimension certification.
This paper is structured as follows. In Sec. 2, we present preliminary notions on the numerical methods used to certify dimension of quantum systems by sequential projective measurements. In Sec. 3, we propose a method to classify scenarios based on the NPA hierarchy and make a proposal to determine what scenario can be used based on this classification. We introduce the notion of robustness that is used to provide a certificate for the dimension. In Sec. 4, we study different scenarios and compare them to each other in the perspective of dimension certification. In particular, we identify a trade off between the experimental challenges to perform a scenario and a more robust dimension certification. Finally, we show how dimension witness can be computed from our method and provide numerical examples and show that randomly chosen measurements can be used to certify dimension in specific scenario.
2 Bounding Finite Dimension in a Sequential Projective Measurements Scenario 2.1 Sequential Projective Measurements Scenario Consider a quantum state ρ in a finite Hilbert space H d ∼ = C d which will be subjected to sequential projective measurements described by the projectors Π r i |s j . Each measurement has an input (or setting) s ∈ S and an output (or result) r ∈ R and the input and output of the i-th measurement will be denoted by s i and r i .
We call an event a representation of an output for a specific input. For instance for a single measurement, an event is written as r i |s i which represents obtaining the output r i for the input s i of the i-th measurement. Each event is associated to a projector and for the event r i |s i the associated projector is Π r i |s i . Such projectors verify the following conditions, the completeness condition: For events with multiple measurements the ordering is important as it forms a sequence, we label from left to right in order of the sequence, for instance, the event r i , r j |s i , s j which represents obtaining the output r i for the input s i for the i-th measurement, then obtaining the output r j for the input s j for the j-th measurement.
After the first measurement on the state ρ, the post-measured state is denoted by where Tr[.] denotes the trace and † is the Hermitian conjugate. After a second measurement, the state is denoted as (2) Fig. 1 illustrates the case of three sequential measurements on the state ρ. Figure 1: Sequential measurements scenario. Each measurement has an input (or setting) s ∈ S and an output (or result) r ∈ R and the input and output of the i-th measurement will be denoted by s i and r i .
This corresponds to the Lüders' rule for state update [43]. Other dimension witnesses [44,45] have been built based on the von Neumann's rule for state update [46].
For simplicity we denote the sequence of outputs r = (r 1 , . . . , r l ) and the sequence of settings s = (s 1 , . . . , s l ). The measurement operator (composition of projectors is not a projector) associated to the event r|s is Π r|s = Π r l |s l . . . Π r 1 |s 1 .
The probability to have the event r|s is given by the Born's rule: In what follows, we consider the case where the set of measurements to choose from is the same for each measurement through the sequence. Moreover, we consider the case where all measurements have the same number of outcomes. Under such assumptions, a scenario is characterized by three following parameters: • The number of measurements: m.
• The maximum length of sequence of measurements: l.
• The number of outcomes for each measurements: o.
We call the MLO (Measurement, Length, Outcomes) representation of a scenario the triplet: m-l-o. As an example the Leggett-Garg scenario [47] correspond to the 3-2-2 scenario.
We call a behavior, P := {P (r|s)} rs , the probability distribution over all the possible events in given sequential measurement scenario. In what follows, we address the issue of certifying dimension by their behaviors. In other words, we are interested to know whether for a behaviour represented by an outcomes statistic P (r|s), there exist a d-dimensional state ρ acting in H d and a set of projective measurements {Π r i |s i } i such that P (r|s) = Tr(Π r|s ρΠ † r|s ). For a given projective sequential measurement scenario, the set of all quantum behaviors arising from d-dimensional systems is described by Q d .
The main questions addressed in this paper can then be described as: • Feasibility problem: For a given behavior P (r|s), verify if P (r|s) ∈ Q d , that is, the existence of a d-dimensional quantum realization. This problem will be further described in Sec. 3.3 where we also discuss a robust version of it.
• Optimization problem: Given a set of real coefficient, γ r|s , what is the maximum value of r,s γ r|s P (r|s) under the constraint P (r|s) ∈ Q d , that is, the behavior P (r|s) admits a a d-dimensional quantum realization.
As we discuss in the next sections, there are methods which allow us to tackle these problems by means of semidefinite programming (SDP) [48][49][50].

Unrestricted Dimensional case
We first present the study of behaviors of quantum systems in a sequential projective measurements scenario without dimensional constraints, that is, the quantum systems are not restricted to any fixed dimension d [48]. To this end we introduce the so-called moment matrix representation. A moment matrix M is a symmetric square matrix whose entries, in this case, are all the expectation values of the product of pairs of Π r|s . We adopt the specific notation introduced in [48], where in the set of projectors, for each setting s, one of the results r is left out and we add the identity matrix to the list of projectors. From [48], the matrix elements of the moment matrix M are: where we use the notation Π 0|0 = 1 to include the identity matrix. Note that M r|s,r|s = P (r|s). As pointed in [48], it follows from the Born's rule that the moment matrix from a behaviour with a quantum realization is positive semidefinite (M ≥ 0) and that M r|s,r |s = M r |s ,r |s (5) when Π † r|s Π r |s = Π † r |s Π r |s . Also, since we are considering projective measurements we have that Π r i |s i Π r i |s j = δ r i ,r i Π r i |s i , this will reflect into additional linear constraints in the moment matrix M . For instance, the orthogonality constraint ensures entries of the moment matrix to be zero, and the idempotency constraint (Π r i |s i Π r i |s i = Π r i |s i ) ensures that some entries of moment matrix are identical. Moreover, when no restrictions in the dimension are imposed, the moment matrices constraints can be used to completely characterize the set of sequential quantum behaviours. More precisely, Ref. [48] exploited the methods of [38,39] to prove that every positive semidefinite operator M respecting the linear conditions imposed by projective measurements (Π r i |s i Π r i |s i = δ r i ,r i 1) and M 0|0,0|0 = 1 has a quantum realization.
When the dimension is unrestricted for any given set of real numbers {γ r|s }, the optimization problem can be solved by the following SDP: This approach can be used to verify the possible quantumness of a behavior regardless of the dimension of its quantum realization.

Finite Dimensional case
The problem of characterising quantum behaviours of some fixed dimension can be tackled by a hierarchy of semidefinite programming relaxations (NV hierarchy) [40,41], which is inspired by the NPA hierarchy [38,39]. Now, instead of a single semidefinite program to decide weather a given behaviour admits a quantum realization, we define a hierarchy of outer approximations which converges to Q d .
The moment matrix associated to a ddimensional quantum state ρ d and to length l sequence of d-dimensional projective measurements, Π r|s is defined as and we denote by M d the set of all d-dimensional length l moment matrices. In this way, we can write the optimization problem Note however that characterizing the set M d is not a simple task, hence this formulation does not simplify the problem. One way to obtain a non-trivial relaxation consists of noticing that if M 0|0,0|0 = 1 (11) Hence, the constraints given by Eq. (9), Eq. (10), and Eq. (11) provide an outer approximation of M d . Also, such relaxation can be made tighter by defining the k-th level of the set of moment matrix M k d as the set of moments corresponding to l + k − 1 measurements. In this way, we have M d = M k=1 d and a tighter approximation can be made by increasing k.
If the set {M i } i is a basis for the linear span of M k d , a non-trivial upper bound for the problem presented in Eq. (8) can be written as [40,41] In this formulation, each level k of the hierarchy provides a bound for the problem defined in Eq. 8 Moreover, this hierarchy converges to the actual maximum [40,41], that is, lim We then define Q k d as the set of behaviors which respect the constraints in Eq. (12b), Eq. (12c), Eq. (12d), and Eq. (12e) and for any level k we are ensured to have an outer approximation Q d ⊆ Q k d (as illustrated in Fig. 2).
In [41], it was shown that for some fixed level k of the hierarchy the set Q k d may be strictly larger than Q d . Here we illustrate this fact by presenting a different example. In the guess-yourneighbor's-input inequality [51], in particular in its sequential measurement scenario [48], it is a sequential scenario with a MLO of 2-3-2 and the inequality is:   Reference [48] evaluated the SDP in Eq. 6 to find the maximum value p * 2 ≈ 1.0225 when the dimension is unrestricted. Here we have used the methods discussed in [41] to obtain p * 2,1 ≈ 1.1588 for the maximum value for the first level of the hierarchy for a qubit system. This provides a direct proof that there exist moment matrices in the first level of the hierarchy that admit no qubit realization in the scenario 2-3-2 at the first level of the hierarchy for a qubit. This also shows that in the scenario 2-3-2, the first level of the hierarchy for a qubit, some behaviors do not admit quantum realization. Hence, the first level of the hierarchy is not sufficient to fully characterize the set Q d of sequential quantum correlations. This example is further discussed in the Appendix B and the code is provided in [52].

Methods and Proposal
In order to solve the optimization problem described in Eq. 8, one needs first to obtain a basis for the linear span of M k d . In particular, if the set {M i } i forms a basis for the linear span of M k d , the problem presented in Eq.(8) can be tackled by means of semidefinite programming.
In [40,41], the authors proposed a randomized method to find a basis for the linear span of M k d . The idea is simply generate several random ddimension moment matrices by choosing random measurements and states. But, as stated by the authors, this method has the following problem: since we do not know the number of elements in the basis, we cannot be sure that we have built a complete basis. Here we solve this problem by providing a simple but convincing empirical method that ensures that the random procedure obtained a basis of M k d as wanted.

Building a Basis of Moment Matrices
By using the randomized method first proposed in Ref. [40,41] and fully described in Append. C, it is possible to construct multiple moment matrices from which a basis can be constructed. As pointed in Ref., [40,41], this method does not ensure that we have completed the processes of finding a basis. We now provide a simple but strong evidence that this is the case. This can be done either by finding the highest number of linearly independent (LI) moment matrices or by using the Gram-Schmidt process on a set of moment matrices until the zero matrix is left through the process. We use the second method while keeping the number of linearly independent moment matrices to characterize a scenario for a specific dimension and level in the hierarchy. An efficient way to build a basis using the Gram Schmidt process is to generate a random moment matrix and using the standard Gram Schmidt process on this matrix with the previously generated moment matrices. By checking the norm of the matrix after removing the 'projections' from the previous moment matrices at each iteration, we can decide to stop the process when only the null matrix is left. Due to numerical precision the resulting matrix will be non zero but small enough to be detected. In Fig. 3 we show the norm of the resulted moment matrices after each iteration in the 3-2-2 scenario. We clearly see a a very large drop of the norms through the iterations. The norms drop suddenly to the order around 10 −14 , which is numerical noise from the computation. While we cannot guarantee the number of LI moment matrices, this is a convincing empirical evidence. Hence the number of LI moment matrices is the number of iterations just before such drop. We can clearly see that such drop does not appear all the time at the same number of iterations depending on the dimension considered. The drops for d = 2 and d = {3, 4} are at different number of iterations, which indicates different numbers of LI moment matrices for these two cases. This important detail is discussed in Sec. 3.2.   To quantify this gap, the ratio between the number of elements of the basis for d = {3, 4, 5} and d = 2 is represented in Fig. 5 as a function of the number of measurements in the m-2-2 scenario. Another curve in Fig. 4 corresponds to the scenario 2-3-3 for d = {3, 4, 5}. In this scenario we see that the number of linearly independent moment matrices for d = 3 is smaller than the one for d = {4, 5}. Hence in the 2-3-3 scenario, we have the strict inclusion Q k=1 d=3 ⊂ Q k=1 d>3 .

Proposal
One could try to derive the basis for higher level of the hierarchy until its possible convergence. However, it is computationally expensive and potentially subject to error due to numerical precision. Another option is to use the fact that Q d ⊆ Q k d . In this case, we could test whether a given behavior P is not in Q k d . If it is the case then we know that P / ∈ Q d . But if one find that P ∈ Q k d this does not imply P / ∈ Q d . In this method one can certify a minimum dimension of quantum system by its behavior without the need to characterize moment matrices sets at a computationally challenging level of the hierarchy. This correspond to take an outer approximation of the set Q, which has shown good results using the NPA hierarchy [38,39] in the context of Bell scenario [53,54] but have not been used for dimension certification yet.
In addition of simply testing if a given behavior P belongs to Q k d , we are also going to quantify "how much" the behavior is outside the set Q k d . This will be done by means of robustness, which is analogous to the robustness of entanglement [55] and have also been used to quantify quantum EPR-steering [56], measurement incompati-bility [57,58], indefinite causality [59], coherence [60,61],and other quantities in quantum information theory. Given a behavior P, the general robustness visibility is we can then see that when ν < 1 (represented in Fig. 2), we have P / ∈ Q k d . Also, if the quantum system describing the experiment is given by ρ, we can ensure that there exists a quantum state σ such that for every visibility η > ν, the noisy state ηρ + (1 − η)σ can generate behaviors which are not inside Q k d . Interestingly, when solving the robustness optimization problem presented in Eq. (15), one also obtains a dimension witness to certify the dimension of the given behavior and this topic will be discussed in Sec. 4.2.1. Further details and a reformulation of this problem simpler for computer codes can be found at the Appendix D.

3-2-2 Scenario
In order to make a step further in the understandings of the geometry of the sets, we focus here on the specific 3-2-2 scenario, namely the Leggett-Garg scenario [47] which is the simplest known sequential measurement scenario to observe quantum features. In particular, with an eye toward certifying dimensions, a legitimate question is whether in the 3-2-2 scenario there exists a behavior given by a qutrit system that cannot be reproduced by any qubit system. In other words, is there a behavior P ∈ Q 3 such that P / ∈ Q 2 . We show that the answer is yes and using our method, this question can be addressed without the need to fully characterize the set of qubit's behavior, Q 2 , as the first level of the SDP hierarchy [40,41], Q 1 2 , turns out to be sufficient. To go even further, we estimate the probability P (P / ∈ Q k 2 |P ∈ Q 3 ), the probability for a randomly chosen qutrit's behavior, P ∈ Q 3 , to be outside the set Q k 2 for a given k characterizing the level of the hierarchy. We evaluate the probability P (P / ∈ Q k 2 |P ∈ Q d ) for d ∈ {3, 4, 5} and k ∈ {1, 2}. In order to evaluate this probability, we first build the basis for the linear span of M k∈{1, 2} 2 corresponding to the sets Q k∈{1, 2} 2 with the method described in Sec. 3.1. Then, with the same method, we also sample the sets Q d∈{3,4,5} and compute the visibilities (defined in Eq.15) for each sampled data point. For that purpose we used CVXPY [62,63] with the solver MOSEK [64]. We used about 10000 points to evaluate each probability. The code is available in [52].
The probability is estimated in the following way: where N (ν < 1) represents the number of data points with a visibility ν < 1 and N tot is the total number of data points. Finally all the computed probabilities are represented in the Tab. 1. As these probabilities are non zero, there are possibilities to find qutrit's behaviors in the 3-2-2 scenario that cannot be reproduce by any qubit's behavior. To obtain this information it is not necessary to characterize the set of qubit's behavior Q 2 directly. This is because the probability P (P / ∈ Q 1 2 |P ∈ Q 3 ) ≈ 0.37 and Q 2 ⊆ · · · ⊆ Q 2 2 ⊆ Q 1 2 .

Moreover, we have
Hence, a behavior P ∈ Q 3 has more chance to be outside the second level of the hierarchy than the first level. This corresponds well to Q 2 2 ⊆ Q 1 2 . For all the dimensions d ∈ {3, 4, 5}, we have P (P / ∈ Q 1 2 |P ∈ Q d ) < P (P / ∈ Q 2 2 |P ∈ Q d ) as shown in Tab. 1. A result that could seem counter-intuitive is when we compare the probabilities for different dimension for the same level of the hierarchy. We find that P (P / ∈ Q k 2 |P ∈ Q d ) < P (P / ∈ Q k 2 |P ∈ Q d ) for d < d with d, d ∈ {3, 4, 5}. This could sound counter-intuitive as we would expect that higher dimension could at least perform as good as the lower dimensions. The source of these differences could be related to the sampling method. Following the discussion in Append. C, larger dimension means larger number of options for binning for the projectors and the use of the Haar measure to sample unitary matrices does not necessarily guarantee uniformity at the behaviors level as well. Moreover, this is related to the so-called Bertrand's Paradox [65], which shows that probabilities may not be well defined as they rely on the method used to produce random variables. In the Bertrand's Paradox, the method used to sample through a circle affects the probabilities. We make the analogy here, where sampling behaviors from different Hilbert spaces of different dimensions impacts the resulted probabilities. For that reasons the values presented in Tab. 1 are not absolute and the different dimensions are not comparable. However, for a specific dimension, as the sampling is the same, the order relationship is not affected: . The results showed in Tab. 1 has two main consequences on our understandings of certifying dimensions of quantum systems via their behaviors. First, in the 3-2-2 scenario, the Leggett-Garg inequality [47] is already maximally violated by a qubit's behavior. However, our results implies that the 3-2-2 scenario is sufficient and inequalities based certification could be built (see Sec. 4.2.1). Secondly, the only known way to certify qubits from the above dimensions is through the Peres-Mermin square [14], which corresponds to the 9-3-2 scenario. Our results provide a reduction of the previously known results by six measurements and shorten the length of the sequence of measurements by one which is much more favorable to experimental perspectives.

Advantage to certify dimension in the m-l-2 Scenario
In the previous section, in Sec. 4.1.1, we show that the scenario 3-2-2 can be used to certify some qutrit (and above dimension) behaviors that are different from those of qubits by only using the first level of the hierarchy. Moreover, as shown in Tab. 1 using to the second level increases the chance of success. In what follow we show what are the advantage to either increase the number of measurements (m-2-2 scenarios) or to increase the maximum length of the sequence of measurements (3-l-2 scenarios).
Following the method explained in Sec. 4.1.1 we evaluate the probability for a random qutrit behavior, P ∈ Q 3 , not to be explained by the approximation of any qubit behavior at the first level of the hierarchy. In other words, we want to evaluate P (P / ∈ Q 1 2 |P ∈ Q 3 ) in the scenario m-2-2 for m ∈ {3, . . . , 8}. In Fig 6, we show that such probability increases in a log-like manner until it reaches the value of 1 in our numerical analysis. While we observe the value 1 in our numerical analysis it is most likely that this log-like curve actually converges to 1 instead. Regardless of how close to the value 1 it is, it seems that using more than 5 or 6 measurements does not bring any further significant improvement when trying to certify dimension in this scenario. However, compared to the 3-2-2 scenario, with a probability approximately 0.37, by using one additional measurement (4-2-2 scenario), this probability increases to approximately 0.81, which is about the double and by using two additional measurements (5-2-2 scenario), this probability increases to approximately 0.96, which is about the 2.6 times larger than in the 3-2-2 scenario.
As explained in Sec. 4.1.1 and in particular in Eq.16, the probabilities are evaluated by using the visibility. Looking at the distribution of the visibility provides also a very good insight as the visibility has a good geometrical interpretation and gives a more fine grain level of information. In Fig 7, we show the distribution of the visibility of random qutrit behaviors, P ∈ Q 3  The other parameter that is possible to change experimentally is the length of the sequence of measurements used in the experimental setup. It is important to clarify that this is different compared to changing the level of the hierarchy. In the case where we increase the length experimentally, we need to collect data for the right length of sequence, while by increasing the level of the hierarchy these data would not be given. In Fig 8  we show the distribution of the visibility of random qutrit behaviors, P ∈ Q 3 , compared to the set of qubit behavior at the first level of the hierarchy in the scenario 3-l-2 for l ∈ {3, 4}. Similarly to the number of measurements, increasing the length of the sequence of measurements makes the behavior further from to the set of qubit behaviors.
Our analysis shows that there are advantages to either increase the number of measurements (m-2-2 scenarios) or to increase the maximum length of the sequence of measurement (3-l-2 scenarios) to increase the chance to certify qutrit behaviors from qubit behaviors. These two parameters require a change in the experimental setup when collecting data while when by increasing the level of the hierarchy it is only about the data processing on a classical computer. While we show that increasing the number of measurements or increasing the maximum length of the sequence of measurement, there are also notice- able differences. Indeed, in the scenario 8-2-2 the average visibility is 0.88 (see Fig. 9) while in the 3-4-2 scenario the average visibility is about 0.75. (see Fig. 10) Hence, increasing the length of the sequence of measurements seems more effective. However, this could be more challenging from an experimental point of view.  Our analysis on the distribution of the visibility also shows that increasing one of these parameters could make an experiment more robust to noise. Because of experimental precision it might sometimes not be clear whether a qutrit behavior could be obtained with a qubit system. A solution to this issue is to prefer a scenario where behaviors are not likely to be close (in a geometrical way) to qubit behaviors. Another important result is when increasing these parameters, even with random measurements, it becomes possible to certify almost all genuine qutrit behaviors from any qubit behavior.

Building Dimension Witness for qubits
Witnesses are simple to use and commonly used to test quantum properties in an experimental setup. From a geometrical perspective, they correspond to hyperplanes in the probability space. In Sec. 2.2 we present what we call the feasibility problem to test whether a given behavior admits a quantum realization with a specific dimension d.
A partial answer to this decision problem could be given by using the hyperplane in an inequality form when one ensures that all the behaviors from quantum realizations with a specific dimension d do not violate the inequality as a consequence of the hyperplane separation theorem. Hence, when the inequality is violated we can infer that the behavior does not admit a quantum realization of dimension d.
When a behavior P does not belong to the set Q k d , one can always find a set of real coefficients {γ r|s } rs and a real number x such that r,s but r,s γ r|s P (r|s) < −x.
Moreover such an inequality can be explicitly obtained by means of the dual formulation of the robustness optimization problem presented in Eq. (15). We present the details on the dual formulation and how to construct such inequalities in the Appendix D. Also, to demonstrate this technique, we provide an explicit example (available at the github repository [52]) in the scenario 3-2-2, where we obtained a randomly generated behavior from a qutrit and solve the generalized robustness problem. The inequality we obtain can be used in any experiment in the scenario 3-2-2 to test if the experimentally obtained behavior does not admit a quantum realization with a qubit.

Higher Dimension Witness
As it has been shown in Sec. 3.2 and in Fig. 4, in the 2-3-3 scenario, we have Q k=1 d=3 ⊆ Q k=1 d>3 . This suggests that there might be ququart behaviors that cannot be obtained via qutrit behaviors as we have seen in the case of dimension higher than two in the m-l-2 scenario presented in Sec.4.1.2. Following the same method used in Sec.4.2.1, we provide an explicit example of both a dimension witness and quantum realization (ququart quantum state and quantum measurements) (available at the github repository [52]) whose behavior cannot be reproduced by qutrits. This is done by generating a random ququart behavior in the 2-3-3 scenario and computing its visibility regarding the set Q 1 d=3 . Once such behavior is found we can find the dimension witness by using the dual problem of the generalized robustness.

Conclusion
In this work, we have refined the known methods that analyze correlations arising from quantum systems subjected to sequential projective measurements to certify that the system in question necessarily has a quantum dimension greater than some dimension d. We have shown that, in the context of dimension certification, it is not necessary to go to high level in the NV hierarchy and in all the examples we have treated the first level of the hierarchy was already sufficient to certify dimensions.
We have shown that scenarios can be classified by the number of elements in the moment matrices basis at the first level of the hierarchy. For all the scenarios where different number of basis elements have been recorded, we have shown that dimension can be certified in these scenarios. While this seems convincing to say that this property is a necessary condition, it is still an open problem. Moreover, we demonstrated that the randomized method to build the basis of moment matrices that was previously considered as a non accurate method due to potential numerical precision can actually be accurate with empirical evidence if one keeps track of the moment matrices norms in the Gram Schmidt process. We showed how dimension witnesses can be obtained from our method and we have provided concrete numerical examples.
With this method we found that in the 3-2-2 scenario, while the known Leggett-Garg inequality is already maximally violated by a qubit's behavior our results implies that the 3-2-2 scenario is sufficient. The only previously known way to certify qubit from the above dimensions was through the Peres-Mermin square, which corresponds to the 9-3-2 scenario in our notation. Our results provide a drastic simplification of the previously known results by six measurements and shorten the length of the sequence of measurements by one which is much more favorable to experimental perspectives. We provided a deep analysis and a characterization of scenarios in which dimension certification of dimension greater than two is possible. In particular, we use two metrics: the probability for a random quantum states with random measurements that does not admit any qubit quantum realization and the distribution of the visibility derived from the generalized robustness. We observed that the probability to find a behaviors with no qubit quantum realization increases when the experiment is more complex (more measurements or longer sequence of measurements). This is also possible by increasing the level of the hierarchy. When we increase the number of measurements or the length of the sequence we see that the distribution of the visibility shifts to lower values, this can be interpreted as a more robust certification. In summary, in the selection of scenarios, when the experiment is more complex there are more chances to make a successful certification which is also getting more robust.
In addition, our methods led us to certify, for the first time in this projective measurements scenario, quantum systems with dimensions strictly greater than three.
Even though there are important results for scenarios considering general measurements [33][34][35], a systematic approach like the one presented here for the projective case is still missing for the general measurements case. Unfortunately, with the method used here, when we lower bound a dimension from its behavior, it only correspond to behaviors arising from projective measurements.
Projective measurements seem to be a crucial hypothesis for moment matrices methods as Eq. 5 does not hold without assuming projective measurements. We notice that the projective measurement assumption is also required in the standard NPA hierarchy [38,39], the finite dimension NV hierarchy [40,41], and the moment matrix approach used by Budroni-Moroder-Kleinmann-Gühne [48]. It is an open problem how this could be resolved in general measurement scenarios. One possible solution to enforce the use of the moment matrices based method, would be to use it together with self-testing methods [66] which has already been used for this purpose in the prepare-and-measure and contextuality scenario [4].
We have implemented the methods described in this paper using the language Python and all code is publicly available on the online repository [52] and free to use under the Apache License 2.0.

D Generalized Robustness
In Sec. 3.3 (in particular in Eq. 15) we have presented an optimization problem to quantify "how far" is a given behavior P := {P (r|s)} r,s from the set Q k d . This quantifier is analogous to the robust of entanglement 1 [55] and we defined it as: where α i and β i are real numbers and X and R are matrices of the size of M i . Following the steps of Ref. [70], the Lagrangian of this optimization problem can then be written as L = η + r|s γ r|s R r|s,r|s − X r|s,r|s + ηP (r|s) + Tr A X − for dual variables γ, A, B, ρ, σ, r, and x. The dual program of the SDP described in Eq. 28 can then be 1 We recommend Ref. [56] for an introduction on robust quantifiers and SDP.