FA-72156 / Error-correcting codes / Open access
Depuncturing ignores the partial final pattern period · case 01
Blocks whose length is not a multiple of the pattern period are rejected.
ROOT CAUSE
The kept count only counts whole pattern periods.
VERIFIED REPAIR
Add the kept positions of the leading slice of the pattern for the remainder.
Unsuccessful approach: Adding the full remainder length counts punctured positions of the tail as kept.
Case contract
Depuncture a rate-matched soft stream: the mother-code stream of length total was punctured with a cyclic 0/1 pattern starting at pattern phase 0 for every block. Reinsert LLR 0 at punctured positions and place received values at kept positions. If the number of received values differs from the number of kept positions, or the pattern keeps nothing, return None. Return the depunctured list.
Why this case matters
Rate-compatible punctured convolutional and turbo codes need exact depuncturing before decoding.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rx, pattern, total):
if not pattern or sum(pattern) == 0 or total < 0:
return None
kept = sum(pattern) * (total // len(pattern))
if kept != len(rx):
return None
out, j = [], 0
for k in range(total):
if pattern[k % len(pattern)]:
out.append(rx[j])
j += 1
else:
out.append(0)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6]', [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6], [-1, -3, 0, 1, 4, -3]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['regression [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14]', [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14], [1, -1, -1, 0, 6, 2, 4, 0, -1, 1, 4, 0, 6, 6]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[6, 2, -1], [1, 0], 5]', [[6, 2, -1], [1, 0], 5], [6, 0, 2, 0, -1]], ['regression [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14]', [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14], [-3, 2, 0, -3, -1, 0, 4, 2, 0, 1, 6, 0, 6, -5]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[7, 8, 9, 5], [1, 1, 0, 1], 5]', [[7, 8, 9, 5], [1, 1, 0, 1], 5], [7, 8, 0, 9, 5]], ['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]]]
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 [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13] | None | [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1] | Failed |
| regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6] | None | [-1, -3, 0, 1, 4, -3] | Failed |
| partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10] | None | [2, 0, 1, -3, 6, 0, -1, 0, -5, -3] | Failed |
| partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8] | None | [-1, 0, 4, 1, -5, 0, -3, 0] | Failed |
| control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | Passed |
| control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | Passed |
| control [[1, 2], [1, 1, 0], 3] | [1, 2, 0] | [1, 2, 0] | Passed |
| control [[1, 2, 3], [1, 1, 0], 3] | None | None | Passed |
SHA-256 / 0ac9752d5d5671234dfee25adaa64e1cec365861383aa557ffe9e6d4ae5a6fc3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rx, pattern, total):
if not pattern or sum(pattern) == 0 or total < 0:
return None
kept = sum(pattern) * (total // len(pattern)) + total % len(pattern)
if kept != len(rx):
return None
out, j = [], 0
for k in range(total):
if pattern[k % len(pattern)]:
out.append(rx[j])
j += 1
else:
out.append(0)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6]', [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6], [-1, -3, 0, 1, 4, -3]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['regression [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14]', [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14], [1, -1, -1, 0, 6, 2, 4, 0, -1, 1, 4, 0, 6, 6]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[6, 2, -1], [1, 0], 5]', [[6, 2, -1], [1, 0], 5], [6, 0, 2, 0, -1]], ['regression [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14]', [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14], [-3, 2, 0, -3, -1, 0, 4, 2, 0, 1, 6, 0, 6, -5]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[7, 8, 9, 5], [1, 1, 0, 1], 5]', [[7, 8, 9, 5], [1, 1, 0, 1], 5], [7, 8, 0, 9, 5]], ['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]]]
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 [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13] | [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1] | [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1] | Passed |
| regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6] | [-1, -3, 0, 1, 4, -3] | [-1, -3, 0, 1, 4, -3] | Passed |
| partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10] | None | [2, 0, 1, -3, 6, 0, -1, 0, -5, -3] | Failed |
| partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8] | None | [-1, 0, 4, 1, -5, 0, -3, 0] | Failed |
| control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | Passed |
| control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | Passed |
| control [[1, 2], [1, 1, 0], 3] | [1, 2, 0] | [1, 2, 0] | Passed |
| control [[1, 2, 3], [1, 1, 0], 3] | None | None | Passed |
SHA-256 / 98094899587eabc07b3598b0915c80ce0078206b53d8a797ff491828d7e6e320
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rx, pattern, total):
if not pattern or sum(pattern) == 0 or total < 0:
return None
kept = sum(pattern) * (total // len(pattern)) + sum(pattern[:total % len(pattern)])
if kept != len(rx):
return None
out, j = [], 0
for k in range(total):
if pattern[k % len(pattern)]:
out.append(rx[j])
j += 1
else:
out.append(0)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6]', [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6], [-1, -3, 0, 1, 4, -3]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['regression [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14]', [[1, -1, -1, 6, 2, 4, -1, 1, 4, 6, 6], [1, 1, 1, 0], 14], [1, -1, -1, 0, 6, 2, 4, 0, -1, 1, 4, 0, 6, 6]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[6, 2, -1], [1, 0], 5]', [[6, 2, -1], [1, 0], 5], [6, 0, 2, 0, -1]], ['regression [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14]', [[-3, 2, -3, -1, 4, 2, 1, 6, 6, -5], [1, 1, 0], 14], [-3, 2, 0, -3, -1, 0, 4, 2, 0, 1, 6, 0, 6, -5]], ['partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[7, 8, 9, 5], [1, 1, 0, 1], 5]', [[7, 8, 9, 5], [1, 1, 0, 1], 5], [7, 8, 0, 9, 5]], ['regression [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13]', [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13], [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1]], ['partial-repair [[4], [1, 0, 0], 2]', [[4], [1, 0, 0], 2], [4, 0]], ['partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]], [['regression [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10]', [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10], [2, 0, 1, -3, 6, 0, -1, 0, -5, -3]], ['regression [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8]', [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8], [-1, 0, 4, 1, -5, 0, -3, 0]], ['partial-repair [[6, 4, 2], [0, 1, 1, 1], 5]', [[6, 4, 2], [0, 1, 1, 1], 5], [0, 6, 4, 2, 0]], ['partial-repair [[-3, 6, 6], [0, 1, 1, 1], 5]', [[-3, 6, 6], [0, 1, 1, 1], 5], [0, -3, 6, 6, 0]], ['control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12]', [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12], [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0]], ['control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12]', [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12], [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0]], ['control [[1, 2], [1, 1, 0], 3]', [[1, 2], [1, 1, 0], 3], [1, 2, 0]], ['control [[1, 2, 3], [1, 1, 0], 3]', [[1, 2, 3], [1, 1, 0], 3], None]]]
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 [[-5, -1, 4, 1, -3, 2, 4, 6, 1, -1], [1, 1, 0, 1], 13] | [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1] | [-5, -1, 0, 4, 1, -3, 0, 2, 4, 6, 0, 1, -1] | Passed |
| regression [[-1, -3, 1, 4, -3], [1, 1, 0, 1], 6] | [-1, -3, 0, 1, 4, -3] | [-1, -3, 0, 1, 4, -3] | Passed |
| partial-repair [[2, 1, -3, 6, -1, -5, -3], [1, 0, 1, 1, 1, 0], 10] | [2, 0, 1, -3, 6, 0, -1, 0, -5, -3] | [2, 0, 1, -3, 6, 0, -1, 0, -5, -3] | Passed |
| partial-repair [[-1, 4, 1, -5, -3], [1, 0, 1, 1, 1, 0], 8] | [-1, 0, 4, 1, -5, 0, -3, 0] | [-1, 0, 4, 1, -5, 0, -3, 0] | Passed |
| control [[1, -3, -5, 2, 2, -1, -3, 2, 4], [1, 1, 1, 0], 12] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | [1, -3, -5, 0, 2, 2, -1, 0, -3, 2, 4, 0] | Passed |
| control [[-5, -3, -1, 6, -3, -5, -5, -3], [1, 1, 0], 12] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | [-5, -3, 0, -1, 6, 0, -3, -5, 0, -5, -3, 0] | Passed |
| control [[1, 2], [1, 1, 0], 3] | [1, 2, 0] | [1, 2, 0] | Passed |
| control [[1, 2, 3], [1, 1, 0], 3] | None | None | Passed |
SHA-256 / 9bcac2248cd1399d60ffd642ba1d42cafaaecd4cf78609eaa4b8196cba270383
Verification & scope
A deterministic, bounded teaching model of the named code under the stated contract; not a production codec. 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:48:35.995382+00:00.
Case digest / 76fc0f99bc8277b6cf73329a11f7a08c6d9b46e1d5742530d272258df4330a03