Experimental test of the Greenberger–Horne–Zeilinger-type paradoxes in and beyond graph states

The Greenberger–Horne–Zeilinger (GHZ) paradox is an exquisite no-go theorem that shows the sharp contradiction between classical theory and quantum mechanics by ruling out any local realistic description of quantum theory. The investigation of GHZ-type paradoxes has been carried out in a variety of systems and led to fruitful discoveries. However, its range of applicability still remains unknown and a unified construction is yet to be discovered. In this work, we present a unified construction of GHZ-type paradoxes for graph states, and show that the existence of GHZ-type paradox is not limited to graph states. The results have important applications in quantum state verification for graph states, entanglement detection, and construction of GHZ-type steering paradox for mixed states. We perform a photonic experiment to test the GHZ-type paradoxes via measuring the success probability of their corresponding perfect Hardy-type paradoxes, and demonstrate the proposed applications. Our work deepens the comprehension of quantum paradoxes in quantum foundations, and may have applications in a broad spectrum of quantum information tasks.


INTRODUCTION
One of the most prominent features about quantum mechanics (QM) is its intrinsic nonlocality 1 , namely, QM cannot be reconciled with local realism 2 , thus no local-hidden-variable (LHV) models can completely reproduce the predictions of quantum theory. Since its discovery, quantum nonlocality has found many significant applications in quantum computation [3][4][5] , device-independent quantum key distribution [6][7][8] , and genuine random number generation 9,10 . It is also a kind of resource playing a vital role in the field of quantum information 11,12 . The Bell-type inequalities, which bound the correlations produced by any LHV models but can be statistically violated by QM, are arguably the most common tools for revealing the nonlocality. Some renowned examples include the two-qubit Clauser-Horne-Shimony-Holt inequality 13 and the multi-qubit Mermin-Ardehali-Belinskiĭ-Klyshko inequality [14][15][16] .
Strikingly, in some measurement scenarios, QM and LHV models give contradictory predictions on whether a specific set of outcomes is even possible. Proofs of nonlocality stemmed from these scenarios are termed possibilistic nonlocality 17 . They occupy a strictly higher hierarchy than the statistical proof in the sheaftheoretic approach, and can reveal the nonlocality of QM using very few measurements and copies of states prepared. The first proof of possibilistic nonlocality, due to Greenberger, Horne and Zeilinger (GHZ) 18 , uses three qubits to formulate a paradox "+1 C = −1 Q " in every round of experiment. Here, the terminology +1 C = −1 Q denotes the contradictory predictions given by the quantum and classical theory for the measurement outcome of an observable. Two-qubit systems can also manifest possibilistic nonlocality, but with a success probability of less than 1, and this way of observing nonlocality is later entitled Hardy's paradox 19 .
The research of the GHZ paradox has achieved vigorous developments. It was experimentally tested 23 with three qubits, and can be observed in a fault-tolerant manner by using nonabelian anyons 24 to avoid the detection loophole. Besides the GHZ states, the earlier GHZ-type paradox is also known to be present in other pure states, such as the linear cluster states 25 and, more generally, a class of highly entangled multipartite states called graph states 26 . The investigation of the GHZ-type paradox has a continuous interest, since there are still some remnant issues with particular importance that require further investigation: (i) it is currently unknown whether a GHZ-type paradox can be exploited to determine a graph state; (ii) it is also not clear whether GHZ-type paradoxes exist for the states that are not equivalent to graph states under local unitary; and (iii) there is no known method to experimentally test of a GHZ-type paradox with an efficient way, i. e, through its equivalent Hardy's paradox. Resolution to these issues may yield significant applications of quantum paradoxes.
In this article, we address the above issues to advance the study of GHZ-type paradoxes in quantum mechanics: First, a unified construction for the GHZ-type paradox is presented, naturally including all the previous results for graph states. For a graph with odd number of total vertices and at least one vertex being universal (i.e, connecting all the other vertices), observation of the GHZ-type paradox verifies the corresponding graph states, and efficiently detects multipartite entanglement. Second, due to a Hamiltonian description, some single-qubit Clifford equivalent graph states, their coherent superpositions and convex mixtures are also found to have the GHZ-type paradoxes. As such, the GHZ-type paradox exists beyond the graph states. Interestingly, for the convex mixtures of some single-qubit Clifford states that support the GHZ-type paradox + 1 C = −1 Q for Bell nonlocality, GHZ-type paradoxes 1 C = 2 Q for EPR steering 27 can be established, thus manifesting the sharp contradictions between a broader class of semiclassical models and quantum theory. Finally, the GHZ-type paradoxes can be converted to the perfect Hardy's paradox, on which we perform an experimental test through measuring the success probability in Hardy's paradox, thus providing an efficient way to reveal the GHZtype paradoxes. Our experimental results are in agreement with the theoretical predictions with high accuracy, thus advance the study of the field of quantum paradoxes.

GHZ-type paradox for graph states
To introduce the idea of GHZ-type paradoxes, we begin with an explicit example based on the 3-qubit GHZ state In this case, the results of the Pauli measurements, (1) cannot be interpreted by any LHV model: when we assign the dichotomic values v = ±1, as pre-determined by the hidden variables, to each measurement outcome, σ i ν ! v i ν , ν ∈ {x, y, z}, i ∈ {1, 2, 3}, they must satisfy v 1 x ¼ À1 in order to recover the predictions of QM. However, multiplying over these equations The graph state is the common eigenstate of the stabilizing operators 28 for an undirected, connected graph G, which has m vertices. We define C j i as the connectivity of the vertices i and j, so that C j i ¼ 1ð0Þ means that vertices i and j are connected (disconnected). For each vertex i, the stabilizing operators read: where i, j = 1, 2, ⋯ , m; σ x,y,z are Pauli matrices; and ðσ j z Þ . The operators S i are involutory and mutually commutative, and serve as the generators of an abelian group, namely, the stabilizing group. The ground state of the Hamiltonian H ¼ À P m i¼1 S i is then defined as the graph state G j i (i.e., S i G j i ¼ þ G j i; 8i 2 f1; Á Á Á ; mg). To construct the GHZ-type paradox, we focus on a vertex labeled as 1 with a degree of n + 1, where 3 ≤ n ≤ m. Without loss of generality, its neighbor vertices are labeled as 2, 3, …, n, and the other vertices unconnected to it are labeled n + 1, n + 2, …, m. Then, the following theorem then holds. Theorem 1.-A GHZ-type paradox can be formulated from the observables E in Table 1. The cardinality of {E} is n + 1 when n is odd, and n when n is even.
A sketch of the construction of Theorem 1 is presented in the Methods section, and the detailed proof for it is provided in Supplementary Information (SI) (See Supplementary Information for proofs of the theorem, some examples and experimental details.). In SI, we apply the Theorem 1 on all possible graphs with m = 3 and 4 to recover the GHZ-type paradoxes above and in 18,25 . A concrete example for m = 4 is as follows.
-Consider a (m, n) = (4, 3) linear graph connected as 2-1-3-4. Its connectivity reads C 2 1 ¼ C 3 1 ¼ C 4 3 ¼ 1, and the other C values are zero. The ground state of H is the 4-qubit cluster state with the form G . From theorem 1, we have a 2 = a 3 = 1, so the GHZ-type paradox can be derived from operato1rs Under local unitary transformation, the ground state is equivalent to the standard form of the cluster state LC 4 j i ¼ ð 0000 j iþ 0011 j iþ 1100 j iÀ 1111 j iÞ=2. Then we recover the usual construction of the GHZtype paradox for the 4-qubit cluster state as 25 Based on equation (3), we have the quantum prediction However, in the LHV models, the product of the observable σ i ν 's expectation values v i ν are ðv 1 x Quantum state verification. A GHZ-type paradox is of particular interest if, using the specific observables, the paradox can be observed only with a specific graph state G j i, similar to the situation of a Bell inequality that gives a single maximum for G j i [29][30][31] . From the form of Theorem 1, when m = n is odd, any n operators E can still generate the n stabilizers of G, so their grand total cannot have a degenerate ground state. Furthermore, in the case of n = m, there are no unmeasured qubits and the GHZ-type paradox constructed from operators E singles out G j i.
Entanglement detection. Theorem 1 also has a significant application in entanglement detection. In the case of odd n, we may transform the GHZ-type paradox into the Bell's inequality ; the maximal violation is then directly given by I QM n ¼ n þ 1. Note that every stabilizer appears an even number of times in all E, so Q nþ1 i¼1 f i E i ¼ 1. Moreover, the second-largest and the smallest eigenvalues of P nþ1 i¼1 f i E i are n − 3 and − n − 1, respectively. According to the properties of the spectrum, the value of I n evaluated for quantum state ψ j i can be related to the fidelity of ψ j i with respect to the target graph state. Using the two extremes above, it is straightforward to conclude that for relatively large I n , the fidelity is sandwiched between Table 1. Construction of GHZ-type paradoxes for graph states.

Symbol
Definition of symbol The set of observables {E} as defined herein manifests a GHZ-type paradox for a graph state G j i with its graph representation G having connectivity C j i , and the stabilizing operators of G j i being S i .
ðI n À n þ 3Þ=4 and ðI n þ n þ 1Þ=ð2n þ 2Þ. Therefore, the amount of violation of (4) gives a lower bound of the fidelity between an unknown state and the target graph state. Especially, violating (4) guarantees a fidelity of at least 50%. Moreover, when the argument is applied to a target state with a large Schmidt measure 32 , a quantum value I n that is well below the LHV bound can still reflect non-trivial feature of entanglement. For example, the 5-qubit ring graph state RC 5 j i in Fig. 1 has a Schmidt measure of 3, so a fidelity of 2 −3 = 0.125 with RC 5 j i already guarantees entanglement. As this only requires achieving I 5 ! 2:5 with the Bell-type inequality (4), our construction has the notable feature of revealing non-classicality even when the observed correlation is not strong enough to reject the LHV models.
GHZ-type paradox beyond graph states So far, only graph states have been known to be able to exhibit GHZ-type paradoxes. Here, we show that there are GHZ-type paradoxes presenting beyond graph states. Let us consider the measurement operators in Example 1. We can define a new Hamiltonian H 0 ¼ ÀðE 1 þ E 2 þ E 4 Þ þ E 3 , whose ground states are interestingly two-fold degeneracies, i.e., H 0 LC 4 j i ¼ À4 LC 4 j i and H 0 LC 0 As in equation (3), we can verify that the extended cluster state also exhibits a GHZ-type paradox (See Supplementary Information for proofs of the theorem, some examples and experimental details.). For θ ≠ 0, π/2, it is easy to check that the pure state LC 4 ðθÞ j i is not the common eigenstate of operators {S i }; it thus cannot be viewed as a graph state. Therefore, we have a GHZ-type paradox for the non-graph state LC 4 ðθÞ j i . Furthermore, let us consider the following mixed state It can be verified that a GHZ-type paradox is also valid and that the paradox is θ-independent (i.e., Q ¼ Steering paradox for mixed states. In 2007, Wiseman et al. classified quantum nonlocality into three distinct types: quantum entanglement, EPR steering, and Bell's nonlocality 27 . EPR steering is a novel form of nonlocality that lies between entanglement and Bell's nonlocality. Gisin's theorem shows that for pure states, entanglement already indicates Bell nonlocality 33 , so the relation among various types of non-classicality is subtler in mixed states.
Here, we demonstrate that the GHZ-type proof is also applicable to EPR steering and, in particular, its scope is beyond the twoqubit pure state scenario 34 .
For the mixed state in equation (6), an analog GHZ-type paradox 1 C = 2 Q for EPR steering can be established, indicating a sharp contradiction between the local hidden-state (LHS) model and quantum theory. Concretely, when Alice prepares the state in equation (6), she keeps the first two qubits and sends the latter two qubits to Bob. Through EPR steering, Alice will persuade Bob that his two qubits do not have a LHS description, and therefore collapse to distinct conditional states according to Alice's measurement settings. Here, we demonstrate the case in which Alice's qubits subjects to two-settings measurements, namely, σ z ⊗ σ z and σ y ⊗ σ x . According to the LHS model, the classical prediction for a steering parameter I s is I LHS

GHZ-type paradoxes verified by Hardy-type paradoxes
To experimentally verify the GHZ-type paradox for nonlocality, conventionally the − 1 factor between the quantum and classical predictions has to be demonstrated. For example, a direct way is to perform four successive measurements E i 's on the initial state LC 4 j i, and show, with the help of some interference techniques, that the final state is e iπ LC 4 j i. However, this way is not particularly amenable to experiment for the following reasons: (i) a highly pure initial state LC 4 j i is required, and (ii) each measurement E i acting on the state LC 4 j i must be nondestructive. To circumvent these difficulties, we resort to other more effective approaches, which are related to measuring various probabilities. For instance, the GHZ-type paradox (3) can be converted to a perfect case of Hardy's paradox, Here, the first three equations denote the Hardy-type constraints, and P suc represents the success probability for observing a LHVimpossible event. Equation (7) implies that a GHZ-type paradox can be viewed as a perfect Hardy's paradox, for which P suc equals 1 in quantum mechanics 35,36 . The sharp contradiction + 1 C = − 1 Q in the GHZ-type paradox is thus equivalent to 0 C = 1 Q in Hardy's paradox (where P suc = 0 for LHV models and P suc = 1 for quantum theory; see SI for further details about the conversion and measurement settings).

Experimental implementation
Using a photonic setup, we experimentally tested the GHZ-type paradoxes for some typical four-qubit graph and non-graph states via the perfect Hardy-type paradox. The steering paradox for the mixed state in equation (6) was also observed. The three unequivalent GHZ-type paradoxes for graph states with m ≤ 4 Fig. 1 Five-qubit graph states and their verification. There are four inequivalent 5-qubit graph states, namely, the GHZ states G 5 j i, the linear cluster state LC 5 j i, the Y state Y 5 j i and the ring cluster state RC 5 j i. We derive the relation between the violation of the Bell's inequality I 5 4 and the fidelity between the tested and target states. The colored region means at least two qubits are entangled, and a value exceeding the LHV bound reveals the genuine multipartite entanglement.
were all tested in our experiment. Moreover, graph states with more qubits can be effectively generated in the linear optics setup by using, for example, the photon fusion gate 37 , the polarizing beam splitter (PBS) gate 38 and the controlled-Z gate 39 . In SI, we give a recipe for generating all m = 5 graph states.
In this work, the four-qubit state was encoded using a two photons scheme 40,41 , with each photon's polarization and path degrees of freedom utilizing two logical qubits. Figure 2a shows the quantum circuit for flexible state generation. Starting from a maximally entangled polarization qubit state of Φ þ ¼ ð 00 j i þ 11 j iÞ= ffiffi ffi 2 p , we applied a controlled-NOT gate on two path qubits to obtain the GHZ state GHZ 4 j i. For cluster state LC 4 j i generation, two Hadamard gates and a controlled-Z gate operating on the polarization qubits converted the state to ð þ þ 00 j iþ þ À 11 j i Þ = ffiffi ffi 2 p . We then projected the first two qubits of the input state onto 00 j i 00 h j þ 11 j i 11 h j basis to obliterate the different inputs on the polarization qubits. This process postselected the system wavefunction into the 4-qubit cluster state LC 4 j i. There is a 50% probability of conducting a successful postselection for such an input state. The final probabilistic gate was reminiscent of the PBS gate 38 in the linear optics system. When two photons meet at a PBS, only the superposition of wavefunction components with the same polarization results in coincident two-photon detection. Further generation of states LC 4 ðθÞ j iand GHZ 4 ðθÞ j ican be realized by performing transformation RðθÞ ¼ cos θ þ σ x sin θ on one of the polarization qubits. This gate is non-unitary and probabilistic, as is common in the one-way quantum computation scenario.
The experimental setup is shown in Fig. 2b. We exploited Hong-Ou-Mandel (HOM) interference 42 to certify the spatial and temporal overlap of the two photons at the PBS gate. As shown in the inset of Figs. 3 and 4, the visibility of the HOM dip was 97.1%, sufficient for observing the sharp Hardy-type paradox. Details about the setup and the HOM interference can be found in the Methods section.
The results for GHZ-type paradox observation via the perfect Hardy-type paradox observation (Eq. (7)) are plotted in Fig. 3. The probabilities of observing event correlations contrary to the LHV predictions for LC 4 ð0Þ j i GHZ 4 ð0Þ j i ; and GHZ 4 ðπ=4Þ j iwere 90.1%, 94.4%, and 96.2%, respectively. To statistically refute the LHV models, we notice that each of the investigated Hardy-type paradoxes effectively contains four contradictory predictions, and the error rate of each measurement must be lower than 1/4 to violate the Bell's inequality (4). The calculated detection probabilities are provided in the subplots of Fig. 3. All of the probabilities fall well into the statistically significant region (≥0.75 for all and ≤0.25 for nothing 43 ) by at least 56.0, 72.7, and 93.9 standard deviations, corresponding to the GHZ-type paradox for LC 4 ð0Þ j i GHZ 4 ð0Þ j i ; and GHZ 4 ðπ=4Þ j i , respectively. Here, the errors are calculated by assuming a Poisson distribution for counting statistics and resampling over recorded data. The residual experimental error is mainly due to the instability of the Mach-Zehnder interferometer, and the non-unity visibility of twophoton interference. Taking experimental imprecision into account, our results reasonably satisfy required constraints and achieve high probability of successful observation of nonclassical behaviors in the manner of a Hardy-type paradox.
Next, from the data for GHZ 4 ð0Þ j i , we kept only the events that register a result of +1 on the σ x measurement of the first qubit to prepare a GHZ 3 j i state. Under this postselection, the remaining three qubits still exhibited the GHZ-type paradox in Eq. (1); this manifestation can be employed to demonstrate the applications of quantum state verification and entanglement detection. The observed GHZ paradox precludes another possible form of genuine three-qubit entanglement, namely, the W-state 44 . By giving a value of I 3 ¼ 3:792, our experimentally prepared To experimentally test the steering paradox, we note that the classical prediction holds because the conditional density matrices for Bob are pure(See Supplementary Information for proofs of the theorem, some examples and experimental details.). Consequently, we need to estimate the lower bound for the dominant eigenvalue of Bob's unnormalized conditional density matrix, and here the entanglement detection methodology can again play a role. Experimentally, Bob was instructed to jointly measure σ y ⊗ σ x and σ x ⊗ σ y on his two qubits when Alice measured σ y ⊗ σ x on her qubits, and jointly measure σ x ⊗ σ x and σ y ⊗ σ y of his two qubits when Alice measured σ z ⊗ σ z on her qubits. Because the spectra of σ x ⊗ σ y + σ y ⊗ σ x and σ x ⊗ σ x + σ y ⊗ σ y are both {2, 0, 0, − 2}, the expectation value of σ x σ y þ σ y σ x and σ x σ x þ σ y σ y for the conditional states can be exploited as a lower bound for the largest eigenvalue of the unnormalized conditional density matrix. This lower bound is further utilized to calculate the quantum value of I s and experimentally reject the LHS prediction (See Supplementary Information for proofs of the theorem, some examples and experimental details.). See Fig. 4, the calculated quantum value of I s is 1.805 ± 0.014, which violates the prediction of the LHS model by 59 standard deviations, thus manifesting the nonclassical phenomenon of EPR steering.

DISCUSSION
This work advanced the study of the GHZ-type paradox in and beyond graph states. In Theorem 1, we present a unified construction of the GHZ-type paradox that naturally includes previous results for graph states. The paradox, when transformed into the Bell-type inequality, becomes an entanglement witness with a significantly lower threshold for refuting the separable models. These Bell-type inequality can also be exploited to estimate the fidelity between a quantum state and a target graph state, hence providing a promising way of evaluating the capacity of a quantum state in specific tasks such as quantum error correction 45,46 and magic state distillation 47 . Along with the Hamiltonian approach, we found that the GHZtype paradox also exists in non-graph states. On one hand, a family of non-graph states and mixed states that also exhibits the GHZ-type paradoxes. This observation suggests that even mixed states can serve as resources for tasks like quantum pseudotelepathy 48 and l2 measurement-based quantum computation 49 , Fig. 3 Experimental observation of the perfect Hardy-type paradox. Data points: Calculated success probabilities that eventuate in Hardytype paradox plotted against the state parameter θ. The error bars correspond to 1σ standard deviation. Gray points are for generalized cluster states and purple ones for GHZ states. Subplots: The sharp contradiction between LHV models and quantum theory corresponding to the Hardy constraints for given data points. Shaded areas represent the effective region of 75% visibility threshold. Dashed box: the Hong-Ou-Mandel dip of two photon interference (visibility = 0.971) and the Gaussian fitted curve. Each measurement result is recorded across a 30 s time span with the pumping power set to 20 mW. each of which typically requires highly-entangled pure states. On the other hand, the non-graph mixed states ρ(θ) can also be used for demonstrating the steering paradox 1 C = 2 Q . We hence enriched quantum paradoxes for more kinds of quantum nonlocality. Since the nonclassical event occurs ideally in every round of experiment, our method has the potential of detecting steering using very few copies of states.
We have experimentally tested the GHZ-type paradoxes for graph and non-graph states by measuring the success probability in Hardy's paradox under Hardy-type constraints. Thus, we provide a more efficient way to demonstrate the GHZ-type paradox by turning it into a Hardy-type one. Our methodology also sheds some new light on the construction of a genuine multipartite GHZ-type paradoxes. In SI (See Supplementary Information for proofs of the theorem, some examples and experimental details.) we show that the mathematical tool of local complementation 50,51 further enlarges the scope of quantum state verification. In particular, this method of quantum state verification is applicable to all the five-qubit graph states; we plan to investigate this property in the near future.

Construction of GHZ-type paradoxes for graph states
To formulate unified GHZ-type paradoxes for the graph states with at least one universal vertex, we start from the following observation: when two unconnected vertices are both connected to a third vertex, a minus sign appears in the product of the three stabilizers for these vertices when they are spanned on the Pauli basis, since the product on the third vertex gives σ z σ x σ z = − σ x . This gives a sign difference between classical and quantum prediction.
A GHZ-type paradox arise when we choose some products of the stabilizing operators (modulo the minus signs before the Pauli matrices), such that for every vertex, any Pauli matrix appear even times, so the product of the classical expectations is +1, regardless of the specific values assigned for the observables; and the three-stabilizer structure appears odd times, so the product of the quantum expectations is −1. In addition, to involve every vertex connected to the universal one in the GHZ-type paradox, they are required to subject to two-setting (instead of onesetting) measurements, so the paradox cannot be simply reproduced by a biseparable quantum state by setting the qubit on the + 1-eigenstate of the one-setting measurement 29 .
For clarity, here we explicitly demonstrate the construction on the case of n = even; the construction for n = odd is very similar. To exploit the constraint of two-setting measurement, an ansatz of operator choices can be conjectured as fS 1 ; ðÀ1Þ ai S ai 1 S i S iþ1 g, so that the first observable S 1 forces a σ z measurement on every peripheral vertices, leaving only one of σ x and σ y to be measured. This in turn gives a iÀ1 È C i iÀ1 ¼ a i È C iþ1 i for i = 3, 4, ⋯ , n, as can be deduced from the form of the ansatz. Finally, the product of the quantum predictions being − 1 requires P n i¼2 a i ¼ odd . Solving the logical equations for a i yields the results in Theorem 1.

Experimetnal setup
A 780 nm mode-locked femtosecond laser pumped an 1 mm-thick bismuth triborate (BiBO) crystal to prepare high-power ultraviolet beam, which further pumped two identical 1mm-thick, type-2 beamlike phasematching 52 β-barium borate (BBO) crystals, clipping on one true-zero-order half-wave plate (HWP), to prepare bright entangled biphotons 53 . After spatial and temporal compensation, the down-converted wavefunctions from two pump processes were overlapped and the fidelity of prepared state with Ψ þ j i ¼ ð HV j iþ VH j iÞ= ffiffi ffi 2 p is 0.991. Here, 0 j i pol ¼ H j i and 1 j i pol ¼ V j i indicate the horizontal and vertical polarization of the photon. After filtered by 3nm bandwidth interference filter, the photons were guided to the main setup by single-mode fibers (SMF), preceded and succeeded by one HWP respectively, to compensate polarization dispersion within the fiber.
In To make joint path-polarization measurement, another pair of BDs was introduced to combine the two paths again and form a Mach-Zehnder intereferometer. Before each BD, two groups of polarization controllers, each containing a quarter-wave plate succeeded by a HWP, were utilized to analyze state of polarization in each path. By carefully tilting the BDs, we compensated for the relative phase difference between the four possible paths. After the convergence of the displaced beams, another group of polarization controllers, together with a PBS, were used to measure the path state of each photon. The single-photon avalanche detectors were exploited to record coincidence counting rates. The length of the two Mach-Zehnder interferometers in the experimental setup was about 27.5 cm. The integration time was 20s for each data point, giving about 10 4 possible counts for each state.
The non-unitary RðθÞ gate is required for the realization of variable θ. A Sagnac ring interferometer in the dashed box in Fig. 2 is sufficient for such operation, which was omitted in the actual experiment. The HWP at θ/2 rotates the photon polarization, meanwhile, the HWP at 0 ∘ operating only on the counter-clockwise cycle of the ring provides the non-unitarity. Adding temporal compensation guarantees coherent superposition of the output beam. Nevertheless, by introducing a compensating HWP to flip the polarization state of a photon, the θ = π/4 case was also experimentally realized.
The PBS gate works ideally when the wavefunctions of the two incident photons are overlapped both spatially and temporally. However, due to the intrinsic difference between wavepackets of the two photons produced in type-II down-conversion 54 , spectral filter and intrinsic dispersion from SMF are not enough to render them identical. To synchronize the arrival time of the two photons and characterize their indistinguishability, we exploit the HOM interference 42 . Explicitly, we rotated the polarization states of both photons to D j i ¼ ð H j i þ V j iÞ= ffiffi ffi 2 p after they had passed through the first pair of BDs, measured the two polarizations on DA j i basis at the final detection, where A j i ¼ ð H j i À V j iÞ= ffiffi ffi 2 p , and projected both of the path qubits on u j i. By tuning the length of the delay line, we can scan the HOM curve as is presented in the inset of Fig. 3.

DATA AVAILABILITY
The data that support the findings of this study are available from the authors upon request.