Optimal quantum-programmable projective measurements with coherent states

We consider a device which can be programmed using coherent states of light to approximate a given projective measurement on an input coherent state. We provide and discuss three practical implementations of this programmable projective measurement device with linear optics, involving only balanced beam splitters and single photon threshold detectors. The three schemes optimally approximate any projective measurement onto a program coherent state in a non-destructive fashion. We further extend these to the case where there are no assumptions on the input state. In this setting, we show that our scheme enables an efficient verification of an unbounded untrusted source with only local coherent states, balanced beam splitters, and threshold detectors. Exploiting the link between programmable measurements and generalised swap test, we show as a direct application that our schemes provide an asymptotically quadratic improvement in existing quantum fingerprinting protocol to approximate the Euclidean distance between two unit vectors.


I. INTRODUCTION
A typical experiment with measurement of a quantum state involves preparing a circuit, which is often classically controlled, to perform a vast range of operations on the state. The choice of measurement typically depends on the task at hand and is usually fixed beforehand. In some cases, one could alternatively use a measurement device which is classically (re)programmable to obtain a wide variety of measurement scenarios. Recent developments on this front involve a programmable optical circuit that can implement all possible linear optical protocols up to the size of that circuit [1]. The circuit involves Mach-Zehnder interferometers and thermo-optic phase shifters which are electronically and optically controlled.
In this work, we investigate an alternative scenario where a quantum input-rather than a classical program-controls the choice of measurement. This setting has applications in several quantum protocols for solving communication complexity problems. These include quantum fingerprinting protocols to check for equality between two given strings [2][3][4][5], Euclidean distance of two real vectors [6], and matching-based oneway communication complexity problems [7,8]. The choice of measurement being driven by an input quantum state has also been extensively used in cryptography settings such as private quantum money schemes [5,[9][10][11][12]. In these works, a central issue is to test whether two unknown quantum states are equal. Such a quantum state comparison can be performed using a programmable projective measurement device, where multiple copies of one of the two states to be compared act as program states The comparison of two states is trivial in the classical world, where two bit strings can be bit-wise checked and thus the maximum number of operations that are needed equals the size of the strings. However, comparing two quantum states is non-trivial since a quantum state is typically in a superposition over multiple possible basis states. If we simply follow the above classical procedure of individually measuring the quantum states in some fixed basis and comparing the measurement outcomes, then the basis measurement only reveals partial information about each quantum state, i.e., the amplitude corresponding to the specific basis state onto which the quantum state has collapsed. Hence, this measureand-compare approach does not work for comparing two unknown quantum states. Buhrman et al. [2] introduced a simple test, the so-called swap test, to compare two unknown quantum states with one-sided error probability, i.e., the test succeeds with certainty if the two quantum states are the same, however, there is a nonzero probability of failing the test if the two states are different. This test uses a controlled-swap operation and is optimal under one-sided error probability, if one only has a single copy of the two quantum states [13]. However, to succeed with an arbitrarily small desired error probability , this technique needs to perform independent tests on at-least logarithm of inverse-number of copies of both quantum states.
Generalising this scenario, Chabaud et al. [14] introduced a version of the swap test when one is provided with just a single copy of one of the states in some input register, and multiple copies of the other state in the program registers. They investigated the probability of a successful projective measurement on the input state in the basis of the program register state by constructing a circuit that takes as inputs the states in the input arXiv:2009.13201v1 [quant-ph] 28 Sep 2020 and program registers. They showed that this probability increases with the number of copies of the state in the program register. In particular, they proposed an implementation of a destructive state comparison test, where all output states are measured, with generic quantum states encoded in single-photons. They showed that the same implementation provides a programmable projective measurement scheme involving balanced beam splitters and photon number-resolving detectors, in which the states in the program registers approximate the direction of the measurement, which is performed on the state in the input register.
Their proposal, however, requires the creation and manipulation of high-dimensional superposition states, which is out of the reach of current experimental photonic technologies required for implementing quantum communication tasks. A major step in overcoming the difficulty in experimental realisation for such protocols requiring high-dimensional states was proposed by the theoretical work of Arrazola et al. [15]: their work maps any protocol involving pure states of many qubits, unitary transformations and projective measurement to protocols based on coherent states of light in multiple optical modes, passive linear optical transformations and single-photon threshold detection. Since coherent states of light are natural realisations of states produced by lasers, these are highly efficient to produce and manipulate experimentally. This model was subsequently used to demonstrate quantum advantage in quantum communication tasks [4,8,16].
Motivated by the coherent state mapping of quantum protocols, we extend the results of [14] and introduce a programmable device which uses coherent states of light to perform a given projective measurement onto program coherent states, with commercially available passive linear optics components such as balanced beam splitters and single-photon threshold detectors. Our scheme takes as input a single-mode coherent state (the input register) and M − 1 copies of some coherent state |β (the program registers) and approximates the projective measurement {|β β| , 1 − |β β|} on the state in the input register in a single run. We provide and discuss three practical implementations of our programmable projective measurement scheme. The three schemes, which we will refer to as the Hadamard scheme, the amplifier scheme, and the looped amplifier scheme, respectively, all provide an optimal projective measurement with one-sided error probability given a single copy of the input register and M − 1 copies of the program registers, in the sense that they achieve the best possible approximation of the projective measurement using M − 1 program states. The schemes differ, however, in the number of linear optics components. While all three schemes are efficient, the looped amplifier scheme is the most practical scheme requiring a single balanced beam splitter and a single threshold detector.
In addition to substantially reducing the experimental requirements, we obtain two additional advantages in our scheme compared to the original scheme of [14].
First, our scheme is non-destructive, implying that the remaining output state after the projective measurement is not destroyed and can be used as a resource for subsequent tasks. The second advantage is that from the use of coherent states we obtain a more 'faithful' projective measurement than using a single-photon encoding, implying better probability in carrying out a successful projective measurement.
Next, we extend our scheme to allow the input register to be obtained from an untrusted source: instead of requiring that the state in the input register is a coherent state, we allow any generic quantum state as an input, while the states in the program registers are still obtained from a trusted coherent state source. This setting is very natural in quantum cryptography and in verification of quantum state preparation [10,12]. In this setting, we also show an optimal approximate projective measurement on the input state, thus finding relevance when such a measurement is a part of some verification protocol. Our result enables an efficient verification of an unbounded untrusted source with only trusted coherent states, balanced beam splitters and threshold detectors.
As a final result, we give an application of our generalised scheme by showing an at-most quadratic improvement in an existing quantum fingerprinting protocol to approximate the Euclidean distance between two unit vectors [6].
The paper is organised as follows. In section II we review the existing state comparison techniques for qubit states and coherent states. Following [14], we then consider the setting of a single input register state and multiple program register states, where both the input register state and the program register states are coherent states, in section III. We introduce three different schemes for performing state comparison and programmable projective measurement with coherent states: the Hadamard scheme, the amplifier scheme and the looped amplifier scheme. Further, in section IV, we give the proof for the optimality of our projective measurement for all three schemes, under the one-sided error requirement. We then analyse the robustness of our schemes by considering experimental imperfections in section V. In section VI, we drop the assumption that the incoming input register state is a coherent state. We further prove that our projective measurement scheme is also optimal in this case. We conclude with section VII by giving a concrete improvement of the quantum fingerprinting protocol to solve the Euclidean distance problem [6].

II. QUANTUM STATE COMPARISON
A circuit for comparing two unknown qubit states, known as the swap test, was first introduced by Buhrman et. al. [2]. The analogue of this test when the states are unknown coherent states was introduced in [15]. We briefly review these two tests here.

A. The swap test
The swap test uses a controlled-swap (C-SWAP) gate applied on two unknown qubit states |φ and |ψ , and controlled by an ancilla qubit, as shown in Fig. 1. Applying the circuit and measuring the ancilla qubit gives the output 1 with a probability P(1) = 1 2 (1 − | φ|ψ | 2 ), and the output 0 with probability P(0) = 1 − P(1).
We define the completeness and soundness of this test as follows: Completeness: If the states |φ and |ψ are the same, then there is a zero probability of the outcome being 1. We say that the test has perfect completeness c 2 = 1, where the completeness is defined as c 2 = 1 − P(1), when the input states are the same. The subscript denotes that two states have been used for testing. Alternatively, we say that the test meets the one-sided error requirement when it has perfect completeness.
Soundness: If the states are different, then with finite probability P(1), one is able to tell the states apart. Thus the soundness, defined as s 2 = P(1), is strictly greater than 0. The soundness of this scheme can be increased to any desired 1 − δ, by repeating the test O(log 1 δ ) times, using new copies of the states each time.
We note that this test provides an optimal comparison between two unknown states for the one-sided error probability.

B. Comparing two coherent states
The above swap test compares two unknown qubit states. If the unknown states are coherent states instead, then an analogous test can be performed by simply mixing the states on a balanced beam splitter (BS) and observing a photon click with a single-photon threshold detector (detector D 0 in Fig. 2).
This can be seen as follows. The beam splitter transforms the input mode creation operators {â † ,b † } into the output mode creation operators {ĉ † ,d † }. This input to output conversion is given by: (1) The input state at the beam splitter is where the subscripts denote the mode in which the coherent states enter the beam splitter. In the absence of experimental imperfections, this yields the output state The probability of obtaining a click in the detector D 0 (mode d) is We can relate the completeness c 2 and soundness s 2 of the test to the trace distance of the tested states |α and |β . The trace distance for two coherent states {|α , |β } is We assign the detection event (obtaining a click in D 0 ) the value 1, and to the other detection event (no click in detector D 0 ) the value 0. The completeness and soundness for this test are: Completeness: If the states are the same, then their trace distance is 0, since |α = |β . This implies that | α|β | = 0 thus leading to P D0 = 0. This ensures perfect completeness c 2 = 1, where the subscript denotes the size of the interferometer.
Soundness: Suppose the states |α and |β are far in trace distance meaning, From this we can upper bound the soundness s 2 as, This implies that the soundness is strictly greater than 0 for a non zero . The soundness can be decreased to any desired δ by repeating the measurement procedure for O(log 1 δ ) runs. Further, this method provides an optimal comparison between two unknown coherent states under one-sided error probability. We prove this more generally in section IV The probability of obtaining a click in D0 relates to the projective measurement test of distinguishing the two coherent states.

III. GENERALISED SINGLE RUN COHERENT STATE COMPARISON
Having briefly reviewed existing unknown state comparison techniques, we now consider the scenario where we have a single copy of an unknown coherent state |α in the input register and multiple copies of the coherent state |β in the program register. The task is to check if the state in the input register is equal to the state in the program register.
In the simplest case, the state comparison can be performed with a single copy of the state in the program register, like in the previous section. This succeeds with a probability given by Eq. (4). In this section, we prove that having multiple copies of |β increases the success probability of state comparison with the state |α . For this, we first provide a generalised interferometer construction, the Hadamard scheme, based on Hadamard-Walsh transforms, following [14]. We then derive the amplifier scheme requiring much less optical gates and detectors than the previous scheme. Finally, we modify the amplifier scheme to construct an even simpler scheme, the looped amplifier scheme.

A. The Hadamard scheme
In [14], it is shown how to perform state comparison and programmable measurements with linear optics using generic quantum states encoded in degrees of freedom of single photons. These photons are fed into an specific interferometer, the Hadamard interferometer, which we review below. All output modes of the interferometer are then measured with photon number-resolving detectors and the classical outcomes are post-processed to retrieve the statistics of a projective measurement. In what follows, we adapt and simplify their approach to the case where the input states are coherent states. We show that single-photon threshold detectors are sufficient for our needs, obtaining a practical scheme.
Input State: Suppose the input is M coherent states, where M is a power of 2: where the subscript denotes the mode in which the coherent state enters the generalised interferometer (indexed from 0 to M − 1). For brevity, we address this state as |αβ . . . β . This input state is then fed in an interferometer of size M . For M = 4 spatial modes, this interferometer is described by the Hadamard-Walsh transform of order 2: where H is a Hadamard matrix. The corresponding interferometer for M = 4 is depicted in Fig. 3.
In the general case, the Hadamard interferometer of order M is described by the Hadamard-Walsh transform of order n = log M , which is defined by: with H 0 = 1 and H 1 = H.
Output state: The input coherent states |αβ . . . β upon interaction with the interferometer of order n transforms as: where, with a simple induction, we obtain δ 0 = α+(M −1)β √ M and δ k = α−β √ M for k > 0. Thus the last M − 1 modes have the same probability of a click when we detect with single-photon threshold detectors. The probability P ∅ that none of the M − 1 detectors clicks is: In particular, for all α, β ∈ C, P ∅ (α, β, +∞) = | α|β | 2 , which corresponds to a perfect projective measurement of the states |α and |β . Writing x := | α|β | 2 the overlap of the test and program register states, we obtain Assigning to this detection event (none of the detectors clicks) the value 0, and to other detection events (at least one of the M −1 detectors clicks) the value 1, we obtain a device whose statistics mimic those of a projective measurement, with The test based on single-photon encoding from [14] requires using M number-resolving detectors. On contrary, the encoding with coherent states requires M − 1 single-photon threshold detectors. Experimentally, this is much more cost effective and relatively easier to implement. The test based on coherent state encoding has the following characteristics: Completeness: If the states are the same, then the trace distance |α α| − |β β| tr = 0, and hence the probability of having the detection event 1 is 0. Thus, the completeness of this scheme is c M = 1.
Soundness: If the states {|α , |β } are far apart in trace distance, then using Eq. (5), and the fact that the soundness is Moreover, contrary to single-photon encoding, the Hadamard scheme with coherent state encoding is nondestructive, as the first output mode is not measured. An other advantage with coherent state encoding is that it gives a more faithful projective measurement than the single-photon encoding in [14]. Indeed,the statistics corresponding to a perfect projective measurement are where x is the overlap between the input state and the program state, while for the single-photon encoding, with an M -mode input state |φψ . . . ψ , the corresponding statistics as obtained in [14] are and for any given value of the overlap x we have: where the term on the left hand side corresponds to a perfect projective measurement (Eq. 16)), the central term corresponds to our coherent state scheme (Eq. (14)) and the term on the right hand side corresponds to the singlephoton scheme (Eq. (17)). In particular, for a given size M , the maximal statistical gap with a perfect projective measurement is, for the single-photon encoding, and for the coherent state encoding, which is lower than the single-photon encoding gap. This happens because for the single-photon encoding no assumption is made about the states |φ and |ψ , while the states |α and |β are assumed to be coherent states. This additional information about the states allows to better approximate a perfect projective measurement with the same number of input states. A related question would be, is the generalised Hadamard scheme optimal? Or can a better measurement setting improve the state comparison? We show in section IV that the generalised Hadamard interferometer is actually optimal for approaching perfect projective measurement with coherent states, under the one-sided error requirement. However, we already show in the next paragraph that there exists a simpler measurement setting than the Hadamard interferometer, achieving the same performance in the test.

B. The amplifier scheme
The Hadamard scheme of size M described in the previous section uses (M log M )/2 balanced beam splitters and M − 1 single-photon threshold detectors. We introduce a simplified scheme of the same size, which only uses M − 1 balanced beam splitters and log M detectors, and show that it achieves the same performance than the Hadamard scheme. We refer to this scheme as the amplifier scheme, since it maps identical input coherent states to an amplified coherent state in the first output mode and the vacuum in all other modes. For M = 4 spatial modes, this interferometer acting on modes {0, 1, 2, 3} is described by the following unitary matrix: where H i,j corresponds to the balanced beam splitter operation acting on modes i and j (where the modes are indexed from 0 to M − 1) and identity on the other modes (Fig. 4).
The generalised amplifier interferometer is defined by induction: where n = log M and where U 1 = H 0,1 = H is a Hadamard matrix. This induction relation is illustrated in Fig. 5. Indexing the spatial modes from 0 to M − 1, the 2 k output modes are measured with single-photon threshold detectors, for k = 0 . . . n − 1. A simple induction shows that the output state in the 2 k output mode is | α−β 2 k+1 2 . Hence, the probability that none of the n = log M detectors clicks is given by thus retrieving the statistics obtained with the Hadamard scheme, using only n = log M detectors. Moreover, another simple induction shows that the amplifier interferometer can be implemented with only M − 1 balanced beam splitters.

C. Looped amplifier scheme
Noting the recursive character of the amplifier scheme, we present another possible implementation of the amplifier scheme using a looped beam splitter interaction, one single-photon threshold detector and an active optical element, namely a switch (Fig. 6).
This setup now uses an active optical element and a constant number of passive linear optical elements, and approximates a perfect projective measurement up to arbitrary precision. It works in the following manner. Initially the states |α and |β are mixed on a balanced beam splitter. This results in a probability of not obtaining a click in the detector D 0 given by If a click is detected in D 0 , then one immediately concludes that |α = |β . Otherwise, in the next iteration, the switch connects to the upper arm and the next interaction with the beam splitter results in, where in the lower arm the amplitude of the new coherent pulse has been multiplied by √ 2. The coherent state | √ 2β is produced using variable optical attenuator (VOA): an active optical element to prepare coherent states with desired amplitude by the varying the intensity in the attenuator. Iterating this over n = log M runs, where at the k-th run, the upper arm corresponding the unmeasured output state interacts with the local state |2 (k−1)/2 β (produced using VOA) in the beam splitter, the probability that there is no click obtained D 0 over all the runs is the same as Eq. (23). Hence, by construction, the statistics of the setup after n − 1 pulses {|β , · · · |2 (n−1)/2 β } sent reproduce those of the amplifier scheme of size M .
The three schemes discussed provide experimentally friendly devices to perform a variety of quantum information processing tasks using coherent states, ranging from state comparison to programmable projective measurements, in a non-destructive manner. We show in the next section that these schemes are optimal for coherent state comparison under the one-sided error requirement.

IV. OPTIMALITY OF THE GENERALISED TEST
An extension of the results in [17], which studies the problem of unambiguous comparison of unknown coherent states, proves the optimality of both the Hadamard scheme and the amplifier scheme for coherent states comparison, under the one-sided error requirement. In other terms, since these schemes satisfy the promise of perfect completeness, we show that they achieve minimal soundness.
A. Optimal POVM for comparing coherent states under the one-sided error requirement Let {Π 0 , Π 1 } be a POVM for comparing coherent states |α and |β under the one-sided error requirement, when provided a single copy of |α and M − 1 copies of |β (the proof of [17] assumes M = 2). The operator Π 0 corresponds to saying that the states |α and |β are the same, while the operator Π 1 corresponds to saying that they are different. These operators thus verify the following conditions: where I is the identity operator, and ∀α ∈ C, Tr Π 1 |α α| where the last condition is the one-sided error requirement. Integrating this condition over C yields where we have defined Note that the condition in (28) is equivalent to the onesided requirement in (27) because the operators Π 1 and |α α| ⊗M are positive. The operator M π ∆ M is actually a projector. This result can be obtained by writing the state |α in the Fock basis and an integration in polar coordinates, where α = re iθ (the derivation is detailed in Appendix A). From Eq. (29) we obtain where we have defined for all N ≥ 0, (32) Note that, with the same proof, this choice of POVM is also optimal in the generalised setting where one is given one unknown generic state (not necessarily a coherent state) and M − 1 unknown coherent states, and is asked to test if all the states are identical or not.

B. The Hadamard interferometer is optimal for coherent state comparison
We now show that the POVM {Π h 0 , Π h 1 } corresponding to the Hadamard interferometer with threshold detection of the last M − 1 modes is optimal for coherent state comparison under the one-sided error requirement, i.e., where Π opt 0 is defined in Eq. (32). We have whereĤ n is the unitary evolution corresponding to the action of the interferometer of order M defined in Eq. (10) in the M -mode infinite-dimensional Hilbert space, with n = log M , and where is the POVM operator corresponding to the event where none of the M − 1 threshold detectors clicks. We obtain For k = 1, . . . , M , we writeâ † k the creation operator for the k th mode. For all N ≥ 0 we have, where we have usedĤ n |0 , the multinomial formula, and Eq. (31). With Eqs. (32) and (36), this concludes the proof.
Given that the statistics obtained with the amplifier scheme and the looped amplifier scheme mimic those of the Hadamard scheme, these schemes are also optimal for the same state comparison task.

V. ANALYSIS WITH EXPERIMENTAL IMPERFECTIONS FOR M = 4 MODES
While these devices are relatively easy to implement, any implementation would suffer from experimental imperfections. In this section, we analyze the performance of the amplifier scheme in presence of such imperfections. Our error model is the following, with three major sources of error: (i) limited detector efficiency and channel transmission loss, characterized by a parameter 0 ≤ η ≤ 1. This changes the coherent state α to √ ηα thus reducing the probability of obtaining a click using a single-photon threshold detector by a factor η; (ii) limited beam splitter visibility 0 ≤ ν ≤ 1, which may lead to a click in the wrong detector; (iii) dark counts in the detectors characterized by a probability p dark . For our analysis, the click probability due to the coherent states is O(1) and thus significantly larger than the dark count probability p dark (∼ 10 −8 ) observed in the standard commercially available superconducting nano-wire single photon detectors. The dark count effect can thus be safely ignored.
For M = 2, when the input |α , |β is fed in an imperfect beam splitter, the transformation from input modes to output modes is the following: where k + = (α + β)/ √ 2 and k − = (α − β)/ √ 2. The corresponding unitary transformation is Next, we consider the case of M = 4 spatial modes (Fig 4), indexed from 0 to 3. We apply the imperfect transformation on the input |αβββ . This results in where from Eq. (21) we derive Adding the channel and detector losses η, the output is mapped as δ k → √ ηδ k , for all k.
Similar to the analysis without experimental imperfections, the output modes 1 and 2 of the imperfect amplifier interferometer are measured, with the coherent state input being |αβββ . The probability P ∅ that none of the two detectors clicks is: Assigning to the detection event no detector clicks the value 0, and to other detection events, i.e., at least one of the detectors clicks, the value 1, we obtain a device whose statistics mimic those of a projective measurement.
Completeness: When the states are the same, the correctness, which is the probability of not obtaining the detection event 1 is (43) We observe that if ν = 1 (no imperfections), then c exp 4 = 1, thus we obtain perfect completeness.
Comparison of Completeness with the M = 2 scheme: The analogous completeness in M = 2 scheme is From Eq. (44) and Eq. (43), we observe that c exp 2 ≤ c exp 4 , which implies that the completeness in the M = 4 scheme is less than the completeness in M = 2 scheme. The reduction in completeness probability for the M = 4 scheme is precisely what accounts for an increase in soundness probability (when the input and program register states are different), which we detail in the next paragraph.
Soundness: If the states are different, the probability of obtaining the detection event 1 (soundness) is computed in Appendix B and given by: The analogous soundness for the M = 2 scheme with experimental imperfections reads: In the absence of any experimental imperfections, it is straightforward to see that s 4 is always greater than s 2 . We show that, even with experimental imperfections, s exp

VI. STATE COMPARISON FOR AN UNTRUSTED SOURCE
We now consider an adversarial scenario where the unknown state in the input register is not restricted to being a coherent state, but can be any generic (mixed) quantum state produced by some untrusted party, while the states in the program register are coherent states obtained from a trusted source. The task is then to check whether the states in the input and program registers are equal. We first analyse this state comparison task under one-sided error when the program register contains a single coherent state |β . Subsequently, we generalise the state comparison procedure by allowing the multiple copies of |β in the program register. We note that in both settings, we receive only a single unknown state from the untrusted source. We conclude this section by proving that our scheme is optimal for state comparison even when we do not make any assumption whatsoever about the state in the input register.

A. State comparison with a single copy of the test and program register states
We consider the scenario where the input register state is a generic quantum state τ and the program register state is a coherent state |β . Any single-mode state τ can be expressed in the Fock basis as with the normalization condition n≥0 τ nn = 1, coming from from Tr(τ ) = 1. Let us look at the completeness and soundness arguments again: Completeness: If the states are τ and |β are the same, then their trace distance is 0. Thus, the probability of having the detection event 1 is zero. This ensures perfect completeness again, i.e., c 2 = 1.
Soundness: Trace distance. Suppose τ −|β β| tr ≥ . This implies so β| τ |β ≤ 1 − 2 . We show in Appendix D that the probability of obtaining a click in the detector D 0 after the interaction of the states τ and |β in the balanced beam splitter is tightly lower bounded as Thus the soundness in this case is s 2 ≥ 2 2 .

B. Generalised single run state comparison
The generalised single run state comparison scheme is run on a single unknown state τ (Eq. (47)) in the input register and M − 1 coherent states |β in the program register. Here we analyse the completeness and soundness of the amplifier scheme used for comparison as described in section III B.
Completeness: If the states τ and |β are the same, then their trace distance is 0, and the probability of a click in at least one of the detectors in output modes 2 k is 0. Thus we obtain perfect completeness c M = 1.

Soundness:
Suppose τ − |β β| tr ≥ , so β| τ |β ≤ 1 − 2 . We show in Appendix E that the probability that at least one of the detectors in output modes 2 k clicks after the interaction of the states τ and |β in the balanced beam splitter is tightly lower bounded as Thus the soundness in this case is s M ≥ 1 − 1 M 2 > s 2 for M > 2. The bound improves by adding more copies of the program register states, as can be expected.

C. Test optimality
The proof of optimality derived in section IV holds even when the input register state is a generic mixed state, as long as the program register states are coherent states. Indeed, the optimal POVM for state comparison, when one has a single copy of input register state and M − 1 copies of the program register states, is derived assuming it satisfies the completeness relation in Eq. (27), which is also the case here. This implies that the optimal POVM when the tested state is generic, while the program register states are coherent states, is the same as the one constructed in section IV. This proves the optimality of our proposed projective schemes, in this generalised setting.

VII. IMPROVED QUANTUM FINGERPRINTING
As a concrete example of an application of our generalised state comparison scheme, we consider the improvement in performance of a specific quantum communication protocol: the quantum fingerprinting protocol for estimating the Euclidean distance of two real vectors within a constant factor. Our model of study is the simultaneous message passing model of communication complexity [6]. The communication task is as follows. Two parties Alice and Bob receive data sets x and y respectively, which are unit vectors in R n . They are interested to check the similarity of their data sets, through a Referee, by estimating the (square of the) Euclidean distance of their vectors, ||x − y|| 2 2 = n j=1 (x j − y j ) 2 within some multiplicative constant with a probability at least 1−δ.
A trivial solution to this problem would be Alice and Bob transmitting the strings x and y respectively to the Referee. This however is a non-optimal protocol in terms of communication resources (number of bits sent to Referee) when the task is only to approximate the Euclidean distance. As we show, the task can be solved with much lower communication resources when Alice and Bob send the fingerprints of their data sets, which would typically be of much shorter length while still allowing the Referee to estimate the Euclidean distance within some constant. When we restrict the model to Alice and Bob sharing no randomness, the classical fingerprint size necessary to solve this problem is Ω( √ n) [18][19][20][21]. Motivated by the original quantum fingerprinting protocol of Buhrman et al. [2] to check for the equality of two n-bit strings, Kumar et al. [6] proposed a coherent state quantum fingerprinting protocol to estimate the Euclidean distance with O(log n) qubits which is asymptotically exponentially shorter in size compared to the classical fingerprints. We note that a similar improvement in resources for the approximately checking the equality of two bit strings problem was proposed by [3] in the coherent state framework and subsequently demonstrated in [4,16].
A. Quantum fingerprinting protocol to approximate the Euclidean distance Here we review the coherent state fingerprinting protocol proposed by [6] to approximate the Euclidean distance. Alice and Bob prepare quantum fingerprints of their data sets, which are a sequence of coherent pulses in n modes, and send these to the Referee. Alice (similarly Bob) prepares her state |1 x by applying the displacement oper-atorD x (1) = exp(â † x −â x ) to the vacuum state, wherê a x = n j=1 x jbj is the superposed annihilation operator [3], andb j is the photon annihilation operator of the j th mode. The coherent state fingerprint of Alice is then, where |x j j is a coherent state of amplitude x j occupying the j th mode. The mean photon number for the state |1 x is given by µ = j |x j | 2 = 1, independent of the input size. This scheme is illustrated in the Fig. 7. The Referee interacts the coherent fingerprints from Alice and Bob sequentially using a balanced beam split- ter and observes the single-photon clicks in a threshold detector D 0 . The input of the interaction is The output in the mode corresponding to the detector D 0 at the j th pulse is | . Let Z j be the binary random variable which equals 1 with the probability that the detector D 1 clicks at the j th pulse, namely . The latter approximation holds true since x and y are unit vectors in R n and for large n the terms (x j − y j ) 2 are typically of the order of 1/n. The Euclidean distance (Ẽ) is equal tõ The Chernoff-Hoeffding inequality [22] can then be used to estimateẼ with n j=1 Z j within a mutiplicative precision > 0: Eq. (54) provides the Referee with the estimation of the Euclidean distance between two unit vectors x and y within a desired multiplicative precision , with a success probability at least 1 − 2δ, with δ = exp(− 2Ẽ 6 ) in a single run.
For the coherent state fingerprint with an average photon number µ = 1 across n time modes, the fingerprint size (transmitted information) is O(log n). Thus the estimation of the Euclidean distance within ( , δ), requires Alice and Bob each to send exponentially smaller sized fingerprints to the Referee than the classical analogue of O( √ n).

B. Improved quantum fingerprint protocol
Here we consider the performance of our generalised state comparison method and demonstrate that in a single run, the Referee is able to estimate the Euclidean distance of two vectors x, y ∈ R n with substantially better probability than the original fingerprinting protocol. The setting is as follows: Similar to the protocol of [6], Alice and Bob prepare their quantum fingerprints |1 x and |1 y respectively as sequence of coherent pulses in n modes. Here, one of the parties, say Alice, sends a single copy of the fingerprint state to the Referee, while Bob sends multiple, M − 1, copies of the fingerprint state to the Referee. Fig. 8 illustrates the setting where upon receiving the fingerprint states, the Referee applies the projective measurement scheme. Here we showcase the amplifier scheme, but the same results are obtained using the Hadamard and looped amplifier schemes.
The referee applies the generalised amplifier interferometer U log M of Eq. (22)  Let Z j,k be the binary random variable that is 1 with the probability that the detector indexed D k clicks at the j th pulse, with j ∈ {1, . . . , n} and k ∈ {0, . . . , log M − 1}, . Again the approximation holds true since x and y are unit vectors in R n and for large n the terms (x j − y j ) 2 are typically of the order of 1/n. The Euclidean distance (Ẽ) in this case is equal to, Once again, the Chernoff-Hoeffding inequality can be used to estimateẼ with n,log M −1 j=1,k=0 Z j,k within a multiplicative precision > 0: where 2δ is the failure probability in estimating the Euclidean distance in the original fingerprint protocol.
With the improved quantum fingerprinting protocol, we conclude with Eq. (56) that the Euclidean distance between two vectors x and y can be estimated within an additive factor with a probability 1 − 2δ 2(1− 1 M ) which is better than the original protocol by a factor 2 1 − 1 M > 1 for all M > 2. For example, M = 4 already provides a power 1.5 improvement in the probability of successfully estimating the Euclidean distance. We note that when Bob sends M − 1 coherent state fingerprints to the Referee, this leads to the total transmitted information to be M × O(log n). As long as M is independent of n, we still achieve an asymptotic exponential reduction in transmitted information compared to the classical analogue of O( √ n).

VIII. DISCUSSION
We have presented an optimal programmable measurement scheme that projects the incoming single mode state in the input register onto a local coherent state in the program register. Our scheme is implemented using balanced beam splitters and single-photon threshold detectors. Our implementation of this interferometer is efficient, and threshold detectors with high efficiency and low dark counts are commercially available [23]. Our most efficient scheme in terms of optical components, the looped amplifier scheme, requires only a single beam splitter and a single threshold detector, together with an optical switch. We have further generalised our schemes to a cryptographic setting where the input register state is obtained from an untrusted source, and is no longer assumed to be a coherent state. This universal implementation using coherent states as program states can act as a backbone in improving the performance of a range of quantum protocols in communication complexity [2,24], cryptography and computational regimes [25][26][27][28][29][30]. For example, it has been shown that communication protocol using coherent state fingerprints provides an asymptotic exponential advantage in communication resources in estimating the Euclidean distance between two vectors compared to any classical protocol [6]. For this protocol, we show a further quadratic improvement in the probability of correctly estimating the Euclidean distance compared to the original protocol.
The general applicability of our optimal state comparison schemes makes it attractive to be readily implementable. Another feature that we bring is that the output quantum states are not completely destroyed after the performing the comparison test. Further, the output states carry the overlap information of the unknown quantum test. Since the function x → 1 − e −x is increasing, it is sufficient to show that A 2 ≤ A 4 for all α, β. Writing α = re iφ and β = te iψ , where r, t ≥ 0 and φ, ψ ∈ [0, 2π], we obtain

(C3)
This last expression is a polynomial of degree 2 in r, with a positive leading coefficient. Thus if its discriminant is negative, then the expression is always positive. The discriminant is where the third line is obtained by using cos(φ − ψ) ≤ 1. Hence for all experimental parameters within the error model we consider, we have s exp 2 ≤ s exp 4 .
The probability that the detector D 0 , corresponding to the output mode d, does not click is given by: (D3) Note that this inequality is an equality whenever ψ n = 0 for n > 1. Given that P D1 = 1 − P ∅ , this yields which concludes the proof when β = 0. Now if β = 0, we define whereD is a displacement operator, with |β = D(β) |0 , so that |ψ = D(β) |φ and | ψ|β | 2 = | φ|0 | 2 . The input state is given by where the subscript indicates the modes onto which the displacement operator acts. The probability that the detector D 0 does not click after the beam splitter interaction is then given by: Now we haveĤ Hence, and the previous proof for β = 0 gives Finally, since | ψ|β | 2 = | φ|0 | 2 , we obtain and this inequality is an equality whenever φ|n = 0 for n > 1, with |φ =D † (β) |ψ .