FAILURE MAP
← Case archive

FA-91236 / Quantum circuit simulation / Open access

Error budget prices a Toffoli like one CNOT · case 01

A Toffoli costs (1-e2) instead of its six-CNOT, nine-single-qubit decomposition.

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

ROOT CAUSE

The fallback branch for three-qubit gates reuses the two-qubit charge.

VERIFIED REPAIR

Charge (1-e2)^6 (1-e1)^9 for three-qubit gates.

Unsuccessful approach: The attempted repair charges only the six CNOTs and forgets the nine single-qubit gates.

Case contract

Input [ops, e1, e2, er] with decimal error rates. Success probability is the product of (1-e1) per single-qubit physical gate, (1-e2) per two-qubit gate, (1-e2)^6 (1-e1)^9 per three-qubit gate (Toffoli decomposition), and (1-er) per measured qubit; rz is virtual and barrier/id are free. Return the probability rounded to 9 decimals.

Why this case matters

Error budgets guide which circuit variant to run on hardware; miscounting gate classes skews every comparison.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    ops, e1, e2, er = x[0], Fraction(x[1]), Fraction(x[2]), Fraction(x[3])
    p = Fraction(1)
    for op in ops:
        name, qs = op[0], op[1]
        if name in ('barrier', 'id', 'rz'):
            continue
        if name == 'measure':
            p *= (1 - er) ** len(qs)
        elif len(qs) == 1:
            p *= 1 - e1
        elif len(qs) == 2:
            p *= 1 - e2
        else:
            p *= 1 - e2
    return round(float(p), 9) + 0.0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli', [[['ccx', [0, 1, 2]]], '0.001', '0.01', '0.02'], 0.933040642], ['regression: random budget 1', [[['rz', [1]], ['ccx', [2, 0, 1]], ['measure', [2]], ['rz', [1]], ['rz', [1]], ['cx', [1, 2]]], '0.001', '0.01', '0.03'], 0.895998929], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: virtual rz only', [[['rz', [0]], ['rz', [1]]], '0.001', '0.01', '0.02'], 1.0], ['control: one cx', [[['cx', [0, 1]]], '0.001', '0.01', '0.02'], 0.99], ['control: measure two qubits', [[['measure', [0, 1]]], '0.001', '0.01', '0.02'], 0.9604], ['control: sx pulse', [[['sx', [0]]], '0.001', '0.01', '0.02'], 0.999]], [['regression: random budget 6', [[['rz', [2]], ['ccx', [1, 0, 2]], ['ccx', [1, 0, 2]], ['rz', [0]], ['h', [2]], ['cx', [0, 2]]], '0.001', '0.05', '0.02'], 0.50367587], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: barrier and id', [[['barrier', [0, 1]], ['id', [0]]], '0.1', '0.1', '0.1'], 1.0], ['control: random budget 0', [[['rz', [2]], ['id', [0]], ['barrier', [0]], ['measure', [0, 1, 2]], ['x', [1]], ['barrier', [0]]], '0.0005', '0.02', '0.02'], 0.940721404], ['control: random budget 2', [[['cx', [0, 2]]], '0.001', '0.01', '0.02'], 0.99], ['control: random budget 3', [[['rz', [1]]], '0.01', '0.02', '0.02'], 1.0]], [['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['regression: random budget 11', [[['ccx', [1, 2, 0]], ['measure', [0, 1, 2]], ['x', [2]], ['cx', [1, 2]], ['ccx', [1, 2, 0]], ['rz', [2]], ['rz', [1]], ['id', [0]]], '0.001', '0.02', '0.02'], 0.710168635], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['control: random budget 5', [[['cx', [1, 0]]], '0.001', '0.01', '0.03'], 0.99], ['control: random budget 10', [[['measure', [1, 2]], ['rz', [2]], ['cx', [2, 0]], ['h', [0]], ['x', [2]]], '0.0005', '0.05', '0.03'], 0.892961368], ['control: random budget 12', [[['barrier', [0]], ['rz', [1]], ['cx', [0, 2]], ['rz', [2]], ['rz', [1]], ['cx', [2, 1]]], '0.0005', '0.02', '0.02'], 0.9604], ['control: random budget 13', [[['cx', [0, 2]]], '0.001', '0.02', '0.03'], 0.98]], [['regression: random budget 23', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['barrier', [0]], ['sx', [1]], ['barrier', [0]], ['id', [0]], ['rz', [2]]], '0.01', '0.01', '0.02'], 0.851457771], ['regression: random budget 25', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['x', [1]], ['measure', [1]], ['cx', [2, 1]]], '0.0005', '0.05', '0.02'], 0.680956386], ['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['control: random budget 14', [[['cx', [1, 0]], ['measure', [1, 2]], ['cx', [1, 0]], ['id', [0]], ['cx', [1, 0]], ['h', [0]]], '0.0005', '0.01', '0.03'], 0.912497852], ['control: random budget 15', [[['measure', [1, 2]], ['h', [2]], ['cx', [1, 2]], ['x', [0]], ['cx', [2, 0]], ['cx', [0, 2]], ['measure', [2]], ['rz', [2]]], '0.0005', '0.01', '0.03'], 0.884680355], ['control: random budget 16', [[['cx', [0, 2]], ['rz', [0]], ['h', [0]], ['measure', [0, 1, 2]], ['rz', [0]], ['rz', [1]]], '0.0005', '0.02', '0.03'], 0.89397233], ['control: random budget 18', [[['measure', [0, 1]], ['sx', [1]], ['id', [0]], ['rz', [2]], ['sx', [1]], ['rz', [0]]], '0.001', '0.05', '0.03'], 0.939019141]], [['regression: random budget 28', [[['cx', [1, 0]], ['rz', [0]], ['sx', [0]], ['ccx', [0, 1, 2]], ['barrier', [0]]], '0.001', '0.05', '0.03'], 0.691385265], ['regression: random budget 29', [[['ccx', [0, 1, 2]], ['rz', [1]], ['ccx', [1, 0, 2]], ['cx', [0, 1]], ['barrier', [0]]], '0.0005', '0.01', '0.03'], 0.86965681], ['regression: random budget 17', [[['ccx', [2, 1, 0]], ['id', [0]], ['cx', [1, 2]], ['cx', [1, 0]], ['measure', [1, 2]], ['ccx', [0, 2, 1]], ['x', [0]], ['barrier', [0]]], '0.0005', '0.02', '0.03'], 0.702395465], ['control: random budget 19', [[['measure', [0, 2]]], '0.01', '0.02', '0.02'], 0.9604], ['control: random budget 20', [[['cx', [2, 1]], ['rz', [0]], ['cx', [0, 2]], ['measure', [0, 1]], ['rz', [1]]], '0.01', '0.05', '0.02'], 0.866761], ['control: random budget 21', [[['measure', [0, 1, 2]], ['rz', [1]], ['x', [1]], ['measure', [0]]], '0.0005', '0.02', '0.03'], 0.884850164], ['control: random budget 22', [[['measure', [0, 1, 2]], ['rz', [0]], ['cx', [2, 1]]], '0.001', '0.02', '0.03'], 0.89441954]]]
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: toffoli0.990.933040642Failed
regression: random budget 10.9506970.895998929Failed
regression: random budget 40.958480160.858623756Failed
control: virtual rz only1.01.0Passed
control: one cx0.990.99Passed
control: measure two qubits0.96040.9604Passed
control: sx pulse0.9990.999Passed

SHA-256 / b6730fdd3498f51756f93bd659bb1c44e0475056df06ca955787163eec6156a6

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    ops, e1, e2, er = x[0], Fraction(x[1]), Fraction(x[2]), Fraction(x[3])
    p = Fraction(1)
    for op in ops:
        name, qs = op[0], op[1]
        if name in ('barrier', 'id', 'rz'):
            continue
        if name == 'measure':
            p *= (1 - er) ** len(qs)
        elif len(qs) == 1:
            p *= 1 - e1
        elif len(qs) == 2:
            p *= 1 - e2
        else:
            p *= (1 - e2) ** 6
    return round(float(p), 9) + 0.0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli', [[['ccx', [0, 1, 2]]], '0.001', '0.01', '0.02'], 0.933040642], ['regression: random budget 1', [[['rz', [1]], ['ccx', [2, 0, 1]], ['measure', [2]], ['rz', [1]], ['rz', [1]], ['cx', [1, 2]]], '0.001', '0.01', '0.03'], 0.895998929], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: virtual rz only', [[['rz', [0]], ['rz', [1]]], '0.001', '0.01', '0.02'], 1.0], ['control: one cx', [[['cx', [0, 1]]], '0.001', '0.01', '0.02'], 0.99], ['control: measure two qubits', [[['measure', [0, 1]]], '0.001', '0.01', '0.02'], 0.9604], ['control: sx pulse', [[['sx', [0]]], '0.001', '0.01', '0.02'], 0.999]], [['regression: random budget 6', [[['rz', [2]], ['ccx', [1, 0, 2]], ['ccx', [1, 0, 2]], ['rz', [0]], ['h', [2]], ['cx', [0, 2]]], '0.001', '0.05', '0.02'], 0.50367587], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: barrier and id', [[['barrier', [0, 1]], ['id', [0]]], '0.1', '0.1', '0.1'], 1.0], ['control: random budget 0', [[['rz', [2]], ['id', [0]], ['barrier', [0]], ['measure', [0, 1, 2]], ['x', [1]], ['barrier', [0]]], '0.0005', '0.02', '0.02'], 0.940721404], ['control: random budget 2', [[['cx', [0, 2]]], '0.001', '0.01', '0.02'], 0.99], ['control: random budget 3', [[['rz', [1]]], '0.01', '0.02', '0.02'], 1.0]], [['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['regression: random budget 11', [[['ccx', [1, 2, 0]], ['measure', [0, 1, 2]], ['x', [2]], ['cx', [1, 2]], ['ccx', [1, 2, 0]], ['rz', [2]], ['rz', [1]], ['id', [0]]], '0.001', '0.02', '0.02'], 0.710168635], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['control: random budget 5', [[['cx', [1, 0]]], '0.001', '0.01', '0.03'], 0.99], ['control: random budget 10', [[['measure', [1, 2]], ['rz', [2]], ['cx', [2, 0]], ['h', [0]], ['x', [2]]], '0.0005', '0.05', '0.03'], 0.892961368], ['control: random budget 12', [[['barrier', [0]], ['rz', [1]], ['cx', [0, 2]], ['rz', [2]], ['rz', [1]], ['cx', [2, 1]]], '0.0005', '0.02', '0.02'], 0.9604], ['control: random budget 13', [[['cx', [0, 2]]], '0.001', '0.02', '0.03'], 0.98]], [['regression: random budget 23', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['barrier', [0]], ['sx', [1]], ['barrier', [0]], ['id', [0]], ['rz', [2]]], '0.01', '0.01', '0.02'], 0.851457771], ['regression: random budget 25', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['x', [1]], ['measure', [1]], ['cx', [2, 1]]], '0.0005', '0.05', '0.02'], 0.680956386], ['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['control: random budget 14', [[['cx', [1, 0]], ['measure', [1, 2]], ['cx', [1, 0]], ['id', [0]], ['cx', [1, 0]], ['h', [0]]], '0.0005', '0.01', '0.03'], 0.912497852], ['control: random budget 15', [[['measure', [1, 2]], ['h', [2]], ['cx', [1, 2]], ['x', [0]], ['cx', [2, 0]], ['cx', [0, 2]], ['measure', [2]], ['rz', [2]]], '0.0005', '0.01', '0.03'], 0.884680355], ['control: random budget 16', [[['cx', [0, 2]], ['rz', [0]], ['h', [0]], ['measure', [0, 1, 2]], ['rz', [0]], ['rz', [1]]], '0.0005', '0.02', '0.03'], 0.89397233], ['control: random budget 18', [[['measure', [0, 1]], ['sx', [1]], ['id', [0]], ['rz', [2]], ['sx', [1]], ['rz', [0]]], '0.001', '0.05', '0.03'], 0.939019141]], [['regression: random budget 28', [[['cx', [1, 0]], ['rz', [0]], ['sx', [0]], ['ccx', [0, 1, 2]], ['barrier', [0]]], '0.001', '0.05', '0.03'], 0.691385265], ['regression: random budget 29', [[['ccx', [0, 1, 2]], ['rz', [1]], ['ccx', [1, 0, 2]], ['cx', [0, 1]], ['barrier', [0]]], '0.0005', '0.01', '0.03'], 0.86965681], ['regression: random budget 17', [[['ccx', [2, 1, 0]], ['id', [0]], ['cx', [1, 2]], ['cx', [1, 0]], ['measure', [1, 2]], ['ccx', [0, 2, 1]], ['x', [0]], ['barrier', [0]]], '0.0005', '0.02', '0.03'], 0.702395465], ['control: random budget 19', [[['measure', [0, 2]]], '0.01', '0.02', '0.02'], 0.9604], ['control: random budget 20', [[['cx', [2, 1]], ['rz', [0]], ['cx', [0, 2]], ['measure', [0, 1]], ['rz', [1]]], '0.01', '0.05', '0.02'], 0.866761], ['control: random budget 21', [[['measure', [0, 1, 2]], ['rz', [1]], ['x', [1]], ['measure', [0]]], '0.0005', '0.02', '0.03'], 0.884850164], ['control: random budget 22', [[['measure', [0, 1, 2]], ['rz', [0]], ['cx', [2, 1]]], '0.001', '0.02', '0.03'], 0.89441954]]]
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: toffoli0.9414801490.933040642Failed
regression: random budget 10.9041033870.895998929Failed
regression: random budget 40.866390150.858623756Failed
control: virtual rz only1.01.0Passed
control: one cx0.990.99Passed
control: measure two qubits0.96040.9604Passed
control: sx pulse0.9990.999Passed

SHA-256 / 6be6d228e8b1e5ed05fedf5975df2dcee3af362371ba51cf3a8d769e9d613768

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
    ops, e1, e2, er = x[0], Fraction(x[1]), Fraction(x[2]), Fraction(x[3])
    p = Fraction(1)
    for op in ops:
        name, qs = op[0], op[1]
        if name in ('barrier', 'id', 'rz'):
            continue
        if name == 'measure':
            p *= (1 - er) ** len(qs)
        elif len(qs) == 1:
            p *= 1 - e1
        elif len(qs) == 2:
            p *= 1 - e2
        else:
            p *= (1 - e2) ** 6 * (1 - e1) ** 9
    return round(float(p), 9) + 0.0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli', [[['ccx', [0, 1, 2]]], '0.001', '0.01', '0.02'], 0.933040642], ['regression: random budget 1', [[['rz', [1]], ['ccx', [2, 0, 1]], ['measure', [2]], ['rz', [1]], ['rz', [1]], ['cx', [1, 2]]], '0.001', '0.01', '0.03'], 0.895998929], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: virtual rz only', [[['rz', [0]], ['rz', [1]]], '0.001', '0.01', '0.02'], 1.0], ['control: one cx', [[['cx', [0, 1]]], '0.001', '0.01', '0.02'], 0.99], ['control: measure two qubits', [[['measure', [0, 1]]], '0.001', '0.01', '0.02'], 0.9604], ['control: sx pulse', [[['sx', [0]]], '0.001', '0.01', '0.02'], 0.999]], [['regression: random budget 6', [[['rz', [2]], ['ccx', [1, 0, 2]], ['ccx', [1, 0, 2]], ['rz', [0]], ['h', [2]], ['cx', [0, 2]]], '0.001', '0.05', '0.02'], 0.50367587], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['regression: random budget 4', [[['cx', [2, 1]], ['ccx', [1, 0, 2]], ['h', [0]], ['x', [2]]], '0.001', '0.02', '0.02'], 0.858623756], ['control: barrier and id', [[['barrier', [0, 1]], ['id', [0]]], '0.1', '0.1', '0.1'], 1.0], ['control: random budget 0', [[['rz', [2]], ['id', [0]], ['barrier', [0]], ['measure', [0, 1, 2]], ['x', [1]], ['barrier', [0]]], '0.0005', '0.02', '0.02'], 0.940721404], ['control: random budget 2', [[['cx', [0, 2]]], '0.001', '0.01', '0.02'], 0.99], ['control: random budget 3', [[['rz', [1]]], '0.01', '0.02', '0.02'], 1.0]], [['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['regression: random budget 11', [[['ccx', [1, 2, 0]], ['measure', [0, 1, 2]], ['x', [2]], ['cx', [1, 2]], ['ccx', [1, 2, 0]], ['rz', [2]], ['rz', [1]], ['id', [0]]], '0.001', '0.02', '0.02'], 0.710168635], ['regression: random budget 7', [[['ccx', [0, 1, 2]], ['barrier', [0]], ['ccx', [0, 1, 2]], ['id', [0]], ['barrier', [0]], ['measure', [1]], ['rz', [2]]], '0.001', '0.02', '0.02'], 0.755297022], ['control: random budget 5', [[['cx', [1, 0]]], '0.001', '0.01', '0.03'], 0.99], ['control: random budget 10', [[['measure', [1, 2]], ['rz', [2]], ['cx', [2, 0]], ['h', [0]], ['x', [2]]], '0.0005', '0.05', '0.03'], 0.892961368], ['control: random budget 12', [[['barrier', [0]], ['rz', [1]], ['cx', [0, 2]], ['rz', [2]], ['rz', [1]], ['cx', [2, 1]]], '0.0005', '0.02', '0.02'], 0.9604], ['control: random budget 13', [[['cx', [0, 2]]], '0.001', '0.02', '0.03'], 0.98]], [['regression: random budget 23', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['barrier', [0]], ['sx', [1]], ['barrier', [0]], ['id', [0]], ['rz', [2]]], '0.01', '0.01', '0.02'], 0.851457771], ['regression: random budget 25', [[['barrier', [0]], ['ccx', [2, 1, 0]], ['x', [1]], ['measure', [1]], ['cx', [2, 1]]], '0.0005', '0.05', '0.02'], 0.680956386], ['regression: random budget 9', [[['ccx', [1, 0, 2]], ['id', [0]], ['cx', [0, 2]], ['rz', [0]], ['ccx', [0, 2, 1]]], '0.001', '0.01', '0.03'], 0.861859192], ['control: random budget 14', [[['cx', [1, 0]], ['measure', [1, 2]], ['cx', [1, 0]], ['id', [0]], ['cx', [1, 0]], ['h', [0]]], '0.0005', '0.01', '0.03'], 0.912497852], ['control: random budget 15', [[['measure', [1, 2]], ['h', [2]], ['cx', [1, 2]], ['x', [0]], ['cx', [2, 0]], ['cx', [0, 2]], ['measure', [2]], ['rz', [2]]], '0.0005', '0.01', '0.03'], 0.884680355], ['control: random budget 16', [[['cx', [0, 2]], ['rz', [0]], ['h', [0]], ['measure', [0, 1, 2]], ['rz', [0]], ['rz', [1]]], '0.0005', '0.02', '0.03'], 0.89397233], ['control: random budget 18', [[['measure', [0, 1]], ['sx', [1]], ['id', [0]], ['rz', [2]], ['sx', [1]], ['rz', [0]]], '0.001', '0.05', '0.03'], 0.939019141]], [['regression: random budget 28', [[['cx', [1, 0]], ['rz', [0]], ['sx', [0]], ['ccx', [0, 1, 2]], ['barrier', [0]]], '0.001', '0.05', '0.03'], 0.691385265], ['regression: random budget 29', [[['ccx', [0, 1, 2]], ['rz', [1]], ['ccx', [1, 0, 2]], ['cx', [0, 1]], ['barrier', [0]]], '0.0005', '0.01', '0.03'], 0.86965681], ['regression: random budget 17', [[['ccx', [2, 1, 0]], ['id', [0]], ['cx', [1, 2]], ['cx', [1, 0]], ['measure', [1, 2]], ['ccx', [0, 2, 1]], ['x', [0]], ['barrier', [0]]], '0.0005', '0.02', '0.03'], 0.702395465], ['control: random budget 19', [[['measure', [0, 2]]], '0.01', '0.02', '0.02'], 0.9604], ['control: random budget 20', [[['cx', [2, 1]], ['rz', [0]], ['cx', [0, 2]], ['measure', [0, 1]], ['rz', [1]]], '0.01', '0.05', '0.02'], 0.866761], ['control: random budget 21', [[['measure', [0, 1, 2]], ['rz', [1]], ['x', [1]], ['measure', [0]]], '0.0005', '0.02', '0.03'], 0.884850164], ['control: random budget 22', [[['measure', [0, 1, 2]], ['rz', [0]], ['cx', [2, 1]]], '0.001', '0.02', '0.03'], 0.89441954]]]
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: toffoli0.9330406420.933040642Passed
regression: random budget 10.8959989290.895998929Passed
regression: random budget 40.8586237560.858623756Passed
control: virtual rz only1.01.0Passed
control: one cx0.990.99Passed
control: measure two qubits0.96040.9604Passed
control: sx pulse0.9990.999Passed

SHA-256 / 842b7345c20117c1498fe0542b03bb8179def3d5a8cf6774c4d77d64e04681d4

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

Case digest / e166de810f70f6451059384c8818fb8f7da3bd7c5aee92a0927e010aac4139bb