FA-71951 / Error-correcting codes / Open access
Viterbi scores a pair mismatch as one error · case 01
Pairs with both bits wrong are penalised like a single error, so wrong paths win.
ROOT CAUSE
The branch metric adds (o0 != y0) or (o1 != y1) instead of the sum of both mismatches.
THE FAILURE
The branch metric adds (o0 != y0) or (o1 != y1) instead of the sum of both mismatches.
Unsuccessful approach: Weighting the first bit double is not a Hamming distance either.
Case contract
Hard-decision Viterbi decoder for the terminated K=3 (7,5) code (outputs g=7 then g=5 per step, two zero tail bits). Branch metric is the Hamming distance between the received pair and the branch output. Survivors keep the first strictly better candidate (states in ascending order, input 0 before 1). Decoding ends in state 0 and the two tail bits are removed. Return [decoded bits, final path metric]; odd or too-short input returns None.
Why this case matters
Receivers recover convolutionally coded frames by maximum-likelihood trellis search.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
if len(r) % 2 or len(r) < 4:
return None
INF = 10 ** 9
metric = [0, INF, INF, INF]
paths = [[], [], [], []]
for t in range(len(r) // 2):
y0, y1 = r[2 * t], r[2 * t + 1]
new_m = [INF] * 4
new_p = [None] * 4
for st in range(4):
if metric[st] >= INF:
continue
for b in (0, 1):
reg = (b << 2) | st
o0 = bin(reg & 7).count('1') % 2
o1 = bin(reg & 5).count('1') % 2
ns = reg >> 1
m = metric[st] + ((o0 != y0) or (o1 != y1))
if m < new_m[ns]:
new_m[ns] = m
new_p[ns] = paths[st] + [b]
metric, paths = new_m, new_p
return [paths[0][:-2], metric[0]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]]', [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]], [[1, 1, 0], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]]', [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], [[0, 1, 0, 0], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]], [[1, 1, 0], 0]], ['control [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]]', [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]], [[1, 1, 0], 1]], ['control [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]]', [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]], [[1, 1, 0], 2]], ['control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]]', [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]], [[0, 1, 0, 0], 0]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1]]', [[0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1]], [[0, 1, 0, 1, 1], 1]], ['control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1]]', [[0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1]], [[0, 1, 0, 0], 2]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]], [[1, 0, 1, 0, 0], 0]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]], [[1, 0, 1, 0, 0], 1]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1]], [[1, 0, 1, 0, 0], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 0]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 1]], ['partial-repair [[0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]], [[1, 1, 0, 0, 0, 0], 1]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1]], [[1, 1, 0, 0, 0, 0], 2]], ['control [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]]', [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]], [[1, 0, 0, 0, 1, 1, 1], 0]], ['control [[1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]]', [[1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]], [[1, 0, 0, 0, 1, 1, 1], 1]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]]', [[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]], [[0, 1, 0, 1], 2]], ['partial-repair [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [[], 3]], ['control [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0]]', [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0]], [[1, 0, 0, 0, 1, 1, 1], 2]], ['control [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]]', [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]], [[0, 0, 0, 0, 0, 0, 1, 1], 0]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]], [[0, 0, 0, 0, 0, 0, 1, 1], 1]], ['control [[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0]]', [[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0]], [[0, 0, 0, 0, 0, 0, 1, 1], 2]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]]', [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], [[0, 1, 0, 0], 2]], ['partial-repair [[1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]], [[1, 0, 1, 0, 0], 2]], ['control [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1]]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1]], [[0, 1, 0, 1, 1], 0]], ['control [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]], [[0, 1, 0, 1, 1], 2]], ['control [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 0]], ['control [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]], [[0, 0, 0, 1, 0, 1], 2]]]]
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, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]] | [[1, 1, 0, 0, 0, 0], 1] | [[1, 1, 0, 0, 0, 0], 2] | Failed |
| regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]] | [[1, 0, 0, 0, 0, 0, 1, 0, 1], 2] | [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2] | Failed |
| partial-repair [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]] | [[1, 1, 0], 2] | [[1, 1, 0], 2] | Passed |
| partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]] | [[0, 1, 0, 0], 2] | [[0, 1, 0, 0], 2] | Passed |
| control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]] | [[1, 1, 0], 0] | [[1, 1, 0], 0] | Passed |
| control [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]] | [[1, 1, 0], 1] | [[1, 1, 0], 1] | Passed |
| control [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]] | [[1, 1, 0], 2] | [[1, 1, 0], 2] | Passed |
| control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]] | [[0, 1, 0, 0], 0] | [[0, 1, 0, 0], 0] | Passed |
SHA-256 / a4960082dc6c87f7dc4c219912b51048046409895fc6a70f9e7cad99084b6e97
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
if len(r) % 2 or len(r) < 4:
return None
INF = 10 ** 9
metric = [0, INF, INF, INF]
paths = [[], [], [], []]
for t in range(len(r) // 2):
y0, y1 = r[2 * t], r[2 * t + 1]
new_m = [INF] * 4
new_p = [None] * 4
for st in range(4):
if metric[st] >= INF:
continue
for b in (0, 1):
reg = (b << 2) | st
o0 = bin(reg & 7).count('1') % 2
o1 = bin(reg & 5).count('1') % 2
ns = reg >> 1
m = metric[st] + 2 * (o0 != y0) + (o1 != y1)
if m < new_m[ns]:
new_m[ns] = m
new_p[ns] = paths[st] + [b]
metric, paths = new_m, new_p
return [paths[0][:-2], metric[0]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]]', [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]], [[1, 1, 0], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]]', [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], [[0, 1, 0, 0], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]], [[1, 1, 0], 0]], ['control [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]]', [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]], [[1, 1, 0], 1]], ['control [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]]', [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]], [[1, 1, 0], 2]], ['control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]]', [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]], [[0, 1, 0, 0], 0]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1]]', [[0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1]], [[0, 1, 0, 1, 1], 1]], ['control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1]]', [[0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1]], [[0, 1, 0, 0], 2]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0]], [[1, 0, 1, 0, 0], 0]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]], [[1, 0, 1, 0, 0], 1]], ['control [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1]]', [[1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1]], [[1, 0, 1, 0, 0], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 0]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 1]], ['partial-repair [[0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 2]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0]], [[1, 1, 0, 0, 0, 0], 1]], ['control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1]]', [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1]], [[1, 1, 0, 0, 0, 0], 2]], ['control [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]]', [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]], [[1, 0, 0, 0, 1, 1, 1], 0]], ['control [[1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]]', [[1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1]], [[1, 0, 0, 0, 1, 1, 1], 1]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]]', [[0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]], [[0, 1, 0, 1], 2]], ['partial-repair [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [[], 3]], ['control [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0]]', [[1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0]], [[1, 0, 0, 0, 1, 1, 1], 2]], ['control [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]]', [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]], [[0, 0, 0, 0, 0, 0, 1, 1], 0]], ['control [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]]', [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1]], [[0, 0, 0, 0, 0, 0, 1, 1], 1]], ['control [[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0]]', [[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0]], [[0, 0, 0, 0, 0, 0, 1, 1], 2]]], [['regression [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]', [[1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]], [[1, 1, 0, 0, 0, 0], 2]], ['regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2]], ['partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]]', [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]], [[0, 1, 0, 0], 2]], ['partial-repair [[1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]]', [[1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0]], [[1, 0, 1, 0, 0], 2]], ['control [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1]]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1]], [[0, 1, 0, 1, 1], 0]], ['control [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]]', [[0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0]], [[0, 1, 0, 1, 1], 2]], ['control [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]], [[0, 0, 0, 1, 0, 1], 0]], ['control [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]]', [[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0]], [[0, 0, 0, 1, 0, 1], 2]]]]
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, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]] | [[1, 1, 0, 0, 0, 0], 3] | [[1, 1, 0, 0, 0, 0], 2] | Failed |
| regression [[1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1]] | [[1, 0, 1, 0, 0, 0, 1, 0, 1], 3] | [[1, 0, 1, 0, 0, 0, 1, 0, 1], 2] | Failed |
| partial-repair [[0, 1, 0, 1, 0, 1, 1, 1, 0, 1]] | [[1, 1, 0], 3] | [[1, 1, 0], 2] | Failed |
| partial-repair [[0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0]] | [[0, 1, 0, 0], 3] | [[0, 1, 0, 0], 2] | Failed |
| control [[1, 1, 0, 1, 0, 1, 1, 1, 0, 0]] | [[1, 1, 0], 0] | [[1, 1, 0], 0] | Passed |
| control [[1, 1, 0, 0, 0, 1, 1, 1, 0, 0]] | [[1, 1, 0], 1] | [[1, 1, 0], 1] | Passed |
| control [[1, 1, 0, 1, 0, 1, 1, 0, 0, 1]] | [[1, 1, 0], 2] | [[1, 1, 0], 2] | Passed |
| control [[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0]] | [[0, 1, 0, 0], 0] | [[0, 1, 0, 0], 0] | Passed |
SHA-256 / 58cddef372a9ac9a3dbc5310ec18ac3dcf3bf908c0560cffc3ad20bfddfa3554
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:34.187353+00:00.
Case digest / 4cf14c9ec15a6e968924477c9c128f2f40435fd8bbc5b62d297d26dc488fc7e1