Equivalence Checking Manager

This is the main class of QCEC that allows to check the equivalence of quantum circuits based on the methods proposed in [3]. It features many configuration options that orchestrate the whole procedure. This page describes all the relevant methods of the Equivalence Checking Manager.

class mqt.qcec.EquivalenceCheckingManager

Main class for orchestrating the equivalence check

Constructing an instance

The simplest way of constructing an EquivalenceCheckingManager is to just pass it the two circuits whose equivalence shall be checked.

ecm = EquivalenceCheckingManager(circ1=qc1, circ2=qc2)

This constructs the manager using all the default options. The circuits to be verified can be provided in various ways:

There are two ways of configuring the manager at construction time, e.g., in order to set a timeout of 60 seconds:

  • Creating and modifying a Configuration object that is then passed to the constructor.

    config = Configuration()
    config.execution.timeout = 60.
    ecm = EquivalenceCheckingManager(circ1=qc1, circ2=qc2, config=config)
  • Setting individual options via the appropriate keyword arguments.

    ecm = EquivalenceCheckingManager(circ1=qc1, circ2=qc2, timeout=60.)


Every keyword argument that takes an enum value can either be conveniently specified as a string (e.g., state_type="stabilizer") or by providing the respective enum value (e.g., state_type=qcec.StateType.stabilizer).

EquivalenceCheckingManager.__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: mqt.qcec.pyqcec.EquivalenceCheckingManager, circ1: object, circ2: object, numerical_tolerance: float = 2.2737367544323206e-13, parallel: bool = True, nthreads: int = 2, timeout: datetime.timedelta = datetime.timedelta(0), run_construction_checker: bool = False, run_simulation_checker: bool = True, run_alternating_checker: bool = True, fix_output_permutation_mismatch: bool = False, fuse_single_qubit_gates: bool = True, reconstruct_swaps: bool = True, remove_diagonal_gates_before_measure: bool = False, transform_dynamic_circuit: bool = False, reorder_operations: bool = True, construction_scheme: mqt.qcec.pyqcec.ApplicationScheme = ‘proportional’, simulation_scheme: mqt.qcec.pyqcec.ApplicationScheme = ‘proportional’, alternating_scheme: mqt.qcec.pyqcec.ApplicationScheme = ‘proportional’, profile: str = ‘’, trace_threshold: float = 1e-08, fidelity_threshold: float = 1e-08, max_sims: int = 16, state_type: mqt.qcec.pyqcec.StateType = ‘computational_basis’, seed: int = 0, store_cex_input: bool = False, store_cex_output: bool = False) -> None

  2. __init__(self: mqt.qcec.pyqcec.EquivalenceCheckingManager, circ1: object, circ2: object, config: mqt.qcec.pyqcec.Configuration) -> None

Configuration after instantiation

In addition, the Configuration of the manager can be altered after its construction. To this end, several convenience functions are provided which allow to modify the individual options:

Running the equivalence check

Once the manager has been constructed and (optionally) configured, the equivalence check can be started by calling run().

EquivalenceCheckingManager.run(self: mqt.qcec.pyqcec.EquivalenceCheckingManager) None

Execute the equivalence check as configured.

Obtaining the results

After the run has completed, several results can be obtained: