A promise problem to decide whether two given pure quantum states are close or far apart Consider this problem in quantum cryptography:

We have two pure states $\phi_1,\phi_2$ as input and constants $0 \leq \alpha &lt;\beta \leq 1 $, where "Yes instances" are those for which $$\left|\left&lt;\phi_1,\phi_2\right&gt;\right| \leq \alpha$$ and "No instances" are those for which $$\left|\left&lt;\phi_1,\phi_2\right&gt;\right|\geq \beta$$

I need to devise a quantum circuit that accepts "Yes instances" with probability at least $p$, and "No instances" with at most probability $q$ for some $q&lt;p$.

How can I do this? Is there a reference in which this problem is solved?

Thanks in advance.
A standard tool is the swap test, which receives two unentangled pure states |φ1⟩ and |φ2⟩ and answers “equal” with probability (1+|⟨φ1|φ2⟩|2)/2 and “not equal” with probability (1−|⟨φ1|φ2⟩|2)/2.  See [BCWW01] (Figure 1 shows the circuit).

[BCWW01] Harry Buhrman, Richard Cleve, John Watrous, and Ronald de Wolf.  Quantum fingerprinting.  Physical Review Letters, 87, article 167902, Sept. 2001.  DOI: 10.1103/PhysRevLett.87.167902.  A preprint version: arXiv:quant-ph/0102001v1.