FA-90996 / Quantum circuit simulation / Open access
Tableau CNOT sign rule drops the constant term · case 01
The CNOT sign update fires for generators such as X_c Z_t that should keep their sign, and misses X_c Y_t style cases.
ROOT CAUSE
The CNOT phase formula uses x_a z_b (x_b xor z_a) without the xor 1 from the Aaronson-Gottesman rule.
VERIFIED REPAIR
Use r ^= x_a z_b (x_b xor z_a xor 1).
Unsuccessful approach: The attempted repair restores the xor 1 but reads the target z bit instead of the control z bit in the parity term.
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]
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])
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: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['repair check: random clifford 4', [3, [['cx', 1, 2], ['h', 1], ['cx', 1, 0], ['s', 1], ['x', 2], ['cx', 1, 2], ['cx', 1, 2], ['h', 0], ['cx', 0, 2], ['z', 0], ['s', 2], ['h', 2], ['z', 0]]], ['-XZY', '+ZYI', '-IYX']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['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']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']], ['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: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']]], [['regression: random clifford 49', [2, [['cx', 0, 1], ['x', 1], ['h', 0], ['z', 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 1, 0]]], ['+XX', '+YY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: random clifford 2', [3, [['cx', 0, 2], ['z', 2], ['s', 2], ['h', 0], ['cx', 2, 1], ['x', 1], ['cx', 1, 0], ['x', 1], ['x', 1], ['z', 0], ['cx', 2, 1], ['h', 1], ['h', 0]]], ['-ZII', '-IXI', '-ZIZ']], ['control: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']]], [['regression: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['regression: random clifford 45', [2, [['z', 1], ['h', 0], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1], ['s', 1], ['z', 0], ['h', 0], ['s', 1], ['z', 1], ['cx', 0, 1], ['h', 1], ['cx', 0, 1], ['z', 1]]], ['+ZZ', '+YY']], ['control: 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 6', [1, [['h', 0], ['z', 0], ['h', 0], ['z', 0], ['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['s', 0], ['x', 0]]], ['-Z']], ['control: 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 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 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['control: random clifford 9', [2, [['cx', 1, 0], ['cx', 1, 0], ['x', 0], ['s', 0], ['cx', 1, 0], ['h', 1], ['x', 0], ['z', 1], ['cx', 0, 1]]], ['-ZX', '-IX']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['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']]]]
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: random clifford 18 | ['-YYI', '+ZZI', '-IIZ'] | ['+YYI', '+ZZI', '-IIZ'] | Failed |
| regression: random clifford 19 | ['+XZ', '+YY'] | ['+XZ', '-YY'] | Failed |
| repair check: random clifford 4 | ['-XZY', '+ZYI', '-IYX'] | ['-XZY', '+ZYI', '-IYX'] | Passed |
| control: bell preparation | ['+XX', '+ZZ'] | ['+XX', '+ZZ'] | Passed |
| control: h then s | ['+Y'] | ['+Y'] | Passed |
| control: s twice after h | ['-X'] | ['-X'] | Passed |
| control: x flips z sign | ['-Z'] | ['-Z'] | Passed |
SHA-256 / 6ee43e886b0509345671db046b253d84014adc1553cc13bb9ca5454b2d6dbe91
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] ^= 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[b] ^ 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: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['repair check: random clifford 4', [3, [['cx', 1, 2], ['h', 1], ['cx', 1, 0], ['s', 1], ['x', 2], ['cx', 1, 2], ['cx', 1, 2], ['h', 0], ['cx', 0, 2], ['z', 0], ['s', 2], ['h', 2], ['z', 0]]], ['-XZY', '+ZYI', '-IYX']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['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']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']], ['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: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']]], [['regression: random clifford 49', [2, [['cx', 0, 1], ['x', 1], ['h', 0], ['z', 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 1, 0]]], ['+XX', '+YY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: random clifford 2', [3, [['cx', 0, 2], ['z', 2], ['s', 2], ['h', 0], ['cx', 2, 1], ['x', 1], ['cx', 1, 0], ['x', 1], ['x', 1], ['z', 0], ['cx', 2, 1], ['h', 1], ['h', 0]]], ['-ZII', '-IXI', '-ZIZ']], ['control: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']]], [['regression: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['regression: random clifford 45', [2, [['z', 1], ['h', 0], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1], ['s', 1], ['z', 0], ['h', 0], ['s', 1], ['z', 1], ['cx', 0, 1], ['h', 1], ['cx', 0, 1], ['z', 1]]], ['+ZZ', '+YY']], ['control: 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 6', [1, [['h', 0], ['z', 0], ['h', 0], ['z', 0], ['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['s', 0], ['x', 0]]], ['-Z']], ['control: 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 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 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['control: random clifford 9', [2, [['cx', 1, 0], ['cx', 1, 0], ['x', 0], ['s', 0], ['cx', 1, 0], ['h', 1], ['x', 0], ['z', 1], ['cx', 0, 1]]], ['-ZX', '-IX']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['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']]]]
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: random clifford 18 | ['-YYI', '+ZZI', '-IIZ'] | ['+YYI', '+ZZI', '-IIZ'] | Failed |
| regression: random clifford 19 | ['+XZ', '-YY'] | ['+XZ', '-YY'] | Passed |
| repair check: random clifford 4 | ['-XZY', '+ZYI', '+IYX'] | ['-XZY', '+ZYI', '-IYX'] | Failed |
| control: bell preparation | ['+XX', '+ZZ'] | ['+XX', '+ZZ'] | Passed |
| control: h then s | ['+Y'] | ['+Y'] | Passed |
| control: s twice after h | ['-X'] | ['-X'] | Passed |
| control: x flips z sign | ['-Z'] | ['-Z'] | Passed |
SHA-256 / e236f61781945d6b442f3fce96950ce2194e5bc962aee2b7fd1092c4f37438c4
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: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['repair check: random clifford 4', [3, [['cx', 1, 2], ['h', 1], ['cx', 1, 0], ['s', 1], ['x', 2], ['cx', 1, 2], ['cx', 1, 2], ['h', 0], ['cx', 0, 2], ['z', 0], ['s', 2], ['h', 2], ['z', 0]]], ['-XZY', '+ZYI', '-IYX']], ['control: bell preparation', [2, [['h', 0], ['cx', 0, 1]]], ['+XX', '+ZZ']], ['control: h then s', [1, [['h', 0], ['s', 0]]], ['+Y']], ['control: s twice after h', [1, [['h', 0], ['s', 0], ['s', 0]]], ['-X']], ['control: x flips z sign', [1, [['x', 0]]], ['-Z']]], [['regression: random clifford 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['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']], ['control: z on plus', [1, [['h', 0], ['z', 0]]], ['-X']], ['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: h on y eigenstate', [1, [['h', 0], ['s', 0], ['h', 0]]], ['-Y']]], [['regression: random clifford 49', [2, [['cx', 0, 1], ['x', 1], ['h', 0], ['z', 1], ['cx', 0, 1], ['cx', 1, 0], ['cx', 1, 0]]], ['+XX', '+YY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['control: random clifford 0', [3, [['cx', 1, 2]]], ['+ZII', '+IZI', '+IZZ']], ['control: random clifford 1', [1, [['z', 0], ['s', 0], ['x', 0], ['x', 0], ['x', 0], ['z', 0], ['z', 0], ['z', 0]]], ['-Z']], ['control: random clifford 2', [3, [['cx', 0, 2], ['z', 2], ['s', 2], ['h', 0], ['cx', 2, 1], ['x', 1], ['cx', 1, 0], ['x', 1], ['x', 1], ['z', 0], ['cx', 2, 1], ['h', 1], ['h', 0]]], ['-ZII', '-IXI', '-ZIZ']], ['control: random clifford 3', [1, [['s', 0], ['h', 0], ['h', 0], ['x', 0], ['h', 0], ['h', 0], ['s', 0], ['s', 0]]], ['-Z']]], [['regression: random clifford 18', [3, [['cx', 1, 0], ['z', 0], ['z', 1], ['x', 2], ['h', 0], ['s', 2], ['z', 1], ['z', 2], ['cx', 0, 1], ['z', 1]]], ['+YYI', '+ZZI', '-IIZ']], ['regression: 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']], ['regression: random clifford 45', [2, [['z', 1], ['h', 0], ['cx', 0, 1], ['cx', 1, 0], ['cx', 0, 1], ['s', 1], ['z', 0], ['h', 0], ['s', 1], ['z', 1], ['cx', 0, 1], ['h', 1], ['cx', 0, 1], ['z', 1]]], ['+ZZ', '+YY']], ['control: 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 6', [1, [['h', 0], ['z', 0], ['h', 0], ['z', 0], ['x', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['h', 0], ['s', 0], ['x', 0]]], ['-Z']], ['control: 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 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 41', [3, [['s', 2], ['s', 0], ['s', 1], ['cx', 1, 2], ['h', 1], ['cx', 2, 1], ['cx', 1, 2], ['h', 1], ['s', 2], ['cx', 1, 0]]], ['+ZZI', '+IZY', '-XYX']], ['regression: random clifford 42', [3, [['h', 2], ['cx', 1, 0], ['h', 2], ['s', 1], ['h', 0], ['cx', 2, 1], ['x', 2], ['x', 2], ['cx', 0, 2], ['h', 0], ['cx', 0, 2]]], ['-XZZ', '-YZY', '-YIY']], ['regression: random clifford 51', [2, [['cx', 0, 1], ['h', 0], ['cx', 1, 0], ['h', 0], ['x', 1], ['x', 0], ['cx', 0, 1], ['cx', 0, 1], ['h', 0], ['cx', 0, 1], ['x', 1]]], ['-XX', '+YY']], ['control: random clifford 9', [2, [['cx', 1, 0], ['cx', 1, 0], ['x', 0], ['s', 0], ['cx', 1, 0], ['h', 1], ['x', 0], ['z', 1], ['cx', 0, 1]]], ['-ZX', '-IX']], ['control: random clifford 10', [1, [['z', 0], ['z', 0], ['s', 0], ['z', 0], ['h', 0], ['h', 0], ['s', 0]]], ['+Z']], ['control: random clifford 11', [2, [['s', 1], ['h', 0], ['cx', 0, 1], ['s', 0], ['x', 0]]], ['-YX', '-ZZ']], ['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']]]]
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: random clifford 18 | ['+YYI', '+ZZI', '-IIZ'] | ['+YYI', '+ZZI', '-IIZ'] | Passed |
| regression: random clifford 19 | ['+XZ', '-YY'] | ['+XZ', '-YY'] | Passed |
| repair check: random clifford 4 | ['-XZY', '+ZYI', '-IYX'] | ['-XZY', '+ZYI', '-IYX'] | Passed |
| control: bell preparation | ['+XX', '+ZZ'] | ['+XX', '+ZZ'] | Passed |
| control: h then s | ['+Y'] | ['+Y'] | Passed |
| control: s twice after h | ['-X'] | ['-X'] | Passed |
| control: x flips z sign | ['-Z'] | ['-Z'] | Passed |
SHA-256 / 662cfdddd16fdff598024f08935d1cc8e7b938f746df1d1e888390785b19a85f
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.767225+00:00.
Case digest / 502f0633395b145e5f79859e2b062c2a912a4cf6f7b6213ad0e0da8682875d25