{'fraction_non_alphanumeric': 0.031537143747079895, 'fraction_numerical': 0.015184550693038467, 'mean_word_length': 4.877803203661327, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Experimental observation of Hardy-like quantum contextuality

Contextuality is a fundamental property of quantum theory and a critical resource for quantum computation. Here, we experimentally observe the arguably cleanest form of contextuality in quantum theory [A. Cabello \emph{et al.}, Phys. Rev. Lett. \textbf{111}, 180404 (2013)] by implementing a novel method for performing two sequential measurements on heralded photons. This method opens the door to a variety of fundamental experiments and applications.


Introduction
Quantum probabilities cannot be reproduced by a joint probability distribution over a single probability space 1,2 . This implies that the outcomes of quantum measurements cannot be preassigned independently of the measurement context (i.e., the set of other compatible measurements that are simultaneously performed). Consequently, some predictions of quantum theory (QT) cannot be reproduced with noncontextual hidden variable (NCHV) theories. In this sense, QT is said to have contextuality.
This contextuality is the critical resource for universal quantum computation via 'magic state' distillation 8 (the leading model for experimentally realizing fault-tolerant quantum computation) and for measurement-based quantum computations for calculating non-linear Boolean functions with a high probability 9 . Contextuality is also the underlying property behind quantum non-locality 10 and its applications for cryptography 11 , reduction of classical communication complexity 12 and randomness generation 13 .
A natural question is: How can one explain the essence of quantum contextuality to the layman?
Which is the simplest and cleanest explanation (in the sense of Ref. 4

) of quantum contextuality? While
Hardy's 5,6 is the "the simplest and cleanest" 4 version of quantum non-locality, an equivalently simple and clean version of quantum contextuality has only been recently discovered 3 . It can be formulated in terms of five imaginary boxes, numbered from 1 to 5, which can be either full or empty. Suppose that P | ψ (0, 1|i, j) denotes the joint probability that box i is empty and box j is full (and likewise for both boxes full and both empty) when the boxes are prepared in state |ψ . If one assumes that the outcomes of opening the boxes are non-contextual, then the fact that would lead to the conclusion that However, in QT, conditions (1a) and (1b) can occur while prediction (2) fails. This proves that some predictions by NCHV theories are violated by QT. Instead of (2), QT predicts Hereafter, we will refer to the non-zero probability in (3) as the "Hardy fraction", because of the analogy with Hardy's proof 5,6 .
As pointed out by Mermin, although Hardy-like proofs may "reign supreme in the gedanken realm", they "provide a rather weak basis for a laboratory violation of the experimentally relevant inequality" 14 .
This is so because any Hardy-like proof can be expressed as a violation of an "experimentally rele-  18,19 . It requires sequentially measuring compatible observables on the same system. Moreover, it requires measuring each observable using the same device in any context 20 achieving that: (i) The probabilities in (1a) and (1b) sum up to 1 within the experimental error, (ii) the Hardy fraction is non-zero and in agreement with the quantum prediction in (3), and (iii) the probabilities violate the relevant non-contextuality inequality (the KCBS inequality).

Experimental setup
Our Hardy-like contextuality experiment adopted a novel method for performing two sequential measurements on the same photon. We encoded the outcome of the first (path) measurement in the polariza-tion degree of freedom. This allowed us to experimentally reach the conditions for a Hardy-like proof of quantum contextuality.
Any experiment testing contextuality must satisfy two requirements: (I) Observables measured together must be compatible and (II) every observable must be measured using the same device in any context. Requirement (I) is sometimes difficult to fulfill and the implications of not having perfect compatibility have been extensively studied 23,24 . Requirement (II) is neglected in some experiments 20 .
In Bell-inequality experiments, no special action is needed to guarantee (I), since each observable is measured on a different subsystem. However, in experiments in which observables cannot be measured on different subsystems or different degrees of freedom of the same system 18,19 , special care must be taken to enforce compatibility.
Recall that, by definition, in a general probabilistic theory, two observables µ 1 and µ 2 are compatible if there exists a third observable µ such that the outcome set of µ is the Cartesian product of the outcome sets of µ 1 and µ 2 , and, for all states ρ, the outcome probability distributions for µ 1 or µ 2 are recovered as marginals of the outcome probability distribution of µ.
In our experiment, we took advantage of the fact that, if µ 1 and µ 2 represent sharp quantum observables (i.e., quantum observables in the sense defined by von Neumann) on path degrees of freedom of a photon. In this case, there is an algorithm for constructing the optical device implementing any unitary transformation 25 . If QT is correct, whenever two operators commute the corresponding devices implement compatible observables. We used this to construct devices for measuring compatible observables µ 1 and µ 2 . Constructing a device for measuring µ can be done by noticing that it is equivalent to the device in which µ 1 and µ 2 are placed sequentially in any order (see Fig. 1). Compatibility can then be tested afterwards (thus removing the need of assuming that QT correctly represents compatible observables) by checking that the definition of compatibility is satisfied within the experimental error for a set of states.
Our approach consists of first constructing devices corresponding to sharp quantum observables, and then placing pairs of them which are compatible in both possible orders. This allows us to satisfy at the same time both requirements (I) and (II). Perfect compatibility is only limited by our ability to construct devices corresponding to the exact unitary transformations needed and by imperfections when combining them. The aim of our setup is to implement a photonic version of a contextuality experiment in which several sequential compatible measurements are performed on a quantum system as the one illustrated in Fig. 1 (a). In our experiment the physical systems are defined by single photons in a three-path setup.
The basis vectors | 0 , | 1 and | 2 correspond to finding the photon in path a, b and c, respectively. To perform two sequential measurements on the same photon we implement a novel scheme shown in Fig. 1 (b) in which the outcome of the first measurement (that only addresses the spatial degrees of freedom) is stored in the polarization of the photon before the second measurement (that also only addresses the spatial degrees of freedom).
where T means transposition. This state is prepared by combining two beam splitters (BSs), the first with a reflectivity/transmitivity ratio of 33:66 and the second with a 50:50 ratio. The setup for the state preparation is shown in Fig. 2.

Experimental Hardy-like quantum contextuality
The experimental results are presented in Table 1. The errors come from Poissonian counting statistics and systematic errors. The main sources of systematic errors are the slight imperfections in the optical interferometers due to nonperfect overlapping and intrinsic imperfections of the BSs and HWPs. As shown in Table 1, the results are in very good agreement with the predictions of QT for an ideal experiment and are essentially insensitive to the order in which the measurements are performed. This contrasts with previous photonic experiments where the independence of the order was not tested 21,22 .
Taking from Table 1 Table 1), and (iv) the sum of the joint probabilities violates the KCBS inequality 7 , namely, where the sum is taken modulo 5 and " NCHV ≤ 2" indicates that 2 is the maximum value for NCHV theories.
From the results in (7a)-(7c), we obtain in agreement with the quantum prediction for an ideal experiment.
As stated above, compatibility was enforced by choosing i or i + 1 to be devices represented in QT by commuting operators. In addition, we checked compatibility in two ways. First, we checked that the probabilities do not depend on the order in which measurements were performed. Second, we counted the detections in the detector corresponding to (1, 1|i, i + 1). These detections would never occur in an ideal situation, since the eigenstates of i and i + 1 with eigenvalue 1 are orthogonal. Our experiment was very close to this ideal situation, since these events only occurred with probabilities in the range 0.002 ± 0.001-0.006 ± 0.001 for 9 out of the 10 configurations. For the most complex configuration (the one shown in Fig. 2) these events occurred with probability 0.021 ± 0.001.
The non-contextual upper bound of the KCBS inequality, namely, 2 is derived under the assumption that the two observables measured sequentially are perfectly compatible. However, experimental imperfections make this assumption only approximately satisfied. To show the significance of the experimental results in this case, we followed the approach used in previous experimental violations of non-contextuality inequalities with sequential measurements 22 (there are other approaches to extract conclusions about contextuality from experimental data 23,24 ). It consists of assuming that the non-contextual upper bound of the inequality is valid for some fraction (1 − ǫ) of the experimental runs, but must be corrected (increased) assuming the most adversarial scenario for the other fraction ǫ. As in previous experiments 22 , here ǫ is defined as the average of P (1, 1|i, i + 1) for the 10 experimental configurations tested. In an ideal experiment ǫ would be zero. Our assumption is that the non-contextual upper bound of the KCBS inequality (namely 2) is valid only for a fraction 1 − ǫ of the runs, while for the remaining fraction ǫ we assume the worst-case scenario in which the algebraic bound of the KCBS inequality (namely 5) is reached. In our experiment, ǫ = 0.0062. Therefore, the non-contextual upper bound of the KCBS inequality shifts from 2 to 2(1 − ǫ) + 5ǫ = 2.019. Nevertheless, the experimental value in (9) still violates this bound.

Conclusions
Using a novel method for performing two sequential measurements on the same photon, we have reported the first experimental observation of Hardy-like quantum contextuality on qutrits, which is the conceptually simplest version of quantum contextuality.
We have sharply observed, for the first time in sequential measurements on photons, that correlations between the outcomes of observables represented by commuting operators are independent of the order in which the sequential measurements are performed, as predicted by QT. Moreover, we have shown that the experimental results violate the relevant NC inequality even when experimental imperfections are taken into account.
The experimental observation of this Hardy-like quantum contextuality is of fundamental importance, since it connects the simplest NC inequality violated by qutrits 7 with the Kochen-Specker theorem 2 , thus providing the missing link between these two fundamental results 3 . At the same time, the method introduced here for sequential measurements on photonic systems opens the door to applications for quantum information processing requiring sequential quantum measurements on physical systems that can be also used for transmission of quantum information between spatially separated locations. i is encoded in the photon's polarization. Then, the unitary operation U j corresponding to observable j is applied. Then, the outcome of observable i is decoded using polarizing beam splitters (PBSs). The outcomes of observables i and j are given by the detector that clicks (since each detector corresponds to a combination of outcomes). There is no need to implement U † j , since no further measurements will be performed on the photon.  happens, D2 clicks for (0, 1|2, 1), D3 or D6 click for (1, 0|2, 1), and D4 or D5 click for (0, 0|2, 1). All coincidence counts between the trigger detector and the measurement detectors are registered using an eight-channel coincidence logic with a time window of 1.7 ns. The number of detected photons was Table 1: Experimental results for the probabilities involved in the Hardy-like proof of contextuality.

Figure captions
The second and third column shows the probabilities when the measurements are performed in direct and reverse order, respectively. The fourth column shows the prediction of QT for an ideal experiment.