FAILURE MAP
← Case archive

FA-71981 / Error-correcting codes / Open access

GF(256) power returns zero for zero to the zero · case 01

Polynomial evaluation at 0 loses its constant term.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The zero-base branch returns 0 unconditionally, although 0^0 = 1 by the stated convention.

VERIFIED REPAIR

Return 1 for exponent 0 and 0 otherwise.

Unsuccessful approach: Returning None for 0^0 treats the convention as undefined.

Case contract

Table-driven GF(2^8) (polynomial 0x11D, generator 2) operations: "div" a/b (None for b = 0, 0 for a = 0 otherwise), "inv" 1/a (None for 0) and "pow" a^b for integer b >= 0 (0^0 = 1, 0^b = 0). EXP is extended to 510 entries so sums of logarithms need no reduction. Unknown ops return None.

Why this case matters

Reed-Solomon decoders spend most time in log/antilog table lookups for division and inversion.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(op, a, b):
    EXP = [0] * 510
    LOG = [0] * 256
    x = 1
    for i in range(255):
        EXP[i] = x
        LOG[x] = i
        x <<= 1
        if x & 0x100:
            x ^= 0x11D
    for i in range(255, 510):
        EXP[i] = EXP[i - 255]
    if op == 'div':
        if b == 0:
            return None
        if a == 0:
            return 0
        return EXP[(LOG[a] - LOG[b]) % 255]
    if op == 'inv':
        if a == 0:
            return None
        return EXP[255 - LOG[a]]
    if op == 'pow':
        if a == 0:
            return 0
        return EXP[(LOG[a] * b) % 255]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 1, 2]', ['div', 1, 2], 142], ['control ["div", 70, 40]', ['div', 70, 40], 108], ['control ["div", 57, 11]', ['div', 57, 11], 179], ['control ["div", 226, 96]', ['div', 226, 96], 190], ['control ["div", 238, 211]', ['div', 238, 211], 155], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76], ['control ["div", 73, 232]', ['div', 73, 232], 21], ['control ["div", 152, 74]', ['div', 152, 74], 235], ['control ["div", 255, 217]', ['div', 255, 217], 240], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133], ['control ["inv", 143, 0]', ['inv', 143, 0], 245], ['control ["inv", 212, 0]', ['inv', 212, 0], 249], ['control ["inv", 188, 0]', ['inv', 188, 0], 149], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214], ['control ["pow", 155, 166]', ['pow', 155, 166], 194], ['control ["pow", 28, 117]', ['pow', 28, 117], 100], ['control ["pow", 149, 57]', ['pow', 149, 57], 39], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40], ['control ["pow", 55, 427]', ['pow', 55, 427], 28], ['control ["div", 0, 0]', ['div', 0, 0], None], ['control ["div", 0, 7]', ['div', 0, 7], 0], ['control ["div", 7, 0]', ['div', 7, 0], None], ['control ["div", 1, 1]', ['div', 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 fixtureActualExpectedOutcome
regression ["pow", 0, 0]01Failed
control ["div", 1, 2]142142Passed
control ["div", 70, 40]108108Passed
control ["div", 57, 11]179179Passed
control ["div", 226, 96]190190Passed
control ["div", 238, 211]155155Passed
control ["div", 48, 99]118118Passed
control ["div", 65, 255]7676Passed

SHA-256 / c7098cd289320db1a27d2e609e60b6b37e853652f0ed91f149618d56ebb748f2

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(op, a, b):
    EXP = [0] * 510
    LOG = [0] * 256
    x = 1
    for i in range(255):
        EXP[i] = x
        LOG[x] = i
        x <<= 1
        if x & 0x100:
            x ^= 0x11D
    for i in range(255, 510):
        EXP[i] = EXP[i - 255]
    if op == 'div':
        if b == 0:
            return None
        if a == 0:
            return 0
        return EXP[(LOG[a] - LOG[b]) % 255]
    if op == 'inv':
        if a == 0:
            return None
        return EXP[255 - LOG[a]]
    if op == 'pow':
        if a == 0:
            return 0 if b > 0 else None
        return EXP[(LOG[a] * b) % 255]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 1, 2]', ['div', 1, 2], 142], ['control ["div", 70, 40]', ['div', 70, 40], 108], ['control ["div", 57, 11]', ['div', 57, 11], 179], ['control ["div", 226, 96]', ['div', 226, 96], 190], ['control ["div", 238, 211]', ['div', 238, 211], 155], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76], ['control ["div", 73, 232]', ['div', 73, 232], 21], ['control ["div", 152, 74]', ['div', 152, 74], 235], ['control ["div", 255, 217]', ['div', 255, 217], 240], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133], ['control ["inv", 143, 0]', ['inv', 143, 0], 245], ['control ["inv", 212, 0]', ['inv', 212, 0], 249], ['control ["inv", 188, 0]', ['inv', 188, 0], 149], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214], ['control ["pow", 155, 166]', ['pow', 155, 166], 194], ['control ["pow", 28, 117]', ['pow', 28, 117], 100], ['control ["pow", 149, 57]', ['pow', 149, 57], 39], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40], ['control ["pow", 55, 427]', ['pow', 55, 427], 28], ['control ["div", 0, 0]', ['div', 0, 0], None], ['control ["div", 0, 7]', ['div', 0, 7], 0], ['control ["div", 7, 0]', ['div', 7, 0], None], ['control ["div", 1, 1]', ['div', 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 fixtureActualExpectedOutcome
regression ["pow", 0, 0]None1Failed
control ["div", 1, 2]142142Passed
control ["div", 70, 40]108108Passed
control ["div", 57, 11]179179Passed
control ["div", 226, 96]190190Passed
control ["div", 238, 211]155155Passed
control ["div", 48, 99]118118Passed
control ["div", 65, 255]7676Passed

SHA-256 / 0fe6a16162a71a041cd9a43d070f66f76b5fe7ff515d531df26802efd12fa92c

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(op, a, b):
    EXP = [0] * 510
    LOG = [0] * 256
    x = 1
    for i in range(255):
        EXP[i] = x
        LOG[x] = i
        x <<= 1
        if x & 0x100:
            x ^= 0x11D
    for i in range(255, 510):
        EXP[i] = EXP[i - 255]
    if op == 'div':
        if b == 0:
            return None
        if a == 0:
            return 0
        return EXP[(LOG[a] - LOG[b]) % 255]
    if op == 'inv':
        if a == 0:
            return None
        return EXP[255 - LOG[a]]
    if op == 'pow':
        if a == 0:
            return 0 if b > 0 else 1
        return EXP[(LOG[a] * b) % 255]
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 1, 2]', ['div', 1, 2], 142], ['control ["div", 70, 40]', ['div', 70, 40], 108], ['control ["div", 57, 11]', ['div', 57, 11], 179], ['control ["div", 226, 96]', ['div', 226, 96], 190], ['control ["div", 238, 211]', ['div', 238, 211], 155], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 48, 99]', ['div', 48, 99], 118], ['control ["div", 65, 255]', ['div', 65, 255], 76], ['control ["div", 73, 232]', ['div', 73, 232], 21], ['control ["div", 152, 74]', ['div', 152, 74], 235], ['control ["div", 255, 217]', ['div', 255, 217], 240], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["div", 82, 3]', ['div', 82, 3], 197], ['control ["inv", 204, 0]', ['inv', 204, 0], 133], ['control ["inv", 143, 0]', ['inv', 143, 0], 245], ['control ["inv", 212, 0]', ['inv', 212, 0], 249], ['control ["inv", 188, 0]', ['inv', 188, 0], 149], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["inv", 186, 0]', ['inv', 186, 0], 7], ['control ["inv", 215, 0]', ['inv', 215, 0], 214], ['control ["pow", 155, 166]', ['pow', 155, 166], 194], ['control ["pow", 28, 117]', ['pow', 28, 117], 100], ['control ["pow", 149, 57]', ['pow', 149, 57], 39], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40]], [['regression ["pow", 0, 0]', ['pow', 0, 0], 1], ['control ["pow", 63, 61]', ['pow', 63, 61], 49], ['control ["pow", 9, 596]', ['pow', 9, 596], 40], ['control ["pow", 55, 427]', ['pow', 55, 427], 28], ['control ["div", 0, 0]', ['div', 0, 0], None], ['control ["div", 0, 7]', ['div', 0, 7], 0], ['control ["div", 7, 0]', ['div', 7, 0], None], ['control ["div", 1, 1]', ['div', 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 fixtureActualExpectedOutcome
regression ["pow", 0, 0]11Passed
control ["div", 1, 2]142142Passed
control ["div", 70, 40]108108Passed
control ["div", 57, 11]179179Passed
control ["div", 226, 96]190190Passed
control ["div", 238, 211]155155Passed
control ["div", 48, 99]118118Passed
control ["div", 65, 255]7676Passed

SHA-256 / ce7bcfce079362099364c4c9743be20ff44035be6b4d3087cb7aab01f350d3b4

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.430953+00:00.

Case digest / 7aebf8220c8fd76941ddc14858e1fc99831dd346322d3eb3550249390fce8272