FA-72066 / Error-correcting codes / Open access
Product code returns the parity row with the data · case 01
Corrected blocks contain one extra row of parity bits.
ROOT CAUSE
The corrected branch strips the parity column but not the parity row.
VERIFIED REPAIR
Return the data block without the last row and last column.
Unsuccessful approach: Dropping the first column instead of the last removes data and keeps parity.
Case contract
Two-dimensional parity product code. m is a (rows+1) x (cols+1) bit matrix: the last column holds row parities, the last row column parities, and the corner the overall parity, so every full row and column is even. A single failing row and single failing column locate one error (in data or parity) which is flipped. Return [status, data block without parity row/column] with status clean/corrected, or ["uncorrectable", None].
Why this case matters
Simple line-card and tape formats use row/column parity to correct single-bit errors.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(m):
Rw = [i for i, row in enumerate(m) if sum(row) % 2]
Cl = [j for j in range(len(m[0])) if sum(row[j] for row in m) % 2]
if not Rw and not Cl:
return ['clean', [row[:-1] for row in m[:-1]]]
if len(Rw) == 1 and len(Cl) == 1:
fx = [list(row) for row in m]
fx[Rw[0]][Cl[0]] ^= 1
return ['corrected', [row[:-1] for row in fx]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['regression [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]]], [['regression [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['regression [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]], ['control [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]], ['clean', [[0, 1], [1, 0], [0, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['clean', [[0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 0, 1], [0, 1, 0, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['regression [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]]], [['regression [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['regression [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', 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, 1, 1], [0, 0, 1]]] | ['corrected', [[0, 0], [0, 1], [0, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Failed |
| regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]] | ['corrected', [[0, 0], [0, 1], [0, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Failed |
| control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]] | ['clean', [[0, 0], [0, 1]]] | ['clean', [[0, 0], [0, 1]]] | Passed |
| control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | Passed |
| control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | Passed |
| control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
SHA-256 / 5b40af0ed5e2af615b7532a48cf8a7ca0579065c02c084a7b1285cf094f29edd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(m):
Rw = [i for i, row in enumerate(m) if sum(row) % 2]
Cl = [j for j in range(len(m[0])) if sum(row[j] for row in m) % 2]
if not Rw and not Cl:
return ['clean', [row[:-1] for row in m[:-1]]]
if len(Rw) == 1 and len(Cl) == 1:
fx = [list(row) for row in m]
fx[Rw[0]][Cl[0]] ^= 1
return ['corrected', [row[1:] for row in fx[:-1]]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['regression [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]]], [['regression [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['regression [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]], ['control [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]], ['clean', [[0, 1], [1, 0], [0, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['clean', [[0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 0, 1], [0, 1, 0, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['regression [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]]], [['regression [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['regression [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', 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, 1, 1], [0, 0, 1]]] | ['corrected', [[0, 0], [1, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Failed |
| regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]] | ['corrected', [[0, 0], [1, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Failed |
| control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]] | ['clean', [[0, 0], [0, 1]]] | ['clean', [[0, 0], [0, 1]]] | Passed |
| control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | Passed |
| control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | Passed |
| control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
SHA-256 / a3f29dd6f84d82dc180f6daf3163a4a5f35cc75a68508d3a88ca12fd700f252f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(m):
Rw = [i for i, row in enumerate(m) if sum(row) % 2]
Cl = [j for j in range(len(m[0])) if sum(row[j] for row in m) % 2]
if not Rw and not Cl:
return ['clean', [row[:-1] for row in m[:-1]]]
if len(Rw) == 1 and len(Cl) == 1:
fx = [list(row) for row in m]
fx[Rw[0]][Cl[0]] ^= 1
return ['corrected', [row[:-1] for row in fx[:-1]]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 0, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]], ['corrected', [[0, 0], [0, 1]]]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 0]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['regression [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 0], [0, 1, 0, 1]]], ['corrected', [[1, 0, 1], [1, 1, 1]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]]], [['regression [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['regression [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 0], [0, 0, 1, 1]]], ['corrected', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['clean', [[1, 0, 1, 0, 1], [1, 0, 0, 0, 0]]]], ['control [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]]', [[[0, 0, 1, 0, 1, 1], [1, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 0, 1]]], ['clean', [[0, 1], [1, 0], [0, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[0, 0, 0, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['clean', [[0, 0, 0, 1], [0, 0, 1, 1], [1, 1, 0, 1], [0, 1, 0, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]]], [['regression [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 1, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['regression [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 1], [1, 1, 0, 0, 0]]], ['corrected', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0...', [[[1, 0, 0, 1, 1], [0, 1, 1, 1, 0], [1, 1, 0, 1, 1], [0, 1, 0, 1, 0], [1, 0, 1, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]]', [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]], ['clean', [[0, 0], [0, 1]]]], ['control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]]', [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]]', [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]], ['clean', [[1, 0, 1], [1, 1, 1]]]], ['control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]]', [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]], ['uncorrectable', None]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]]], [['regression [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 0, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['regression [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 0], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['corrected', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]]], ['control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]]', [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]], ['uncorrectable', None]], ['control [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[1, 0, 0, 0, 1], [0, 1, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['clean', [[1, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 1]]]], ['control [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]]', [[[0, 0, 0, 0, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 0], [1, 1, 0, 0, 0]]], ['uncorrectable', None]], ['control [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[0, 1, 1], [1, 0, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['clean', [[0, 1], [1, 0], [0, 1], [1, 1]]]], ['control [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]]', [[[1, 1, 1], [1, 1, 1], [0, 1, 1], [1, 1, 0], [0, 1, 1]]], ['uncorrectable', 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, 1, 1], [0, 0, 1]]] | ['corrected', [[0, 0], [0, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Passed |
| regression [[[0, 0, 1], [0, 1, 1], [0, 1, 1]]] | ['corrected', [[0, 0], [0, 1]]] | ['corrected', [[0, 0], [0, 1]]] | Passed |
| control [[[0, 0, 0], [0, 1, 1], [0, 1, 1]]] | ['clean', [[0, 0], [0, 1]]] | ['clean', [[0, 0], [0, 1]]] | Passed |
| control [[[1, 0, 0], [0, 0, 1], [0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[1, 0, 1, 0], [1, 1, 1, 1], [0, 1, 0, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | ['clean', [[1, 0, 1], [1, 1, 1]]] | Passed |
| control [[[0, 0, 1, 0], [1, 0, 1, 1], [0, 1, 0, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[[0, 1, 0, 1], [0, 0, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | ['clean', [[0, 1, 0], [0, 0, 1], [0, 1, 0]]] | Passed |
| control [[[1, 1, 0, 1], [0, 1, 1, 1], [0, 1, 0, 1], [0, 0, 1, 1]]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
SHA-256 / 3c35dccc64fdcda059512234b4381a26db6d3b1788955f52a145f2b9c35c5b87
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.265661+00:00.
Case digest / 29db9f424244768d9ee576b84e0b230b3533faae23e4c9bf71db3a382720a79d