FA-90921 / Quantum circuit simulation / Open access
Collapse judges impossibility on absolute rather than relative mass · case 01
A valid state stored with amplitudes around 1e-7 is reported as "impossible" although the outcome has probability 0.64.
ROOT CAUSE
The guard compares the unnormalized kept mass p against 1e-12 instead of the normalized probability.
VERIFIED REPAIR
Compare the normalized probability prob < 1e-12.
Unsuccessful approach: The attempted repair compares prob to exactly zero, so branches with probability 1e-16 are renormalized into huge amplitudes.
Case contract
Input [n, amps, q, outcome]; measure qubit q (0 = LSB) of the possibly unnormalized state. Return {"probability": p, "state": post} with p normalized by the total squared norm and the post-measurement state renormalized to unit norm with the other branch zeroed; values rounded to 6 decimals. Return "impossible" when p < 1e-12.
Why this case matters
Mid-circuit measurement and collapse drive dynamic circuits; wrong renormalization breaks every later probability.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, q, outcome = x
psi = [complex(a, b) for a, b in amps]
keep = [((i >> q) & 1) == outcome for i in range(len(psi))]
p = sum(abs(v) ** 2 for i, v in enumerate(psi) if keep[i])
norm = sum(abs(v) ** 2 for v in psi)
prob = p / norm
if p < 1e-12:
return 'impossible'
scale = 1 / math.sqrt(p)
post = [v * scale if keep[i] else 0j for i, v in enumerate(psi)]
return {'probability': round(prob, 6) + 0.0, 'state': [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in post]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['control: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: unnormalized bell measure qubit 1', [2, [[2, 0], [0, 0], [0, 0], [2, 0]], 1, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 0', [1, [[-0.305, 0.494], [0.447, -0.241]], 0, 0], {'probability': 0.566536, 'state': [[-0.525346, 0.850889], [0.0, 0.0]]}], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['control: random collapse 3', [3, [[0.755, 0.514], [0.624, 0.382], [-0.745, 0.675], [-0.295, 0.287], [0.799, -0.013], [-0.459, 0.107], [0.751, 0.682], [0.988, 0.816]], 0, 1], {'probability': 0.422407, 'state': [[0.0, 0.0], [0.38933, 0.23834], [0.0, 0.0], [-0.184058, 0.179067], [0.0, 0.0], [-0.286382, 0.06676], [0.0, 0.0], [0.616439, 0.509123]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 4', [1, [[-0.125, -0.177], [0.075, 0.432]], 0, 0], {'probability': 0.196294, 'state': [[-0.576864, -0.81684], [0.0, 0.0]]}], ['control: random collapse 5', [3, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0], [0.0, 0.0], [-0.0, -0.0]], 1, 0], {'probability': 1.0, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 6', [3, [[-0.436, -0.015], [-0.35, 0.017], [0.17, 0.002], [0.369, -0.461], [0.411, -0.033], [-0.475, 0.29], [0.379, -0.067], [-0.298, 0.408]], 2, 0], {'probability': 0.438863, 'state': [[-0.524618, -0.018049], [-0.421138, 0.020455], [0.204553, 0.002407], [0.444, -0.554699], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible']], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 8', [2, [[-1.464, -0.995], [0.052, 0.311], [0.0, 0.0], [0.0, 0.0]], 0, 0], {'probability': 0.969244, 'state': [[-0.827063, -0.562109], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 9', [1, [[0.307, 0.202], [-0.161, 0.592]], 0, 0], {'probability': 0.264065, 'state': [[0.835384, 0.549666], [0.0, 0.0]]}], ['control: random collapse 10', [2, [[0.359, -0.323], [-0.182, -0.34], [0.238, 0.218], [-0.224, 0.46]], 0, 1], {'probability': 0.548886, 'state': [[0.0, 0.0], [-0.284063, -0.530667], [0.0, 0.0], [-0.349616, 0.717962]]}], ['control: random collapse 11', [2, [[0.414, -0.429], [-0.452, -0.264], [0.422, -0.171], [-0.123, 0.056]], 0, 1], {'probability': 0.34182, 'state': [[0.0, 0.0], [-0.836084, -0.488332], [0.0, 0.0], [-0.227518, 0.103586]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 13', [3, [[0.164, 0.188], [0.288, -0.262], [0.203, 0.372], [0.485, -0.006], [-0.386, -0.389], [-0.128, 0.167], [-0.162, 0.438], [-0.379, -0.043]], 0, 1], {'probability': 0.431321, 'state': [[0.0, 0.0], [0.379272, -0.345032], [0.0, 0.0], [0.638704, -0.007901], [0.0, 0.0], [-0.168565, 0.219925], [0.0, 0.0], [-0.499111, -0.056627]]}], ['control: random collapse 14', [2, [[-1.5, 0.759], [0.0, 0.0], [0.0, 0.0], [-2.588, 1.898]], 1, 0], {'probability': 0.2153, 'state': [[-0.892275, 0.451491], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 15', [1, [[0.489, -0.285], [-0.403, 0.425]], 0, 1], {'probability': 0.5171, 'state': [[0.0, 0.0], [-0.688076, 0.725639]]}]]]
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: tiny norm state | impossible | {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]} | Failed |
| repair check: near impossible branch | impossible | impossible | Passed |
| control: measure 0 on |+> | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | Passed |
| control: measure 1 on |+> | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | Passed |
| control: impossible outcome | impossible | impossible | Passed |
| control: unnormalized bell measure qubit 1 | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | Passed |
SHA-256 / 154bab14f70792e17ef1427d39743e71e4524d97baadd163026bb911ecbfae8d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, q, outcome = x
psi = [complex(a, b) for a, b in amps]
keep = [((i >> q) & 1) == outcome for i in range(len(psi))]
p = sum(abs(v) ** 2 for i, v in enumerate(psi) if keep[i])
norm = sum(abs(v) ** 2 for v in psi)
prob = p / norm
if prob <= 0.0:
return 'impossible'
scale = 1 / math.sqrt(p)
post = [v * scale if keep[i] else 0j for i, v in enumerate(psi)]
return {'probability': round(prob, 6) + 0.0, 'state': [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in post]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['control: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: unnormalized bell measure qubit 1', [2, [[2, 0], [0, 0], [0, 0], [2, 0]], 1, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 0', [1, [[-0.305, 0.494], [0.447, -0.241]], 0, 0], {'probability': 0.566536, 'state': [[-0.525346, 0.850889], [0.0, 0.0]]}], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['control: random collapse 3', [3, [[0.755, 0.514], [0.624, 0.382], [-0.745, 0.675], [-0.295, 0.287], [0.799, -0.013], [-0.459, 0.107], [0.751, 0.682], [0.988, 0.816]], 0, 1], {'probability': 0.422407, 'state': [[0.0, 0.0], [0.38933, 0.23834], [0.0, 0.0], [-0.184058, 0.179067], [0.0, 0.0], [-0.286382, 0.06676], [0.0, 0.0], [0.616439, 0.509123]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 4', [1, [[-0.125, -0.177], [0.075, 0.432]], 0, 0], {'probability': 0.196294, 'state': [[-0.576864, -0.81684], [0.0, 0.0]]}], ['control: random collapse 5', [3, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0], [0.0, 0.0], [-0.0, -0.0]], 1, 0], {'probability': 1.0, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 6', [3, [[-0.436, -0.015], [-0.35, 0.017], [0.17, 0.002], [0.369, -0.461], [0.411, -0.033], [-0.475, 0.29], [0.379, -0.067], [-0.298, 0.408]], 2, 0], {'probability': 0.438863, 'state': [[-0.524618, -0.018049], [-0.421138, 0.020455], [0.204553, 0.002407], [0.444, -0.554699], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible']], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 8', [2, [[-1.464, -0.995], [0.052, 0.311], [0.0, 0.0], [0.0, 0.0]], 0, 0], {'probability': 0.969244, 'state': [[-0.827063, -0.562109], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 9', [1, [[0.307, 0.202], [-0.161, 0.592]], 0, 0], {'probability': 0.264065, 'state': [[0.835384, 0.549666], [0.0, 0.0]]}], ['control: random collapse 10', [2, [[0.359, -0.323], [-0.182, -0.34], [0.238, 0.218], [-0.224, 0.46]], 0, 1], {'probability': 0.548886, 'state': [[0.0, 0.0], [-0.284063, -0.530667], [0.0, 0.0], [-0.349616, 0.717962]]}], ['control: random collapse 11', [2, [[0.414, -0.429], [-0.452, -0.264], [0.422, -0.171], [-0.123, 0.056]], 0, 1], {'probability': 0.34182, 'state': [[0.0, 0.0], [-0.836084, -0.488332], [0.0, 0.0], [-0.227518, 0.103586]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 13', [3, [[0.164, 0.188], [0.288, -0.262], [0.203, 0.372], [0.485, -0.006], [-0.386, -0.389], [-0.128, 0.167], [-0.162, 0.438], [-0.379, -0.043]], 0, 1], {'probability': 0.431321, 'state': [[0.0, 0.0], [0.379272, -0.345032], [0.0, 0.0], [0.638704, -0.007901], [0.0, 0.0], [-0.168565, 0.219925], [0.0, 0.0], [-0.499111, -0.056627]]}], ['control: random collapse 14', [2, [[-1.5, 0.759], [0.0, 0.0], [0.0, 0.0], [-2.588, 1.898]], 1, 0], {'probability': 0.2153, 'state': [[-0.892275, 0.451491], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 15', [1, [[0.489, -0.285], [-0.403, 0.425]], 0, 1], {'probability': 0.5171, 'state': [[0.0, 0.0], [-0.688076, 0.725639]]}]]]
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: tiny norm state | {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]} | {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]} | Passed |
| repair check: near impossible branch | {'probability': 0.0, 'state': [[0.0, 0.0], [1.0, 0.0]]} | impossible | Failed |
| control: measure 0 on |+> | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | Passed |
| control: measure 1 on |+> | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | Passed |
| control: impossible outcome | impossible | impossible | Passed |
| control: unnormalized bell measure qubit 1 | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | Passed |
SHA-256 / 32dd8347f4d603908e39af3bf3d97168faeef1bc3905a7541536d4e0a6aa33a2
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x):
n, amps, q, outcome = x
psi = [complex(a, b) for a, b in amps]
keep = [((i >> q) & 1) == outcome for i in range(len(psi))]
p = sum(abs(v) ** 2 for i, v in enumerate(psi) if keep[i])
norm = sum(abs(v) ** 2 for v in psi)
prob = p / norm
if prob < 1e-12:
return 'impossible'
scale = 1 / math.sqrt(p)
post = [v * scale if keep[i] else 0j for i, v in enumerate(psi)]
return {'probability': round(prob, 6) + 0.0, 'state': [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in post]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['control: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: unnormalized bell measure qubit 1', [2, [[2, 0], [0, 0], [0, 0], [2, 0]], 1, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 0', [1, [[-0.305, 0.494], [0.447, -0.241]], 0, 0], {'probability': 0.566536, 'state': [[-0.525346, 0.850889], [0.0, 0.0]]}], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['control: random collapse 3', [3, [[0.755, 0.514], [0.624, 0.382], [-0.745, 0.675], [-0.295, 0.287], [0.799, -0.013], [-0.459, 0.107], [0.751, 0.682], [0.988, 0.816]], 0, 1], {'probability': 0.422407, 'state': [[0.0, 0.0], [0.38933, 0.23834], [0.0, 0.0], [-0.184058, 0.179067], [0.0, 0.0], [-0.286382, 0.06676], [0.0, 0.0], [0.616439, 0.509123]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 4', [1, [[-0.125, -0.177], [0.075, 0.432]], 0, 0], {'probability': 0.196294, 'state': [[-0.576864, -0.81684], [0.0, 0.0]]}], ['control: random collapse 5', [3, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0], [0.0, 0.0], [-0.0, -0.0]], 1, 0], {'probability': 1.0, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 6', [3, [[-0.436, -0.015], [-0.35, 0.017], [0.17, 0.002], [0.369, -0.461], [0.411, -0.033], [-0.475, 0.29], [0.379, -0.067], [-0.298, 0.408]], 2, 0], {'probability': 0.438863, 'state': [[-0.524618, -0.018049], [-0.421138, 0.020455], [0.204553, 0.002407], [0.444, -0.554699], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible']], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 8', [2, [[-1.464, -0.995], [0.052, 0.311], [0.0, 0.0], [0.0, 0.0]], 0, 0], {'probability': 0.969244, 'state': [[-0.827063, -0.562109], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 9', [1, [[0.307, 0.202], [-0.161, 0.592]], 0, 0], {'probability': 0.264065, 'state': [[0.835384, 0.549666], [0.0, 0.0]]}], ['control: random collapse 10', [2, [[0.359, -0.323], [-0.182, -0.34], [0.238, 0.218], [-0.224, 0.46]], 0, 1], {'probability': 0.548886, 'state': [[0.0, 0.0], [-0.284063, -0.530667], [0.0, 0.0], [-0.349616, 0.717962]]}], ['control: random collapse 11', [2, [[0.414, -0.429], [-0.452, -0.264], [0.422, -0.171], [-0.123, 0.056]], 0, 1], {'probability': 0.34182, 'state': [[0.0, 0.0], [-0.836084, -0.488332], [0.0, 0.0], [-0.227518, 0.103586]]}]], [['regression: tiny norm state', [1, [[3e-07, 0], [0, 4e-07]], 0, 1], {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]}], ['repair check: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 13', [3, [[0.164, 0.188], [0.288, -0.262], [0.203, 0.372], [0.485, -0.006], [-0.386, -0.389], [-0.128, 0.167], [-0.162, 0.438], [-0.379, -0.043]], 0, 1], {'probability': 0.431321, 'state': [[0.0, 0.0], [0.379272, -0.345032], [0.0, 0.0], [0.638704, -0.007901], [0.0, 0.0], [-0.168565, 0.219925], [0.0, 0.0], [-0.499111, -0.056627]]}], ['control: random collapse 14', [2, [[-1.5, 0.759], [0.0, 0.0], [0.0, 0.0], [-2.588, 1.898]], 1, 0], {'probability': 0.2153, 'state': [[-0.892275, 0.451491], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}], ['control: random collapse 15', [1, [[0.489, -0.285], [-0.403, 0.425]], 0, 1], {'probability': 0.5171, 'state': [[0.0, 0.0], [-0.688076, 0.725639]]}]]]
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: tiny norm state | {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]} | {'probability': 0.64, 'state': [[0.0, 0.0], [0.0, 1.0]]} | Passed |
| repair check: near impossible branch | impossible | impossible | Passed |
| control: measure 0 on |+> | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]} | Passed |
| control: measure 1 on |+> | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]} | Passed |
| control: impossible outcome | impossible | impossible | Passed |
| control: unnormalized bell measure qubit 1 | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]} | Passed |
SHA-256 / 0c94a6168d14a2186a9c577b5da1b6c1d818cd63fc468d8c194390c7e5985170
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.092238+00:00.
Case digest / e9c4bdbf2581b8578fb9a7c5eb822e2fbd8ff5d8a3a38f4f0ebb95a8b0decad9