Tilted Hardy paradoxes for device-independent randomness extraction

The device-independent paradigm has had spectacular successes in randomness generation, key distribution and self-testing, however most of these results have been obtained under the assumption that parties hold trusted and private random seeds. In efforts to relax the assumption of measurement independence, Hardy's non-locality tests have been proposed as ideal candidates. In this paper, we introduce a family of tilted Hardy paradoxes that allow to self-test general pure two-qubit entangled states, as well as certify up to $1$ bit of local randomness. We then use these tilted Hardy tests to obtain an improvement in the generation rate in the state-of-the-art randomness amplification protocols for Santha-Vazirani (SV) sources with arbitrarily limited measurement independence. Our result shows that device-independent randomness amplification is possible for arbitrarily biased SV sources and from almost separable states. Finally, we introduce a family of Hardy tests for maximally entangled states of local dimension $4, 8$ as the potential candidates for DI randomness extraction to certify up to the maximum possible $2 \log d$ bits of global randomness.


Introduction
One of the most fundamental features of quantum mechanics is the presence of correlations that cannot be explained by any local hidden variable theory [1,2].Apart from being of fundamental interest, this phenomenon of Bell non-locality has led to the powerful idea of device-independent (DI) quantum key distribution [3,4], randomness generation [5,6] and certification of quantum systems [7,8].
The strength of the device-independent paradigm is that no assumption on the nature of the systems subject to measurement needs to be made.Indeed, one may simply consider the systems participating in the Bell experiment to be (two or more) black boxes that parties provide an input to and obtain an outcome from, not taking into account the complex details of the physical implementation at all.The observation of a Bell inequality violation then allows one to make nontrivial deductions about the nature of the systems under study, such as the presence of entanglement, or a lower bound on the system dimension, or the non-determinism of the measurement outputs.In the extreme case, observation Ravishankar Ramanathan: ravi@cs.hku.hkYuan Liu: yuan59@connect.hku.hk of maximum violation of certain Bell inequalities even permits the device-independent certification (self-testing) [8,9] of the quantum state and measurements performed on the system, i.e., their uniqueness up to irrelevant local equivalences.
Such self-testing has obvious advantages over traditional certification methods such as those based on quantum tomography [10], and a lot of attention has therefore been devoted recently to designing Bell inequalities suited for self-testing different entangled quantum states.However, DI certification based on the violation of Bell inequalities nevertheless still relies upon some assumptions, the foremost being the requirements of no-signaling between the local systems (typically enforced by space-like separation), and that the measurements on the local systems are chosen freely and randomly.This latter requirement known as measurement independence is typically justified by the assumption that the parties hold independent and trusted random number generators (i.e., trusted and private random seeds).However, this assumption is clearly incongruous with the very framework of device-independence, wherein all devices held by the honest parties may have been tampered with, or even provided by, an adversary.To elaborate, consider the adversarial scenario wherein an adversary Eve has had access to the very devices used by the honest parties in the protocol.If such an adversary was able to influence the local random number generators held by the parties, then she would be able to ensure that the parties only hold imperfect seeds (about which Eve has some side information).In the extreme case, Eve may even be able to prepare devices that only operate according to local hidden variable behaviors, and yet appear non-local to the parties due to the imperfection of their seeds.Indeed, when no measurement independence at all is available, one cannot demonstrate any non-locality.It is therefore of vital importance to extend the studies on device-independent certification (as well as other tasks such as key distribution and random number generation) to the scenario in which only limited (arbitrarily small) measurement independence is available [11,12,13,14,15,16].
As a model of an imperfect seed, one may consider the ε-SV source [17], a model of a biased coin where the individual coin tosses are not independent but rather the bits R i produced by the source obey 1  2 − ε ≤ P (R i = 0|R i−1 , . . ., R 1 , W ) ≤ 1 2 + ε.The parameter 0 ≤ ε < 1  2 described the reliability of the source, with ε = 0 being the ideal random seed and W denotes any side information, possibly held by an adversary.It is worth remarking that more general 'min-entropy' sources are also possible, wherein only a lower bound on the min-entropy (the negative logarithm of the maximum probability of any output string) produced by the source is assumed.
With regards to the task of self-testing, an important result was the formulation of a general class of Bell inequalities known as the tilted-CHSH inequalities suitable for selftesting general pure two-qubit entangled states.Specifically, in the simplest bipartite Bell scenario with two binary observables A 0 , A 1 for Alice and two binary observables B 0 , B 1 for Bob, the following family of tilted CHSH operators was introduced in [18] where β ∈ [0, 2) is a parameter with β = 0 corresponding to the well-known CHSH operator.The maximum value of this tilted CHSH quantity in classical theories is easily seen to be 2 + β.In [19], it was shown that the optimal quantum value of T β max = 8 + 2β 2 can only be achieved when specific reference observables A x , B y are measured on the state |ψ θ ⟩ = cos θ|00⟩ + sin θ|11⟩ with θ = 1 2 arctan 2 β 2 − 1 2 .Specifically, it was shown that the observation of the expectation value ⟨T β ⟩ ≥ T β max −e for the tilted CHSH operator by measuring a physical state |ψ ′ ⟩ with observables A ′ x and B ′ y implies the existence of an isometry Φ = Φ A ⊗ Φ B and a state |junk⟩ such that where x, y ∈ {−1, 0, 1} (with subscript −1 indicating the identity operator) and where e ′ = O ( √ e).The family of tilted CHSH inequalities has since played a crucial role in several aspects, including (a) showing the quantitative inequivalence between the amount of non-locality and the amount of certified randomness [18], (b) being the building block that enabled the self-testing of all bipartite pure (two-qudit) entangled states [20], (c) enabling the formulation of a device-independent quantum random number generation (DIQRNG) protocol that only requires a sublinear amount of quantum communication [21] (i.e., produces n bits of output randomness with a total of Ω(n k log n) ebits where 7  8 < k < 1), and (d) unbounded randomness certification from a single pair of entangled qubits using a sequence of measurements [22].
A natural question is whether a corresponding family of inequalities can be formulated in the scenario of (arbitrarily) limited measurement independence so that the above (and further such DI) results can be achieved in the setting when the parties are not assumed to possess perfect random seeds.In section 2, we answer this question in the positive by formulating a class of tilted Hardy paradoxes that allow to self-test general pure two-qubit entangled states (except the maximally entangled state).As shown in [23], tests of Hardy paradoxes (in an equivalent formulation as 'measurement-dependent' locality inequalities) allow for arbitrary small measurement independence making them ideal candidates for device-independent tasks when only weak seeds are available.In this section 2, we also derive expressions for the amount of randomness that can be certified from the maximum violation of the tilted Hardy tests in terms of the guessing probability by an adversary holding a quantum system that is potentially correlated to the devices involved in the test.In section 3, we compute the guessing probability in the noisy scenario of non-maximal violation, here distinguishing between two cases: (a) a scenario of colored noise where the 'zero' constraints in the tilted Hardy paradox are satisfied but the non-zero Hardy probability is non-maximal, and (b) a scenario of white noise where we consider the non-maximal violation of a Bell expression derived from the tilted Hardy paradox.While an amount of local randomness up to the maximum possible value of 1 bit can be certified by the tilted Hardy tests, the amount of global randomness is limited to a value of approximately 1.6806 bits.Nevertheless, we show that the derived results present an improvement in generation rate over the state-of-the-art protocols of randomness amplification against quantum adversaries.Meanwhile, we slightly change the coefficients of the expression of Hardy probability and show that the derived Bell expression provides a robust self-testing statement of the corresponding optimal quantum system.In section 3.3, we derive the analytical expression for the guessing probability in the scenario of an adversary that is allowed to prepare bipartite devices for the honest parties constrained only by the no-signaling principle, a result that also finds application in the state-of-the-art protocols for randomness amplification against no-signaling adversaries [15].Finally, in section 4, we present a class of Hardy paradoxes with more inputs and outputs that potentially allow to certify the maximal amount of global randomness of 2 log d bits for dimensions d = 4, 8.To do this, we exploit a recently discovered connection between Hardy paradoxes and substructures of Kochen Specker proofs termed 01-gadgets [24].We conclude with a discussion on future research directions.
2 A family of Tilted Hardy paradoxes: Self-testing general pure twoqubit entangled states We work in the simplest bipartite Bell scenario with Alice and Bob performing measurements corresponding to two binary observables each.Specifically, Alice and Bob provide inputs x ∈ {0, 1} and y ∈ {0, 1} to their respective device, and obtain respective binary outcomes a ∈ {0, 1} and b ∈ {0, 1}.The behavior of the device is described by a set of probability distributions {P A,B|X,Y (a, b|A x , B y )} where P A,B|X,Y (a, b|A x , B y ) denotes the probability to obtain outputs a, b conditioned on measurement inputs x, y for Alice and Bob.We define a family of tilted Hardy tests in this scenario as given by the following set of constraints: P A,B|X,Y (a, b|A x , B y ) = 0, ∀ (a, b|x, y) ∈ S Hz := {(0, 1|0, 1), (1, 0|1, 0), (0, 0|1, 1)} where w ∈ (− 1 4 , 1) is a parameter, and max(0, w) is the maximum value of the Hardy probability P w Hardy in any classical local hidden variable (LHV) theory.This latter bound can be seen from the fact that the enforcement of the three Hardy 'zero' constraints P A,B|X,Y (a, b|A x , B y ) = 0 for (a, b|x, y) ∈ S Hz implies as in the original Hardy paradox that P A,B|X,Y (0, 0|A 0 , B 0 ) = 0 and in any LHV model P A,B|X,Y (1, 1|A 0 , B 0 ) ≤ 1.As we shall see, quantum theory allows for a value of P w Hardy larger than this classical bound.Indeed when w = 0, we recover the original Hardy paradox [25] for which it is well-known that P w=0 Hardy = P A,B|X,Y (0, 0|A 0 , B 0 ) can achieve a maximal value of 5 in quantum theory.Furthermore, as shown in [26], this quantum behavior is achieved by a unique two-qubit state and measurements up to local isometries.
As anticipated in the Introduction, the motivation for introducing the tilted Hardy paradoxes is that as shown in [23], Hardy paradoxes can be used to certify quantum nonlocality even in scenarios when the measurement settings are not chosen completely freely.Specifically, in any scenario where the parties choose their measurement settings using weak sources of randomness that obey l ≤ P X,Y (x, y|λ) ≤ h for l, h ∈ (0, 1), the tilted Hardy test in Eq. (2) can be converted into a Measurement-Dependent Locality (MDL) inequality as: where P X,Y (A x , B y ) denotes the probability of choosing inputs x, y.Furthermore, as the following Prop. 1 shows (we defer its proof to Appendix A), the tilted Hardy tests can be used to self-test every entangled pure two-qubit state other than the maximally entangled state.

Then in any local hidden variable theory it holds that P w,LHV
Hardy ≤ max(0, w).On the other hand, quantum theory allows to achieve P w,Q Hardy = (4w+5) > P w,LHV Hardy for w ∈ (− 1 4 , 1).Furthermore, up to local isometries, P w,Q Hardy is uniquely achieved by the two-qubit state ) and the measurements {A 0 , A 1 }, {B 0 , B 1 } given as • X, (1 + sin θ) (1 + sin θ) where X and Z are the usual Pauli matrices.
Let us briefly observe that no loss of generality is accrued in considering the expression P w Hardy in Eq. (2) -when the three Hardy zero constraints are satisfied, P w Hardy constitutes a general (non-zero) Hardy expression, i.e., no additional gain is obtained by considering the quantum value of an expression such as for arbitrary coefficients α i,j with i, j ∈ {0, 1}.
Removing the offset term and denoting the ratio of α As the pure state |ψ θ ⟩ is uncorrelated with any third party's system, the maximal local and global randomness is against quantum eavesdroppers.
We calculate the maximum amount of certifiable local and global randomness from the tilted Hardy tests as: where θ = arcsin (3 − √ 4w + 5) from Prop. 1, and where 3 )) 2 ] ≈ −0.1054.Note that the reason why H global ∞ is a piecewise function is that the maximum global randomness is achieved by different measurement inputs x, y for different values of w.We see that the tilted Hardy tests allow to certify up to 1 bit of local randomness in the limit as w → − 1 4 (as the state tends to a maximally entangled state).Similarly, one can obtain up to 1.6806 bits of global randomness for w = w 0 .In [18], it was observed that the amount of certified randomness is an inequivalent resource to non-locality and entanglement, in that high global randomness (close to 2 bits) may be certified by the tilted CHSH inequality even when using states that are almost unentangled, with the corresponding quantum behaviors being close to the set of local hidden variable behaviors.A similar phenomenon can also be observed in the expression for the global randomness in Eq. (8).While the maximum global randomness is achieved at w ≈ −0.1546, the largest separation between the quantum and the LHV set occurs at w = 0 (when sin θ = 3 − √ 5), and the optimal state is close to maximally entangled as w → − 1 4 (when sin θ → 1).Note that the above self-testing result of Proposition. 1 does not consider an SVsource input distribution per se, since the biased SV-source themselves only give bounds of each input probability l ≤ P X,Y (x, y|λ) ≤ h, and in this case it is not possible to even determine the exact quantum value of the corresponding measurement-dependent-locality (MDL) inequality.However, if the input distribution is explicitly known, the tilted Hardy paradoxes can be modified into the MDL version of the tilted Hardy tests and then the corresponding self-testing statement can be derived correspondingly, such that every pure two-qubit entangled state (other than the maximally entangled state) can be self-tested under arbitrary limited of measurement dependence.
3 Applying the Tilted Hardy Test in device-independent randomness generation against Quantum adversaries In the previous section, we have derived the optimal amount of randomness that can be certified when the maximal violation of the tilted Hardy test is observed for any value of the parameter w ∈ (− 1 4 , 1).When using the Hardy paradox in an actual device-independent protocol to certify randomness against a quantum adversary (such as [27]), it is important to consider the noisy scenario of non-maximal violation.Specifically, we consider the threeparty scenario of Alice, Bob and Eve holding a tripartite quantum state ρ ABE belonging to the Hilbert spaces H A ⊗H B ⊗H E , i.e., Eve holds a quantum system that may be entangled with that held by Alice and Bob.Alice and Bob perform measurements chosen using some ϵ-SV source, observe a certain value in the Hardy test and attempt to generate randomness from their measurement outcomes for some specific setting (A x , B y ).Eve performs a single measurement with outcome e ∈ {0, 1} 2 which will constitute her guess of the measurement results of Alice and Bob for this setting.
Formally, Eve's guessing probability of Alice and Bob's outputs can be written as the maximization of subject to some given constraints.
Here P A,B,E|X,Y (a, b, e|A x , B y ) = Tr A a|x ⊗ B b|y ⊗ Π e ρ ABE where A a|x and B b|y are the projectors corresponding to the outcomes a and b for Alice and Bob respectively, and Π e denotes the projector corresponding to Eve's measurement outcome e.The min-entropy is denoted as A similar expression holds when Eve attempts to guess the local outcomes of one of the parties alone.
We consider two noise models that we term (1) colored noise and (2) white noise -in the former, we consider the scenario where the observed behavior {P A,B|X,Y } stays on the boundary of the quantum set (i.e., the three Hardy zero constraints are satisfied, while the non-zero Hardy probability takes on some intermediate value between the local and the quantum maximum), while in the latter, we consider the scenario where the observed behavior {P A,B|X,Y } is in the interior of the quantum set (i.e., the honest parties simply observe some non-optimal value for a Bell expression derived from the Hardy test).
1. Colored Noise: In this case, we consider that Alice and Bob's reduced system ρ AB satisfies the three Hardy zero constraints, while the P w Hardy is non-maximal, that is P w Hardy lies in the intermediate range between max(0, w) and P w,Q Hardy .
2. White Noise: In this case, we slightly change the coefficients of Hardy probability in Eq. ( 5) to α 0,0 = 1, α 0,1 = α 1,0 = 1−α 2 , α 1,1 = 0, and consider that Alice and Bob's reduced system ρ AB achieves some (non-maximal) value of the corresponding derived Bell expression (by subtracting the Hardy zero constraints from the non-zero Hardy probability): It is worth noting that a similar expression for α = 1 (in which case we recover the original Hardy paradox and I Hardy α=1 corresponds to the CHSH inequality) has found application in the state-of-the-art device-independent randomness amplification protocol against an adversary holding quantum side information [16].

Colored Noise
In this subsection, we show the guessing probability for the value of w that results in the largest min-entropy in the noiseless setting, i.e., we set w = w 0 (in this case we note that the randomness is certified from the input (A 0 , B 0 ) ). Suppose that Alice and Bob observe a value of the Hardy probability P w Hardy =: p that lies between the classical value max(0, w 0 ) = 0 and the quantum maximum . We compute the analytical bound of the guessing probability as a function of p for the input (A 0 , B 0 ) (the detailed computation is deferred to Appendix B) as where p * ≈ 0.01366, p * ≈ 0.01563, θ p,w 0 i for i = 1, 2 are the two solutions of Eq. ( 26) for P w 0 Hardy = p when the three zero constraints are satisfied.

White Noise
In this subsection, we consider the scenario in which Alice and Bob's system ρ AB achieves a non-maximal value of the Bell expression I α derived from the tilted Hardy test.To simplify matters, we formulate this Bell expression in terms of the correlators ) a P A|X (a|A x ) (and similar for ⟨B y ⟩).To this end, let us subtract the three zero terms from the Hardy non-zero probability (5) (with coefficients α 0,0 = 1, α 0,1 = α 1,0 = 1−α 2 , α 1,1 = 0): where 2 ).It is in the form of I α that Hardy tests find application in testing non-locality with arbitrarily limited measurement independence, using the so-called measurement-dependent locality (MDL) inequalities (see following Eq.(13) for our case) [23].
To elaborate, consider the scenario in which the measurement settings (x, y) are chosen using a weak seed such as an ϵ-SV source which obeys l ≤ P X,Y (x, y|λ) ≤ h, where λ denotes any side information that may be held by an adversary about the source.Here 0 < l ≤ h < 1, and for the specific case of the ϵ-SV source, l = ( 1 2 −ϵ) 2 and h = ( 1 2 +ϵ) 2 .The expression I α gives rise to the following tilted measurement-dependent-locality expression with α ∈ (1/3, +∞).The corresponding classical bound is readily seen to be I M DL α LHV ≤ 0, and the quantum bound is directly obtained from the optimal quantum strategy for the Bell expression I α in Eq. (12).From Eq. (13) we get: By numerically calculating the guessing probability P guess (A 0 , B 0 |E) and corresponding min-entropy H ∞ (A, B|A 0 , B 0 , E) versus the ⟨I α ⟩ using the NPA hierarchy (of level 2), one can then use them with the relation in Eq. ( 14) to bound the min-entropy versus I M DL α in the MDL scenarios.We show the three cases for α = 1 2 , α = 4 5 and α = 1 in Fig. 2(a), from which and the quantum-classical value gap we calculate in Appendix C, one can see there is a trade-off between the maximal randomness one can certify from the MDL inequality I M DL α and the robustness of this MDL inequality I M DL α .I M DL α= 1   2   gives the highest randomness (2 bits) but it is not very robust, and I M DL α=1 is the most robust one in this whole family of MDL inequality.I M DL α= 4   5   is one choice that balances the randomness and robustness between these two extreme cases. 2 , α = 4 5 , α = 1) versus the lower bound l of a weak SV-source.Here for the weak SV-source with fixed l, we consider two extreme cases of the input distribution (1) three settings are chosen with probability h and the remaining one is l, i.e. l = 1 − 3h (h = 1−l 3 ), and (2) three settings are chosen with probability l and the remaining one is h, i.e. h = 1 − 3l.As a comparison, we also plot the results in [16], in which the authors calculated the von Neumann entropy in the MDL scenario for α = 1.
Since only the lower and higher bounds l, h of each input are known instead of the explicitly input distribution, the MDL inequality I M DL α is not fixed, thus the maximal quantum value cannot be calculated.Nevertheless one can derive a lower bound of the maximal quantum value of I M DL α by considering the worst-case input distribution, i.e.P X,Y (A 0 , B 0 ) = l, and P X,Y (A x , B y ) = h for (x, y) ̸ = (0, 0), then we get: We use the NPA hierarchy of level 2 to numerically calculate the maximal quantum value of ĨMDL 2 , α = 4 5 , α = 1 versus the lower bound l of the SV-source, in which for a fixed l, we consider two extreme cases of the input distribution (1) three settings are chosen with probability h and the remaining one is l, i.e. l = 1 − 3h (h = 1−l 3 ), and (2) three settings are chosen with probability l and the remaining one is h, i.e. h = 1 − 3l.
It is worth noting that the randomness calculated for I M DL α=1 found direct application in the state-of-the-art device-independent protocol for randomness amplification of arbitrarily weak seeds against adversaries holding quantum side information [16].We illustrate the usefulness of the tilted Hardy test in randomness amplification by showing that an improvement in the generation rate of the DI protocol in [16] can be achieved by considering the tilted Hardy tests for α ̸ = 1.Specifically, for α = 1  2 global randomness of up to H ∞ (A, B|A 0 , B 0 , E) = 2 bits can be certified as compared to the corresponding value of ≈ 1.23 bits from the CHSH expression (α = 1) used in [18,16].However, the robustness performance for α = 1  2 is not very good as seen in Fig. 2(b).The robustness property for α = 4  5 is comparable with α = 1, and from Fig. 2(b) we see that the certified minentropy at I M DL α= 4   5   exceeds that derived for I M DL α=1 for the whole range of l ∈ [0, 1  4 ] in either case.Therefore, plugging this min-entropy per round into the state-of-the-art DI protocol against quantum adversaries in [16] leads to a concomitant improvement in the generation rate of that protocol.

The guessing probability of a classical adversary allowed to prepare arbitrary nosignaling boxes for Alice and Bob
In this section, we compute the upper bound of the guessing probability of a classical adversary allowed to prepare arbitrary no-signaling boxes P A,B|X,Y in the scenario where Alice and Bob observe some (noisy) value I M DL α (P A,B|X,Y ) = δ.This scenario has direct applicability to the fully general scenario of arbitrary no-signaling adversaries, i.e., in the scenario of arbitrary tripartite no-signaling boxes P A,B,E|X,Y,Z with a concomitant loss in the generation rate as shown in [14].
Proposition 2. Suppose that the honest parties observe a value I M DL α (P A,B|X,Y ) = δ for the MDL quantity defined in (13) using a SV-source with l ≤ P X,Y (x, y|λ) ≤ h, ∀x, y ∈ {0, 1} .Then for any pair of inputs x, y and outcomes a, b, their shared box satisfies The proof of this proposition can be found in Appendix D. As mentioned earlier, the above bound finds direct applicability in the state-of-the-art protocol for randomness amplification of arbitrary ϵ-SV sources against general no-signaling adversaries.An optimization over α and the amount of shared entanglement is then required to identify the best protocol for randomness amplification against no-signaling adversaries in terms of these two parameters.
4 Achieving Global randomness of 2 log d bits with arbitrarily limited measurement independence In this section, we present candidate Hardy paradoxes that potentially allow for the certification of the maximal amount of H global ∞ = 2 log d bits of global randomness for quantum systems of local Hilbert space dimensions 2, 4 or 8.The candidate Hardy test for systems of local dimension 2 is the well-known ladder Hardy test [30] while the candidate Hardy tests for systems of dimensions 4, 8 are novel constructions based on a connection to sub-structures of Kochen-Specker tests in [31].
We first recall the Ladder version of the Hardy test.Here, Alice and Bob perform measurements corresponding to N +1 inputs x, y ∈ {0, 1 . . ., N } and obtain binary outputs a, b ∈ {0, 1} respectively.The Ladder Hardy test is comprised of 2N + 1 Hardy zero constraints: and the (non-zero) Hardy probability is P Hardy = P A,B|X,Y (0, 0|A N , B N ).In classical (LHV) theories, the 2N + 1 Hardy constraints imply that the Hardy probability is zero, i.e., P Hardy = 0.However, quantum theory allows to reach P Hardy → 1 2 under the following optimal quantum strategy [32].Alice and Bob share the two-qubit state |ψ⟩ = α|00⟩−β|11⟩, where α, β are parameters depending on on N with |α| 2 + |β| 2 = 1, we denote their ratio as t = α β .The projectors for the two parties correspond to ) are the angles for Alice and Bob's k-th measurement.For the state satisfying all the Hardy constraints and achieving the optimal Hardy probability, one can calculate the probability distributions for any measurement setting x, y as The Hardy probability is then given by Under the (as yet unproven) assumption that this optimal quantum strategy (N → ∞, t → 1 − ) is self-testing, we see that one may certify arbitrarily close to the maximum possible value of 2 bits of global randomness from the measurement setting x = N, y = 0 (or x = 0, y = N ), i.e., P A,B|X,Y (a, b|A N , B 0 ) → 1 4 for all a, b ∈ {0, 1} (note that both the two limits N → ∞, t → 1 − need to be taken.) The second family of Hardy tests (for certifying 2 log 2 d bits of global randomness in d = 4, 8) is based on a novel construction using sub-structures of Kochen-Specker sets, that were termed 01-gadgets in [31].A 01-gadget is a graph G = (V G , E G ) with a faithful orthogonal representation in C ω (G) , where ω(G) denotes the clique number of the graph.Here, a faithful orthogonal representation is a mapping of the vertices of the graph to (unit) vectors such that adjacent vertices are mapped to orthogonal vectors, and distinct vertices are assigned distinct vectors.Kochen-Specker sets concern {0, 1}-colorings of the graph (i.e., mappings f : V G → {0, 1}) that satisfy the conditions that (i) any two adjacent vertices cannot be assigned value 1 simultaneously; and that (ii) in any maximal clique, there is a unique vertex that is assigned value 1.A defining property of a 01-gadget G is that there exist two distinct non-adjacent vertices v 1 ≁ v 2 that cannot be assigned value 1 simultaneously in any feasible {0, 1}-coloring of G, while at the same time, a faithful orthogonal representation of G exists in C ω (G)   The figure shown in Fig. 3(a) is an example of 01-gadget, which has an orthogonal representation in R 3 , and the maximal overlap of the two distinguished vectors |u 1 ⟩, |u 14 ⟩ is 1  2 , i.e., |⟨u 1 |u 14 ⟩| ≤ 1 2 [31].The 01-gadget shown in Fig. 3(b) has an orthogonal representation in R 4 which is constructed by adding an extra vector |v 15 ⟩ to the first 01-gadget and making this vector |v 15 ⟩ orthogonal to all of the other vectors.Specifically, since the first 01-gadget has an orthogonal representation in R 3 , one can keep the structure of the first 01-gadget in the first three dimensions of R 4 and the extra vector is the basis vector on the fourth dimension (0, 0, 0, 1) T .It is easy to verify that the two distinguished vectors of this new 01-gadget are still |v 1 ⟩, |v 14 ⟩ and their maximal overlap is still 1  2 .Specifically, an orthogonal representation of the 01-gadget Fig. 3(b) for which the maximal overlap of the two special distinguished vertices is |⟨v 1 |v 14 ⟩| = 1  2 is given as (excluding normalization factors): (20) In order to certify 4 bits of global randomness for the quantum system of dimension 4, we create four copies of this 01-gadget G (1) , G (2) , G (3) , G (4) in C 4 such that the corresponding vectors in each copy are mutually orthogonal, i.e., |v  (d, −c, b, −a) in the copies while preserving the orthogonality structure.Note that such a construction is also possible in dimension 8, because there exist division algebras (the quaternions and octonions) in dimensions 4 and 8 [33].Let G in Fig. 4 denote the orthogonality graph of these four copies with vertices V (G) = V (G (1) ) ∪ V (G (2) ) ∪ V (G (3) ) ∪ V (G (4) ) and edges formed by the orthogonality constraints.
(1,0,0,0) (0,1,0,0) (0,0,1,0) (0,0,0,1)    Some of us showed in [24] that there exists a one-to-one correspondence between 01gadget in dimension d and two-player Hardy paradoxes for the maximally entangled state in C d ⊗ C d .We now proceed to construct the Hardy paradox for the maximally entangled state |ψ⟩ = 1 2 3 i=0 |i, i⟩.To do this, we first complete all the possible measurement bases (maximal cliques in the graph), these bases will serve as the measurement inputs x, y for both players.In particular, let us denote by x * , y * the respective maximal cliques formed by the distinguished vertices v (the blue clique in Fig. 4) and v The Hardy probability is then given by the sum of the probabilities of the input-output pairs in the set S exp defined as ))}.Note that these input-output pairs correspond to the four pairs of distinguished vertices of the four copies of the 01-gadget.It is readily seen that in any deterministic classical (LHV) behavior, by the property of the 01-gadget that the distinguished vertices cannot be assigned value 1 simultaneously, it holds that the sum of the probabilities of the input-output pairs in S exp is always 0.
On the other hand, we present a quantum strategy that satisfies all the zero constraints while simultaneously achieving the Hardy probability of 1.In the strategy, the two players share a two-ququart maximally entangled state |ψ⟩ = 1 which correspond to the zero constraints in the Hardy paradox.While, for the input-output pairs in S exp , we obtain which correspond to the non-zero Hardy expressions in the Hardy paradox.Furthermore, from the orthogonal representation shown in (20), we also see that the outcomes of the measurement settings x * , y * are uniform: Thus, the presented Hardy test is a good candidate to certify the maximum possible value (using systems of local Hilbert space dimension d = 4) of 4 bits of global randomness and 2 bits of local randomness from the measurement settings x * , y * .We defer the detailed self-testing statement of the above Hardy test and the corresponding test using systems of local dimension d = 8 to forthcoming work.

Conclusions
The generalisation of device-independent protocols for randomness generation, key distribution and self-testing to the scenario when the honest parties do not have trusted, fully uniform private seeds remains an interesting open question.In this paper, we have proposed a class of tilted Hardy tests in the simplest Bell scenario of two players performing a pair of binary measurements on two-qubit states that serve as ideal candidates for this generalisation.Our derived results on the amount of certifiable randomness from these tests against different sets of adversaries find immediate application in the state-of-the-art protocols for randomness amplification of weak SV seeds against quantum and no-signaling adversaries.While the tests allow to certify the maximum possible amount of 1 bit of local randomness for each player, they fall short of the ideal global randomness of 2 bits from the measurement outputs of both players.To remedy this defect, we proposed a class of Hardy tests in systems of local Hilbert space dimensions 4, 8 that can allow to certify up to the maximum possible 2 log 2 d bits of randomness under arbitrarily limited measurement independence.It is an interesting task for future research to utilize the proposed tests to improve the generation rates of fully device-independent protocols against general adversaries.
the value is uniquely achieved by the two-qubit state ) and the measurement {A 0 , A 1 }, {B 0 , B 1 } given by • X, (1 + sin θ) (1 + sin θ) where X and Z are Pauli matrices.
Proof.The proof consists of the following three statements.
• The classical value P w,LHV Hardy ≤ max(0, w).Any local hidden variable behavior can be written as a convex combination of deterministic non-signaling behaviors {P A,B|X,Y (a, b|x, y)}.In the Bell scenario under consideration, it is well known that there are 16 deterministic behaviors in total (where each party deterministically outputs a specific value of a, b ∈ {0, 1} for each input).Of these, there are five deterministic non-signaling behaviors that meet the Hardy 'zero' constraints 1 and 2. As is easily seen, the three Hardy zero constraints force P A,B|X,Y (0, 0|A 0 , B 0 ) = 0 in each of the deterministic non-signaling boxes.P A,B|X,Y (1, 1|A 0 , B 0 ) ≤ 1 leads to the bound of the non-zero Hardy probability term: P w,LHV .
In the Bell scenario under consideration where each party performs measurements of two binary observables, the well-known Jordan's Lemma [34] states that arbitrary Hermitian observables can be block diagonalized into blocks of size at most 2 × 2.
operators are: with (1 + sin θ) (1 + sin θ) As such, the actual experiment quantum system can satisfy all the Hardy zero constraints and achieve the bound P w,Q Hardy , if and only if the state is given by |ψ θ ⟩ = i,j √ q i,j |ψ i,j,θ ⟩ with the measurements being 1 and B 0 = j B j 0 , with coefficients q i,j satisfying q i,j ≥ 0, i,j q i,j = 1.The isometry is given by Φ = Φ A ⊗ Φ B [26] and where |σ⟩ AB is a bipartite 'junk' state.Analogous self-testing equations hold for B 1 , B 0 as well as A x B y for x, y ∈ {0, 1}.

B The guessing probability of a quantum adversary under Colored Noise
As a quantum adversary, Eve holds a quantum system that may be entangled with the device held by Alice and Bob.Let us denote the tripartite quantum state of Alice, Bob and Eve by |Ψ⟩ ABE .In this section, we will calculate the guessing probability of such an adversary Eve, when Alice and Bob perform the tilted Hardy test on their reduced system ρ AB and observe that the three Hardy zero constraints are perfectly satisfied while the Hardy probability achieves some non-maximal value 0 < p ≤ P w=w 0 ,Q Hardy = (4w 0 +5) .
Here we fix w = w 0 , in which case as discussed in Section 2, one can certify the most global randomness from the measurement setting (A 0 , B 0 ), when the optimal quantum behaviour is observed.The problem we want to solve is to maximize the guessing probability under the constraint that (i) Alice, Bob and Eve's system is quantum, (ii) the reduced system of Alice and Bob satisfies the three Hardy zero constraints, and (iii) the reduced system of Alice and Bob achieves some value 0 < p ≤ P w=w 0 ,Q Hardy for the Hardy probability, i.e., max P guess (A, B|A 0 , B 0 , E) where Q denotes the set of three-party quantum boxes.When the three zero constraints are satisfied, solving Eq. (26 Importantly, the measurements on Alice and Bob's system for the two corresponding states |ψ θ ⟩ are also fixed (and different) as specified in Eq. (24) so that the zero constraints cannot be satisfied by mixed states on Alice and Bob's system.Therefore, Eve's strategy in this case just consists of a mixture of extreme quantum boxes (for which the state of Alice and Bob's system is pure and decoupled from that of Eve) under the constraint that the observed Hardy probability is p.For any extreme quantum behavior {P A,B|X,Y } θ p,w 0 parameterized by the value θ p,w 0 , one can readily calculate the guessing probability directly from the behavior as where θ w 0 = arcsin −4 ≈ 1.1356 which corresponds to the optimal quantum behaviour P w 0 ,Q Hardy .
Here P A,B|X,Y (0, 1|A 0 , B 0 ) for all p ∈ (0, P w=w 0 ,Q Hardy ) and the corresponding guessing probabilities for these two extreme boxes are related as , ∀p ∈ (0, P w 0 ,Q Hardy ].Furthermore, as a function of p, the probabilities are both concave and monotonically decreasing (see Fig. 5).
The general strategy of any adversary Eve is thus to provide Alice and Bob with (a mixture of) extreme quantum boxes {P A,B|X,Y } that achieve the Hardy probability p.To do this, she may admix some local deterministic boxes (which allow a guessing probability of 1) with quantum behaviors that achieve a Hardy probability in the range (p, P w 0 ,Q Hardy ].Solving for the optimal admixture of extreme boxes for which the guessing probability is given by the equation (35) with local boxes from the Tables 1 and 2 gives the guessing probability for any given p ∈ [0, P w 0 ,Q Hardy ].From Appendix A, we know there are totally 5 local hidden variable deterministic behaviours which satisfy the three Hardy zero constraints.The local boxes shown in Table 1 satisfy P A,B|X,Y (1, 1|A 0 , B 0 ) , and these boxes achieve a Hardy probability P A,B|X,Y (0, 0|A 0 , B 0 ) + w 0 P A,B|X,Y (1, 1|A 0 , B 0 ) LHV I = w 0 < 0. Thus, when Eve chooses a probabilistic mixture of a deterministic box from Table 1 and any pure quantum behaviour (θ p,w 0 1 ) with p < p ≤ P w 0 ,Q Hardy , the following equation holds (from the constraint that P Hardy = p): Such a mixture can not increase the guessing probability, due to the fact that Therefore, the admixture of local deterministic boxes from Table 1 does not increase the guessing probability.
On the other hand, any local deterministic box from Table 2 satisfies P A,B|X,Y (0, 1|A 0 , B 0 ) 1 and achieves the zero Hardy probability LHV II = 0.When Eve chooses a probabilistic mixture of a deterministic box from Table 2 and any pure quantum behavior (θ p,w 0 2 ) with p < p ≤ P w 0 ,Q Hardy , the following equation holds (from the constraint that P Hardy = p) We can find the optimal p which maximizes the guessing probability of Eve: The above problem is equivalent to find the p on the curve of the function P A,B|X,Y (0, 1|A where p * ≈ 0.01366.

C α-CHSH and its robust self-testing statement
In this section, We first introduce a family of bipartite Bell expressions named α-CHSH (used in Eq. ( 12)) with a parameter α > 1  3 : where A 0 , A 1 are two binary observables for Alice and B 0 , B 1 are two binary observables for Bob.The maximum value of I α in quantum theory is I Q α = (α + 1) α+1 α , and it's achieved by the specific reference quantum system (up to a local isometry) : The maximum value of I α in classical theory is easily verified to be: Let define the shifted Bell operator as

and take a trivial monomials basis
to do the sum of squares (SOS) decomposition of the shifted operator Bell I α = R † M α R. Obviously, I α is inherently positive semidefinite, and we get: One can do Cholesky Decomposition of M α to get two polynomials P 1 , P 2 and the shifted Bell operator is expressed as I α = P † 1 P 1 + P † 2 P 2 .
Due to the experimental noise, usually the ideal maximum quantum value I Q α cannot be observed in the experiments but up to some error term e.To distinguish the notations used by the reference quantum system above, we will refer to the physical state and observables (hermitian and dichotomic) to prime notations |ψ ′ ⟩, This Bell expression I α provides a robust self-test for its reference state |ϕ + ⟩ and reference observables A 0 , A 1 , B 0 , B 1 , to prove this robust self-testing statement, we show there exist a local isometry Φ = Φ A ⊗ Φ B , as shown in Fig. 6 acting on the physical system and its output state is close to the corresponding reference system in a noise-tolerant way (the error term is of order O( √ e)) with some |junk⟩ state.More precisely: where x, y ∈ {−1, 0, 1}, the subscript -1 refers to I and the operators X A , X B , Z A , Z B in the isometry are defined in terms of A ′ x , B ′ y , x, y ∈ {0, 1}.
Proof.The proof of the robust self-testing statement includes the following 4 steps.
Step. 1 Defining the operators in the isometry.
Firstly, we define the following four local operators (with the prime notation) in terms of A ′ x , B ′ y , x, y ∈ {0, 1}: (α + 1) (49) In order to make the operators in the isometry unitary, we play the regularisation trick [19] on these operators.For operator X ′ A , we first replace the zero eigenvalues into 1 and denote the new operator as X * A , then normalize the eigenvalues by A | , such that the resulting operator X A is Hermitian and unitary and has the property Step. 2 Deriving some useful bounds for physical operators.
According to the SOS decomposition (47), suppose the observation of the quantum value is ≤ e, we have the following two bounds: The left side of (55) can also be expressed as: (1 + α) (1 + α) (αB √ e (56) From the above two inequalities (55) and (56), we have: (1 + α) Then we can get: From (59), we can also get Note that δ 1 ∼ δ 7 are all of order O( √ e).
Step. 3 Deriving the bounds for regularized operators.
Next, we will derive the similar bounds like (52), (53), (58) and (59) for regularized operators: A is an unitary operator.In the forth line, we use the operator inequality A ≤ |A|.
In the fifth line, we use the operator inequality I + |A| ≥ I.
In the third line, we use the intermediate result of (62) and play the same trick as line 5 of (62).In the last line, we use the bound (60).
Step. 4 Using the derived bounds to prove the robust self-testing statements.
With these conditions (61), (62), ( 63) and (64), it's easy to see the following statement holds: where x, y ∈ {−1, 0, 1}, the subscript -1 refers to A −1 = B −1 = I and the isometry is shown as Fig. 6.The output of the isometry is: 1. Robust self-testing the state |ψ ′ ⟩.When x = y = −1, the second and third terms of (66) are bounded by: The difference of the first and fourth terms of (66) is:

Robust self-testing the local measurements A ′
x , x ∈ {0, 1} on Alice's side.Since A ′ x , x ∈ {0, 1} is the linear combination of Z ′ A and X ′ A , here we take the local operator to be either Z ′ A or X ′ A , and the corresponding reference operators is σ A z or σ A x (the Pauli operators).When A ′ x = Z ′ A , y = −1, the second and third terms of (66) are bounded by: The difference of the fourth term and the negative of the first term in (66) is: A , y = −1, we will use the fact that Φ is linear and preservers the norms, ∥Φ (X

This allows us to bound the (65) with
When A ′ x = X A , y = −1, the difference of the second and third terms of (66) is bounded by: (71) And the first term and the fourth term of (66) are bounded by:  for the expression in (10).For any pair of measurement settings x, y and outcomes a, b, the following upper bound holds: (77) In the following, we will discuss the two cases α ∈ ( Case 2. α ∈ (1, +∞).In this case, we observe that max(0, 1−α 2 ) = 0 and derive the bounds The proof in this case is similar to the proof of Case 1, we omit the details here.For any given α ∈ (1, +∞), we obtain the upper bound

= 2 2 ≤ 5
which is termed as α-CHSH expression in Appendix C.And in Appendix C, We analytically compute the maximum values of this Bell expression I α in quantum and classical theories, and show it provides a robust selftesting statement for the optimal quantum strategy.With the optimal quantum strategy, one can obtain H global ∞ bits of global randomness when α = 1 2 (See Fig.1for details on the relation between the global randomness and violation of the inequality I α= 1

Figure 1 :
Figure1: At the optimal point, I α=1/2 , the inequality allows to certify up to H ∞ (A, B|A 0 , B 0 , E) = 2 bits global randomness.The guessing probability P guess (A, B|A 0 , B 0 , E) and corresponding Minentropy H ∞ (A, B|A 0 , B 0 , E) (bits per round) versus I α=1/2 calculated at the second level of the NPA hierarchy is shown.

Figure 2 :
Figure 2: (a) Min-entropy bound in the MDL scenario verses I M DL α for α = 1 2 , α = 4 5 , α = 1 with the given lower and higher bounds l, h of a weak SV-source.The black dots denote the lower bound on the maximal possible quantum value of I M DL α with the given lower and higher bounds l, h of the SV-source.(b) Lower bound on the maximal achievable entropy of I M DL α (α = 12 , α = 4 5 , α = 1) versus the lower bound l of a weak SV-source.Here for the weak SV-source with fixed l, we consider two extreme cases of the input distribution (1) three settings are chosen with probability h and the remaining one is l, i.e. l = 1 − 3h (h = 1−l 3 ), and (2) three settings are chosen with probability l and the remaining one is h, i.e. h = 1 − 3l.As a comparison, we also plot the results in[16], in which the authors calculated the von Neumann entropy in the MDL scenario for α = 1.

α
which is the lower bound of the maximal quantum value of I M DL α .In Fig. 2(b), we then use this lower bound of I M DL α to show the lower bound on the maximal achievable min-entropy of I M DL α for α = 1

Figure 3 :
Figure 3: The graph in (a) is a 01-gadget that has a faithful orthogonal representation in R 3 , and the overlap of the two distinguished vectors |⟨u 1 |u 14 ⟩| ≤ 1 2 .The graph in (b) is a 01-gadget constructed by adding an additional vector |v 15 ⟩ that is orthogonal with all of the vectors in the faithful representation of (a).The graph in (b) has an orthogonal representation in R 4 , and the maximal overlap of the two distinguished vectors is still 1 2 , i.e., |⟨v 1 |v 14 ⟩| ≤ 1 2 .
) k ⟩ form a complete basis (the vertices form a maximal clique).This is achieved by rotating each vector (a, b, c, d) ∈ R 4 in the original 01-gadget Fig. 3(b) into the orthogonal vectors (b, −a, −d, c), (c, d, −a, −b),

Figure 4 :
Figure 4: As explained in the text, one can rotate the vectors in the 01-gadget Fig. 3(b) to create four copies of it.The corresponding vectors in each copy are mutually orthogonal, i.e., |v (1) k ⟩, |v

( 4 )
k ⟩ form a complete basis (the vertices form a maximal clique).
red clique in Fig. 4).The outcomes of each measurement are labeled by a, b ∈ {1, 2, 3, 4} for the two players respectively, and correspond to the vertices in the clique.For convenience, let us rewrite the notation of the orthogonal representations of G as {|v z,c ⟩} z ∈ {x, y}, c ∈ {a, b}.We define the set S Hz of Hardy 'zero' constraints in this case as S Hz := {((x, a), (y, b)) : ⟨v (x,a) |v (y,b) ⟩ = 0} ∀x, y, a, b

Figure 6 :
Figure 6: The local isometry Φ = Φ A ⊗ Φ B used to self-test the reference state and measurements.

( 13 )− ϵ 2 and h = 1 2 + ϵ 2 .
) for l, h being the lower and upper bounds on the probability of choosing measurement inputs x, y respectively.Note that when measurement inputs are chosen using an ϵ-SV source, we have l =1  2 Proposition.Consider any bipartite no-signaling box P A,B|X,Y that achieves the value I Hardy α

PFigure 7 :
Figure 7: (a), (b) and (c): Chains of inequalities under the no-signaling conditions.(d): No-signaling and normalization constraints used for calculating the upper bounds of x, x ′ , s, s ′ , t. (NS: no-signaling constraint; NOR: normalization constraint.) To see this, consider an arbitrary bipartite pure state |ψ⟩ = k λ k |k A ⟩|k B ⟩, where {|k A ⟩}and {|k B ⟩} are basis sets of Hilbert spaces H A and H B respectively and λ k ≥ 0 are the corresponding Schmidt coefficients.First observe that Jordan's lemma allows for a reduction to the setting where Alice and Bob hold qubit systems, i.e., H A = H B = C 2 .Furthermore, when the Hardy zero constraints are satisfied, as shown in Appendix A, Alice and Bob's measurement observables are identical, i.e., A 0 = B 0 and A 1 = B 1 giving rise to the symmetry P (0, 1|A 0 , B 0 ) = P (1, 0|A 0 , B 0 ).Under these conditions, the arbitrary Hardy expression P Hardy = i,j=0,1 α i,j P A,B|X,Y (i, j|A 0 , B 0 ) reduces to

measurements of A x , B y on |ψ⟩. The corresponding amount of global randomness (in bits) is then given by the min
-entropy H ∞ (|ψ⟩, A x , B y ) = − log 2 G ψ,Ax,By .Similarly, one can quantify the amount of local randomness through the guessing probability of marginal outcomes of each local party.One may then define the maximum global randomness certifiable from any input pair x, y the tilted Hardy tests for any given w as H global ∞ = max x,y H ∞ (|ψ θ ⟩, A x , B y ) where |ψ θ ⟩, A x , B y are given by the self-testing in which v 1 and v 2 are assigned non-orthogonal vectors.

Table 1 :
Local boxes that lead to the upper bound of tilted Hardy's paradox when w ≥ 0.

Table 2 :
Local boxes that lead to the upper bound of tilted Hardy's paradox when w ≤ 0.
0 , B 0 ) .Therefore, in any Eve's mixed strategy for the value p ∈ [0, P w 0 ,Q Hardy ], Eve's guessing probability is given as *