FA-72021 / Error-correcting codes / Open access
RS single-error correction accepts a locator beyond the block · case 01
Multi-symbol errors are "corrected" at a wrapped position.
ROOT CAUSE
The locator range check is missing, so negative indices wrap around.
VERIFIED REPAIR
Treat a locator degree >= n as uncorrectable.
Unsuccessful approach: Allowing loc == n still wraps to the last symbol.
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
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 [[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 [[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']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']]], [['regression [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['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, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[100, 129, 216, 244, 158, 37, 73]]', [[100, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']]], [['regression [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['regression [[47, 164, 158, 90, 100, 125, 111]]', [[47, 164, 158, 90, 100, 125, 111]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['control [[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']], ['control [[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 [[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, 14, 133, 199, 50, 207, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 207, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['control [[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 [[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']], ['regression [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [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']], ['control [[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 [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['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']]], [['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['regression [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[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 [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 76, 66, 165]]', [[161, 66, 213, 76, 66, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[194, 66, 213, 76, 223, 165]]', [[194, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [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 [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]] | [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 238, 98, 222], 'corrected'] | [None, 'uncorrectable'] | Failed |
| regression [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]] | [[178, 226, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95], 'corrected'] | [None, 'uncorrectable'] | Failed |
| partial-repair [[207, 121, 195, 225]] | [[207, 121, 195, 117], 'corrected'] | [None, 'uncorrectable'] | Failed |
| partial-repair [[177, 230, 201, 198, 207, 184, 216]] | [[177, 230, 201, 198, 207, 184, 47], 'corrected'] | [None, 'uncorrectable'] | Failed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 72, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[246, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
SHA-256 / 7ba562b982b5a2831b2778fd20d46d769bc329649da78ce42f7304510f7bda11
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 - 1 - loc] ^= s0
return [out, 'corrected']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[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 [[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']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']]], [['regression [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['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, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[100, 129, 216, 244, 158, 37, 73]]', [[100, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']]], [['regression [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['regression [[47, 164, 158, 90, 100, 125, 111]]', [[47, 164, 158, 90, 100, 125, 111]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['control [[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']], ['control [[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 [[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, 14, 133, 199, 50, 207, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 207, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['control [[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 [[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']], ['regression [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [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']], ['control [[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 [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['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']]], [['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['regression [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[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 [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 76, 66, 165]]', [[161, 66, 213, 76, 66, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[194, 66, 213, 76, 223, 165]]', [[194, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [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 [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| regression [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| partial-repair [[207, 121, 195, 225]] | [[207, 121, 195, 117], 'corrected'] | [None, 'uncorrectable'] | Failed |
| partial-repair [[177, 230, 201, 198, 207, 184, 216]] | [[177, 230, 201, 198, 207, 184, 47], 'corrected'] | [None, 'uncorrectable'] | Failed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 72, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[246, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
SHA-256 / 4e64bb63a9c8140e617edafd57485c96b0127e36569f65500c320e054075a6c7
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 [[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 [[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']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[197, 174, 1, 105, 3]]', [[197, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'clean']], ['control [[197, 174, 1, 72, 3]]', [[197, 174, 1, 72, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[246, 174, 1, 105, 3]]', [[246, 174, 1, 105, 3]], [[197, 174, 1, 105, 3], 'corrected']], ['control [[170, 170, 73, 201, 214, 86]]', [[170, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'clean']]], [['regression [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]]', [[5, 251, 11, 179, 254, 41, 48, 5, 217, 18, 31]], [None, 'uncorrectable']], ['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[159, 170, 73, 201, 214, 86]]', [[159, 170, 73, 201, 214, 86]], [[170, 170, 73, 201, 214, 86], 'corrected']], ['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, 244, 184, 37, 73]]', [[95, 129, 216, 244, 184, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']], ['control [[100, 129, 216, 244, 158, 37, 73]]', [[100, 129, 216, 244, 158, 37, 73]], [[95, 129, 216, 244, 158, 37, 73], 'corrected']]], [['regression [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['regression [[47, 164, 158, 90, 100, 125, 111]]', [[47, 164, 158, 90, 100, 125, 111]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['control [[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']], ['control [[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 [[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, 14, 133, 199, 50, 207, 133, 156, 190, 249]]', [[249, 14, 133, 199, 50, 207, 133, 156, 190, 249]], [[249, 14, 133, 199, 50, 217, 133, 156, 190, 249], 'corrected']], ['control [[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 [[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']], ['regression [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]]', [[168, 112, 224, 76, 56, 53, 214, 250, 9, 141, 18]], [None, 'uncorrectable']], ['partial-repair [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [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']], ['control [[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 [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]]', [[215, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52]], [[11, 173, 115, 26, 44, 95, 50, 118, 184, 32, 84, 52], 'corrected']], ['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']]], [['regression [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]]', [[234, 110, 32, 238, 251, 206, 1, 255, 255, 76, 117]], [None, 'uncorrectable']], ['regression [[207, 121, 195, 225]]', [[207, 121, 195, 225]], [None, 'uncorrectable']], ['partial-repair [[177, 230, 201, 198, 207, 184, 216]]', [[177, 230, 201, 198, 207, 184, 216]], [None, 'uncorrectable']], ['control [[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 [[161, 66, 213, 76, 223, 165]]', [[161, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'clean']], ['control [[161, 66, 213, 76, 66, 165]]', [[161, 66, 213, 76, 66, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[194, 66, 213, 76, 223, 165]]', [[194, 66, 213, 76, 223, 165]], [[161, 66, 213, 76, 223, 165], 'corrected']], ['control [[161, 66, 213, 86, 235, 165]]', [[161, 66, 213, 86, 235, 165]], [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 [[101, 113, 37, 242, 195, 183, 157, 181, 211, 30, 108, 98, 222]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| regression [[178, 163, 216, 203, 246, 61, 83, 52, 85, 245, 59, 90, 113, 95]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| partial-repair [[207, 121, 195, 225]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| partial-repair [[177, 230, 201, 198, 207, 184, 216]] | [None, 'uncorrectable'] | [None, 'uncorrectable'] | Passed |
| control [[197, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'clean'] | [[197, 174, 1, 105, 3], 'clean'] | Passed |
| control [[197, 174, 1, 72, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[246, 174, 1, 105, 3]] | [[197, 174, 1, 105, 3], 'corrected'] | [[197, 174, 1, 105, 3], 'corrected'] | Passed |
| control [[170, 170, 73, 201, 214, 86]] | [[170, 170, 73, 201, 214, 86], 'clean'] | [[170, 170, 73, 201, 214, 86], 'clean'] | Passed |
SHA-256 / 52bb395d8afb6d8c759aa1499d63680cca89a05860309e6aa5f9b9ba4691a41a
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.803247+00:00.
Case digest / 6455851595907b8f5e71da99320c1b0d3696b54416cf861ab1cd510bd53c103f