FAILURE MAP
← Case archive

FA-46301 / Bounded deques / Open access

Reverse bookmark mapping includes the exclusive stop · case 01

Reverse bookmark mapping includes the exclusive stop.

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

ROOT CAUSE

Reverse bookmark mapping includes the exclusive stop.

VERIFIED REPAIR

Restore the documented bookmark membership invariant in range-reverse.

Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.

Case contract

Reverse a valid half-open range in a bounded deque and return an old-index to new-index mapping for stable bookmarks. Empty ranges leave all positions unchanged.

Why this case matters

Controlled bounded deque implementation model with explicit storage and lifecycle observations.

1 / The failure

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

N = 1
observations = []
def solve(x):
    a,start,stop=x
    result=a[:start]+a[start:stop][::-1]+a[stop:]
    mapping=[]
    for i in range(len(a)):
        target=start+stop-1-i if start<=i<=stop else i
        mapping.append(target)
    return [result,mapping]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[N])
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
0[[1, 4, 3, 2, 5], [0, 3, 2, 1, 0]][[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]]Failed
1[[3, 2, 1], [2, 1, 0]][[3, 2, 1], [2, 1, 0]]Passed
2[[1, 2], [0, 0]][[1, 2], [0, 1]]Failed
3[[1], [0]][[1], [0]]Passed
4[[], []][[], []]Passed
5[[1, 2, 4, 3], [0, 1, 3, 2]][[1, 2, 4, 3], [0, 1, 3, 2]]Passed

SHA-256 / 81dffba291f38dbdc3a6018e78403c26ba5cf5695d37b20e7e0b1ac852c41f9b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    a,start,stop=x
    result=a[:start]+a[start:stop][::-1]+a[stop:]
    mapping=[]
    for i in range(len(a)):
        target=start+stop-1-i if (start<=i<stop if start==stop else start<=i<=stop) else i
        mapping.append(target)
    return [result,mapping]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[N])
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
0[[1, 4, 3, 2, 5], [0, 3, 2, 1, 0]][[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]]Failed
1[[3, 2, 1], [2, 1, 0]][[3, 2, 1], [2, 1, 0]]Passed
2[[1, 2], [0, 1]][[1, 2], [0, 1]]Passed
3[[1], [0]][[1], [0]]Passed
4[[], []][[], []]Passed
5[[1, 2, 4, 3], [0, 1, 3, 2]][[1, 2, 4, 3], [0, 1, 3, 2]]Passed

SHA-256 / f5c2d3223dc703f43c76c6c44fc4920211a909a6040be6b431cf0e443a596f32

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    a,start,stop=x
    result=a[:start]+a[start:stop][::-1]+a[stop:]
    mapping=[]
    for i in range(len(a)):
        target=start+stop-1-i if start<=i<stop else i
        mapping.append(target)
    return [result,mapping]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[N])
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
0[[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]][[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]]Passed
1[[3, 2, 1], [2, 1, 0]][[3, 2, 1], [2, 1, 0]]Passed
2[[1, 2], [0, 1]][[1, 2], [0, 1]]Passed
3[[1], [0]][[1], [0]]Passed
4[[], []][[], []]Passed
5[[1, 2, 4, 3], [0, 1, 3, 2]][[1, 2, 4, 3], [0, 1, 3, 2]]Passed

SHA-256 / a402916bde8514081ee94dd3a1deb26b9bc994fc70b1a74f7c7c6cda2dafc95e

Verification & scope

Offline finite deterministic model; no claim of production implementation or concurrent memory-model 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:44:30.779947+00:00.

Case digest / 74e10baa35fa3929ca627d36c155e000a2baf07e46ebf9242a4be64f8279d405