FAILURE MAP
← Case archive

FA-91186 / Quantum circuit simulation / Open access

Dynamic circuit prints registers with index 0 leftmost · case 01

A circuit that excites qubit 0 of three reports "100" instead of "001".

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Both register strings are joined in index order without reversing.

VERIFIED REPAIR

Reverse both registers so the highest index is leftmost.

Unsuccessful approach: The attempted repair reverses the qubit string but leaves the clbit string in index order.

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 q), 'clbits': ''.join(str(b) for b in c)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['regression: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['regression: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}], ['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'}], ['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'}]], [['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['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'}], ['control: 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: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}], ['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'}]], [['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'}], ['regression: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['regression: 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 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'}], ['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 20', [2, 2, [['cx', 1, 0], ['x', 0], ['x_if', 0, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 21', [4, 4, [['swap', 1, 2], ['measure', 3, 0], ['x_if', 0, 10], ['swap', 0, 2], ['x_if', 2, 9], ['cx', 0, 2], ['x_if', 0, 15], ['cx', 0, 3]]], {'qubits': '0000', 'clbits': '0000'}]], [['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 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['regression: random dynamic 46', [2, 2, [['swap', 0, 1], ['swap', 0, 1], ['reset', 0], ['x', 0], ['x_if', 1, 0], ['x', 0], ['measure', 1, 1], ['cx', 1, 0], ['x', 0]]], {'qubits': '10', 'clbits': '10'}], ['control: random dynamic 25', [2, 2, [['cx', 0, 1], ['measure', 0, 1], ['x_if', 0, 1], ['swap', 0, 1], ['x_if', 0, 2], ['swap', 0, 1], ['measure', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 26', [4, 4, [['x_if', 3, 15], ['cx', 1, 0], ['measure', 0, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 27', [2, 2, [['swap', 0, 1], ['measure', 0, 1], ['x_if', 0, 0], ['x_if', 1, 1], ['x', 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 28', [3, 3, [['ccx', 2, 1, 0], ['x', 0], ['cx', 1, 0], ['x', 2]]], {'qubits': '101', 'clbits': '000'}]], [['regression: 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'}], ['regression: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['regression: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 29', [2, 2, [['measure', 0, 0], ['swap', 1, 0], ['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['cx', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 30', [4, 4, [['x_if', 3, 8], ['cx', 1, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 33', [4, 4, [['x', 0], ['x_if', 1, 8], ['reset', 1], ['x', 2], ['x', 1], ['swap', 3, 2], ['x', 2]]], {'qubits': '1111', 'clbits': '0000'}], ['control: random dynamic 36', [4, 4, [['swap', 2, 3], ['reset', 1], ['cx', 2, 3], ['ccx', 0, 2, 1]]], {'qubits': '0000', 'clbits': '0000'}]]]
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 fixtureActualExpectedOutcome
regression: feed-forward on register value 2{'clbits': '01', 'qubits': '11'}{'clbits': '10', 'qubits': '11'}Failed
regression: toffoli one control{'clbits': '000', 'qubits': '100'}{'clbits': '000', 'qubits': '001'}Failed
regression: measure into other clbit{'clbits': '01', 'qubits': '10'}{'clbits': '10', 'qubits': '01'}Failed
control: reset excited qubit{'clbits': '0', 'qubits': '0'}{'clbits': '0', 'qubits': '0'}Passed
control: toffoli no controls{'clbits': '000', 'qubits': '000'}{'clbits': '000', 'qubits': '000'}Passed
control: random dynamic 1{'clbits': '00', 'qubits': '11'}{'clbits': '00', 'qubits': '11'}Passed
control: random dynamic 3{'clbits': '0000', 'qubits': '0000'}{'clbits': '0000', 'qubits': '0000'}Passed

SHA-256 / 0cdf767797ed312d318eeb89a1056f4555e25ce897d8c2a5190545f549be6b7d

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 c)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['regression: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['regression: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}], ['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'}], ['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'}]], [['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['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'}], ['control: 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: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}], ['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'}]], [['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'}], ['regression: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['regression: 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 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'}], ['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 20', [2, 2, [['cx', 1, 0], ['x', 0], ['x_if', 0, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 21', [4, 4, [['swap', 1, 2], ['measure', 3, 0], ['x_if', 0, 10], ['swap', 0, 2], ['x_if', 2, 9], ['cx', 0, 2], ['x_if', 0, 15], ['cx', 0, 3]]], {'qubits': '0000', 'clbits': '0000'}]], [['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 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['regression: random dynamic 46', [2, 2, [['swap', 0, 1], ['swap', 0, 1], ['reset', 0], ['x', 0], ['x_if', 1, 0], ['x', 0], ['measure', 1, 1], ['cx', 1, 0], ['x', 0]]], {'qubits': '10', 'clbits': '10'}], ['control: random dynamic 25', [2, 2, [['cx', 0, 1], ['measure', 0, 1], ['x_if', 0, 1], ['swap', 0, 1], ['x_if', 0, 2], ['swap', 0, 1], ['measure', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 26', [4, 4, [['x_if', 3, 15], ['cx', 1, 0], ['measure', 0, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 27', [2, 2, [['swap', 0, 1], ['measure', 0, 1], ['x_if', 0, 0], ['x_if', 1, 1], ['x', 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 28', [3, 3, [['ccx', 2, 1, 0], ['x', 0], ['cx', 1, 0], ['x', 2]]], {'qubits': '101', 'clbits': '000'}]], [['regression: 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'}], ['regression: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['regression: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 29', [2, 2, [['measure', 0, 0], ['swap', 1, 0], ['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['cx', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 30', [4, 4, [['x_if', 3, 8], ['cx', 1, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 33', [4, 4, [['x', 0], ['x_if', 1, 8], ['reset', 1], ['x', 2], ['x', 1], ['swap', 3, 2], ['x', 2]]], {'qubits': '1111', 'clbits': '0000'}], ['control: random dynamic 36', [4, 4, [['swap', 2, 3], ['reset', 1], ['cx', 2, 3], ['ccx', 0, 2, 1]]], {'qubits': '0000', 'clbits': '0000'}]]]
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 fixtureActualExpectedOutcome
regression: feed-forward on register value 2{'clbits': '01', 'qubits': '11'}{'clbits': '10', 'qubits': '11'}Failed
regression: toffoli one control{'clbits': '000', 'qubits': '001'}{'clbits': '000', 'qubits': '001'}Passed
regression: measure into other clbit{'clbits': '01', 'qubits': '01'}{'clbits': '10', 'qubits': '01'}Failed
control: reset excited qubit{'clbits': '0', 'qubits': '0'}{'clbits': '0', 'qubits': '0'}Passed
control: toffoli no controls{'clbits': '000', 'qubits': '000'}{'clbits': '000', 'qubits': '000'}Passed
control: random dynamic 1{'clbits': '00', 'qubits': '11'}{'clbits': '00', 'qubits': '11'}Passed
control: random dynamic 3{'clbits': '0000', 'qubits': '0000'}{'clbits': '0000', 'qubits': '0000'}Passed

SHA-256 / 3b64da7635f870abc2f6ff99a7f65a94361de9a5d3d08b35f0aae9a20a4c6f1c

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: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['regression: toffoli one control', [3, 3, [['x', 0], ['ccx', 0, 1, 2]]], {'qubits': '001', 'clbits': '000'}], ['regression: measure into other clbit', [2, 2, [['x', 0], ['measure', 0, 1]]], {'qubits': '01', 'clbits': '10'}], ['control: reset excited qubit', [1, 1, [['x', 0], ['reset', 0], ['measure', 0, 0]]], {'qubits': '0', 'clbits': '0'}], ['control: toffoli no controls', [3, 3, [['ccx', 0, 1, 2]]], {'qubits': '000', 'clbits': '000'}], ['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'}], ['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'}]], [['regression: swap excitation', [2, 2, [['x', 0], ['swap', 0, 1]]], {'qubits': '10', 'clbits': '00'}], ['regression: asymmetric output', [3, 3, [['x', 0], ['measure', 0, 0]]], {'qubits': '001', 'clbits': '001'}], ['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'}], ['control: 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: random dynamic 7', [4, 4, [['ccx', 1, 0, 2], ['x_if', 1, 6]]], {'qubits': '0000', 'clbits': '0000'}], ['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'}]], [['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'}], ['regression: random dynamic 4', [2, 2, [['x', 0], ['measure', 1, 1]]], {'qubits': '01', 'clbits': '00'}], ['regression: 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 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'}], ['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 20', [2, 2, [['cx', 1, 0], ['x', 0], ['x_if', 0, 0], ['cx', 1, 0]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 21', [4, 4, [['swap', 1, 2], ['measure', 3, 0], ['x_if', 0, 10], ['swap', 0, 2], ['x_if', 2, 9], ['cx', 0, 2], ['x_if', 0, 15], ['cx', 0, 3]]], {'qubits': '0000', 'clbits': '0000'}]], [['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 11', [3, 3, [['reset', 2], ['x', 2]]], {'qubits': '100', 'clbits': '000'}], ['regression: random dynamic 46', [2, 2, [['swap', 0, 1], ['swap', 0, 1], ['reset', 0], ['x', 0], ['x_if', 1, 0], ['x', 0], ['measure', 1, 1], ['cx', 1, 0], ['x', 0]]], {'qubits': '10', 'clbits': '10'}], ['control: random dynamic 25', [2, 2, [['cx', 0, 1], ['measure', 0, 1], ['x_if', 0, 1], ['swap', 0, 1], ['x_if', 0, 2], ['swap', 0, 1], ['measure', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 26', [4, 4, [['x_if', 3, 15], ['cx', 1, 0], ['measure', 0, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 27', [2, 2, [['swap', 0, 1], ['measure', 0, 1], ['x_if', 0, 0], ['x_if', 1, 1], ['x', 0], ['swap', 0, 1], ['measure', 0, 1], ['swap', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 28', [3, 3, [['ccx', 2, 1, 0], ['x', 0], ['cx', 1, 0], ['x', 2]]], {'qubits': '101', 'clbits': '000'}]], [['regression: 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'}], ['regression: random dynamic 16', [2, 2, [['reset', 0], ['x_if', 0, 1], ['x', 0]]], {'qubits': '01', 'clbits': '00'}], ['regression: feed-forward on register value 2', [2, 2, [['x', 1], ['measure', 1, 1], ['x_if', 0, 2]]], {'qubits': '11', 'clbits': '10'}], ['control: random dynamic 29', [2, 2, [['measure', 0, 0], ['swap', 1, 0], ['swap', 0, 1], ['reset', 0], ['swap', 1, 0], ['cx', 0, 1]]], {'qubits': '00', 'clbits': '00'}], ['control: random dynamic 30', [4, 4, [['x_if', 3, 8], ['cx', 1, 2]]], {'qubits': '0000', 'clbits': '0000'}], ['control: random dynamic 33', [4, 4, [['x', 0], ['x_if', 1, 8], ['reset', 1], ['x', 2], ['x', 1], ['swap', 3, 2], ['x', 2]]], {'qubits': '1111', 'clbits': '0000'}], ['control: random dynamic 36', [4, 4, [['swap', 2, 3], ['reset', 1], ['cx', 2, 3], ['ccx', 0, 2, 1]]], {'qubits': '0000', 'clbits': '0000'}]]]
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 fixtureActualExpectedOutcome
regression: feed-forward on register value 2{'clbits': '10', 'qubits': '11'}{'clbits': '10', 'qubits': '11'}Passed
regression: toffoli one control{'clbits': '000', 'qubits': '001'}{'clbits': '000', 'qubits': '001'}Passed
regression: measure into other clbit{'clbits': '10', 'qubits': '01'}{'clbits': '10', 'qubits': '01'}Passed
control: reset excited qubit{'clbits': '0', 'qubits': '0'}{'clbits': '0', 'qubits': '0'}Passed
control: toffoli no controls{'clbits': '000', 'qubits': '000'}{'clbits': '000', 'qubits': '000'}Passed
control: random dynamic 1{'clbits': '00', 'qubits': '11'}{'clbits': '00', 'qubits': '11'}Passed
control: random dynamic 3{'clbits': '0000', 'qubits': '0000'}{'clbits': '0000', 'qubits': '0000'}Passed

SHA-256 / 1fd84a23e02e6e530d5dbe58d30d611fa4da8028920e837540cc06f71fe5246f

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.617924+00:00.

Case digest / 4100a69443dd31fd30a29035c239ae3608b540f5dfeff490f466b22a364296df