In OpenQASM grammar, it seems that it might not be required that measurement statements make reference to a classical (target) qubit.
The openqasm3.ast.QuantumMeasurementStatement is documented as:
Stand-alone statement of a quantum measurement, potentially assigning the result to a classical variable.
and specifies field target of type Optional[Union[IndexedIdentifier, Identifier]].
This makes me think that specifying a target (classical) bit might not be semantically necessary.
If this is true, the following should be valid:
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
bit[3] b;
h q[0];
cx q[0], q[1];
measure q;
However, in pyqasm.unroll(), it raises an AssertionError:
|
source = statement.measure.qubit |
|
target = statement.target |
|
assert source and target |
In OpenQASM grammar, it seems that it might not be required that measurement statements make reference to a classical (target) qubit.
The openqasm3.ast.QuantumMeasurementStatement is documented as:
and specifies field
targetof typeOptional[Union[IndexedIdentifier, Identifier]].This makes me think that specifying a target (classical) bit might not be semantically necessary.
If this is true, the following should be valid:
However, in
pyqasm.unroll(), it raises anAssertionError:pyqasm/src/pyqasm/visitor.py
Lines 441 to 443 in 0fd2956