CQCL / tket

Source code for the TKET quantum compiler, Python bindings and utilities
https://docs.quantinuum.com/tket/
Apache License 2.0
257 stars 48 forks source link

`DecomposeClassicalExp()` fails for constant conditions #1581

Closed cqc-alec closed 4 days ago

cqc-alec commented 2 months ago
from pytket import Circuit
from pytket.circuit.logic_exp import BitZero, BitOne
from pytket.passes import DecomposeClassicalExp

circuit = Circuit(1)
circuit.X(0, condition=BitZero())
DecomposeClassicalExp().apply(circuit)

Output:

Traceback (most recent call last):
  File "/home/alec/r/tket/pytket/pytket/circuit/decompose_classical.py", line 334, in _decompose_expressions
    comp_bit = bit_recursive_walk(pred_exp, kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alec/r/tket/pytket/pytket/circuit/decompose_classical.py", line 230, in recursive_walk
    arg1, arg2 = exp.args
    ^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 0)