FAILURE MAP
← Case archive

FA-15686 / Numerics / Open access

Binary field trace: prime field trace representation · case 01

The exact binary field trace result violates the stated contract at prime field trace representation.

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

ROOT CAUSE

The prime field trace representation step uses out^1 instead of out.

VERIFIED REPAIR

Use out at the prime field trace representation step.

Unsuccessful approach: The partial repair out%2 if n%2 else 0 still violates the prime field trace representation invariant.

Case contract

Input [a,irreducible bitmask]; return absolute field trace a+a^2+...+a^(2^(n-1)), an F2 element represented integer 0 or1.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a,poly=x;n=poly.bit_length()-1
    def mul(a,b):
     z=0
     while b:
      if b&1:z^=a
      b>>=1;a<<=1
      if a&(1<<n):a^=poly
     return z
    v=a;out=0
    for _ in range(n):
     out=out^v
     v=mul(v,v)
    return out^1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 7], 0), ([2, 7], 1), ([63, 67], 1), ([1, 7], 0), ([3, 7], 1), ([0, 11], 0), ([1, 11], 1), ([2, 11], 0)], [([1, 7], 0), ([9, 19], 1), ([0, 7], 0), ([63, 67], 1), ([5, 19], 0), ([6, 19], 0), ([7, 19], 0), ([8, 19], 1)], [([2, 7], 1), ([12, 19], 1), ([0, 7], 0), ([63, 67], 1), ([6, 25], 0), ([7, 25], 0), ([8, 25], 1), ([9, 25], 1)], [([3, 7], 1), ([15, 19], 1), ([0, 7], 0), ([63, 67], 1), ([7, 31], 0), ([8, 31], 1), ([9, 31], 1), ([10, 31], 0)], [([0, 11], 0), ([4, 25], 1), ([0, 7], 0), ([63, 67], 1), ([8, 37], 1), ([9, 37], 0), ([10, 37], 1), ([11, 37], 0)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 010Failed
explicit oracle 101Failed
explicit oracle 201Failed
explicit oracle 310Failed
explicit oracle 401Failed
explicit oracle 510Failed
explicit oracle 601Failed
explicit oracle 710Failed

SHA-256 / 91f515c138ab9bb8db72a64005827f3dddfebf7bd751106da3b5cd15edfa6a4f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a,poly=x;n=poly.bit_length()-1
    def mul(a,b):
     z=0
     while b:
      if b&1:z^=a
      b>>=1;a<<=1
      if a&(1<<n):a^=poly
     return z
    v=a;out=0
    for _ in range(n):
     out=out^v
     v=mul(v,v)
    return out%2 if n%2 else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 7], 0), ([2, 7], 1), ([63, 67], 1), ([1, 7], 0), ([3, 7], 1), ([0, 11], 0), ([1, 11], 1), ([2, 11], 0)], [([1, 7], 0), ([9, 19], 1), ([0, 7], 0), ([63, 67], 1), ([5, 19], 0), ([6, 19], 0), ([7, 19], 0), ([8, 19], 1)], [([2, 7], 1), ([12, 19], 1), ([0, 7], 0), ([63, 67], 1), ([6, 25], 0), ([7, 25], 0), ([8, 25], 1), ([9, 25], 1)], [([3, 7], 1), ([15, 19], 1), ([0, 7], 0), ([63, 67], 1), ([7, 31], 0), ([8, 31], 1), ([9, 31], 1), ([10, 31], 0)], [([0, 11], 0), ([4, 25], 1), ([0, 7], 0), ([63, 67], 1), ([8, 37], 1), ([9, 37], 0), ([10, 37], 1), ([11, 37], 0)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 000Passed
explicit oracle 101Failed
explicit oracle 201Failed
explicit oracle 300Passed
explicit oracle 401Failed
explicit oracle 500Passed
explicit oracle 611Passed
explicit oracle 700Passed

SHA-256 / 07f4fb961862bb2f0abb5686bf80f3d95996e85a34ebd706e6f92c83ecc34678

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    a,poly=x;n=poly.bit_length()-1
    def mul(a,b):
     z=0
     while b:
      if b&1:z^=a
      b>>=1;a<<=1
      if a&(1<<n):a^=poly
     return z
    v=a;out=0
    for _ in range(n):
     out=out^v
     v=mul(v,v)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 7], 0), ([2, 7], 1), ([63, 67], 1), ([1, 7], 0), ([3, 7], 1), ([0, 11], 0), ([1, 11], 1), ([2, 11], 0)], [([1, 7], 0), ([9, 19], 1), ([0, 7], 0), ([63, 67], 1), ([5, 19], 0), ([6, 19], 0), ([7, 19], 0), ([8, 19], 1)], [([2, 7], 1), ([12, 19], 1), ([0, 7], 0), ([63, 67], 1), ([6, 25], 0), ([7, 25], 0), ([8, 25], 1), ([9, 25], 1)], [([3, 7], 1), ([15, 19], 1), ([0, 7], 0), ([63, 67], 1), ([7, 31], 0), ([8, 31], 1), ([9, 31], 1), ([10, 31], 0)], [([0, 11], 0), ([4, 25], 1), ([0, 7], 0), ([63, 67], 1), ([8, 37], 1), ([9, 37], 0), ([10, 37], 1), ([11, 37], 0)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, 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
explicit oracle 000Passed
explicit oracle 111Passed
explicit oracle 211Passed
explicit oracle 300Passed
explicit oracle 411Passed
explicit oracle 500Passed
explicit oracle 611Passed
explicit oracle 700Passed

SHA-256 / b6654e6a24890b2420c5336b8fc3cdbe89fa4270e1c85088ba8e9be2d5f46760

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:39:29.383756+00:00.

Case digest / a74ae36962f56438fd6b76620d8f479f5dad495fec3271839cf753c7ef33f2b0