cda-tum / mqt-qcec

MQT QCEC - A tool for Quantum Circuit Equivalence Checking
https://mqt.readthedocs.io/projects/qcec
MIT License
90 stars 21 forks source link

🐛 Regression using `qiskit>=0.45`. #334

Closed burgholzer closed 10 months ago

burgholzer commented 10 months ago

Environment information

Description

While looking through the example docs, I noticed that the very simple example shown in the documentation for verifying compilation flows is broken as it reports not_equivalent and emits a warning that both circuits do not operate on the same number of qubits.

After checking the example locally, it turns out that this is a regression in the latest qiskit version. Downgrading qiskit solves the problem. Two things that could be at fault here are the new Singleton Gates or some changes in the _layout attribute.

Expected behavior

Circuits should be considered equivalent (as they always have been).

How to Reproduce

from qiskit import QuantumCircuit, transpile
from qiskit.providers.fake_provider import FakeLondon

from mqt import qcec

circ = QuantumCircuit(3)
circ.x(2)
circ.h(range(3))
circ.ccx(0, 1, 2)
circ.h(range(2))
circ.x(range(2))
circ.h(1)
circ.cx(0, 1)
circ.h(1)
circ.x(range(2))
circ.h(range(2))
circ.measure_all()

optimization_level = 1
circ_comp = transpile(circ, backend=FakeLondon(), optimization_level=optimization_level)

print(qcec.verify_compilation(circ, circ_comp, optimization_level=optimization_level))
burgholzer commented 10 months ago

This seems to have resolved on its own as I can no longer reproduce it and the documentation now also prints equivalent again.