You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The circuit identity check does not distinguish between classical wires used as cargs and classical wires used as conditionals, and so the following two circuits are marked as non-equivalent:
Since both gates use c0 as a condition, and there is no gate between them which uses c0 as a carg, it should be possible to determine that the order of the two gates on c0 is not important. Ref. test.python.transpiler.test_cx_direction.TestCXDirection.test_preserves_conditions .
The text was updated successfully, but these errors were encountered:
The two circuits given in this example are structurally different because of the data dependency flowing along bit 0; without an optimising compiler recognising that these are the same condition and that they can be merged into a single classical check, there's no practical way for the DAG comparison to see these two circuits as equal, because under the IR, they are different.
There's not entirely a problem with conditionals: if I instead make the circuits as
then we have qc1 == qc2, despite the re-ordering of the circuits required.
I think that if we use "the bit can't have changed between the conditions" as a requirement, we're opening a separate can of worms - should two circuits compare equal if there's extra explicit quantum no-ops on some of its qubits too? It feels like we're getting into the realm of larger equivalence checkers at that point, which I think is a separate and larger issue than this one.
I propose to close this bug report as "not a bug", and fold its requests into a potential equivalence checker feature request (e.g. #761). In the interests of slimming the issues, I'll just close this pre-emptively, but feel free to re-open if you disagree with me.
The circuit identity check does not distinguish between classical wires used as cargs and classical wires used as conditionals, and so the following two circuits are marked as non-equivalent:
Since both gates use
c0
as a condition, and there is no gate between them which usesc0
as a carg, it should be possible to determine that the order of the two gates onc0
is not important. Ref.test.python.transpiler.test_cx_direction.TestCXDirection.test_preserves_conditions
.The text was updated successfully, but these errors were encountered: