FA-71861 / Error-correcting codes / Open access
Hamming encoder parity covers multiples of the parity position · case 01
Codewords fail to decode as clean.
ROOT CAUSE
Coverage is tested with pos % p == 0 instead of the binary membership pos & p.
VERIFIED REPAIR
A parity bit at p covers exactly the positions whose index has bit p set.
Unsuccessful approach: Covering every position at or after p ignores the binary structure.
Case contract
Hamming(7,4) encoder: data d1..d4 go to positions 3, 5, 6, 7; the parity bit at position p (1, 2, 4) is the XOR of all other positions whose index has bit p set. Return the 7-bit codeword (position 1 first).
Why this case matters
Low-cost telemetry links protect nibbles with Hamming(7,4).
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
d1, d2, d3, d4 = d
c = [0, 0, d1, 0, d2, d3, d4]
for p in (1, 2, 4):
v = 0
for pos in range(1, 8):
if pos % p == 0 and pos != p:
v ^= c[pos - 1]
c[p - 1] = v
return c
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['regression [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]]], [['regression [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['regression [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['partial-repair [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['control [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]]], [['regression [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['partial-repair [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['control [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]]], [['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['regression [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['control [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['control [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]]], [['regression [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['regression [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['partial-repair [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 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 [[0, 0, 0, 1]] | [1, 0, 0, 0, 0, 0, 1] | [1, 1, 0, 1, 0, 0, 1] | Failed |
| regression [[0, 0, 1, 0]] | [1, 1, 0, 0, 0, 1, 0] | [0, 1, 0, 1, 0, 1, 0] | Failed |
| partial-repair [[0, 0, 1, 1]] | [0, 1, 0, 0, 0, 1, 1] | [1, 0, 0, 0, 0, 1, 1] | Failed |
| control [[0, 0, 0, 0]] | [0, 0, 0, 0, 0, 0, 0] | [0, 0, 0, 0, 0, 0, 0] | Passed |
| control [[0, 1, 0, 0]] | [1, 0, 0, 0, 1, 0, 0] | [1, 0, 0, 1, 1, 0, 0] | Failed |
| control [[0, 1, 0, 1]] | [0, 0, 0, 0, 1, 0, 1] | [0, 1, 0, 0, 1, 0, 1] | Failed |
| control [[0, 1, 1, 0]] | [0, 1, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Failed |
| control [[0, 1, 1, 1]] | [1, 1, 0, 0, 1, 1, 1] | [0, 0, 0, 1, 1, 1, 1] | Failed |
SHA-256 / 73d73b2c428e25df798a1e9db10f922d4453226370a28cce79551ea8f6e53ddc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
d1, d2, d3, d4 = d
c = [0, 0, d1, 0, d2, d3, d4]
for p in (1, 2, 4):
v = 0
for pos in range(1, 8):
if pos >= p and pos != p:
v ^= c[pos - 1]
c[p - 1] = v
return c
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['regression [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]]], [['regression [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['regression [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['partial-repair [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['control [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]]], [['regression [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['partial-repair [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['control [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]]], [['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['regression [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['control [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['control [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]]], [['regression [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['regression [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['partial-repair [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 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 [[0, 0, 0, 1]] | [1, 1, 0, 1, 0, 0, 1] | [1, 1, 0, 1, 0, 0, 1] | Passed |
| regression [[0, 0, 1, 0]] | [1, 1, 0, 1, 0, 1, 0] | [0, 1, 0, 1, 0, 1, 0] | Failed |
| partial-repair [[0, 0, 1, 1]] | [0, 0, 0, 0, 0, 1, 1] | [1, 0, 0, 0, 0, 1, 1] | Failed |
| control [[0, 0, 0, 0]] | [0, 0, 0, 0, 0, 0, 0] | [0, 0, 0, 0, 0, 0, 0] | Passed |
| control [[0, 1, 0, 0]] | [1, 1, 0, 1, 1, 0, 0] | [1, 0, 0, 1, 1, 0, 0] | Failed |
| control [[0, 1, 0, 1]] | [0, 0, 0, 0, 1, 0, 1] | [0, 1, 0, 0, 1, 0, 1] | Failed |
| control [[0, 1, 1, 0]] | [0, 0, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Failed |
| control [[0, 1, 1, 1]] | [1, 1, 0, 1, 1, 1, 1] | [0, 0, 0, 1, 1, 1, 1] | Failed |
SHA-256 / cef6e033bc938420524954cb461e74f999892c4b158a2f670f10305876b2e92b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
d1, d2, d3, d4 = d
c = [0, 0, d1, 0, d2, d3, d4]
for p in (1, 2, 4):
v = 0
for pos in range(1, 8):
if pos & p and pos != p:
v ^= c[pos - 1]
c[p - 1] = v
return c
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['regression [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]]], [['regression [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['regression [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['partial-repair [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['control [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]]], [['regression [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 1]], ['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['partial-repair [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['control [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]]], [['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['regression [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 0, 0, 1]]', [[0, 0, 0, 1]], [1, 1, 0, 1, 0, 0, 1]], ['control [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['control [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]]], [['regression [[1, 1, 1, 0]]', [[1, 1, 1, 0]], [0, 0, 1, 0, 1, 1, 0]], ['regression [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['partial-repair [[0, 0, 1, 0]]', [[0, 0, 1, 0]], [0, 1, 0, 1, 0, 1, 0]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 0, 1]]', [[0, 1, 0, 1]], [0, 1, 0, 0, 1, 0, 1]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[0, 1, 1, 1]]', [[0, 1, 1, 1]], [0, 0, 0, 1, 1, 1, 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 [[0, 0, 0, 1]] | [1, 1, 0, 1, 0, 0, 1] | [1, 1, 0, 1, 0, 0, 1] | Passed |
| regression [[0, 0, 1, 0]] | [0, 1, 0, 1, 0, 1, 0] | [0, 1, 0, 1, 0, 1, 0] | Passed |
| partial-repair [[0, 0, 1, 1]] | [1, 0, 0, 0, 0, 1, 1] | [1, 0, 0, 0, 0, 1, 1] | Passed |
| control [[0, 0, 0, 0]] | [0, 0, 0, 0, 0, 0, 0] | [0, 0, 0, 0, 0, 0, 0] | Passed |
| control [[0, 1, 0, 0]] | [1, 0, 0, 1, 1, 0, 0] | [1, 0, 0, 1, 1, 0, 0] | Passed |
| control [[0, 1, 0, 1]] | [0, 1, 0, 0, 1, 0, 1] | [0, 1, 0, 0, 1, 0, 1] | Passed |
| control [[0, 1, 1, 0]] | [1, 1, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Passed |
| control [[0, 1, 1, 1]] | [0, 0, 0, 1, 1, 1, 1] | [0, 0, 0, 1, 1, 1, 1] | Passed |
SHA-256 / a398373379e46b6b15a432faa20844e17ee71cbf16437f284e99d85d3fe701d8
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:33.448843+00:00.
Case digest / fc113ca0cc480470c14c579c6d9c8af8f2c66e2615858e24fc9865e6432e9ea8