FA-15616 / Numerics / Open access
Binary polynomial division: degree termination · case 01
The exact binary polynomial division result violates the stated contract at degree termination.
ROOT CAUSE
The degree termination step uses a.bit_length()<=b.bit_length() instead of a.bit_length()<b.bit_length().
VERIFIED REPAIR
Use a.bit_length()<b.bit_length() at the degree termination step.
Unsuccessful approach: The partial repair a<b still violates the degree termination invariant.
Case contract
Input [a,b] integer bitmasks for F2 polynomials with b>0; return [quotient,remainder] of carryless division. Bounds: a,b<2^32.
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,b=x;q=0
for _ in range(40):
if a.bit_length()<=b.bit_length():break
shift=a.bit_length()-b.bit_length()
if shift<0:return None
q=q^(1<<shift)
a=a^(b<<shift)
return [q,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 1], [1, 0]), ([2, 3], [1, 1]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 2], [0, 0]), ([0, 3], [0, 0]), ([0, 4], [0, 0]), ([0, 5], [0, 0])], [([2, 2], [1, 0]), ([4, 6], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 18], [0, 0]), ([0, 19], [0, 0]), ([0, 20], [0, 0]), ([0, 21], [0, 0])], [([2, 3], [1, 1]), ([5, 7], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 4], [0, 1]), ([1, 5], [0, 1]), ([1, 6], [0, 1]), ([1, 7], [0, 1])], [([3, 1], [3, 0]), ([8, 6], [3, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 21], [0, 1]), ([1, 22], [0, 1]), ([1, 23], [0, 1]), ([1, 24], [0, 1])], [([3, 2], [1, 1]), ([8, 10], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([2, 7], [0, 2]), ([2, 8], [0, 2]), ([2, 9], [0, 2]), ([2, 10], [0, 2])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [0, 1] | [1, 0] | Failed |
| explicit oracle 1 | [0, 2] | [1, 1] | Failed |
| explicit oracle 2 | [0, 0] | [0, 0] | Passed |
| explicit oracle 3 | [4, 3] | [4, 3] | Passed |
| explicit oracle 4 | [0, 0] | [0, 0] | Passed |
| explicit oracle 5 | [0, 0] | [0, 0] | Passed |
| explicit oracle 6 | [0, 0] | [0, 0] | Passed |
| explicit oracle 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / affc09f7cbd7217e15e4204ac18ae3bf1cbf08e90f80f1d54d1275d006998c70
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,b=x;q=0
for _ in range(40):
if a<b:break
shift=a.bit_length()-b.bit_length()
if shift<0:return None
q=q^(1<<shift)
a=a^(b<<shift)
return [q,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 1], [1, 0]), ([2, 3], [1, 1]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 2], [0, 0]), ([0, 3], [0, 0]), ([0, 4], [0, 0]), ([0, 5], [0, 0])], [([2, 2], [1, 0]), ([4, 6], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 18], [0, 0]), ([0, 19], [0, 0]), ([0, 20], [0, 0]), ([0, 21], [0, 0])], [([2, 3], [1, 1]), ([5, 7], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 4], [0, 1]), ([1, 5], [0, 1]), ([1, 6], [0, 1]), ([1, 7], [0, 1])], [([3, 1], [3, 0]), ([8, 6], [3, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 21], [0, 1]), ([1, 22], [0, 1]), ([1, 23], [0, 1]), ([1, 24], [0, 1])], [([3, 2], [1, 1]), ([8, 10], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([2, 7], [0, 2]), ([2, 8], [0, 2]), ([2, 9], [0, 2]), ([2, 10], [0, 2])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [1, 0] | [1, 0] | Passed |
| explicit oracle 1 | [0, 2] | [1, 1] | Failed |
| explicit oracle 2 | [0, 0] | [0, 0] | Passed |
| explicit oracle 3 | [4, 3] | [4, 3] | Passed |
| explicit oracle 4 | [0, 0] | [0, 0] | Passed |
| explicit oracle 5 | [0, 0] | [0, 0] | Passed |
| explicit oracle 6 | [0, 0] | [0, 0] | Passed |
| explicit oracle 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / d720f9c795cc0e5f7cf86db5f3c2a7c8174d7ca9eaa7a27d805d66debc50e65f
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,b=x;q=0
for _ in range(40):
if a.bit_length()<b.bit_length():break
shift=a.bit_length()-b.bit_length()
if shift<0:return None
q=q^(1<<shift)
a=a^(b<<shift)
return [q,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 1], [1, 0]), ([2, 3], [1, 1]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 2], [0, 0]), ([0, 3], [0, 0]), ([0, 4], [0, 0]), ([0, 5], [0, 0])], [([2, 2], [1, 0]), ([4, 6], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([0, 18], [0, 0]), ([0, 19], [0, 0]), ([0, 20], [0, 0]), ([0, 21], [0, 0])], [([2, 3], [1, 1]), ([5, 7], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 4], [0, 1]), ([1, 5], [0, 1]), ([1, 6], [0, 1]), ([1, 7], [0, 1])], [([3, 1], [3, 0]), ([8, 6], [3, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([1, 21], [0, 1]), ([1, 22], [0, 1]), ([1, 23], [0, 1]), ([1, 24], [0, 1])], [([3, 2], [1, 1]), ([8, 10], [1, 2]), ([0, 1], [0, 0]), ([127, 31], [4, 3]), ([2, 7], [0, 2]), ([2, 8], [0, 2]), ([2, 9], [0, 2]), ([2, 10], [0, 2])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit oracle 0 | [1, 0] | [1, 0] | Passed |
| explicit oracle 1 | [1, 1] | [1, 1] | Passed |
| explicit oracle 2 | [0, 0] | [0, 0] | Passed |
| explicit oracle 3 | [4, 3] | [4, 3] | Passed |
| explicit oracle 4 | [0, 0] | [0, 0] | Passed |
| explicit oracle 5 | [0, 0] | [0, 0] | Passed |
| explicit oracle 6 | [0, 0] | [0, 0] | Passed |
| explicit oracle 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / 36f54831271ffe7dc9d5fbe8ab4c90aa19b1342a17c1c0793d65bafadae29e51
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.689109+00:00.
Case digest / 30589660da3dcc5662da4f8f7f460f4ed575f67db7e00b786a1fa23a20885c96