In[]:=
toffoli=QuantumCircuitOperator[{"0"->4,"1"->5,"0"->6,QuantumOperator["Fredkin",{1,2,4}],QuantumOperator["Fredkin",{4,5,6}],QuantumOperator["Fredkin",{1,2,4}],QuantumOperator["Fredkin",{3,5,6}]}];
In[]:=
toffoli["Diagram"]
Out[]=
In[]:=
toffoli/*("Discard"->#&/@{3,4,5})
Out[]=
QuantumCircuitOperator
Can’t discard like this in real world!
In[]:=
toffoli/*("Discard"->#&/@{3,4,5})==QuantumOperator["Toffoli"]
Out[]=
True
And this is not Toffoli:
In[]:=
toffoliDouble=toffoli["Double"]/*{Splice["Discard"[4]->#&/@{3,4,5}],"I"[4]->6->3}
Out[]=
QuantumCircuitOperator
In[]:=
toffoliDouble==QuantumOperator["Toffoli"]["Double"]
Out[]=
False
Because these discards are not the same!
In[]:=
QuantumOperator["Discard"[4]]==QuantumOperator["Discard"]["Double"]
Out[]=
False