I am looking to do a $CNOT$ on itself, i.e., if the qubit is in $|0\rangle$ it stays in $|0\rangle$ and if it is in $|1\rangle$ it becomes $|0\rangle$. We are allowed to use $H$, $X$, $Z$, and $CNOT$ gates.
-
1$\begingroup$ $\left \{ |0\rangle \to |0\rangle, |1\rangle \to |0\rangle \right \}$ operation cannot be a unitary for a single qubit. You will need extra qubits or environment. The operation you want to do is standard a lowering operator $\sigma_- = |0\rangle \langle 1|$. $\endgroup$– FDGodSep 23 at 0:17
1 Answer
Quantum operations have to be reversible and the operation you described is not reversible. Both 0 and 1 map to 0, so it is a many-to-one function and thus if you are just given 0 you have no methodology of deriving what input caused that.
However, you can do it using classical logic if your simulator or quantum computer supports using boolean functions.
measure q[0] -> c[0];
if(c==1) x q[0];
Here you measure the qubit and store the value into a classical bit and if the value is a 1 then you flip the qubit to a zero.
Some simulators also support an instruction called "reset" that basically does this in a single step.
reset q[0];