FA-71866 / Error-correcting codes / Open access
Hamming encoder writes the nibble in reverse order · case 01
Decoders recover the data bits reversed.
ROOT CAUSE
The data bits are placed as d4, d3, d2, d1 across positions 3, 5, 6, 7.
VERIFIED REPAIR
Place d1 at position 3, d2 at 5, d3 at 6 and d4 at 7.
Unsuccessful approach: Swapping only d2 and d3 still misplaces half the data.
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, d4, 0, d3, d2, d1]
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, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]]], [['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 [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]]], [['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]]], [['regression [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['regression [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['partial-repair [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]]], [['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 [[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 [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 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, 1, 0, 0, 0, 0] | [1, 1, 0, 1, 0, 0, 1] | Failed |
| regression [[0, 0, 1, 0]] | [1, 0, 0, 1, 1, 0, 0] | [0, 1, 0, 1, 0, 1, 0] | Failed |
| partial-repair [[0, 0, 1, 1]] | [0, 1, 1, 1, 1, 0, 0] | [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, 1, 0]] | [1, 1, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Passed |
| control [[1, 0, 0, 1]] | [0, 0, 1, 1, 0, 0, 1] | [0, 0, 1, 1, 0, 0, 1] | Passed |
| control [[1, 1, 1, 1]] | [1, 1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1, 1] | Passed |
| control [[0, 1, 0, 0]] | [0, 1, 0, 1, 0, 1, 0] | [1, 0, 0, 1, 1, 0, 0] | Failed |
SHA-256 / 0a23c7200eab4c824d9112af3306717383d06fcf6b42d64adcd4cf8e8cd75cce
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, d3, d2, 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, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]]], [['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 [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]]], [['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]]], [['regression [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['regression [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['partial-repair [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]]], [['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 [[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 [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 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, 0, 0, 1, 1, 0, 0] | [0, 1, 0, 1, 0, 1, 0] | Failed |
| partial-repair [[0, 0, 1, 1]] | [0, 1, 0, 0, 1, 0, 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, 1, 0]] | [1, 1, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Passed |
| control [[1, 0, 0, 1]] | [0, 0, 1, 1, 0, 0, 1] | [0, 0, 1, 1, 0, 0, 1] | Passed |
| control [[1, 1, 1, 1]] | [1, 1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1, 1] | Passed |
| control [[0, 1, 0, 0]] | [0, 1, 0, 1, 0, 1, 0] | [1, 0, 0, 1, 1, 0, 0] | Failed |
SHA-256 / 8b8f08a1f15402fa326ecfc0c3864fdcdf7f1d002da8415f287e841010f4bb64
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, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]]], [['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 [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[1, 0, 1, 1]]', [[1, 0, 1, 1]], [0, 1, 1, 0, 0, 1, 1]]], [['regression [[1, 0, 0, 0]]', [[1, 0, 0, 0]], [1, 1, 1, 0, 0, 0, 0]], ['regression [[1, 0, 1, 0]]', [[1, 0, 1, 0]], [1, 0, 1, 1, 0, 1, 0]], ['partial-repair [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['partial-repair [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]]], [['regression [[1, 1, 0, 0]]', [[1, 1, 0, 0]], [0, 1, 1, 1, 1, 0, 0]], ['regression [[1, 1, 0, 1]]', [[1, 1, 0, 1]], [1, 0, 1, 0, 1, 0, 1]], ['partial-repair [[0, 0, 1, 1]]', [[0, 0, 1, 1]], [1, 0, 0, 0, 0, 1, 1]], ['partial-repair [[0, 1, 0, 0]]', [[0, 1, 0, 0]], [1, 0, 0, 1, 1, 0, 0]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 1, 1, 1, 1]], ['control [[0, 0, 0, 0]]', [[0, 0, 0, 0]], [0, 0, 0, 0, 0, 0, 0]], ['control [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]]], [['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 [[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 [[0, 1, 1, 0]]', [[0, 1, 1, 0]], [1, 1, 0, 0, 1, 1, 0]], ['control [[1, 0, 0, 1]]', [[1, 0, 0, 1]], [0, 0, 1, 1, 0, 0, 1]], ['control [[1, 1, 1, 1]]', [[1, 1, 1, 1]], [1, 1, 1, 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, 1, 0]] | [1, 1, 0, 0, 1, 1, 0] | [1, 1, 0, 0, 1, 1, 0] | Passed |
| control [[1, 0, 0, 1]] | [0, 0, 1, 1, 0, 0, 1] | [0, 0, 1, 1, 0, 0, 1] | Passed |
| control [[1, 1, 1, 1]] | [1, 1, 1, 1, 1, 1, 1] | [1, 1, 1, 1, 1, 1, 1] | Passed |
| control [[0, 1, 0, 0]] | [1, 0, 0, 1, 1, 0, 0] | [1, 0, 0, 1, 1, 0, 0] | Passed |
SHA-256 / 07fd1cd37bcafaf27500981719d5cfc1f054375be8735795cd1aa9769722c2d3
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.463074+00:00.
Case digest / da70fb6fc5116f8cadab32f38a7a436efae20db299b896c0ebce5b2ca5b4cdf6