FA-14796 / Numerics / Open access
Integer polynomial pseudodivision: leading cancellation coefficient · case 01
The exact integer polynomial pseudodivision result violates the stated contract at leading cancellation coefficient.
ROOT CAUSE
The leading cancellation coefficient step uses B[-1] instead of r[-1].
VERIFIED REPAIR
Use r[-1] at the leading cancellation coefficient step.
Unsuccessful approach: The partial repair abs(r[-1]) still violates the leading cancellation coefficient invariant.
Case contract
Input [A,B] integer ascending canonical nonzero polynomials degA>=degB; returns [scale, quotient, remainder] with scale*A=B*quotient+remainder, scale=lc(B)^(degA-degB+1).
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
r=A[:];q=[0]*(len(A)-len(B)+1);b=B[-1];steps=len(A)-len(B)+1
for _ in range(steps):
if len(r)<len(B):
q=[b*v for v in q];r=[b*v for v in r];continue
k=len(r)-len(B)
c=B[-1]
q=[b*v for v in q]
q[k]=q[k]+c
r=[b*v for v in r]
for j in range(len(B)):r[j+k]=r[j+k]-c*B[j]
while r and r[-1]==0:r.pop()
while q and q[-1]==0:q.pop()
return [b**steps,q,r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, -2, -2], [-2, -1]], [1, [-2, 2], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [-1, 1]], [1, [-4, -2], [-6]])], [([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [2, -1]], [1, [6, 2], [-14]]), ([[-2, -2, -2], [2, 1]], [1, [2, -2], [-6]]), ([[-2, -2, -2], [2, 2]], [4, [0, -4], [-8]]), ([[-2, -2, -1], [-2, -2]], [4, [2, 2], [-4]])], [([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [0, -2]], [4, [4, 4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -1], [1, 1]], [1, [-1, -1], [-1]]), ([[-2, -2, -1], [1, 2]], [4, [-3, -2], [-5]]), ([[-2, -2, -1], [2, -2]], [4, [6, 2], [-20]]), ([[-2, -2, -1], [2, -1]], [1, [4, 1], [-10]])], [([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [0, 2]], [4, [-4, -4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 1], [0, 2]], [4, [-4, 2], [-8]]), ([[-2, -2, 1], [1, -2]], [4, [3, -2], [-11]]), ([[-2, -2, 1], [1, -1]], [1, [1, -1], [-3]]), ([[-2, -2, 1], [1, 1]], [1, [-3, 1], [1]])], [([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [1, 1]], [1, [0, -2], [-2]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 2], [0, -2]], [4, [4, -4], [-8]]), ([[-2, -2, 2], [0, -1]], [1, [2, -2], [-2]]), ([[-2, -2, 2], [0, 1]], [1, [-2, 2], [-2]]), ([[-2, -2, 2], [0, 2]], [4, [-4, 4], [-8]])]]
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, [], [-2, -2, -2]] | [1, [-2, 2], [-6]] | Failed |
| explicit oracle 1 | [4, [0, 4], [-8]] | [4, [0, 4], [-8]] | Passed |
| explicit oracle 2 | [2, [2], []] | [2, [2], []] | Passed |
| explicit oracle 3 | [1, [0, 2], [-2, 2, -4]] | [1, [-6, -2], [-14]] | Failed |
| explicit oracle 4 | [4, [0, 6], [-8, 4, -20]] | [4, [-8, -4], [-24]] | Failed |
| explicit oracle 5 | [4, [-2, 4], [-10, -8]] | [4, [2, 4], [-6]] | Failed |
| explicit oracle 6 | [1, [], [-2, -2, -2]] | [1, [0, 2], [-2]] | Failed |
| explicit oracle 7 | [1, [0, 2], [-2, 0, -4]] | [1, [-4, -2], [-6]] | Failed |
SHA-256 / 2d00425958ab16e7a83c92e1e9d3f135b4963582a4ec3f9e0a90cb58df19256c
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
r=A[:];q=[0]*(len(A)-len(B)+1);b=B[-1];steps=len(A)-len(B)+1
for _ in range(steps):
if len(r)<len(B):
q=[b*v for v in q];r=[b*v for v in r];continue
k=len(r)-len(B)
c=abs(r[-1])
q=[b*v for v in q]
q[k]=q[k]+c
r=[b*v for v in r]
for j in range(len(B)):r[j+k]=r[j+k]-c*B[j]
while r and r[-1]==0:r.pop()
while q and q[-1]==0:q.pop()
return [b**steps,q,r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, -2, -2], [-2, -1]], [1, [-2, 2], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [-1, 1]], [1, [-4, -2], [-6]])], [([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [2, -1]], [1, [6, 2], [-14]]), ([[-2, -2, -2], [2, 1]], [1, [2, -2], [-6]]), ([[-2, -2, -2], [2, 2]], [4, [0, -4], [-8]]), ([[-2, -2, -1], [-2, -2]], [4, [2, 2], [-4]])], [([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [0, -2]], [4, [4, 4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -1], [1, 1]], [1, [-1, -1], [-1]]), ([[-2, -2, -1], [1, 2]], [4, [-3, -2], [-5]]), ([[-2, -2, -1], [2, -2]], [4, [6, 2], [-20]]), ([[-2, -2, -1], [2, -1]], [1, [4, 1], [-10]])], [([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [0, 2]], [4, [-4, -4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 1], [0, 2]], [4, [-4, 2], [-8]]), ([[-2, -2, 1], [1, -2]], [4, [3, -2], [-11]]), ([[-2, -2, 1], [1, -1]], [1, [1, -1], [-3]]), ([[-2, -2, 1], [1, 1]], [1, [-3, 1], [1]])], [([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [1, 1]], [1, [0, -2], [-2]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 2], [0, -2]], [4, [4, -4], [-8]]), ([[-2, -2, 2], [0, -1]], [1, [2, -2], [-2]]), ([[-2, -2, 2], [0, 1]], [1, [-2, 2], [-2]]), ([[-2, -2, 2], [0, 2]], [4, [-4, 4], [-8]])]]
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, 2], [-2, 2]] | [1, [-2, 2], [-6]] | Failed |
| explicit oracle 1 | [4, [0, 4], [-8]] | [4, [0, 4], [-8]] | Passed |
| explicit oracle 2 | [2, [2], []] | [2, [2], []] | Passed |
| explicit oracle 3 | [1, [0, 6], [-2, 10, -8]] | [1, [-6, -2], [-14]] | Failed |
| explicit oracle 4 | [4, [0, 12], [-8, 16, -32]] | [4, [-8, -4], [-24]] | Failed |
| explicit oracle 5 | [4, [0, 4], [-8, -4]] | [4, [2, 4], [-6]] | Failed |
| explicit oracle 6 | [1, [0, 2], [-2]] | [1, [0, 2], [-2]] | Passed |
| explicit oracle 7 | [1, [0, 6], [-2, 4, -8]] | [1, [-4, -2], [-6]] | Failed |
SHA-256 / 7f2988058a50619a710a464c2b45487869c50b06f2e05415f8718c9421f554d2
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
r=A[:];q=[0]*(len(A)-len(B)+1);b=B[-1];steps=len(A)-len(B)+1
for _ in range(steps):
if len(r)<len(B):
q=[b*v for v in q];r=[b*v for v in r];continue
k=len(r)-len(B)
c=r[-1]
q=[b*v for v in q]
q[k]=q[k]+c
r=[b*v for v in r]
for j in range(len(B)):r[j+k]=r[j+k]-c*B[j]
while r and r[-1]==0:r.pop()
while q and q[-1]==0:q.pop()
return [b**steps,q,r]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-2, -2, -2], [-2, -1]], [1, [-2, 2], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [-1, 1]], [1, [-4, -2], [-6]])], [([[-2, -2, -2], [-2, 1]], [1, [-6, -2], [-14]]), ([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -2], [2, -1]], [1, [6, 2], [-14]]), ([[-2, -2, -2], [2, 1]], [1, [2, -2], [-6]]), ([[-2, -2, -2], [2, 2]], [4, [0, -4], [-8]]), ([[-2, -2, -1], [-2, -2]], [4, [2, 2], [-4]])], [([[-2, -2, -2], [-2, 2]], [4, [-8, -4], [-24]]), ([[-2, -2, -2], [0, -2]], [4, [4, 4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, -1], [1, 1]], [1, [-1, -1], [-1]]), ([[-2, -2, -1], [1, 2]], [4, [-3, -2], [-5]]), ([[-2, -2, -1], [2, -2]], [4, [6, 2], [-20]]), ([[-2, -2, -1], [2, -1]], [1, [4, 1], [-10]])], [([[-2, -2, -2], [-1, -2]], [4, [2, 4], [-6]]), ([[-2, -2, -2], [0, 2]], [4, [-4, -4], [-8]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 1], [0, 2]], [4, [-4, 2], [-8]]), ([[-2, -2, 1], [1, -2]], [4, [3, -2], [-11]]), ([[-2, -2, 1], [1, -1]], [1, [1, -1], [-3]]), ([[-2, -2, 1], [1, 1]], [1, [-3, 1], [1]])], [([[-2, -2, -2], [-1, -1]], [1, [0, 2], [-2]]), ([[-2, -2, -2], [1, 1]], [1, [0, -2], [-2]]), ([[-2, -2, -2], [-2, -2]], [4, [0, 4], [-8]]), ([[2, 2], [2, 2]], [2, [2], []]), ([[-2, -2, 2], [0, -2]], [4, [4, -4], [-8]]), ([[-2, -2, 2], [0, -1]], [1, [2, -2], [-2]]), ([[-2, -2, 2], [0, 1]], [1, [-2, 2], [-2]]), ([[-2, -2, 2], [0, 2]], [4, [-4, 4], [-8]])]]
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, [-2, 2], [-6]] | [1, [-2, 2], [-6]] | Passed |
| explicit oracle 1 | [4, [0, 4], [-8]] | [4, [0, 4], [-8]] | Passed |
| explicit oracle 2 | [2, [2], []] | [2, [2], []] | Passed |
| explicit oracle 3 | [1, [-6, -2], [-14]] | [1, [-6, -2], [-14]] | Passed |
| explicit oracle 4 | [4, [-8, -4], [-24]] | [4, [-8, -4], [-24]] | Passed |
| explicit oracle 5 | [4, [2, 4], [-6]] | [4, [2, 4], [-6]] | Passed |
| explicit oracle 6 | [1, [0, 2], [-2]] | [1, [0, 2], [-2]] | Passed |
| explicit oracle 7 | [1, [-4, -2], [-6]] | [1, [-4, -2], [-6]] | Passed |
SHA-256 / 2f46bf8941d8f82adf55282db1aa368125a0156004cd5199bb5d80e5ed7131a3
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:20.469987+00:00.
Case digest / e155b675c9830bf7265a358f682cd4e1f745a34878ca66aac5ddfcab8efa3728