FA-91021 / Quantum circuit simulation / Open access
Depth scheduler only waits on the first qubit of a gate · case 01
A CNOT whose target is still busy is placed in the same layer as the target work.
ROOT CAUSE
The level is computed from ql[qs[0]] alone rather than all operand qubits.
VERIFIED REPAIR
Take the maximum level over every operand qubit (and clbit).
Unsuccessful approach: The attempted repair looks at the first and last operands, which fixes two-qubit gates but not the middle control of a Toffoli.
Case contract
Input [nq, nc, ops]; ops are [name, qubits], ["measure", [q], [c]], ["g", [q], "if", c] (classically conditioned), ["barrier", qubits] (empty list = all qubits) and ["id", [q]]. ASAP layering: each op lands one layer after the latest of its qubits and any clbit it reads or writes, and sets those levels; barriers align the listed qubits to their maximum without adding a layer; id costs nothing. Return [depth, qubit levels].
Why this case matters
Depth drives decoherence budgets and transpiler choices; scheduling slips misreport circuit cost.
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
ql = [0] * nq
cl = [0] * nc
for op in ops:
name, qs = op[0], op[1]
if name == 'barrier':
qs = qs or list(range(nq))
top = max(ql[q] for q in qs)
for q in qs:
ql[q] = top
continue
if name == 'id':
continue
cbits = []
if name == 'measure':
cbits = op[2]
elif len(op) > 2 and op[2] == 'if':
cbits = [op[3]]
level = 1 + max([ql[qs[0]]] + [cl[c] for c in cbits])
for q in qs:
ql[q] = level
for c in cbits:
cl[c] = level
return [max(ql + cl + [0]), ql]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli waits on all', [3, 0, [['h', [2]], ['h', [2]], ['ccx', [0, 1, 2]], ['x', [0]]]], [4, [4, 3, 3]]], ['regression: cx waits on target', [2, 0, [['h', [1]], ['h', [1]], ['cx', [0, 1]]]], [3, [3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: barrier aligns everything', [3, 1, [['h', [0]], ['h', [0]], ['barrier', []], ['x', [2]]]], [3, [2, 2, 3]]], ['control: partial barrier', [3, 1, [['h', [0]], ['barrier', [0, 1]], ['x', [1]], ['x', [2]]]], [2, [1, 2, 1]]], ['control: identity is free', [1, 0, [['id', [0]], ['id', [0]], ['x', [0]]]], [1, [1]]], ['control: conditioned gate after measure', [2, 1, [['h', [0]], ['measure', [0], [0]], ['x', [1], 'if', 0]]], [3, [2, 3]]]], [['regression: random schedule 7', [4, 2, [['x', [2], 'if', 1], ['x', [1]], ['barrier', [2]], ['cx', [0, 1]], ['h', [2]]]], [2, [2, 2, 2, 0]]], ['regression: random schedule 14', [4, 1, [['cx', [0, 3]], ['x', [0]], ['cx', [0, 2]], ['cx', [2, 3]], ['x', [1], 'if', 0], ['cx', [3, 0]], ['cx', [1, 2]], ['id', [0]], ['barrier', [2]]]], [5, [5, 5, 5, 5]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: measure after conditioned read', [2, 1, [['h', [0]], ['h', [0]], ['h', [0]], ['x', [1], 'if', 0], ['measure', [1], [0]]]], [3, [3, 2]]], ['control: empty circuit', [2, 1, []], [0, [0, 0]]], ['control: late read then early-qubit measure', [2, 1, [['h', [1]], ['h', [1]], ['h', [1]], ['x', [1], 'if', 0], ['measure', [0], [0]]]], [5, [5, 4]]], ['control: read then measure other clbit writer', [3, 2, [['h', [2]], ['h', [2]], ['z', [2], 'if', 1], ['measure', [0], [1]], ['x', [1], 'if', 1]]], [5, [4, 5, 3]]]], [['regression: random schedule 17', [2, 1, [['barrier', [1]], ['rz', [1]], ['cx', [1, 0]], ['cx', [1, 0]], ['x', [1]], ['cx', [0, 1]], ['measure', [1], [0]], ['h', [0]], ['barrier', [0, 1]]]], [6, [6, 6]]], ['regression: random schedule 23', [4, 1, [['barrier', [0, 1, 2, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['rz', [1]], ['cx', [0, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['barrier', [0, 2, 3]]]], [3, [3, 1, 3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 0', [1, 2, [['x', [0]], ['rz', [0]], ['measure', [0], [0]], ['x', [0]], ['barrier', [0]], ['x', [0], 'if', 1], ['x', [0], 'if', 1], ['x', [0]], ['measure', [0], [0]]]], [8, [8]]], ['control: random schedule 2', [1, 1, [['h', [0]], ['rz', [0]], ['x', [0]], ['x', [0], 'if', 0], ['x', [0]], ['x', [0]], ['x', [0], 'if', 0], ['id', [0]]]], [7, [7]]], ['control: random schedule 3', [1, 2, [['h', [0]], ['h', [0]]]], [2, [2]]], ['control: random schedule 4', [4, 1, [['measure', [3], [0]], ['ccx', [2, 1, 0]], ['ccx', [0, 2, 3]]]], [2, [2, 1, 2, 2]]]], [['regression: random schedule 31', [3, 2, [['ccx', [2, 1, 0]], ['measure', [0], [1]], ['x', [1]], ['cx', [2, 0]], ['ccx', [1, 0, 2]], ['cx', [1, 0]]]], [5, [5, 5, 4]]], ['regression: random schedule 32', [3, 2, [['cx', [1, 0]], ['cx', [1, 0]], ['rz', [0]], ['ccx', [2, 1, 0]], ['cx', [0, 2]], ['id', [0]], ['h', [0]], ['h', [0]], ['cx', [1, 2]]]], [7, [7, 6, 6]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 5', [3, 2, [['ccx', [0, 1, 2]], ['ccx', [2, 1, 0]], ['barrier', [0, 1, 2]], ['x', [1]]]], [3, [2, 3, 2]]], ['control: random schedule 6', [4, 2, [['barrier', [2]], ['cx', [1, 2]], ['ccx', [2, 3, 0]]]], [2, [2, 1, 2, 2]]], ['control: random schedule 8', [1, 1, [['x', [0], 'if', 0], ['rz', [0]], ['rz', [0]], ['h', [0]], ['rz', [0]], ['h', [0]], ['measure', [0], [0]], ['rz', [0]]]], [8, [8]]], ['control: random schedule 9', [3, 1, [['cx', [2, 1]], ['h', [1]], ['barrier', [1, 2]]]], [2, [0, 2, 2]]]], [['regression: random schedule 39', [2, 1, [['barrier', [1]], ['barrier', []], ['cx', [0, 1]], ['rz', [1]], ['id', [0]], ['barrier', [0]], ['h', [1]], ['cx', [0, 1]]]], [4, [4, 4]]], ['regression: random schedule 41', [3, 2, [['barrier', [0, 1, 2]], ['h', [0]], ['x', [0], 'if', 0], ['cx', [1, 0]], ['x', [0]]]], [4, [4, 3, 0]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 10', [4, 1, [['id', [2]]]], [0, [0, 0, 0, 0]]], ['control: random schedule 11', [2, 2, [['barrier', [0]], ['barrier', [1]], ['h', [1]], ['h', [0]], ['id', [0]], ['cx', [0, 1]], ['x', [1]], ['rz', [0]]]], [3, [3, 3]]], ['control: random schedule 12', [1, 2, [['rz', [0]], ['rz', [0]], ['barrier', []], ['rz', [0]], ['id', [0]], ['barrier', [0]], ['x', [0]], ['h', [0]]]], [5, [5]]], ['control: random schedule 13', [4, 2, [['cx', [3, 2]], ['x', [3]], ['ccx', [3, 1, 0]], ['ccx', [1, 0, 2]], ['h', [0]]]], [5, [5, 4, 4, 3]]]]]
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: toffoli waits on all | [2, [2, 1, 1]] | [4, [4, 3, 3]] | Failed |
| regression: cx waits on target | [1, [1, 1]] | [3, [3, 3]] | Failed |
| regression: random schedule 51 | [4, [4, 4, 4]] | [5, [5, 5, 5]] | Failed |
| control: barrier aligns everything | [3, [2, 2, 3]] | [3, [2, 2, 3]] | Passed |
| control: partial barrier | [2, [1, 2, 1]] | [2, [1, 2, 1]] | Passed |
| control: identity is free | [1, [1]] | [1, [1]] | Passed |
| control: conditioned gate after measure | [3, [2, 3]] | [3, [2, 3]] | Passed |
SHA-256 / 5dfab296176a6b48a42cf00e0806f2a6e3114f303658b720edbfee9d8c3f33f4
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
ql = [0] * nq
cl = [0] * nc
for op in ops:
name, qs = op[0], op[1]
if name == 'barrier':
qs = qs or list(range(nq))
top = max(ql[q] for q in qs)
for q in qs:
ql[q] = top
continue
if name == 'id':
continue
cbits = []
if name == 'measure':
cbits = op[2]
elif len(op) > 2 and op[2] == 'if':
cbits = [op[3]]
level = 1 + max([ql[qs[0]], ql[qs[-1]]] + [cl[c] for c in cbits])
for q in qs:
ql[q] = level
for c in cbits:
cl[c] = level
return [max(ql + cl + [0]), ql]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli waits on all', [3, 0, [['h', [2]], ['h', [2]], ['ccx', [0, 1, 2]], ['x', [0]]]], [4, [4, 3, 3]]], ['regression: cx waits on target', [2, 0, [['h', [1]], ['h', [1]], ['cx', [0, 1]]]], [3, [3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: barrier aligns everything', [3, 1, [['h', [0]], ['h', [0]], ['barrier', []], ['x', [2]]]], [3, [2, 2, 3]]], ['control: partial barrier', [3, 1, [['h', [0]], ['barrier', [0, 1]], ['x', [1]], ['x', [2]]]], [2, [1, 2, 1]]], ['control: identity is free', [1, 0, [['id', [0]], ['id', [0]], ['x', [0]]]], [1, [1]]], ['control: conditioned gate after measure', [2, 1, [['h', [0]], ['measure', [0], [0]], ['x', [1], 'if', 0]]], [3, [2, 3]]]], [['regression: random schedule 7', [4, 2, [['x', [2], 'if', 1], ['x', [1]], ['barrier', [2]], ['cx', [0, 1]], ['h', [2]]]], [2, [2, 2, 2, 0]]], ['regression: random schedule 14', [4, 1, [['cx', [0, 3]], ['x', [0]], ['cx', [0, 2]], ['cx', [2, 3]], ['x', [1], 'if', 0], ['cx', [3, 0]], ['cx', [1, 2]], ['id', [0]], ['barrier', [2]]]], [5, [5, 5, 5, 5]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: measure after conditioned read', [2, 1, [['h', [0]], ['h', [0]], ['h', [0]], ['x', [1], 'if', 0], ['measure', [1], [0]]]], [3, [3, 2]]], ['control: empty circuit', [2, 1, []], [0, [0, 0]]], ['control: late read then early-qubit measure', [2, 1, [['h', [1]], ['h', [1]], ['h', [1]], ['x', [1], 'if', 0], ['measure', [0], [0]]]], [5, [5, 4]]], ['control: read then measure other clbit writer', [3, 2, [['h', [2]], ['h', [2]], ['z', [2], 'if', 1], ['measure', [0], [1]], ['x', [1], 'if', 1]]], [5, [4, 5, 3]]]], [['regression: random schedule 17', [2, 1, [['barrier', [1]], ['rz', [1]], ['cx', [1, 0]], ['cx', [1, 0]], ['x', [1]], ['cx', [0, 1]], ['measure', [1], [0]], ['h', [0]], ['barrier', [0, 1]]]], [6, [6, 6]]], ['regression: random schedule 23', [4, 1, [['barrier', [0, 1, 2, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['rz', [1]], ['cx', [0, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['barrier', [0, 2, 3]]]], [3, [3, 1, 3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 0', [1, 2, [['x', [0]], ['rz', [0]], ['measure', [0], [0]], ['x', [0]], ['barrier', [0]], ['x', [0], 'if', 1], ['x', [0], 'if', 1], ['x', [0]], ['measure', [0], [0]]]], [8, [8]]], ['control: random schedule 2', [1, 1, [['h', [0]], ['rz', [0]], ['x', [0]], ['x', [0], 'if', 0], ['x', [0]], ['x', [0]], ['x', [0], 'if', 0], ['id', [0]]]], [7, [7]]], ['control: random schedule 3', [1, 2, [['h', [0]], ['h', [0]]]], [2, [2]]], ['control: random schedule 4', [4, 1, [['measure', [3], [0]], ['ccx', [2, 1, 0]], ['ccx', [0, 2, 3]]]], [2, [2, 1, 2, 2]]]], [['regression: random schedule 31', [3, 2, [['ccx', [2, 1, 0]], ['measure', [0], [1]], ['x', [1]], ['cx', [2, 0]], ['ccx', [1, 0, 2]], ['cx', [1, 0]]]], [5, [5, 5, 4]]], ['regression: random schedule 32', [3, 2, [['cx', [1, 0]], ['cx', [1, 0]], ['rz', [0]], ['ccx', [2, 1, 0]], ['cx', [0, 2]], ['id', [0]], ['h', [0]], ['h', [0]], ['cx', [1, 2]]]], [7, [7, 6, 6]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 5', [3, 2, [['ccx', [0, 1, 2]], ['ccx', [2, 1, 0]], ['barrier', [0, 1, 2]], ['x', [1]]]], [3, [2, 3, 2]]], ['control: random schedule 6', [4, 2, [['barrier', [2]], ['cx', [1, 2]], ['ccx', [2, 3, 0]]]], [2, [2, 1, 2, 2]]], ['control: random schedule 8', [1, 1, [['x', [0], 'if', 0], ['rz', [0]], ['rz', [0]], ['h', [0]], ['rz', [0]], ['h', [0]], ['measure', [0], [0]], ['rz', [0]]]], [8, [8]]], ['control: random schedule 9', [3, 1, [['cx', [2, 1]], ['h', [1]], ['barrier', [1, 2]]]], [2, [0, 2, 2]]]], [['regression: random schedule 39', [2, 1, [['barrier', [1]], ['barrier', []], ['cx', [0, 1]], ['rz', [1]], ['id', [0]], ['barrier', [0]], ['h', [1]], ['cx', [0, 1]]]], [4, [4, 4]]], ['regression: random schedule 41', [3, 2, [['barrier', [0, 1, 2]], ['h', [0]], ['x', [0], 'if', 0], ['cx', [1, 0]], ['x', [0]]]], [4, [4, 3, 0]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 10', [4, 1, [['id', [2]]]], [0, [0, 0, 0, 0]]], ['control: random schedule 11', [2, 2, [['barrier', [0]], ['barrier', [1]], ['h', [1]], ['h', [0]], ['id', [0]], ['cx', [0, 1]], ['x', [1]], ['rz', [0]]]], [3, [3, 3]]], ['control: random schedule 12', [1, 2, [['rz', [0]], ['rz', [0]], ['barrier', []], ['rz', [0]], ['id', [0]], ['barrier', [0]], ['x', [0]], ['h', [0]]]], [5, [5]]], ['control: random schedule 13', [4, 2, [['cx', [3, 2]], ['x', [3]], ['ccx', [3, 1, 0]], ['ccx', [1, 0, 2]], ['h', [0]]]], [5, [5, 4, 4, 3]]]]]
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: toffoli waits on all | [4, [4, 3, 3]] | [4, [4, 3, 3]] | Passed |
| regression: cx waits on target | [3, [3, 3]] | [3, [3, 3]] | Passed |
| regression: random schedule 51 | [4, [4, 4, 4]] | [5, [5, 5, 5]] | Failed |
| control: barrier aligns everything | [3, [2, 2, 3]] | [3, [2, 2, 3]] | Passed |
| control: partial barrier | [2, [1, 2, 1]] | [2, [1, 2, 1]] | Passed |
| control: identity is free | [1, [1]] | [1, [1]] | Passed |
| control: conditioned gate after measure | [3, [2, 3]] | [3, [2, 3]] | Passed |
SHA-256 / f30e1bafc4838d1054af914a93ee1ea08c4e545ae924ec4baaf496abc5bfe004
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
ql = [0] * nq
cl = [0] * nc
for op in ops:
name, qs = op[0], op[1]
if name == 'barrier':
qs = qs or list(range(nq))
top = max(ql[q] for q in qs)
for q in qs:
ql[q] = top
continue
if name == 'id':
continue
cbits = []
if name == 'measure':
cbits = op[2]
elif len(op) > 2 and op[2] == 'if':
cbits = [op[3]]
level = 1 + max([ql[q] for q in qs] + [cl[c] for c in cbits])
for q in qs:
ql[q] = level
for c in cbits:
cl[c] = level
return [max(ql + cl + [0]), ql]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: toffoli waits on all', [3, 0, [['h', [2]], ['h', [2]], ['ccx', [0, 1, 2]], ['x', [0]]]], [4, [4, 3, 3]]], ['regression: cx waits on target', [2, 0, [['h', [1]], ['h', [1]], ['cx', [0, 1]]]], [3, [3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: barrier aligns everything', [3, 1, [['h', [0]], ['h', [0]], ['barrier', []], ['x', [2]]]], [3, [2, 2, 3]]], ['control: partial barrier', [3, 1, [['h', [0]], ['barrier', [0, 1]], ['x', [1]], ['x', [2]]]], [2, [1, 2, 1]]], ['control: identity is free', [1, 0, [['id', [0]], ['id', [0]], ['x', [0]]]], [1, [1]]], ['control: conditioned gate after measure', [2, 1, [['h', [0]], ['measure', [0], [0]], ['x', [1], 'if', 0]]], [3, [2, 3]]]], [['regression: random schedule 7', [4, 2, [['x', [2], 'if', 1], ['x', [1]], ['barrier', [2]], ['cx', [0, 1]], ['h', [2]]]], [2, [2, 2, 2, 0]]], ['regression: random schedule 14', [4, 1, [['cx', [0, 3]], ['x', [0]], ['cx', [0, 2]], ['cx', [2, 3]], ['x', [1], 'if', 0], ['cx', [3, 0]], ['cx', [1, 2]], ['id', [0]], ['barrier', [2]]]], [5, [5, 5, 5, 5]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: measure after conditioned read', [2, 1, [['h', [0]], ['h', [0]], ['h', [0]], ['x', [1], 'if', 0], ['measure', [1], [0]]]], [3, [3, 2]]], ['control: empty circuit', [2, 1, []], [0, [0, 0]]], ['control: late read then early-qubit measure', [2, 1, [['h', [1]], ['h', [1]], ['h', [1]], ['x', [1], 'if', 0], ['measure', [0], [0]]]], [5, [5, 4]]], ['control: read then measure other clbit writer', [3, 2, [['h', [2]], ['h', [2]], ['z', [2], 'if', 1], ['measure', [0], [1]], ['x', [1], 'if', 1]]], [5, [4, 5, 3]]]], [['regression: random schedule 17', [2, 1, [['barrier', [1]], ['rz', [1]], ['cx', [1, 0]], ['cx', [1, 0]], ['x', [1]], ['cx', [0, 1]], ['measure', [1], [0]], ['h', [0]], ['barrier', [0, 1]]]], [6, [6, 6]]], ['regression: random schedule 23', [4, 1, [['barrier', [0, 1, 2, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['rz', [1]], ['cx', [0, 3]], ['x', [3], 'if', 0], ['rz', [2]], ['barrier', [0, 2, 3]]]], [3, [3, 1, 3, 3]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 0', [1, 2, [['x', [0]], ['rz', [0]], ['measure', [0], [0]], ['x', [0]], ['barrier', [0]], ['x', [0], 'if', 1], ['x', [0], 'if', 1], ['x', [0]], ['measure', [0], [0]]]], [8, [8]]], ['control: random schedule 2', [1, 1, [['h', [0]], ['rz', [0]], ['x', [0]], ['x', [0], 'if', 0], ['x', [0]], ['x', [0]], ['x', [0], 'if', 0], ['id', [0]]]], [7, [7]]], ['control: random schedule 3', [1, 2, [['h', [0]], ['h', [0]]]], [2, [2]]], ['control: random schedule 4', [4, 1, [['measure', [3], [0]], ['ccx', [2, 1, 0]], ['ccx', [0, 2, 3]]]], [2, [2, 1, 2, 2]]]], [['regression: random schedule 31', [3, 2, [['ccx', [2, 1, 0]], ['measure', [0], [1]], ['x', [1]], ['cx', [2, 0]], ['ccx', [1, 0, 2]], ['cx', [1, 0]]]], [5, [5, 5, 4]]], ['regression: random schedule 32', [3, 2, [['cx', [1, 0]], ['cx', [1, 0]], ['rz', [0]], ['ccx', [2, 1, 0]], ['cx', [0, 2]], ['id', [0]], ['h', [0]], ['h', [0]], ['cx', [1, 2]]]], [7, [7, 6, 6]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 5', [3, 2, [['ccx', [0, 1, 2]], ['ccx', [2, 1, 0]], ['barrier', [0, 1, 2]], ['x', [1]]]], [3, [2, 3, 2]]], ['control: random schedule 6', [4, 2, [['barrier', [2]], ['cx', [1, 2]], ['ccx', [2, 3, 0]]]], [2, [2, 1, 2, 2]]], ['control: random schedule 8', [1, 1, [['x', [0], 'if', 0], ['rz', [0]], ['rz', [0]], ['h', [0]], ['rz', [0]], ['h', [0]], ['measure', [0], [0]], ['rz', [0]]]], [8, [8]]], ['control: random schedule 9', [3, 1, [['cx', [2, 1]], ['h', [1]], ['barrier', [1, 2]]]], [2, [0, 2, 2]]]], [['regression: random schedule 39', [2, 1, [['barrier', [1]], ['barrier', []], ['cx', [0, 1]], ['rz', [1]], ['id', [0]], ['barrier', [0]], ['h', [1]], ['cx', [0, 1]]]], [4, [4, 4]]], ['regression: random schedule 41', [3, 2, [['barrier', [0, 1, 2]], ['h', [0]], ['x', [0], 'if', 0], ['cx', [1, 0]], ['x', [0]]]], [4, [4, 3, 0]]], ['regression: random schedule 51', [3, 2, [['x', [1], 'if', 1], ['x', [1], 'if', 1], ['measure', [1], [0]], ['x', [1]], ['measure', [2], [1]], ['ccx', [2, 1, 0]]]], [5, [5, 5, 5]]], ['control: random schedule 10', [4, 1, [['id', [2]]]], [0, [0, 0, 0, 0]]], ['control: random schedule 11', [2, 2, [['barrier', [0]], ['barrier', [1]], ['h', [1]], ['h', [0]], ['id', [0]], ['cx', [0, 1]], ['x', [1]], ['rz', [0]]]], [3, [3, 3]]], ['control: random schedule 12', [1, 2, [['rz', [0]], ['rz', [0]], ['barrier', []], ['rz', [0]], ['id', [0]], ['barrier', [0]], ['x', [0]], ['h', [0]]]], [5, [5]]], ['control: random schedule 13', [4, 2, [['cx', [3, 2]], ['x', [3]], ['ccx', [3, 1, 0]], ['ccx', [1, 0, 2]], ['h', [0]]]], [5, [5, 4, 4, 3]]]]]
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: toffoli waits on all | [4, [4, 3, 3]] | [4, [4, 3, 3]] | Passed |
| regression: cx waits on target | [3, [3, 3]] | [3, [3, 3]] | Passed |
| regression: random schedule 51 | [5, [5, 5, 5]] | [5, [5, 5, 5]] | Passed |
| control: barrier aligns everything | [3, [2, 2, 3]] | [3, [2, 2, 3]] | Passed |
| control: partial barrier | [2, [1, 2, 1]] | [2, [1, 2, 1]] | Passed |
| control: identity is free | [1, [1]] | [1, [1]] | Passed |
| control: conditioned gate after measure | [3, [2, 3]] | [3, [2, 3]] | Passed |
SHA-256 / 2ab7ead568e456570184b9100bbd2649dbbc720318315ddd57cc9d44cab765dc
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:32.196533+00:00.
Case digest / 75238f3e4fb6110d479b4232a6f50b46276bd99ad7ead0904669225fb882b6f7