FAILURE MAP
← Case archive

FA-15646 / Numerics / Open access

Binary field inversion: second polynomial Bezout seed · case 01

The exact binary field inversion result violates the stated contract at second polynomial Bezout seed.

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

ROOT CAUSE

The second polynomial Bezout seed step uses 1 instead of 0.

VERIFIED REPAIR

Use 0 at the second polynomial Bezout seed step.

Unsuccessful approach: The partial repair a still violates the second polynomial Bezout seed invariant.

Case contract

Input [a,irreducible bitmask], a nonzero with degree below modulus; return multiplicative inverse in binary field. Bounds: modulus degree is between two and six.

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,p=x;u=a;v=p;g1=1;g2=1
    for _ in range(60):
     if u==1:break
     if u==0:return None
     j=u.bit_length()-v.bit_length()
     if j<0:
      u,v=v,u;g1,g2=g2,g1;j=-j
     u=u^(v<<j)
     g1=g1^(g2<<j)
    for _ in range(60):
     if g1.bit_length()<p.bit_length():break
     g1=g1^(p<<(g1.bit_length()-p.bit_length()))
    return g1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 7], 3), ([1, 7], 1), ([63, 67], 32), ([3, 7], 2), ([1, 11], 1), ([2, 11], 5), ([3, 11], 6), ([4, 11], 7)], [([3, 7], 2), ([3, 11], 6), ([1, 7], 1), ([63, 67], 32), ([8, 19], 15), ([9, 19], 2), ([10, 19], 12), ([11, 19], 5)], [([2, 11], 5), ([6, 11], 3), ([1, 7], 1), ([63, 67], 32), ([10, 25], 11), ([11, 25], 10), ([12, 25], 2), ([13, 25], 9)], [([3, 11], 6), ([3, 19], 14), ([1, 7], 1), ([63, 67], 32), ([12, 31], 13), ([13, 31], 12), ([14, 31], 11), ([15, 31], 2)], [([4, 11], 7), ([6, 19], 7), ([1, 7], 1), ([63, 67], 32), ([14, 37], 6), ([15, 37], 13), ([16, 37], 11), ([17, 37], 24)]]
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 023Failed
explicit oracle 111Passed
explicit oracle 26332Failed
explicit oracle 332Failed
explicit oracle 411Passed
explicit oracle 545Failed
explicit oracle 676Failed
explicit oracle 747Failed

SHA-256 / 072467ea0f1f088fb4c9df8193ac252c90cca1bde3441aca93879a7091875c78

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,p=x;u=a;v=p;g1=1;g2=a
    for _ in range(60):
     if u==1:break
     if u==0:return None
     j=u.bit_length()-v.bit_length()
     if j<0:
      u,v=v,u;g1,g2=g2,g1;j=-j
     u=u^(v<<j)
     g1=g1^(g2<<j)
    for _ in range(60):
     if g1.bit_length()<p.bit_length():break
     g1=g1^(p<<(g1.bit_length()-p.bit_length()))
    return g1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 7], 3), ([1, 7], 1), ([63, 67], 32), ([3, 7], 2), ([1, 11], 1), ([2, 11], 5), ([3, 11], 6), ([4, 11], 7)], [([3, 7], 2), ([3, 11], 6), ([1, 7], 1), ([63, 67], 32), ([8, 19], 15), ([9, 19], 2), ([10, 19], 12), ([11, 19], 5)], [([2, 11], 5), ([6, 11], 3), ([1, 7], 1), ([63, 67], 32), ([10, 25], 11), ([11, 25], 10), ([12, 25], 2), ([13, 25], 9)], [([3, 11], 6), ([3, 19], 14), ([1, 7], 1), ([63, 67], 32), ([12, 31], 13), ([13, 31], 12), ([14, 31], 11), ([15, 31], 2)], [([4, 11], 7), ([6, 19], 7), ([1, 7], 1), ([63, 67], 32), ([14, 37], 6), ([15, 37], 13), ([16, 37], 11), ([17, 37], 24)]]
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 013Failed
explicit oracle 111Passed
explicit oracle 21132Failed
explicit oracle 312Failed
explicit oracle 411Passed
explicit oracle 575Failed
explicit oracle 656Failed
explicit oracle 707Failed

SHA-256 / ba30290f51f944bee71814d75dee3f32f06cc48913e463603905422d6c353bc5

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,p=x;u=a;v=p;g1=1;g2=0
    for _ in range(60):
     if u==1:break
     if u==0:return None
     j=u.bit_length()-v.bit_length()
     if j<0:
      u,v=v,u;g1,g2=g2,g1;j=-j
     u=u^(v<<j)
     g1=g1^(g2<<j)
    for _ in range(60):
     if g1.bit_length()<p.bit_length():break
     g1=g1^(p<<(g1.bit_length()-p.bit_length()))
    return g1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 7], 3), ([1, 7], 1), ([63, 67], 32), ([3, 7], 2), ([1, 11], 1), ([2, 11], 5), ([3, 11], 6), ([4, 11], 7)], [([3, 7], 2), ([3, 11], 6), ([1, 7], 1), ([63, 67], 32), ([8, 19], 15), ([9, 19], 2), ([10, 19], 12), ([11, 19], 5)], [([2, 11], 5), ([6, 11], 3), ([1, 7], 1), ([63, 67], 32), ([10, 25], 11), ([11, 25], 10), ([12, 25], 2), ([13, 25], 9)], [([3, 11], 6), ([3, 19], 14), ([1, 7], 1), ([63, 67], 32), ([12, 31], 13), ([13, 31], 12), ([14, 31], 11), ([15, 31], 2)], [([4, 11], 7), ([6, 19], 7), ([1, 7], 1), ([63, 67], 32), ([14, 37], 6), ([15, 37], 13), ([16, 37], 11), ([17, 37], 24)]]
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 033Passed
explicit oracle 111Passed
explicit oracle 23232Passed
explicit oracle 322Passed
explicit oracle 411Passed
explicit oracle 555Passed
explicit oracle 666Passed
explicit oracle 777Passed

SHA-256 / 9b2294b7b11db037b75557dc09e207659c06ee2bffe1be119991138ec3171c87

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

Case digest / 2548a92b2c5d75e258501b83944357d495ff54d9f8ba8d663b1e9925e2293000