FAILURE MAP
← Case archive

FA-90926 / Quantum circuit simulation / Open access

Collapse keeps amplitudes of the unobserved branch · case 01

After observing 0 on |+> the returned state still has a 0.707 amplitude on |1>.

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

ROOT CAUSE

The post-state comprehension copies v for indices outside the observed branch instead of zeroing them.

VERIFIED REPAIR

Zero every amplitude whose measured bit differs from the outcome and rescale the rest.

Unsuccessful approach: The attempted repair zeroes the discarded branch but rescales by the total norm, so the post state is not unit norm.

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 prob < 1e-12:
        return 'impossible'
    scale = 1 / math.sqrt(p)
    post = [v * scale if keep[i] else v 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: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['regression: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['regression: 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['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']], [['regression: 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]]}], ['regression: 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: 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]]}], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 16', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, -0.0], [-0.0, 0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 22', [2, [[0.5, 0.0], [-0.0, -0.0], [0.0, 0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 23', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 34', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0]], 1, 1], 'impossible'], ['control: random collapse 37', [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]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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: 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 39', [2, [[0.5, 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible']]]
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: measure 0 on |+>{'probability': 0.5, 'state': [[1.0, 0.0], [0.707107, 0.0]]}{'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}Failed
regression: measure 1 on |+>{'probability': 0.5, 'state': [[0.707107, 0.0], [1.0, 0.0]]}{'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}Failed
regression: unnormalized bell measure qubit 1{'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [2.0, 0.0]]}{'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]]}Failed
control: impossible outcomeimpossibleimpossiblePassed
control: near impossible branchimpossibleimpossiblePassed
control: random collapse 1impossibleimpossiblePassed
control: random collapse 2impossibleimpossiblePassed

SHA-256 / 8c24891c56844d62c69cdd81e5884c7c2d93921a631a464ebbe27cdb69ff29f9

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 < 1e-12:
        return 'impossible'
    scale = 1 / math.sqrt(norm)
    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: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['regression: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['regression: 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['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']], [['regression: 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]]}], ['regression: 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: 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]]}], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 16', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, -0.0], [-0.0, 0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 22', [2, [[0.5, 0.0], [-0.0, -0.0], [0.0, 0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 23', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 34', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0]], 1, 1], 'impossible'], ['control: random collapse 37', [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]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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: 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 39', [2, [[0.5, 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible']]]
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: measure 0 on |+>{'probability': 0.5, 'state': [[0.707107, 0.0], [0.0, 0.0]]}{'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}Failed
regression: measure 1 on |+>{'probability': 0.5, 'state': [[0.0, 0.0], [0.707107, 0.0]]}{'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}Failed
regression: unnormalized bell measure qubit 1{'probability': 0.5, 'state': [[0.707107, 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]]}Failed
control: impossible outcomeimpossibleimpossiblePassed
control: near impossible branchimpossibleimpossiblePassed
control: random collapse 1impossibleimpossiblePassed
control: random collapse 2impossibleimpossiblePassed

SHA-256 / f48047e97c365f171951bdb0efe1faab2d8956592ad91b097d7b5f4aea688b83

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: measure 0 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 0], {'probability': 0.5, 'state': [[1.0, 0.0], [0.0, 0.0]]}], ['regression: measure 1 on |+>', [1, [[0.707107, 0], [0.707107, 0]], 0, 1], {'probability': 0.5, 'state': [[0.0, 0.0], [1.0, 0.0]]}], ['regression: 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['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']], [['regression: 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]]}], ['regression: 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: 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]]}], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 16', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, -0.0], [-0.0, 0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 22', [2, [[0.5, 0.0], [-0.0, -0.0], [0.0, 0.0], [-0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 23', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, -0.0]], 0, 1], 'impossible'], ['control: random collapse 34', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, 0.0], [-0.0, 0.0]], 1, 1], 'impossible'], ['control: random collapse 37', [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]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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: 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 39', [2, [[0.5, 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]]}], ['control: impossible outcome', [1, [[1, 0], [0, 0]], 0, 1], 'impossible'], ['control: near impossible branch', [1, [[1, 0], [1e-08, 0]], 0, 1], 'impossible'], ['control: random collapse 1', [2, [[0.5, 0.0], [0.0, 0.0], [0.0, -0.0], [-0.0, -0.0]], 0, 1], 'impossible']], [['regression: 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]]}], ['regression: 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]]}], ['regression: 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 2', [2, [[0.0, 0.0], [0.0, 0.0], [0.591, 0.404], [0.405, 0.306]], 1, 0], 'impossible'], ['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 7', [2, [[0.5, 0.0], [-0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], 0, 1], 'impossible'], ['control: random collapse 12', [1, [[0.5, 0.0], [0.0, 0.0]], 0, 1], 'impossible']]]
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: 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
regression: 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
regression: 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
control: impossible outcomeimpossibleimpossiblePassed
control: near impossible branchimpossibleimpossiblePassed
control: random collapse 1impossibleimpossiblePassed
control: random collapse 2impossibleimpossiblePassed

SHA-256 / f564c52b2dc542b8d0c8863cd0bdf93abc3a34645b428a81527949255818d335

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

Case digest / 65086501e1fe6cbe9fce0ae9f1d0c859cc7185ce060f4f2635e814022ee659fd