FA-91191 / Quantum circuit simulation / Open access
Dynamic circuit swap overwrites one operand first · case 01
swap after exciting qubit 0 leaves both qubits excited.
ROOT CAUSE
The swap is written as two sequential assignments, so the second reads the already-overwritten value.
VERIFIED REPAIR
Use a simultaneous tuple assignment.
Unsuccessful approach: The attempted repair uses two XORs instead of three, which leaves a XOR-mixed value on the second qubit.
Case contract
Input [nq, nc, ops] on computational basis states only: ["x", q], ["cx", c, t], ["ccx", a, b, t], ["swap", a, b], ["measure", q, c], ["reset", q], ["x_if", q, value] (flip q when the classical register value, clbit 0 = LSB, equals value). Return {"qubits": bits with qubit nq-1 leftmost, "clbits": bits with clbit nc-1 leftmost}.
Why this case matters
Feed-forward and reset semantics are central to dynamic circuits; register-value or reset slips change control flow.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
nq, nc, ops = x
q = [0] * nq
c = [0] * nc
for op in ops:
name = op[0]
if name == 'x':
q[op[1]] ^= 1
elif name == 'cx':
if q[op[1]]:
q[op[2]] ^= 1
elif name == 'ccx':
if q[op[1]] and q[op[2]]:
q[op[3]] ^= 1
elif name == 'swap':
a, b = op[1], op[2]
q[a] = q[b]
q[b] = q[a]
elif name == 'measure':
_, qb, cb = op
c[cb] = q[qb]
elif name == 'reset':
q[op[1]] = 0
elif name == 'x_if':
creg = sum(bit << i for i, bit in enumerate(c))
if creg == op[2]:
q[op[1]] ^= 1
return {'qubits': ''.join(str(b) for b in reversed(q)), 'clbits': ''.join(str(b) for b in reversed(c))}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 2', [3, 3, [['cx', 2, 1], ['x', 1], ['measure', 1, 1], ['x', 0], ['x_if', 2, 5], ['reset', 1], ['cx', 2, 0], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '011', 'clbits': '010'}], ['repair check: random dynamic 6', [2, 2, [['reset', 0], ['x', 1], ['swap', 1, 0], ['reset', 0], ['measure', 1, 0], ['x_if', 0, 1], ['cx', 0, 1], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}]], [['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['regression: random dynamic 24', [2, 2, [['measure', 1, 0], ['swap', 1, 0], ['x', 0], ['cx', 0, 1], ['x_if', 0, 0], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '01', 'clbits': '00'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['control: random dynamic 0', [4, 4, [['cx', 2, 1], ['reset', 2], ['x_if', 1, 5], ['x_if', 3, 6], ['reset', 2], ['cx', 3, 1], ['swap', 1, 2], ['x', 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 1', [2, 2, [['cx', 1, 0], ['x_if', 0, 2], ['x', 1], ['swap', 0, 1], ['reset', 1], ['cx', 1, 0], ['x', 1]]], {'qubits': '11', 'clbits': '00'}]], [['regression: random dynamic 40', [2, 2, [['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['x', 1], ['swap', 1, 0], ['swap', 0, 1], ['x', 0], ['swap', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '00'}], ['regression: random dynamic 41', [3, 3, [['x_if', 2, 4], ['x_if', 2, 3], ['measure', 2, 2], ['x', 1], ['swap', 1, 0], ['ccx', 0, 2, 1]]], {'qubits': '001', 'clbits': '000'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 3', [4, 4, [['ccx', 3, 0, 2], ['x_if', 1, 8], ['x_if', 1, 10], ['measure', 0, 3], ['reset', 0], ['measure', 0, 1]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 5', [4, 4, [['x_if', 1, 4], ['reset', 1], ['x_if', 1, 10], ['x', 0], ['measure', 2, 1], ['measure', 1, 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}]], [['regression: random dynamic 48', [2, 2, [['x', 0], ['swap', 0, 1], ['swap', 1, 0], ['swap', 0, 1], ['cx', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 43', [3, 3, [['x', 1], ['swap', 1, 2], ['x_if', 2, 6], ['measure', 2, 0], ['measure', 2, 0], ['x', 2]]], {'qubits': '000', 'clbits': '001'}], ['control: random dynamic 8', [3, 3, [['reset', 2], ['x', 1], ['ccx', 0, 2, 1], ['measure', 1, 1], ['reset', 2]]], {'qubits': '010', 'clbits': '010'}], ['control: random dynamic 9', [2, 2, [['cx', 0, 1], ['cx', 0, 1], ['measure', 0, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1], ['measure', 0, 1], ['measure', 0, 0], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['control: random dynamic 12', [3, 3, [['x', 1], ['x', 2]]], {'qubits': '110', 'clbits': '000'}]], [['regression: random dynamic 10', [3, 3, [['x', 2], ['measure', 2, 2], ['ccx', 2, 1, 0], ['swap', 0, 2], ['cx', 2, 0], ['x', 1], ['ccx', 2, 0, 1], ['cx', 2, 0], ['x', 1]]], {'qubits': '001', 'clbits': '100'}], ['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['repair check: random dynamic 54', [4, 4, [['x', 0], ['cx', 0, 2], ['measure', 1, 1], ['ccx', 2, 3, 0], ['x_if', 1, 0], ['cx', 3, 0], ['swap', 2, 0], ['x', 0]]], {'qubits': '0110', 'clbits': '0000'}], ['control: random dynamic 14', [2, 2, [['measure', 1, 0], ['reset', 0], ['measure', 0, 1], ['x_if', 1, 3], ['cx', 1, 0], ['cx', 0, 1], ['x_if', 1, 1], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 15', [3, 3, [['cx', 2, 1], ['x_if', 0, 0], ['cx', 2, 1], ['ccx', 0, 1, 2], ['reset', 2], ['reset', 1], ['cx', 0, 1]]], {'qubits': '011', 'clbits': '000'}], ['control: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 17', [2, 2, [['reset', 0], ['measure', 0, 0], ['cx', 0, 1], ['x', 1], ['measure', 0, 0]]], {'qubits': '10', 'clbits': '00'}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: swap excitation | {'clbits': '00', 'qubits': '00'} | {'clbits': '00', 'qubits': '10'} | Failed |
| regression: random dynamic 2 | {'clbits': '010', 'qubits': '010'} | {'clbits': '010', 'qubits': '011'} | Failed |
| repair check: random dynamic 6 | {'clbits': '00', 'qubits': '00'} | {'clbits': '00', 'qubits': '00'} | Passed |
| control: feed-forward on register value 2 | {'clbits': '10', 'qubits': '11'} | {'clbits': '10', 'qubits': '11'} | Passed |
| control: reset excited qubit | {'clbits': '0', 'qubits': '0'} | {'clbits': '0', 'qubits': '0'} | Passed |
| control: toffoli one control | {'clbits': '000', 'qubits': '001'} | {'clbits': '000', 'qubits': '001'} | Passed |
| control: toffoli no controls | {'clbits': '000', 'qubits': '000'} | {'clbits': '000', 'qubits': '000'} | Passed |
SHA-256 / 7f4e26605bda5631581bf3d9920d158b4e5fc9edf1afb339928ce47237084dc9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
nq, nc, ops = x
q = [0] * nq
c = [0] * nc
for op in ops:
name = op[0]
if name == 'x':
q[op[1]] ^= 1
elif name == 'cx':
if q[op[1]]:
q[op[2]] ^= 1
elif name == 'ccx':
if q[op[1]] and q[op[2]]:
q[op[3]] ^= 1
elif name == 'swap':
a, b = op[1], op[2]
q[a] ^= q[b]
q[b] ^= q[a]
elif name == 'measure':
_, qb, cb = op
c[cb] = q[qb]
elif name == 'reset':
q[op[1]] = 0
elif name == 'x_if':
creg = sum(bit << i for i, bit in enumerate(c))
if creg == op[2]:
q[op[1]] ^= 1
return {'qubits': ''.join(str(b) for b in reversed(q)), 'clbits': ''.join(str(b) for b in reversed(c))}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 2', [3, 3, [['cx', 2, 1], ['x', 1], ['measure', 1, 1], ['x', 0], ['x_if', 2, 5], ['reset', 1], ['cx', 2, 0], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '011', 'clbits': '010'}], ['repair check: random dynamic 6', [2, 2, [['reset', 0], ['x', 1], ['swap', 1, 0], ['reset', 0], ['measure', 1, 0], ['x_if', 0, 1], ['cx', 0, 1], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}]], [['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['regression: random dynamic 24', [2, 2, [['measure', 1, 0], ['swap', 1, 0], ['x', 0], ['cx', 0, 1], ['x_if', 0, 0], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '01', 'clbits': '00'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['control: random dynamic 0', [4, 4, [['cx', 2, 1], ['reset', 2], ['x_if', 1, 5], ['x_if', 3, 6], ['reset', 2], ['cx', 3, 1], ['swap', 1, 2], ['x', 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 1', [2, 2, [['cx', 1, 0], ['x_if', 0, 2], ['x', 1], ['swap', 0, 1], ['reset', 1], ['cx', 1, 0], ['x', 1]]], {'qubits': '11', 'clbits': '00'}]], [['regression: random dynamic 40', [2, 2, [['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['x', 1], ['swap', 1, 0], ['swap', 0, 1], ['x', 0], ['swap', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '00'}], ['regression: random dynamic 41', [3, 3, [['x_if', 2, 4], ['x_if', 2, 3], ['measure', 2, 2], ['x', 1], ['swap', 1, 0], ['ccx', 0, 2, 1]]], {'qubits': '001', 'clbits': '000'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 3', [4, 4, [['ccx', 3, 0, 2], ['x_if', 1, 8], ['x_if', 1, 10], ['measure', 0, 3], ['reset', 0], ['measure', 0, 1]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 5', [4, 4, [['x_if', 1, 4], ['reset', 1], ['x_if', 1, 10], ['x', 0], ['measure', 2, 1], ['measure', 1, 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}]], [['regression: random dynamic 48', [2, 2, [['x', 0], ['swap', 0, 1], ['swap', 1, 0], ['swap', 0, 1], ['cx', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 43', [3, 3, [['x', 1], ['swap', 1, 2], ['x_if', 2, 6], ['measure', 2, 0], ['measure', 2, 0], ['x', 2]]], {'qubits': '000', 'clbits': '001'}], ['control: random dynamic 8', [3, 3, [['reset', 2], ['x', 1], ['ccx', 0, 2, 1], ['measure', 1, 1], ['reset', 2]]], {'qubits': '010', 'clbits': '010'}], ['control: random dynamic 9', [2, 2, [['cx', 0, 1], ['cx', 0, 1], ['measure', 0, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1], ['measure', 0, 1], ['measure', 0, 0], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['control: random dynamic 12', [3, 3, [['x', 1], ['x', 2]]], {'qubits': '110', 'clbits': '000'}]], [['regression: random dynamic 10', [3, 3, [['x', 2], ['measure', 2, 2], ['ccx', 2, 1, 0], ['swap', 0, 2], ['cx', 2, 0], ['x', 1], ['ccx', 2, 0, 1], ['cx', 2, 0], ['x', 1]]], {'qubits': '001', 'clbits': '100'}], ['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['repair check: random dynamic 54', [4, 4, [['x', 0], ['cx', 0, 2], ['measure', 1, 1], ['ccx', 2, 3, 0], ['x_if', 1, 0], ['cx', 3, 0], ['swap', 2, 0], ['x', 0]]], {'qubits': '0110', 'clbits': '0000'}], ['control: random dynamic 14', [2, 2, [['measure', 1, 0], ['reset', 0], ['measure', 0, 1], ['x_if', 1, 3], ['cx', 1, 0], ['cx', 0, 1], ['x_if', 1, 1], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 15', [3, 3, [['cx', 2, 1], ['x_if', 0, 0], ['cx', 2, 1], ['ccx', 0, 1, 2], ['reset', 2], ['reset', 1], ['cx', 0, 1]]], {'qubits': '011', 'clbits': '000'}], ['control: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 17', [2, 2, [['reset', 0], ['measure', 0, 0], ['cx', 0, 1], ['x', 1], ['measure', 0, 0]]], {'qubits': '10', 'clbits': '00'}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: swap excitation | {'clbits': '00', 'qubits': '11'} | {'clbits': '00', 'qubits': '10'} | Failed |
| regression: random dynamic 2 | {'clbits': '010', 'qubits': '011'} | {'clbits': '010', 'qubits': '011'} | Passed |
| repair check: random dynamic 6 | {'clbits': '01', 'qubits': '11'} | {'clbits': '00', 'qubits': '00'} | Failed |
| control: feed-forward on register value 2 | {'clbits': '10', 'qubits': '11'} | {'clbits': '10', 'qubits': '11'} | Passed |
| control: reset excited qubit | {'clbits': '0', 'qubits': '0'} | {'clbits': '0', 'qubits': '0'} | Passed |
| control: toffoli one control | {'clbits': '000', 'qubits': '001'} | {'clbits': '000', 'qubits': '001'} | Passed |
| control: toffoli no controls | {'clbits': '000', 'qubits': '000'} | {'clbits': '000', 'qubits': '000'} | Passed |
SHA-256 / 8134493b47b8b423e5adc93168edad22ea767590ee169ea861b4ad4d942af888
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
nq, nc, ops = x
q = [0] * nq
c = [0] * nc
for op in ops:
name = op[0]
if name == 'x':
q[op[1]] ^= 1
elif name == 'cx':
if q[op[1]]:
q[op[2]] ^= 1
elif name == 'ccx':
if q[op[1]] and q[op[2]]:
q[op[3]] ^= 1
elif name == 'swap':
a, b = op[1], op[2]
q[a], q[b] = q[b], q[a]
elif name == 'measure':
_, qb, cb = op
c[cb] = q[qb]
elif name == 'reset':
q[op[1]] = 0
elif name == 'x_if':
creg = sum(bit << i for i, bit in enumerate(c))
if creg == op[2]:
q[op[1]] ^= 1
return {'qubits': ''.join(str(b) for b in reversed(q)), 'clbits': ''.join(str(b) for b in reversed(c))}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 2', [3, 3, [['cx', 2, 1], ['x', 1], ['measure', 1, 1], ['x', 0], ['x_if', 2, 5], ['reset', 1], ['cx', 2, 0], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '011', 'clbits': '010'}], ['repair check: random dynamic 6', [2, 2, [['reset', 0], ['x', 1], ['swap', 1, 0], ['reset', 0], ['measure', 1, 0], ['x_if', 0, 1], ['cx', 0, 1], ['swap', 1, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}]], [['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['regression: random dynamic 24', [2, 2, [['measure', 1, 0], ['swap', 1, 0], ['x', 0], ['cx', 0, 1], ['x_if', 0, 0], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '01', 'clbits': '00'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['control: random dynamic 0', [4, 4, [['cx', 2, 1], ['reset', 2], ['x_if', 1, 5], ['x_if', 3, 6], ['reset', 2], ['cx', 3, 1], ['swap', 1, 2], ['x', 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 1', [2, 2, [['cx', 1, 0], ['x_if', 0, 2], ['x', 1], ['swap', 0, 1], ['reset', 1], ['cx', 1, 0], ['x', 1]]], {'qubits': '11', 'clbits': '00'}]], [['regression: random dynamic 40', [2, 2, [['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['x', 1], ['swap', 1, 0], ['swap', 0, 1], ['x', 0], ['swap', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '00'}], ['regression: random dynamic 41', [3, 3, [['x_if', 2, 4], ['x_if', 2, 3], ['measure', 2, 2], ['x', 1], ['swap', 1, 0], ['ccx', 0, 2, 1]]], {'qubits': '001', 'clbits': '000'}], ['repair check: random dynamic 38', [2, 2, [['x_if', 0, 1], ['measure', 1, 0], ['x_if', 1, 0], ['cx', 1, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 1, 0]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 3', [4, 4, [['ccx', 3, 0, 2], ['x_if', 1, 8], ['x_if', 1, 10], ['measure', 0, 3], ['reset', 0], ['measure', 0, 1]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 5', [4, 4, [['x_if', 1, 4], ['reset', 1], ['x_if', 1, 10], ['x', 0], ['measure', 2, 1], ['measure', 1, 0]]], {'qubits': '0001', 'clbits': '0000'}], ['control: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}]], [['regression: random dynamic 48', [2, 2, [['x', 0], ['swap', 0, 1], ['swap', 1, 0], ['swap', 0, 1], ['cx', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: random dynamic 43', [3, 3, [['x', 1], ['swap', 1, 2], ['x_if', 2, 6], ['measure', 2, 0], ['measure', 2, 0], ['x', 2]]], {'qubits': '000', 'clbits': '001'}], ['control: random dynamic 8', [3, 3, [['reset', 2], ['x', 1], ['ccx', 0, 2, 1], ['measure', 1, 1], ['reset', 2]]], {'qubits': '010', 'clbits': '010'}], ['control: random dynamic 9', [2, 2, [['cx', 0, 1], ['cx', 0, 1], ['measure', 0, 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1], ['measure', 0, 1], ['measure', 0, 0], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['control: random dynamic 12', [3, 3, [['x', 1], ['x', 2]]], {'qubits': '110', 'clbits': '000'}]], [['regression: random dynamic 10', [3, 3, [['x', 2], ['measure', 2, 2], ['ccx', 2, 1, 0], ['swap', 0, 2], ['cx', 2, 0], ['x', 1], ['ccx', 2, 0, 1], ['cx', 2, 0], ['x', 1]]], {'qubits': '001', 'clbits': '100'}], ['regression: random dynamic 13', [2, 2, [['x_if', 1, 0], ['x', 0], ['swap', 1, 0], ['x', 1], ['cx', 1, 0], ['x_if', 1, 3], ['measure', 1, 1], ['swap', 1, 0], ['x', 1]]], {'qubits': '00', 'clbits': '00'}], ['repair check: random dynamic 54', [4, 4, [['x', 0], ['cx', 0, 2], ['measure', 1, 1], ['ccx', 2, 3, 0], ['x_if', 1, 0], ['cx', 3, 0], ['swap', 2, 0], ['x', 0]]], {'qubits': '0110', 'clbits': '0000'}], ['control: random dynamic 14', [2, 2, [['measure', 1, 0], ['reset', 0], ['measure', 0, 1], ['x_if', 1, 3], ['cx', 1, 0], ['cx', 0, 1], ['x_if', 1, 1], ['swap', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 15', [3, 3, [['cx', 2, 1], ['x_if', 0, 0], ['cx', 2, 1], ['ccx', 0, 1, 2], ['reset', 2], ['reset', 1], ['cx', 0, 1]]], {'qubits': '011', 'clbits': '000'}], ['control: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['control: random dynamic 17', [2, 2, [['reset', 0], ['measure', 0, 0], ['cx', 0, 1], ['x', 1], ['measure', 0, 0]]], {'qubits': '10', 'clbits': '00'}]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: swap excitation | {'clbits': '00', 'qubits': '10'} | {'clbits': '00', 'qubits': '10'} | Passed |
| regression: random dynamic 2 | {'clbits': '010', 'qubits': '011'} | {'clbits': '010', 'qubits': '011'} | Passed |
| repair check: random dynamic 6 | {'clbits': '00', 'qubits': '00'} | {'clbits': '00', 'qubits': '00'} | Passed |
| control: feed-forward on register value 2 | {'clbits': '10', 'qubits': '11'} | {'clbits': '10', 'qubits': '11'} | Passed |
| control: reset excited qubit | {'clbits': '0', 'qubits': '0'} | {'clbits': '0', 'qubits': '0'} | Passed |
| control: toffoli one control | {'clbits': '000', 'qubits': '001'} | {'clbits': '000', 'qubits': '001'} | Passed |
| control: toffoli no controls | {'clbits': '000', 'qubits': '000'} | {'clbits': '000', 'qubits': '000'} | Passed |
SHA-256 / 15195308ec64f446da60d9165a6d2e72ca629b5d1d2737731dc14d79b6d255ea
Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; amplitudes are rounded to fixed decimals for strict JSON output. It is not a production quantum SDK and claims no standards conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:33.664213+00:00.
Case digest / 47e6e72884555b8b501fd7e4e8824164579220d199339a06c274c977d44b40b9