# Are there multiple control quantum gates where the control bit is an OR relationship?

In general, the control bits of a multi-control bit quantum gate are in an AND relationship. Is there a quantum gate that makes the control bits an OR relationship?

If you can implement standard AND-controlled $$U^\dagger$$ gate you can implement your OR-controlled $$U$$ gate without any additional controls, as follows

This is an example for the $$S$$ gate and 2 control qubits, but it applies universally. A qiskit code snippet for checking.

from qiskit import QuantumCircuit
from qiskit.circuit.library import SGate
from qiskit.quantum_info import Operator
import numpy as np

qc = QuantumCircuit(3)
qc.x(0)
qc.x(1)
qc.s(2)
qc.append(SGate().control(2).inverse(), [0, 1, 2])
qc.x(0)
qc.x(1)

u_target = np.kron(np.diag([1, 0, 0, 0]), np.identity(2))+np.kron(np.diag([0, 1, 1, 1]), np.array([[1, 0], [0, 1j]]))
u_qs = Operator(qc.reverse_bits()).data

print(np.allclose(u_target, u_qs))
qc.draw(output='mpl')

• Great, looks like it saves qubits more than the first option. Jul 17 at 12:35
• @R-XZhao 'saving qubits' might have multiple meanings, such as gate count, gate depth or something else. It's better to say precisely what are you optimizing for. Jul 17 at 13:07
• I'm building a PQC where one of the submodules wants to implement multiple control quantum gates, and the control relationship is OR or XOR. I can design it by referring to the QISKIT official guide, but it uses a large number of auxiliary qubits, which is a challenge in the nearly 29 qubits system. Jul 17 at 13:12
• So my idea is to use as few auxiliary qubits as possible without changing the number of qubits, otherwise it will become difficult to achieve. Jul 17 at 13:14

You can use the fact that: $$a \lor b = \neg(\neg a \land \neg b)$$ For example, in the following circuit the unitary is applied if either $$q_0$$ or $$q_1$$ (or both) equals $$1$$:

• This seems to be no longer a gate, but a network. I don't know if there is a quantum gate with OR relationship in quantum information. It can be optical or superconducting. At present, the network is very bloated because of the single relationship of control bits. Jul 16 at 12:15
• May I ask if it is possible to design a quantum circuit in which the control bits are in an XOR relationship, hoping to save qubits as much as possible. Jul 16 at 12:17