FA-72331 / Error-correcting codes / Open access
Bounded-distance decoder picks the first of tied codewords · case 01
Received words equidistant from two codewords are decoded to an arbitrary one.
ROOT CAUSE
Ties at the minimum distance are not tracked.
VERIFIED REPAIR
Flag a tie when a different codeword reaches the current minimum distance.
Unsuccessful approach: Flagging every equal-distance entry treats duplicate listings of the same codeword as ambiguity.
Case contract
Bounded-distance decoding against an explicit codebook (duplicate entries allowed). Find the codeword at minimum Hamming distance from r; if two different codewords tie for the minimum, or the minimum exceeds radius, return None. Otherwise return [codeword, distance].
Why this case matters
Short control-channel codes are decoded against small codebooks; ties must be reported as failures, not guessed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codebook, r, radius):
best, bd, tie = None, None, False
for cwd in codebook:
d = sum(a != b for a, b in zip(cwd, r))
if bd is None or d < bd:
best, bd, tie = cwd, d, False
if bd is None or bd > radius or tie:
return None
return [list(best), bd]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 2], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 0, 1, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 1, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 0, 0, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 0], 1], [[0, 0, 0, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 1, 1, 0], 1], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 1, 0, 0, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 0, 0], 0], [[1, 1, 1, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 0, 0], 1], [[1, 1, 1, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 1], [[0, 0, 0, 0, 0], 1]]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], 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 [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | [[0, 0, 0, 0, 0, 0], 3] | None | Failed |
| regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | [[0, 0, 0, 0, 0, 0], 3] | None | Failed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | [[0, 0, 0, 0, 0, 0], 2] | [[0, 0, 0, 0, 0, 0], 2] | Passed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ... | [[0, 0, 0, 0, 0, 0], 2] | [[0, 0, 0, 0, 0, 0], 2] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[0, 0, 1, 1, 1], 0] | [[0, 0, 1, 1, 1], 0] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | None | None | Passed |
SHA-256 / 7b0122d4e37d977b4f29a67491ca48672d39827a979ca061e89bc9aa777d4698
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codebook, r, radius):
best, bd, tie = None, None, False
for cwd in codebook:
d = sum(a != b for a, b in zip(cwd, r))
if bd is None or d < bd:
best, bd, tie = cwd, d, False
elif d == bd:
tie = True
if bd is None or bd > radius or tie:
return None
return [list(best), bd]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 2], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 0, 1, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 1, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 0, 0, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 0], 1], [[0, 0, 0, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 1, 1, 0], 1], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 1, 0, 0, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 0, 0], 0], [[1, 1, 1, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 0, 0], 1], [[1, 1, 1, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 1], [[0, 0, 0, 0, 0], 1]]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], 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 [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | None | None | Passed |
| regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | None | None | Passed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | None | [[0, 0, 0, 0, 0, 0], 2] | Failed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ... | None | [[0, 0, 0, 0, 0, 0], 2] | Failed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[0, 0, 1, 1, 1], 0] | [[0, 0, 1, 1, 1], 0] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | None | None | Passed |
SHA-256 / edb873540cf9dc112cc44965f28e97ed5786a2d5cf1531bcd652fb2ddffa8b63
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codebook, r, radius):
best, bd, tie = None, None, False
for cwd in codebook:
d = sum(a != b for a, b in zip(cwd, r))
if bd is None or d < bd:
best, bd, tie = cwd, d, False
elif d == bd and cwd != best:
tie = True
if bd is None or bd > radius or tie:
return None
return [list(best), bd]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 2], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 0, 1, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 1, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 0], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 0, 0, 1], 0], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 1], 1], [[0, 0, 0, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 0, 0, 0], 1], [[0, 0, 0, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 1, 1, 0], 1], None]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 0, 1, 1, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 1, 0, 0, 0], 1], None], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 0, 0], 0], [[1, 1, 1, 0, 0], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 0, 1, 0, 0], 1], [[1, 1, 1, 0, 0], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 0, 0], 1], [[0, 0, 0, 0, 0], 1]]], [['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 0, 1, 1, 0, 1], 3], None], ['regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 1, 0, 1], 3], None], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, 1, 0, 0, 0, 1], 2], [[0, 0, 0, 0, 0, 0], 2]], ['partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ...', [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, 0, 0, 1, 0, 0], 2], [[0, 0, 0, 0, 0, 0], 2]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 1, 0, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [1, 1, 1, 1, 1], 1], [[1, 1, 0, 1, 1], 1]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 1], 1], [[0, 0, 1, 1, 1], 0]], ['control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1...', [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1]], [0, 0, 1, 1, 0], 0], 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 [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | None | None | Passed |
| regression [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | None | None | Passed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [0, ... | [[0, 0, 0, 0, 0, 0], 2] | [[0, 0, 0, 0, 0, 0], 2] | Passed |
| partial-repair [[[0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0]], [1, ... | [[0, 0, 0, 0, 0, 0], 2] | [[0, 0, 0, 0, 0, 0], 2] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[1, 1, 0, 1, 1], 1] | [[1, 1, 0, 1, 1], 1] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | [[0, 0, 1, 1, 1], 0] | [[0, 0, 1, 1, 1], 0] | Passed |
| control [[[0, 0, 0, 0, 0], [1, 1, 1, 0, 0], [0, 0, 1, 1, 1], [1, 1, 0, 1, 1... | None | None | Passed |
SHA-256 / 283d098520074dbfe1e92dd461106ce2c40a9df7f66126f2ac1c675d55d851d8
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:37.555424+00:00.
Case digest / 5811c24aa133963017dfd654ca4050c31b31cc39420c3315bd28fe970f7b9f74