FA-72136 / Error-correcting codes / Open access
Syndrome table keeps the heaviest coset member · case 01
Received words are "corrected" by high-weight patterns instead of the most likely error.
ROOT CAUSE
The table assignment overwrites earlier entries, so the last (heaviest) pattern becomes the leader.
VERIFIED REPAIR
Keep the first pattern per syndrome (setdefault) while enumerating by increasing weight.
Unsuccessful approach: Enumerating equal-weight patterns in reverse order breaks the stated lexicographic tie rule.
Case contract
Syndrome decoding of a binary linear code from its parity-check matrix H (rows). The coset-leader table is built by enumerating error patterns by increasing weight and, within a weight, in lexicographic order of error positions; the first pattern seen for a syndrome is its leader. Decode r by XORing the leader of its syndrome. Return [codeword, leader weight] (None if the syndrome has no leader).
Why this case matters
Short block codes in control channels are decoded with precomputed coset-leader tables.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import itertools
N = 1
observations = []
def solve(H, r):
n = len(H[0])
def syn(v):
return tuple(sum(h[k] & v[k] for k in range(n)) % 2 for h in H)
table = {}
for w in range(n + 1):
for pos in itertools.combinations(range(n), w):
e = [1 if k in pos else 0 for k in range(n)]
table[syn(e)] = e
e = table.get(syn(r))
if e is None:
return None
return [[a ^ b for a, b in zip(r, e)], sum(e)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 0, 0]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 1, 0, 1, 1]], [[0, 0, 1, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 0, 0, 0, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 1, 0]], [[1, 0, 1, 1, 1, 0], 0]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 1, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 1]], [[0, 0, 1, 0, 1, 1], 0]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 0]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]], [[0, 0, 1, 1, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]], [[1, 0, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]]]]
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 [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 1, 1, 1, 1, 1, 1], 6] | [[0, 0, 0, 0, 0, 0, 0], 1] | Failed |
| regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 0, 0, 0, 1, 1, 0], 6] | [[0, 1, 1, 1, 0, 0, 1], 1] | Failed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]] | [[0, 1, 1, 0, 1], 4] | [[0, 1, 0, 1, 0], 1] | Failed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]] | [[0, 1, 0, 1, 0], 4] | [[0, 1, 1, 0, 1], 1] | Failed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 1, 0, 0, 1, 0, 1], 6] | [[0, 0, 1, 1, 0, 1, 0], 1] | Failed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 0, 1, 0, 0, 1, 1], 6] | [[0, 1, 0, 1, 1, 0, 0], 1] | Failed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 0, 0, 0, 1, 1, 0], 6] | [[0, 1, 1, 1, 0, 0, 1], 1] | Failed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 0, 0, 0, 0, 0, 0], 6] | [[1, 1, 1, 1, 1, 1, 1], 1] | Failed |
SHA-256 / 2822b91adbac900f8b6e158edea6f97184b7882469c4124bc930438c297e816e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import itertools
N = 1
observations = []
def solve(H, r):
n = len(H[0])
def syn(v):
return tuple(sum(h[k] & v[k] for k in range(n)) % 2 for h in H)
table = {}
for w in range(n + 1):
for pos in reversed(list(itertools.combinations(range(n), w))):
e = [1 if k in pos else 0 for k in range(n)]
table.setdefault(syn(e), e)
e = table.get(syn(r))
if e is None:
return None
return [[a ^ b for a, b in zip(r, e)], sum(e)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 0, 0]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 1, 0, 1, 1]], [[0, 0, 1, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 0, 0, 0, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 1, 0]], [[1, 0, 1, 1, 1, 0], 0]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 1, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 1]], [[0, 0, 1, 0, 1, 1], 0]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 0]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]], [[0, 0, 1, 1, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]], [[1, 0, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]]]]
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 [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 0, 0, 0, 0, 0, 0], 1] | [[0, 0, 0, 0, 0, 0, 0], 1] | Passed |
| regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 1, 1, 0, 0, 1], 1] | [[0, 1, 1, 1, 0, 0, 1], 1] | Passed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]] | [[0, 0, 0, 0, 0], 1] | [[0, 1, 0, 1, 0], 1] | Failed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]] | [[1, 1, 0, 0, 1], 1] | [[0, 1, 1, 0, 1], 1] | Failed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 0, 1, 1, 0, 1, 0], 1] | [[0, 0, 1, 1, 0, 1, 0], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 0, 1, 1, 0, 0], 1] | [[0, 1, 0, 1, 1, 0, 0], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 1, 1, 0, 0, 1], 1] | [[0, 1, 1, 1, 0, 0, 1], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 1, 1, 1, 1, 1, 1], 1] | [[1, 1, 1, 1, 1, 1, 1], 1] | Passed |
SHA-256 / 5930df600e06d84917ebb4e5032eed40e637a6f68b986aae1e2b7b43345becef
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import itertools
N = 1
observations = []
def solve(H, r):
n = len(H[0])
def syn(v):
return tuple(sum(h[k] & v[k] for k in range(n)) % 2 for h in H)
table = {}
for w in range(n + 1):
for pos in itertools.combinations(range(n), w):
e = [1 if k in pos else 0 for k in range(n)]
table.setdefault(syn(e), e)
e = table.get(syn(r))
if e is None:
return None
return [[a ^ b for a, b in zip(r, e)], sum(e)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 0, 0]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 1, 0, 1, 1]], [[0, 0, 1, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 1, 1, 0, 0]], [[0, 1, 0, 1, 1, 0, 0], 1]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 1, 1, 1, 0, 1, 1]], [[0, 1, 1, 1, 0, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 1, 1, 0, 1, 1]], [[1, 1, 1, 1, 1, 1, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 0, 0, 0, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]]], [['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 0, 1]], [[0, 0, 1, 0, 1, 0, 1], 0]], ['regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [1, 1, 0, 1, 1, 0, 1]], [[1, 1, 0, 0, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 1, 0]], [[1, 0, 1, 1, 1, 0], 0]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 1, 0, 0, 1, 0]], [[1, 1, 0, 0, 1, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 1, 0, 0, 0, 0]], [[0, 0, 0, 0, 0, 0], 1]], ['control [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [0, 0, 1, 0, 1, 1]], [[0, 0, 1, 0, 1, 1], 0]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 0]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 0]]], [['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 1]], [[1, 0, 0, 1, 0, 1], 1]], ['regression [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, ...', [[[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 1, 0, 0, 1]], [1, 0, 1, 1, 0, 0]], [[1, 0, 1, 1, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]], [[0, 1, 0, 1, 0], 1]], ['partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]], [[0, 1, 1, 0, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 1, 0, 1, 1]], [[0, 1, 0, 1, 0], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 1, 1, 0]], [[0, 0, 1, 1, 1], 1]], ['control [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]]', [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 0, 1, 0, 1]], [[1, 0, 1, 0, 0], 1]], ['control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ...', [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, 1]], [0, 0, 0, 0, 0, 1, 0]], [[0, 0, 0, 0, 0, 0, 0], 1]]]]
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 [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 0, 0, 0, 0, 0, 0], 1] | [[0, 0, 0, 0, 0, 0, 0], 1] | Passed |
| regression [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 1, 1, 0, 0, 1], 1] | [[0, 1, 1, 1, 0, 0, 1], 1] | Passed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [0, 0, 0, 1, 0]] | [[0, 1, 0, 1, 0], 1] | [[0, 1, 0, 1, 0], 1] | Passed |
| partial-repair [[[1, 1, 1, 1, 0], [1, 0, 1, 0, 1]], [1, 1, 1, 0, 1]] | [[0, 1, 1, 0, 1], 1] | [[0, 1, 1, 0, 1], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 0, 1, 1, 0, 1, 0], 1] | [[0, 0, 1, 1, 0, 1, 0], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 0, 1, 1, 0, 0], 1] | [[0, 1, 0, 1, 1, 0, 0], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[0, 1, 1, 1, 0, 0, 1], 1] | [[0, 1, 1, 1, 0, 0, 1], 1] | Passed |
| control [[[1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 0, 0, ... | [[1, 1, 1, 1, 1, 1, 1], 1] | [[1, 1, 1, 1, 1, 1, 1], 1] | Passed |
SHA-256 / 538b7964168c5be7bcbe3f00b552d1aad0a8636b029e200ace0cf09fb0a7876e
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.885699+00:00.
Case digest / 61ecf89ef442d2de0e8f95d4e50a52fa1f5ff583f5efc1445f140f7651feaadd