FA-46281 / Bounded deques / Open access
Zip drain reports consumed scalar values instead of pair count · case 01
Zip drain reports consumed scalar values instead of pair count.
ROOT CAUSE
Zip drain reports consumed scalar values instead of pair count.
VERIFIED REPAIR
Restore the documented pair receipt invariant in zip-drain.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Consume paired entries from two bounded deques up to a limit, preserving each unmatched suffix. Return pairs, both remainders and pair count.
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,b,limit=x
count=min(len(a),len(b),limit)
pairs=[[a[i],b[i]] for i in range(count)]
left=a[count:]
right=b[count:]
return [pairs,left,right,2*count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 0]}[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[[1, 4], [2, 5]], [3], [], 4] | [[[1, 4], [2, 5]], [3], [], 2] | Failed |
| 1 | [[[1, 2]], [], [3], 2] | [[[1, 2]], [], [3], 1] | Failed |
| 2 | [[[1, 3]], [2], [4], 2] | [[[1, 3]], [2], [4], 1] | Failed |
| 3 | [[], [], [1], 0] | [[], [], [1], 0] | Passed |
| 4 | [[], [1], [], 0] | [[], [1], [], 0] | Passed |
| 5 | [[], [1, 2], [3, 4], 0] | [[], [1, 2], [3, 4], 0] | Passed |
SHA-256 / b35927e2229d80a7415ba45538f9f257adf3b9eae20ce029a7e37844d9f37177
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,b,limit=x
count=min(len(a),len(b),limit)
pairs=[[a[i],b[i]] for i in range(count)]
left=a[count:]
right=b[count:]
return [pairs,left,right,count if count<=1 else 2*count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 0]}[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[[1, 4], [2, 5]], [3], [], 4] | [[[1, 4], [2, 5]], [3], [], 2] | Failed |
| 1 | [[[1, 2]], [], [3], 1] | [[[1, 2]], [], [3], 1] | Passed |
| 2 | [[[1, 3]], [2], [4], 1] | [[[1, 3]], [2], [4], 1] | Passed |
| 3 | [[], [], [1], 0] | [[], [], [1], 0] | Passed |
| 4 | [[], [1], [], 0] | [[], [1], [], 0] | Passed |
| 5 | [[], [1, 2], [3, 4], 0] | [[], [1, 2], [3, 4], 0] | Passed |
SHA-256 / 45d7aef8d95ca07b8e7a19471f9903a0ee61a1787593747b6b905ba7c8949d10
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,b,limit=x
count=min(len(a),len(b),limit)
pairs=[[a[i],b[i]] for i in range(count)]
left=a[count:]
right=b[count:]
return [pairs,left,right,count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 0]}[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[[1, 4], [2, 5]], [3], [], 2] | [[[1, 4], [2, 5]], [3], [], 2] | Passed |
| 1 | [[[1, 2]], [], [3], 1] | [[[1, 2]], [], [3], 1] | Passed |
| 2 | [[[1, 3]], [2], [4], 1] | [[[1, 3]], [2], [4], 1] | Passed |
| 3 | [[], [], [1], 0] | [[], [], [1], 0] | Passed |
| 4 | [[], [1], [], 0] | [[], [1], [], 0] | Passed |
| 5 | [[], [1, 2], [3, 4], 0] | [[], [1, 2], [3, 4], 0] | Passed |
SHA-256 / eb7c7c21783fed8c59e134e974a1ee28f5c6a5b7a37e363dc380e10e8b58b10c
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.563540+00:00.
Case digest / 99b32f770b87b312133ab10739ad6191dee059c8a7aa0949da5a4b329ab9cc95