FA-14606 / Numerics / Open access
Polynomial long division: divisor subtraction · case 01
The exact polynomial long division result violates the stated contract at divisor subtraction.
ROOT CAUSE
The divisor subtraction step uses r[j+k]+c*b[j] instead of r[j+k]-c*b[j].
THE FAILURE
The divisor subtraction step uses r[j+k]+c*b[j] instead of r[j+k]-c*b[j].
Unsuccessful approach: The partial repair r[j+k]-b[j] still violates the divisor subtraction invariant.
Case contract
Input [A,B] integer ascending coefficients, B nonzero canonical; return rational quotient/remainder coefficient pairs; zero polynomial is []. Bounds: len(A)<=4 and 1<=len(B)<=4.
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=list(map(Fraction,A));b=list(map(Fraction,B))
while r and r[-1]==0:r.pop()
q=[Fraction(0)]*max(0,len(r)-len(b)+1)
for _ in range(20):
if len(r)<len(b):break
k=len(r)-len(b)
if k<0 or k>=len(q):return None
c=r[-1]/b[-1]
q[k]=q[k]+c
for j in range(len(b)):
if j+k>=len(r):return None
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 [[[v.numerator,v.denominator] for v in z] for z in (q,r)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [-1, 1]], [[[-2, 1], [-1, 1]], [[-3, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, -1], [-1, 2]], [[[-3, 4], [-1, 2]], [[-7, 4]]]), ([[-1, -1, -1], [0, -1]], [[[1, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [0, 1]], [[[-1, 1], [-1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [0, 2]], [[[-1, 2], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [1, -1]], [[[2, 1], [1, 1]], [[-3, 1]]])], [([[-1, -1, -1], [-1, 1]], [[[-2, 1], [-1, 1]], [[-3, 1]]]), ([[-1, -1, -1], [0, 2]], [[[-1, 2], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, 0], [0, 2]], [[[-1, 2]], [[-1, 1]]]), ([[-1, -1, 0], [1, -1]], [[[1, 1]], [[-2, 1]]]), ([[-1, -1, 0], [1, 1]], [[[-1, 1]], []]), ([[-1, -1, 0], [1, 2]], [[[-1, 2]], [[-1, 2]]])], [([[-1, -1, -1], [-1, 2]], [[[-3, 4], [-1, 2]], [[-7, 4]]]), ([[-1, -1, -1], [1, 2]], [[[-1, 4], [-1, 2]], [[-3, 4]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, 1], [2, 1]], [[[-3, 1], [1, 1]], [[5, 1]]]), ([[-1, -1, 1], [2, 2]], [[[-1, 1], [1, 2]], [[1, 1]]]), ([[-1, -1, 2], [-1, -1]], [[[3, 1], [-2, 1]], [[2, 1]]]), ([[-1, -1, 2], [-1, 1]], [[[1, 1], [2, 1]], []])], [([[-1, -1, -1], [0, -1]], [[[1, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [2, 2]], [[[0, 1], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, 0, -1], [0, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[-1, 0, -1], [0, 1]], [[[0, 1], [-1, 1]], [[-1, 1]]]), ([[-1, 0, -1], [0, 2]], [[[0, 1], [-1, 2]], [[-1, 1]]]), ([[-1, 0, -1], [1, -1]], [[[1, 1], [1, 1]], [[-2, 1]]])], [([[-1, -1, -1], [0, 1]], [[[-1, 1], [-1, 1]], [[-1, 1]]]), ([[-1, -1, 0], [0, 1]], [[[-1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, 0, 0], [1, 2]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, -1]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, 1]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, 2]], [[], [[-1, 1]]])]]
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], [1048575, 1]], [[-1, 1], [-1048576, 1], [-1048576, 1]]] | [[[0, 1], [1, 1]], [[-1, 1]]] | Failed |
| explicit oracle 1 | [[[0, 1], [-1048575, 1]], [[-1, 1], [1048574, 1], [-1048576, 1]]] | [[[-2, 1], [-1, 1]], [[-3, 1]]] | Failed |
| explicit oracle 2 | [[[0, 1], [2097150, 1]], [[1, 1], [2097152, 1], [3, 1], [4194304, 1]]] | [[[3, 2], [2, 1]], [[-1, 2]]] | Failed |
| explicit oracle 3 | [[[0, 1], [-1048575, 2]], [[-1, 1], [1048573, 2], [-1048576, 1]]] | [[[-3, 4], [-1, 2]], [[-7, 4]]] | Failed |
| explicit oracle 4 | [[[0, 1], [1048575, 1]], [[-1, 1], [-1, 1], [-1048576, 1]]] | [[[1, 1], [1, 1]], [[-1, 1]]] | Failed |
| explicit oracle 5 | [[[0, 1], [-1048575, 1]], [[-1, 1], [-1, 1], [-1048576, 1]]] | [[[-1, 1], [-1, 1]], [[-1, 1]]] | Failed |
| explicit oracle 6 | [[[0, 1], [-1048575, 2]], [[-1, 1], [-1, 1], [-1048576, 1]]] | [[[-1, 2], [-1, 2]], [[-1, 1]]] | Failed |
| explicit oracle 7 | [[[0, 1], [1048575, 1]], [[-1, 1], [1048574, 1], [-1048576, 1]]] | [[[2, 1], [1, 1]], [[-3, 1]]] | Failed |
SHA-256 / b66e22aefcf296c4964308264c667500de00c07d1f692efbd783a3dd84800501
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=list(map(Fraction,A));b=list(map(Fraction,B))
while r and r[-1]==0:r.pop()
q=[Fraction(0)]*max(0,len(r)-len(b)+1)
for _ in range(20):
if len(r)<len(b):break
k=len(r)-len(b)
if k<0 or k>=len(q):return None
c=r[-1]/b[-1]
q[k]=q[k]+c
for j in range(len(b)):
if j+k>=len(r):return None
r[j+k]=r[j+k]-b[j]
while r and r[-1]==0:r.pop()
while q and q[-1]==0:q.pop()
return [[[v.numerator,v.denominator] for v in z] for z in (q,r)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [-1, 1]], [[[-2, 1], [-1, 1]], [[-3, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, -1], [-1, 2]], [[[-3, 4], [-1, 2]], [[-7, 4]]]), ([[-1, -1, -1], [0, -1]], [[[1, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [0, 1]], [[[-1, 1], [-1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [0, 2]], [[[-1, 2], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [1, -1]], [[[2, 1], [1, 1]], [[-3, 1]]])], [([[-1, -1, -1], [-1, 1]], [[[-2, 1], [-1, 1]], [[-3, 1]]]), ([[-1, -1, -1], [0, 2]], [[[-1, 2], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, 0], [0, 2]], [[[-1, 2]], [[-1, 1]]]), ([[-1, -1, 0], [1, -1]], [[[1, 1]], [[-2, 1]]]), ([[-1, -1, 0], [1, 1]], [[[-1, 1]], []]), ([[-1, -1, 0], [1, 2]], [[[-1, 2]], [[-1, 2]]])], [([[-1, -1, -1], [-1, 2]], [[[-3, 4], [-1, 2]], [[-7, 4]]]), ([[-1, -1, -1], [1, 2]], [[[-1, 4], [-1, 2]], [[-3, 4]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, -1, 1], [2, 1]], [[[-3, 1], [1, 1]], [[5, 1]]]), ([[-1, -1, 1], [2, 2]], [[[-1, 1], [1, 2]], [[1, 1]]]), ([[-1, -1, 2], [-1, -1]], [[[3, 1], [-2, 1]], [[2, 1]]]), ([[-1, -1, 2], [-1, 1]], [[[1, 1], [2, 1]], []])], [([[-1, -1, -1], [0, -1]], [[[1, 1], [1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [2, 2]], [[[0, 1], [-1, 2]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, 0, -1], [0, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[-1, 0, -1], [0, 1]], [[[0, 1], [-1, 1]], [[-1, 1]]]), ([[-1, 0, -1], [0, 2]], [[[0, 1], [-1, 2]], [[-1, 1]]]), ([[-1, 0, -1], [1, -1]], [[[1, 1], [1, 1]], [[-2, 1]]])], [([[-1, -1, -1], [0, 1]], [[[-1, 1], [-1, 1]], [[-1, 1]]]), ([[-1, -1, 0], [0, 1]], [[[-1, 1]], [[-1, 1]]]), ([[-1, -1, -1], [-1, -1]], [[[0, 1], [1, 1]], [[-1, 1]]]), ([[1, 2, 3, 4], [1, 0, 2]], [[[3, 2], [2, 1]], [[-1, 2]]]), ([[-1, 0, 0], [1, 2]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, -1]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, 1]], [[], [[-1, 1]]]), ([[-1, 0, 0], [2, 2]], [[], [[-1, 1]]])]]
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, 1]], [[-1, 1]]] | [[[0, 1], [1, 1]], [[-1, 1]]] | Passed |
| explicit oracle 1 | [[[0, 1], [-210, 1]], [[-1, 1], [19, 1], [-21, 1]]] | [[[-2, 1], [-1, 1]], [[-3, 1]]] | Failed |
| explicit oracle 2 | [[[-126, 1], [3, 1]], [[-17, 1], [0, 1], [-33, 1]]] | [[[3, 2], [2, 1]], [[-1, 2]]] | Failed |
| explicit oracle 3 | [[[0, 1], [-200, 1]], [[-1, 1], [19, 1], [-41, 1]]] | [[[-3, 4], [-1, 2]], [[-7, 4]]] | Failed |
| explicit oracle 4 | [[[1, 1], [1, 1]], [[-1, 1]]] | [[[1, 1], [1, 1]], [[-1, 1]]] | Passed |
| explicit oracle 5 | [[[0, 1], [-210, 1]], [[-1, 1], [-1, 1], [-21, 1]]] | [[[-1, 1], [-1, 1]], [[-1, 1]]] | Failed |
| explicit oracle 6 | [[[0, 1], [-200, 1]], [[-1, 1], [-1, 1], [-41, 1]]] | [[[-1, 2], [-1, 2]], [[-1, 1]]] | Failed |
| explicit oracle 7 | [[[3, 1], [1, 1]], [[-3, 1]]] | [[[2, 1], [1, 1]], [[-3, 1]]] | Failed |
SHA-256 / e23f0b704914d4740f8a97f8c937583024d3fe8e4f1423a7304a4cb5a6813eee
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:18.501286+00:00.
Case digest / dfa28bc780908b62f557e01376e73a71b5866d34d8272cda18b426e15b738c5e