FAILURE MAP
← Case archive

FA-90991 / Quantum circuit simulation / Open access

Tableau S gate updates z before computing the sign · case 01

H followed by S on |0> reports the stabilizer -Y instead of +Y.

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

ROOT CAUSE

The S rule adds x into z first and then computes the sign from the updated bits.

VERIFIED REPAIR

Compute the sign from x & z of the incoming generator, then set z ^= x.

Unsuccessful approach: The attempted repair toggles the sign whenever z is set, which ignores the x component.

Case contract

Input [n, gates] with gates h, s, x, z (["g", q]) and cx (["cx", c, t]). Track the n stabilizer generators of |0...0> (initially Z on each qubit) under the Aaronson-Gottesman update rules and return them as signed strings such as "+XX", character q describing qubit q.

Why this case matters

Stabilizer simulators verify Clifford circuits and error-correction encoders; a phase-bit rule error yields wrong syndromes.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    n, gates = x
    xs = [[0] * n for _ in range(n)]
    zs = [[1 if i == j else 0 for j in range(n)] for i in range(n)]
    rs = [0] * n
    for g in gates:
        op = g[0]
        for row in range(n):
            X, Z = xs[row], zs[row]
            if op == 'h':
                a = g[1]
                rs[row] ^= X[a] & Z[a]
                X[a], Z[a] = Z[a], X[a]
            elif op == 's':
                a = g[1]
                Z[a] ^= X[a]
                rs[row] ^= X[a] & Z[a]
            elif op == 'x':
                rs[row] ^= Z[g[1]]
            elif op == 'z':
                rs[row] ^= X[g[1]]
            elif op == 'cx':
                a, b = g[1], g[2]
                rs[row] ^= X[a] & Z[b] & (X[b] ^ Z[a] ^ 1)
                X[b] ^= X[a]
                Z[a] ^= Z[b]
    letters = {(0, 0): 'I', (1, 0): 'X', (0, 1): 'Z', (1, 1): 'Y'}
    return [('-' if rs[r] else '+') + ''.join(letters[(xs[r][q], zs[r][q])] for q in range(n)) for r in range(n)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['regression: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']]], [['regression: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['regression: random clifford 17', [1, [['h', 0], ['s', 0], ['h', 0], ['h', 0], ['x', 0], ['s', 0], ['s', 0]]], ['+Y']], ['repair check: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']], ['control: cx on excited control', [2, [['x', 0], ['cx', 0, 1]]], ['-ZI', '+ZZ']], ['control: ghz', [3, [['h', 0], ['cx', 0, 1], ['cx', 0, 2]]], ['+XXX', '+ZZI', '+ZIZ']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 8', [3, [['cx', 0, 1], ['h', 2], ['h', 2], ['h', 0], ['cx', 2, 1], ['h', 2], ['z', 0], ['cx', 1, 2]]], ['-XII', '-XZX', '+IIX']]], [['regression: random clifford 28', [3, [['h', 1], ['cx', 0, 1], ['h', 0], ['cx', 2, 1], ['z', 0], ['x', 0], ['cx', 2, 1], ['h', 1], ['h', 2], ['s', 0], ['h', 0], ['cx', 1, 2]]], ['+YII', '+IZI', '+IIX']], ['regression: random clifford 29', [3, [['h', 2], ['s', 0], ['z', 1], ['h', 0], ['s', 0], ['z', 2], ['x', 1], ['z', 0], ['h', 2]]], ['-YII', '-IZI', '-IIZ']], ['repair check: random clifford 5', [1, [['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['s', 0], ['s', 0], ['s', 0], ['x', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 12', [1, [['h', 0], ['s', 0], ['h', 0], ['x', 0], ['s', 0], ['x', 0], ['x', 0], ['z', 0], ['h', 0], ['s', 0], ['s', 0]]], ['+Z']], ['control: random clifford 15', [2, [['z', 1], ['cx', 0, 1], ['x', 1], ['h', 1]]], ['+ZI', '-ZX']], ['control: random clifford 16', [1, [['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['z', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']]], [['regression: random clifford 37', [3, [['z', 0], ['cx', 0, 2], ['s', 1], ['z', 1], ['h', 2], ['cx', 0, 1], ['s', 2], ['cx', 1, 0], ['h', 2], ['cx', 1, 0]]], ['+ZII', '+ZZI', '-ZIY']], ['regression: random clifford 38', [3, [['z', 1], ['h', 0], ['h', 2], ['h', 2], ['cx', 1, 2], ['cx', 2, 1], ['h', 1], ['h', 1], ['cx', 0, 1], ['h', 2], ['cx', 2, 1], ['s', 1], ['x', 0], ['s', 2]]], ['+XYI', '+ZXX', '-ZZZ']], ['repair check: random clifford 7', [3, [['cx', 0, 2], ['cx', 2, 1], ['s', 0], ['cx', 0, 2], ['cx', 2, 1], ['z', 1], ['z', 0], ['h', 1], ['x', 1]]], ['+ZII', '+ZXI', '+IIZ']], ['control: random clifford 19', [2, [['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1]]], ['+XZ', '-YY']], ['control: random clifford 20', [3, [['cx', 2, 0], ['h', 2], ['z', 0], ['cx', 2, 1], ['cx', 0, 2], ['cx', 2, 1]]], ['+ZIX', '+ZZI', '+IIX']], ['control: random clifford 22', [3, [['h', 2], ['h', 0], ['cx', 1, 0], ['s', 1], ['cx', 0, 1], ['cx', 1, 0], ['s', 0], ['cx', 2, 1]]], ['+IXI', '+ZII', '+IXX']], ['control: random clifford 24', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 52', [1, [['h', 0], ['h', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['s', 0], ['h', 0], ['s', 0]]], ['-Y']], ['regression: random clifford 54', [1, [['h', 0], ['h', 0], ['x', 0], ['s', 0], ['h', 0], ['s', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 13', [1, [['z', 0], ['x', 0], ['z', 0], ['z', 0], ['s', 0], ['x', 0], ['h', 0], ['h', 0], ['z', 0], ['h', 0]]], ['+X']], ['control: random clifford 25', [2, [['cx', 1, 0], ['cx', 1, 0]]], ['+ZI', '+IZ']], ['control: random clifford 27', [2, [['cx', 1, 0], ['x', 0], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 1, 0], ['h', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['z', 1], ['h', 1]]], ['-XX', '+IX']], ['control: random clifford 32', [3, [['z', 1], ['x', 1], ['cx', 1, 0], ['cx', 1, 2], ['cx', 2, 1], ['x', 0], ['cx', 1, 2], ['z', 1], ['z', 1], ['cx', 2, 1], ['z', 2], ['x', 0], ['cx', 0, 2]]], ['+IIZ', '-ZIZ', '+ZZZ']], ['control: random clifford 34', [1, [['z', 0], ['h', 0], ['z', 0], ['h', 0]]], ['-Z']]]]
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: h then s['-Y']['+Y']Failed
regression: h on y eigenstate['+Y']['-Y']Failed
repair check: random clifford 1['-Z']['-Z']Passed
control: bell preparation['+XX', '+ZZ']['+XX', '+ZZ']Passed
control: s twice after h['-X']['-X']Passed
control: x flips z sign['-Z']['-Z']Passed
control: z on plus['-X']['-X']Passed

SHA-256 / eece4bc0677c59fe2258030414a1e368b0ae9bc7a1462a2c07e1808d1d543dd5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    n, gates = x
    xs = [[0] * n for _ in range(n)]
    zs = [[1 if i == j else 0 for j in range(n)] for i in range(n)]
    rs = [0] * n
    for g in gates:
        op = g[0]
        for row in range(n):
            X, Z = xs[row], zs[row]
            if op == 'h':
                a = g[1]
                rs[row] ^= X[a] & Z[a]
                X[a], Z[a] = Z[a], X[a]
            elif op == 's':
                a = g[1]
                rs[row] ^= Z[a]
                Z[a] ^= X[a]
            elif op == 'x':
                rs[row] ^= Z[g[1]]
            elif op == 'z':
                rs[row] ^= X[g[1]]
            elif op == 'cx':
                a, b = g[1], g[2]
                rs[row] ^= X[a] & Z[b] & (X[b] ^ Z[a] ^ 1)
                X[b] ^= X[a]
                Z[a] ^= Z[b]
    letters = {(0, 0): 'I', (1, 0): 'X', (0, 1): 'Z', (1, 1): 'Y'}
    return [('-' if rs[r] else '+') + ''.join(letters[(xs[r][q], zs[r][q])] for q in range(n)) for r in range(n)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['regression: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']]], [['regression: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['regression: random clifford 17', [1, [['h', 0], ['s', 0], ['h', 0], ['h', 0], ['x', 0], ['s', 0], ['s', 0]]], ['+Y']], ['repair check: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']], ['control: cx on excited control', [2, [['x', 0], ['cx', 0, 1]]], ['-ZI', '+ZZ']], ['control: ghz', [3, [['h', 0], ['cx', 0, 1], ['cx', 0, 2]]], ['+XXX', '+ZZI', '+ZIZ']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 8', [3, [['cx', 0, 1], ['h', 2], ['h', 2], ['h', 0], ['cx', 2, 1], ['h', 2], ['z', 0], ['cx', 1, 2]]], ['-XII', '-XZX', '+IIX']]], [['regression: random clifford 28', [3, [['h', 1], ['cx', 0, 1], ['h', 0], ['cx', 2, 1], ['z', 0], ['x', 0], ['cx', 2, 1], ['h', 1], ['h', 2], ['s', 0], ['h', 0], ['cx', 1, 2]]], ['+YII', '+IZI', '+IIX']], ['regression: random clifford 29', [3, [['h', 2], ['s', 0], ['z', 1], ['h', 0], ['s', 0], ['z', 2], ['x', 1], ['z', 0], ['h', 2]]], ['-YII', '-IZI', '-IIZ']], ['repair check: random clifford 5', [1, [['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['s', 0], ['s', 0], ['s', 0], ['x', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 12', [1, [['h', 0], ['s', 0], ['h', 0], ['x', 0], ['s', 0], ['x', 0], ['x', 0], ['z', 0], ['h', 0], ['s', 0], ['s', 0]]], ['+Z']], ['control: random clifford 15', [2, [['z', 1], ['cx', 0, 1], ['x', 1], ['h', 1]]], ['+ZI', '-ZX']], ['control: random clifford 16', [1, [['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['z', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']]], [['regression: random clifford 37', [3, [['z', 0], ['cx', 0, 2], ['s', 1], ['z', 1], ['h', 2], ['cx', 0, 1], ['s', 2], ['cx', 1, 0], ['h', 2], ['cx', 1, 0]]], ['+ZII', '+ZZI', '-ZIY']], ['regression: random clifford 38', [3, [['z', 1], ['h', 0], ['h', 2], ['h', 2], ['cx', 1, 2], ['cx', 2, 1], ['h', 1], ['h', 1], ['cx', 0, 1], ['h', 2], ['cx', 2, 1], ['s', 1], ['x', 0], ['s', 2]]], ['+XYI', '+ZXX', '-ZZZ']], ['repair check: random clifford 7', [3, [['cx', 0, 2], ['cx', 2, 1], ['s', 0], ['cx', 0, 2], ['cx', 2, 1], ['z', 1], ['z', 0], ['h', 1], ['x', 1]]], ['+ZII', '+ZXI', '+IIZ']], ['control: random clifford 19', [2, [['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1]]], ['+XZ', '-YY']], ['control: random clifford 20', [3, [['cx', 2, 0], ['h', 2], ['z', 0], ['cx', 2, 1], ['cx', 0, 2], ['cx', 2, 1]]], ['+ZIX', '+ZZI', '+IIX']], ['control: random clifford 22', [3, [['h', 2], ['h', 0], ['cx', 1, 0], ['s', 1], ['cx', 0, 1], ['cx', 1, 0], ['s', 0], ['cx', 2, 1]]], ['+IXI', '+ZII', '+IXX']], ['control: random clifford 24', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 52', [1, [['h', 0], ['h', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['s', 0], ['h', 0], ['s', 0]]], ['-Y']], ['regression: random clifford 54', [1, [['h', 0], ['h', 0], ['x', 0], ['s', 0], ['h', 0], ['s', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 13', [1, [['z', 0], ['x', 0], ['z', 0], ['z', 0], ['s', 0], ['x', 0], ['h', 0], ['h', 0], ['z', 0], ['h', 0]]], ['+X']], ['control: random clifford 25', [2, [['cx', 1, 0], ['cx', 1, 0]]], ['+ZI', '+IZ']], ['control: random clifford 27', [2, [['cx', 1, 0], ['x', 0], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 1, 0], ['h', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['z', 1], ['h', 1]]], ['-XX', '+IX']], ['control: random clifford 32', [3, [['z', 1], ['x', 1], ['cx', 1, 0], ['cx', 1, 2], ['cx', 2, 1], ['x', 0], ['cx', 1, 2], ['z', 1], ['z', 1], ['cx', 2, 1], ['z', 2], ['x', 0], ['cx', 0, 2]]], ['+IIZ', '-ZIZ', '+ZZZ']], ['control: random clifford 34', [1, [['z', 0], ['h', 0], ['z', 0], ['h', 0]]], ['-Z']]]]
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: h then s['+Y']['+Y']Passed
regression: h on y eigenstate['-Y']['-Y']Passed
repair check: random clifford 1['+Z']['-Z']Failed
control: bell preparation['+XX', '+ZZ']['+XX', '+ZZ']Passed
control: s twice after h['-X']['-X']Passed
control: x flips z sign['-Z']['-Z']Passed
control: z on plus['-X']['-X']Passed

SHA-256 / 9642ff7b75cdcb36ec3593ce44ceee1d1d8da9d3dd3ad8c4e790feb5fc49d59b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    n, gates = x
    xs = [[0] * n for _ in range(n)]
    zs = [[1 if i == j else 0 for j in range(n)] for i in range(n)]
    rs = [0] * n
    for g in gates:
        op = g[0]
        for row in range(n):
            X, Z = xs[row], zs[row]
            if op == 'h':
                a = g[1]
                rs[row] ^= X[a] & Z[a]
                X[a], Z[a] = Z[a], X[a]
            elif op == 's':
                a = g[1]
                rs[row] ^= X[a] & Z[a]
                Z[a] ^= X[a]
            elif op == 'x':
                rs[row] ^= Z[g[1]]
            elif op == 'z':
                rs[row] ^= X[g[1]]
            elif op == 'cx':
                a, b = g[1], g[2]
                rs[row] ^= X[a] & Z[b] & (X[b] ^ Z[a] ^ 1)
                X[b] ^= X[a]
                Z[a] ^= Z[b]
    letters = {(0, 0): 'I', (1, 0): 'X', (0, 1): 'Z', (1, 1): 'Y'}
    return [('-' if rs[r] else '+') + ''.join(letters[(xs[r][q], zs[r][q])] for q in range(n)) for r in range(n)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['regression: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']]], [['regression: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['regression: random clifford 17', [1, [['h', 0], ['s', 0], ['h', 0], ['h', 0], ['x', 0], ['s', 0], ['s', 0]]], ['+Y']], ['repair check: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']], ['control: cx on excited control', [2, [['x', 0], ['cx', 0, 1]]], ['-ZI', '+ZZ']], ['control: ghz', [3, [['h', 0], ['cx', 0, 1], ['cx', 0, 2]]], ['+XXX', '+ZZI', '+ZIZ']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 8', [3, [['cx', 0, 1], ['h', 2], ['h', 2], ['h', 0], ['cx', 2, 1], ['h', 2], ['z', 0], ['cx', 1, 2]]], ['-XII', '-XZX', '+IIX']]], [['regression: random clifford 28', [3, [['h', 1], ['cx', 0, 1], ['h', 0], ['cx', 2, 1], ['z', 0], ['x', 0], ['cx', 2, 1], ['h', 1], ['h', 2], ['s', 0], ['h', 0], ['cx', 1, 2]]], ['+YII', '+IZI', '+IIX']], ['regression: random clifford 29', [3, [['h', 2], ['s', 0], ['z', 1], ['h', 0], ['s', 0], ['z', 2], ['x', 1], ['z', 0], ['h', 2]]], ['-YII', '-IZI', '-IIZ']], ['repair check: random clifford 5', [1, [['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['s', 0], ['s', 0], ['s', 0], ['x', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 12', [1, [['h', 0], ['s', 0], ['h', 0], ['x', 0], ['s', 0], ['x', 0], ['x', 0], ['z', 0], ['h', 0], ['s', 0], ['s', 0]]], ['+Z']], ['control: random clifford 15', [2, [['z', 1], ['cx', 0, 1], ['x', 1], ['h', 1]]], ['+ZI', '-ZX']], ['control: random clifford 16', [1, [['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['z', 0], ['z', 0], ['h', 0], ['x', 0], ['h', 0]]], ['-Z']]], [['regression: random clifford 37', [3, [['z', 0], ['cx', 0, 2], ['s', 1], ['z', 1], ['h', 2], ['cx', 0, 1], ['s', 2], ['cx', 1, 0], ['h', 2], ['cx', 1, 0]]], ['+ZII', '+ZZI', '-ZIY']], ['regression: random clifford 38', [3, [['z', 1], ['h', 0], ['h', 2], ['h', 2], ['cx', 1, 2], ['cx', 2, 1], ['h', 1], ['h', 1], ['cx', 0, 1], ['h', 2], ['cx', 2, 1], ['s', 1], ['x', 0], ['s', 2]]], ['+XYI', '+ZXX', '-ZZZ']], ['repair check: random clifford 7', [3, [['cx', 0, 2], ['cx', 2, 1], ['s', 0], ['cx', 0, 2], ['cx', 2, 1], ['z', 1], ['z', 0], ['h', 1], ['x', 1]]], ['+ZII', '+ZXI', '+IIZ']], ['control: random clifford 19', [2, [['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 0, 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1]]], ['+XZ', '-YY']], ['control: random clifford 20', [3, [['cx', 2, 0], ['h', 2], ['z', 0], ['cx', 2, 1], ['cx', 0, 2], ['cx', 2, 1]]], ['+ZIX', '+ZZI', '+IIX']], ['control: random clifford 22', [3, [['h', 2], ['h', 0], ['cx', 1, 0], ['s', 1], ['cx', 0, 1], ['cx', 1, 0], ['s', 0], ['cx', 2, 1]]], ['+IXI', '+ZII', '+IXX']], ['control: random clifford 24', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 52', [1, [['h', 0], ['h', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['s', 0], ['h', 0], ['s', 0]]], ['-Y']], ['regression: random clifford 54', [1, [['h', 0], ['h', 0], ['x', 0], ['s', 0], ['h', 0], ['s', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0]]], ['-Y']], ['repair check: random clifford 13', [1, [['z', 0], ['x', 0], ['z', 0], ['z', 0], ['s', 0], ['x', 0], ['h', 0], ['h', 0], ['z', 0], ['h', 0]]], ['+X']], ['control: random clifford 25', [2, [['cx', 1, 0], ['cx', 1, 0]]], ['+ZI', '+IZ']], ['control: random clifford 27', [2, [['cx', 1, 0], ['x', 0], ['h', 0], ['cx', 1, 0], ['cx', 1, 0], ['cx', 1, 0], ['h', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['z', 1], ['h', 1]]], ['-XX', '+IX']], ['control: random clifford 32', [3, [['z', 1], ['x', 1], ['cx', 1, 0], ['cx', 1, 2], ['cx', 2, 1], ['x', 0], ['cx', 1, 2], ['z', 1], ['z', 1], ['cx', 2, 1], ['z', 2], ['x', 0], ['cx', 0, 2]]], ['+IIZ', '-ZIZ', '+ZZZ']], ['control: random clifford 34', [1, [['z', 0], ['h', 0], ['z', 0], ['h', 0]]], ['-Z']]]]
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: h then s['+Y']['+Y']Passed
regression: h on y eigenstate['-Y']['-Y']Passed
repair check: random clifford 1['-Z']['-Z']Passed
control: bell preparation['+XX', '+ZZ']['+XX', '+ZZ']Passed
control: s twice after h['-X']['-X']Passed
control: x flips z sign['-Z']['-Z']Passed
control: z on plus['-X']['-X']Passed

SHA-256 / 6a45724085bd41da9db2ff045cd50254e5513e83f4cc30f11bcc3782150e3caa

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

Case digest / 62c9b55ba5278f04bcebb568b2e89eeafaa203a115f071846955565b2a1dc5ab