FAILURE MAP
← Case archive

FA-91206 / Quantum circuit simulation / Open access

Grover planner rejects a fully marked search space · case 01

N=8, M=8 is reported as "invalid" instead of the trivial zero-iteration plan with success 1.

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

ROOT CAUSE

The validation rejects M >= N, treating the legal all-marked case as out of range.

VERIFIED REPAIR

Reject only M > N.

Unsuccessful approach: The attempted repair loosens the bound to M > N + 1, which now accepts M = N + 1 and reports a success probability above 1.

Case contract

Input [N, M]. "invalid" if N < 1, M < 0 or M > N; "no-solution" if M == 0; if 2M >= N return {"iterations": 0, "success": M/N}; else theta = asin(sqrt(M/N)), k = floor(pi/(4 theta)) and success = sin^2((2k+1) theta). Probabilities rounded to 6 decimals.

Why this case matters

Choosing the Grover iteration count wrongly overshoots the amplitude peak and collapses the success 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, M = x
    if N < 1 or M < 0 or M >= N:
        return 'invalid'
    if M == 0:
        return 'no-solution'
    if 2 * M >= N:
        return {'iterations': 0, 'success': round(M / N, 6)}
    theta = math.asin(math.sqrt(M / N))
    k = math.floor(math.pi / (4 * theta))
    return {'iterations': k, 'success': round(math.sin((2 * k + 1) * theta) ** 2, 6)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: half marked N=4 M=2', [4, 2], {'iterations': 0, 'success': 0.5}], ['control: odd N just under half', [5, 2], {'iterations': 1, 'success': 0.784}], ['control: single marked N=4', [4, 1], {'iterations': 1, 'success': 1.0}], ['control: no marked items', [8, 0], 'no-solution']], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: negative M', [4, -1], 'invalid'], ['control: empty space', [0, 0], 'invalid'], ['control: N=7 M=3', [7, 3], {'iterations': 1, 'success': 0.708455}], ['control: N=9 M=4', [9, 4], {'iterations': 1, 'success': 0.663923}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=1', [8, 1], {'iterations': 2, 'success': 0.945312}], ['control: N=8 M=2', [8, 2], {'iterations': 1, 'success': 1.0}], ['control: N=8 M=3', [8, 3], {'iterations': 1, 'success': 0.84375}], ['control: N=8 M=5', [8, 5], {'iterations': 0, 'success': 0.625}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=7', [8, 7], {'iterations': 0, 'success': 0.875}], ['control: N=16 M=1', [16, 1], {'iterations': 3, 'success': 0.961319}], ['control: N=16 M=2', [16, 2], {'iterations': 2, 'success': 0.945312}], ['control: N=16 M=3', [16, 3], {'iterations': 1, 'success': 0.949219}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=16 M=5', [16, 5], {'iterations': 1, 'success': 0.957031}], ['control: N=16 M=7', [16, 7], {'iterations': 1, 'success': 0.683594}], ['control: N=16 M=13', [16, 13], {'iterations': 0, 'success': 0.8125}], ['control: N=32 M=1', [32, 1], {'iterations': 4, 'success': 0.999182}]]]
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: all markedinvalid{'iterations': 0, 'success': 1.0}Failed
regression: all marked N=1invalid{'iterations': 0, 'success': 1.0}Failed
repair check: M greater than NinvalidinvalidPassed
control: half marked N=4 M=2{'iterations': 0, 'success': 0.5}{'iterations': 0, 'success': 0.5}Passed
control: odd N just under half{'iterations': 1, 'success': 0.784}{'iterations': 1, 'success': 0.784}Passed
control: single marked N=4{'iterations': 1, 'success': 1.0}{'iterations': 1, 'success': 1.0}Passed
control: no marked itemsno-solutionno-solutionPassed

SHA-256 / c4b21b7bda8c0c9fef01cacb40980d14ef3514112a0fb190cb63463a71279c22

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, M = x
    if N < 1 or M < 0 or M > N + 1:
        return 'invalid'
    if M == 0:
        return 'no-solution'
    if 2 * M >= N:
        return {'iterations': 0, 'success': round(M / N, 6)}
    theta = math.asin(math.sqrt(M / N))
    k = math.floor(math.pi / (4 * theta))
    return {'iterations': k, 'success': round(math.sin((2 * k + 1) * theta) ** 2, 6)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: half marked N=4 M=2', [4, 2], {'iterations': 0, 'success': 0.5}], ['control: odd N just under half', [5, 2], {'iterations': 1, 'success': 0.784}], ['control: single marked N=4', [4, 1], {'iterations': 1, 'success': 1.0}], ['control: no marked items', [8, 0], 'no-solution']], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: negative M', [4, -1], 'invalid'], ['control: empty space', [0, 0], 'invalid'], ['control: N=7 M=3', [7, 3], {'iterations': 1, 'success': 0.708455}], ['control: N=9 M=4', [9, 4], {'iterations': 1, 'success': 0.663923}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=1', [8, 1], {'iterations': 2, 'success': 0.945312}], ['control: N=8 M=2', [8, 2], {'iterations': 1, 'success': 1.0}], ['control: N=8 M=3', [8, 3], {'iterations': 1, 'success': 0.84375}], ['control: N=8 M=5', [8, 5], {'iterations': 0, 'success': 0.625}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=7', [8, 7], {'iterations': 0, 'success': 0.875}], ['control: N=16 M=1', [16, 1], {'iterations': 3, 'success': 0.961319}], ['control: N=16 M=2', [16, 2], {'iterations': 2, 'success': 0.945312}], ['control: N=16 M=3', [16, 3], {'iterations': 1, 'success': 0.949219}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=16 M=5', [16, 5], {'iterations': 1, 'success': 0.957031}], ['control: N=16 M=7', [16, 7], {'iterations': 1, 'success': 0.683594}], ['control: N=16 M=13', [16, 13], {'iterations': 0, 'success': 0.8125}], ['control: N=32 M=1', [32, 1], {'iterations': 4, 'success': 0.999182}]]]
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: all marked{'iterations': 0, 'success': 1.0}{'iterations': 0, 'success': 1.0}Passed
regression: all marked N=1{'iterations': 0, 'success': 1.0}{'iterations': 0, 'success': 1.0}Passed
repair check: M greater than N{'iterations': 0, 'success': 1.25}invalidFailed
control: half marked N=4 M=2{'iterations': 0, 'success': 0.5}{'iterations': 0, 'success': 0.5}Passed
control: odd N just under half{'iterations': 1, 'success': 0.784}{'iterations': 1, 'success': 0.784}Passed
control: single marked N=4{'iterations': 1, 'success': 1.0}{'iterations': 1, 'success': 1.0}Passed
control: no marked itemsno-solutionno-solutionPassed

SHA-256 / 7a731e24db03e128ef2fd32ca768b4580b376bca1d887be3fbc17bbff07b86f5

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, M = x
    if N < 1 or M < 0 or M > N:
        return 'invalid'
    if M == 0:
        return 'no-solution'
    if 2 * M >= N:
        return {'iterations': 0, 'success': round(M / N, 6)}
    theta = math.asin(math.sqrt(M / N))
    k = math.floor(math.pi / (4 * theta))
    return {'iterations': k, 'success': round(math.sin((2 * k + 1) * theta) ** 2, 6)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: half marked N=4 M=2', [4, 2], {'iterations': 0, 'success': 0.5}], ['control: odd N just under half', [5, 2], {'iterations': 1, 'success': 0.784}], ['control: single marked N=4', [4, 1], {'iterations': 1, 'success': 1.0}], ['control: no marked items', [8, 0], 'no-solution']], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: negative M', [4, -1], 'invalid'], ['control: empty space', [0, 0], 'invalid'], ['control: N=7 M=3', [7, 3], {'iterations': 1, 'success': 0.708455}], ['control: N=9 M=4', [9, 4], {'iterations': 1, 'success': 0.663923}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=1', [8, 1], {'iterations': 2, 'success': 0.945312}], ['control: N=8 M=2', [8, 2], {'iterations': 1, 'success': 1.0}], ['control: N=8 M=3', [8, 3], {'iterations': 1, 'success': 0.84375}], ['control: N=8 M=5', [8, 5], {'iterations': 0, 'success': 0.625}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=8 M=7', [8, 7], {'iterations': 0, 'success': 0.875}], ['control: N=16 M=1', [16, 1], {'iterations': 3, 'success': 0.961319}], ['control: N=16 M=2', [16, 2], {'iterations': 2, 'success': 0.945312}], ['control: N=16 M=3', [16, 3], {'iterations': 1, 'success': 0.949219}]], [['regression: all marked', [8, 8], {'iterations': 0, 'success': 1.0}], ['regression: all marked N=1', [1, 1], {'iterations': 0, 'success': 1.0}], ['repair check: M greater than N', [4, 5], 'invalid'], ['control: N=16 M=5', [16, 5], {'iterations': 1, 'success': 0.957031}], ['control: N=16 M=7', [16, 7], {'iterations': 1, 'success': 0.683594}], ['control: N=16 M=13', [16, 13], {'iterations': 0, 'success': 0.8125}], ['control: N=32 M=1', [32, 1], {'iterations': 4, 'success': 0.999182}]]]
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: all marked{'iterations': 0, 'success': 1.0}{'iterations': 0, 'success': 1.0}Passed
regression: all marked N=1{'iterations': 0, 'success': 1.0}{'iterations': 0, 'success': 1.0}Passed
repair check: M greater than NinvalidinvalidPassed
control: half marked N=4 M=2{'iterations': 0, 'success': 0.5}{'iterations': 0, 'success': 0.5}Passed
control: odd N just under half{'iterations': 1, 'success': 0.784}{'iterations': 1, 'success': 0.784}Passed
control: single marked N=4{'iterations': 1, 'success': 1.0}{'iterations': 1, 'success': 1.0}Passed
control: no marked itemsno-solutionno-solutionPassed

SHA-256 / 50bb450cb577c10906706f347928d662c325a7ee3a18f55e1d3225d67efb2577

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

Case digest / eedc463afd4e441af49f4288118cfda36210530ca92acb49e7d74c010ed317ca