I've been struggling with this for a while now, and whilst I suspect the answer is unknown or very complicated, I thought I'd ask regardless.

Suppose I have some states $|\psi_i\rangle = \sum_{j=1}^n a_{ij} |j\rangle : i,n\in\mathbb{Z}^+$, and $\langle\psi_i|\psi_i\rangle=1$ holds true (i.e., are normalsied). I also have some conditional statements about the measured values these states are allowed to take to be a valid solution to my problem, using only XOR ($\oplus$) and AND ($\land$).

For instance, I might have three states $|\psi_1\rangle$, $|\psi_2\rangle$, and $|\psi_3\rangle$, which, when measured, in order to satisfy my problem must also satisfy $(\psi_1\oplus \psi_2)\land(\psi_2\oplus\psi_3)\land(\psi_1\oplus \psi_3)$. Of course, when I talk about satisfying a condition after measurement, I mean to a high probability.

How does one, or can one, go about implementing this kind of logic in a quantum circuit? I feel that since each operation would entangle the states, that this is not possible.

I've thought about and tested a Swap test, but this has a number of issues.

Any help or thoughts would be greatly appreciated.


1 Answer 1


Disclaimer: Just few ideas, this is not full answer.

XOR function is implemented by CNOT gate since:

  • $|00\rangle \rightarrow |00\rangle$
  • $|01\rangle \rightarrow |01\rangle$
  • $|10\rangle \rightarrow |11\rangle$
  • $|11\rangle \rightarrow |10\rangle$

Assuming the result is on second qubit, you can see it is the XOR of $q_1$ and $q_2$, the first qubit of the result is identity of the first qubit.

AND function is implemented by Toffoli gate (assuming $|0\rangle$ is put on target qubit).

You can use CNOT also as fan-out gate and "copy" your states to ancilla qubits and then implement with CNOTs and Toffolis. After that, measure your states and also result of the logical function indicating whether the condition is met (or what is a probability of $|1\rangle$). Maybe, some simplified solution minimizing number of ancillas is possible but I have not time to think about it.

Another possibility is to firstly measure your states and then check the condition classicaly. If it is fullfiled, you accept the result or discard it otherwise.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.