FA-72011 / Error-correcting codes / Open access
RS single-error correction indexes by degree · case 01
The error value is applied to the symbol at the mirrored position.
ROOT CAUSE
The degree is used directly as a list index although the list stores the highest degree first.
VERIFIED REPAIR
Apply the correction at index n - 1 - loc.
Unsuccessful approach: Using n - loc is one position off.
Case contract
Correct at most one symbol error in a Reed-Solomon codeword with two parity symbols over GF(2^8) (0x11D, roots alpha^0 and alpha^1, alpha = 2). msg lists coefficients highest degree first, so index n-1-i holds degree i. With S0 = msg(1) and S1 = msg(alpha): both zero -> clean; one zero -> uncorrectable; else the error degree is log(S1/S0), which must be < n, and the error value is S0. Return [corrected symbols or None, status].
Why this case matters
Short-block RS codes in barcodes and radio headers correct a single corrupted symbol cheaply.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(msg):
EXP, LOG = [0] * 512, [0] * 256
x = 1
for i in range(255):
EXP[i] = EXP[i + 255] = x
LOG[x] = i
x <<= 1
if x & 0x100:
x ^= 0x11D
def mul(a, b):
return 0 if a == 0 or b == 0 else EXP[LOG[a] + LOG[b]]
n = len(msg)
def ev(root):
v = 0
for coef in msg:
v = mul(v, root) ^ coef
return v
s0, s1 = ev(1), ev(2)
if s0 == 0 and s1 == 0:
return [list(msg), 'clean']
if s0 == 0 or s1 == 0:
return [None, 'uncorrectable']
loc = (LOG[s1] - LOG[s0]) % 255
if loc >= n:
return [None, 'uncorrectable']
out = list(msg)
out[loc] ^= s0
return [out, 'corrected']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['regression [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 32, 233]]', [[197, 174, 1, 32, 233]], [None, 'uncorrectable']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']], ['control [[170, 108, 73, 201, 214, 197]]', [[170, 108, 73, 201, 214, 197]], [None, 'uncorrectable']], ['control [[95, 129, 216, 244, 158, 37, 73]]', [[95, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'clean']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']]], [['regression [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['regression [[95, 129, 216, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']], ['control [[29, 68, 82, 179, 193, 203, 215, 101]]', [[29, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'clean']], ['control [[224, 68, 82, 179, 193, 34, 215, 101]]', [[224, 68, 82, 179, 193, 34, 215, 101]], [None, 'uncorrectable']], ['control [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'clean']], ['control [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]]', [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]], [None, 'uncorrectable']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']]], [['regression [[29, 68, 82, 251, 193, 203, 215, 101]]', [[29, 68, 82, 251, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['regression [[160, 68, 82, 179, 193, 203, 215, 101]]', [[160, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']], ['control [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]], [None, 'uncorrectable']], ['control [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'clean']], ['control [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]]', [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]], [None, 'uncorrectable']], ['control [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']]], [['regression [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['regression [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']], ['control [[204, 34, 231, 58, 245, 3, 153, 92]]', [[204, 34, 231, 58, 245, 3, 153, 92]], [[204, 34, 231, 58, 245, 3, 153, 92], 'clean']], ['control [[204, 34, 231, 58, 245, 220, 9, 92]]', [[204, 34, 231, 58, 245, 220, 9, 92]], [None, 'uncorrectable']], ['control [[102, 133, 139, 4, 108]]', [[102, 133, 139, 4, 108]], [[102, 133, 139, 4, 108], 'clean']], ['control [[102, 133, 139, 20, 49]]', [[102, 133, 139, 20, 49]], [None, 'uncorrectable']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']]], [['regression [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['regression [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']], ['control [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]]', [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]], [None, 'uncorrectable']], ['control [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['control [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['control [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['control [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']]]]
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 [[197, 174, 1, 72, 3]] | [[197, 143, 1, 72, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Failed |
| regression [[246, 174, 1, 105, 3]] | [[246, 174, 1, 105, 48], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Failed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 32, 233]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
| control [[170, 108, 73, 201, 214, 197]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[95, 129, 216, 244, 158, 37, 73]] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | Passed |
| control [[95, 129, 216, 148, 158, 46, 73]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
SHA-256 / fd5b556ee1ac9336593b111a616c24e9220cf87d9ab8ac26af4f22d75175cd12
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(msg):
EXP, LOG = [0] * 512, [0] * 256
x = 1
for i in range(255):
EXP[i] = EXP[i + 255] = x
LOG[x] = i
x <<= 1
if x & 0x100:
x ^= 0x11D
def mul(a, b):
return 0 if a == 0 or b == 0 else EXP[LOG[a] + LOG[b]]
n = len(msg)
def ev(root):
v = 0
for coef in msg:
v = mul(v, root) ^ coef
return v
s0, s1 = ev(1), ev(2)
if s0 == 0 and s1 == 0:
return [list(msg), 'clean']
if s0 == 0 or s1 == 0:
return [None, 'uncorrectable']
loc = (LOG[s1] - LOG[s0]) % 255
if loc >= n:
return [None, 'uncorrectable']
out = list(msg)
out[n - loc] ^= s0
return [out, 'corrected']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['regression [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 32, 233]]', [[197, 174, 1, 32, 233]], [None, 'uncorrectable']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']], ['control [[170, 108, 73, 201, 214, 197]]', [[170, 108, 73, 201, 214, 197]], [None, 'uncorrectable']], ['control [[95, 129, 216, 244, 158, 37, 73]]', [[95, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'clean']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']]], [['regression [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['regression [[95, 129, 216, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']], ['control [[29, 68, 82, 179, 193, 203, 215, 101]]', [[29, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'clean']], ['control [[224, 68, 82, 179, 193, 34, 215, 101]]', [[224, 68, 82, 179, 193, 34, 215, 101]], [None, 'uncorrectable']], ['control [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'clean']], ['control [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]]', [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]], [None, 'uncorrectable']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']]], [['regression [[29, 68, 82, 251, 193, 203, 215, 101]]', [[29, 68, 82, 251, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['regression [[160, 68, 82, 179, 193, 203, 215, 101]]', [[160, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']], ['control [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]], [None, 'uncorrectable']], ['control [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'clean']], ['control [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]]', [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]], [None, 'uncorrectable']], ['control [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']]], [['regression [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['regression [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']], ['control [[204, 34, 231, 58, 245, 3, 153, 92]]', [[204, 34, 231, 58, 245, 3, 153, 92]], [[204, 34, 231, 58, 245, 3, 153, 92], 'clean']], ['control [[204, 34, 231, 58, 245, 220, 9, 92]]', [[204, 34, 231, 58, 245, 220, 9, 92]], [None, 'uncorrectable']], ['control [[102, 133, 139, 4, 108]]', [[102, 133, 139, 4, 108]], [[102, 133, 139, 4, 108], 'clean']], ['control [[102, 133, 139, 20, 49]]', [[102, 133, 139, 20, 49]], [None, 'uncorrectable']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']]], [['regression [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['regression [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']], ['control [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]]', [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]], [None, 'uncorrectable']], ['control [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['control [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['control [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['control [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']]]]
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 [[197, 174, 1, 72, 3]] | [[197, 174, 1, 72, 34], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Failed |
| regression [[246, 174, 1, 105, 3]] | [[246, 157, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Failed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 32, 233]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
| control [[170, 108, 73, 201, 214, 197]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[95, 129, 216, 244, 158, 37, 73]] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | Passed |
| control [[95, 129, 216, 148, 158, 46, 73]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
SHA-256 / d416622167bbde45ab8994c576d3759e52b8353901095d58fbe63c2ef8867e6d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(msg):
EXP, LOG = [0] * 512, [0] * 256
x = 1
for i in range(255):
EXP[i] = EXP[i + 255] = x
LOG[x] = i
x <<= 1
if x & 0x100:
x ^= 0x11D
def mul(a, b):
return 0 if a == 0 or b == 0 else EXP[LOG[a] + LOG[b]]
n = len(msg)
def ev(root):
v = 0
for coef in msg:
v = mul(v, root) ^ coef
return v
s0, s1 = ev(1), ev(2)
if s0 == 0 and s1 == 0:
return [list(msg), 'clean']
if s0 == 0 or s1 == 0:
return [None, 'uncorrectable']
loc = (LOG[s1] - LOG[s0]) % 255
if loc >= n:
return [None, 'uncorrectable']
out = list(msg)
out[n - 1 - loc] ^= s0
return [out, 'corrected']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['regression [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 32, 233]]', [[197, 174, 1, 32, 233]], [None, 'uncorrectable']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']], ['control [[170, 108, 73, 201, 214, 197]]', [[170, 108, 73, 201, 214, 197]], [None, 'uncorrectable']], ['control [[95, 129, 216, 244, 158, 37, 73]]', [[95, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'clean']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']]], [['regression [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['regression [[95, 129, 216, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[95, 129, 216, 148, 158, 46, 73]]', [[95, 129, 216, 148, 158, 46, 73]], [None, 'uncorrectable']], ['control [[29, 68, 82, 179, 193, 203, 215, 101]]', [[29, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'clean']], ['control [[224, 68, 82, 179, 193, 34, 215, 101]]', [[224, 68, 82, 179, 193, 34, 215, 101]], [None, 'uncorrectable']], ['control [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'clean']], ['control [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]]', [[249, 89, 133, 199, 50, 217, 133, 156, 84, 249]], [None, 'uncorrectable']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']]], [['regression [[29, 68, 82, 251, 193, 203, 215, 101]]', [[29, 68, 82, 251, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['regression [[160, 68, 82, 179, 193, 203, 215, 101]]', [[160, 68, 82, 179, 193, 203, 215, 101]], [[29, 68, 82, 179, 193, 203, 215, 101], 'corrected']], ['control [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'clean']], ['control [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 74, 155, 50, 118, 184, 32, 84, 52]], [None, 'uncorrectable']], ['control [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'clean']], ['control [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]]', [[83, 45, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 128, 142]], [None, 'uncorrectable']], ['control [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']]], [['regression [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]]', [[101, 14, 133, 199, 50, 217, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['regression [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]]', [[11, 173, 115, 26, 153, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [None, 'uncorrectable']], ['control [[204, 34, 231, 58, 245, 3, 153, 92]]', [[204, 34, 231, 58, 245, 3, 153, 92]], [[204, 34, 231, 58, 245, 3, 153, 92], 'clean']], ['control [[204, 34, 231, 58, 245, 220, 9, 92]]', [[204, 34, 231, 58, 245, 220, 9, 92]], [None, 'uncorrectable']], ['control [[102, 133, 139, 4, 108]]', [[102, 133, 139, 4, 108]], [[102, 133, 139, 4, 108], 'clean']], ['control [[102, 133, 139, 20, 49]]', [[102, 133, 139, 20, 49]], [None, 'uncorrectable']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']]], [['regression [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[83, 135, 139, 126, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['regression [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]]', [[25, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142]], [[83, 135, 139, 74, 148, 233, 28, 230, 113, 155, 213, 155, 184, 142], 'corrected']], ['control [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]]', [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]], [None, 'uncorrectable']], ['control [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]]', [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]], [None, 'uncorrectable']], ['control [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['control [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['control [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['control [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']]]]
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 [[197, 174, 1, 72, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| regression [[246, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 32, 233]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
| control [[170, 108, 73, 201, 214, 197]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[95, 129, 216, 244, 158, 37, 73]] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | [[95, 129, 216, 244, 158, 37, 73], 'clean'] | Passed |
| control [[95, 129, 216, 148, 158, 46, 73]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
SHA-256 / 7c6d1f5238d49af03a7c1c63064f0fe1140809538a73ba41e6b062a8613e8322
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.680957+00:00.
Case digest / a8a0cd72fb47f8d55b5171f5aa65ab4eb1067c2a913b68fdb8884bc13c10eb38