FA-14751 / Numerics / Open access
Bernstein to power basis: result degree mapping · case 01
The exact bernstein to power basis result violates the stated contract at result degree mapping.
ROOT CAUSE
The result degree mapping step uses j instead of i+j.
VERIFIED REPAIR
Use i+j at the result degree mapping step.
Unsuccessful approach: The partial repair i still violates the result degree mapping invariant.
Case contract
Input Bernstein coefficients b0..bn as integers; return exact ascending power coefficients of sum bi*choose(n,i)*t^i*(1-t)^(n-i).
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):
b=x;n=len(b)-1;r=[0]*(n+1)
for i in range(n+1):
for j in range(n-i+1):
k=j
if k<0 or k>n:return None
r[k]+=b[i]*(math.comb(n,i)) * (math.comb(n-i,j)*(-1)**j if j<=n-i else 0)
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([-1, -1], [-1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0], [0]), ([1], [1]), ([2], [2]), ([-1, 0], [-1, 1]), ([-1, 1], [-1, 2])], [([-1, 1], [-1, 2]), ([-1, 2], [-1, 3]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, 0], [2, -2]), ([2, 1], [2, -1]), ([2, 2], [2, 0]), ([-1, -1, -1], [-1, 0, 0])], [([-1, 2], [-1, 3]), ([1, 1], [1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([-1, 2, 1], [-1, 6, -4]), ([-1, 2, 2], [-1, 6, -3]), ([0, -1, -1], [0, -2, 1]), ([0, -1, 0], [0, -2, 2])], [([0, -1], [0, -1]), ([2, 0], [2, -2]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0, 2, 2], [0, 4, -2]), ([1, -1, -1], [1, -4, 2]), ([1, -1, 0], [1, -4, 3]), ([1, -1, 1], [1, -4, 4])], [([0, 1], [0, 1]), ([-1, -1, -1], [-1, 0, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, -1, -1], [2, -6, 3]), ([2, -1, 0], [2, -6, 4]), ([2, -1, 1], [2, -6, 5]), ([2, -1, 2], [2, -6, 6])]]
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 | [-2, 1] | [-1, 0] | Failed |
| explicit oracle 1 | [-1] | [-1] | Passed |
| explicit oracle 2 | [32, -64, 48, -16, 2] | [2, 0, 0, 0, 0] | Failed |
| explicit oracle 3 | [0] | [0] | Passed |
| explicit oracle 4 | [1] | [1] | Passed |
| explicit oracle 5 | [2] | [2] | Passed |
| explicit oracle 6 | [-1, 1] | [-1, 1] | Passed |
| explicit oracle 7 | [0, 1] | [-1, 2] | Failed |
SHA-256 / 5c22de8fb24a6966a80f8aaf2fe30c51b34ac3b1e8c60e5750412221584794d5
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):
b=x;n=len(b)-1;r=[0]*(n+1)
for i in range(n+1):
for j in range(n-i+1):
k=i
if k<0 or k>n:return None
r[k]+=b[i]*(math.comb(n,i)) * (math.comb(n-i,j)*(-1)**j if j<=n-i else 0)
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([-1, -1], [-1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0], [0]), ([1], [1]), ([2], [2]), ([-1, 0], [-1, 1]), ([-1, 1], [-1, 2])], [([-1, 1], [-1, 2]), ([-1, 2], [-1, 3]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, 0], [2, -2]), ([2, 1], [2, -1]), ([2, 2], [2, 0]), ([-1, -1, -1], [-1, 0, 0])], [([-1, 2], [-1, 3]), ([1, 1], [1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([-1, 2, 1], [-1, 6, -4]), ([-1, 2, 2], [-1, 6, -3]), ([0, -1, -1], [0, -2, 1]), ([0, -1, 0], [0, -2, 2])], [([0, -1], [0, -1]), ([2, 0], [2, -2]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0, 2, 2], [0, 4, -2]), ([1, -1, -1], [1, -4, 2]), ([1, -1, 0], [1, -4, 3]), ([1, -1, 1], [1, -4, 4])], [([0, 1], [0, 1]), ([-1, -1, -1], [-1, 0, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, -1, -1], [2, -6, 3]), ([2, -1, 0], [2, -6, 4]), ([2, -1, 1], [2, -6, 5]), ([2, -1, 2], [2, -6, 6])]]
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 | [-1] | [-1] | Passed |
| explicit oracle 2 | [0, 0, 0, 0, 2] | [2, 0, 0, 0, 0] | Failed |
| explicit oracle 3 | [0] | [0] | Passed |
| explicit oracle 4 | [1] | [1] | Passed |
| explicit oracle 5 | [2] | [2] | Passed |
| explicit oracle 6 | [0, 0] | [-1, 1] | Failed |
| explicit oracle 7 | [0, 1] | [-1, 2] | Failed |
SHA-256 / 289256a5e78d3e4e943c0800747323488a29f2ad6dec172687a4dcc7e00f90b0
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):
b=x;n=len(b)-1;r=[0]*(n+1)
for i in range(n+1):
for j in range(n-i+1):
k=i+j
if k<0 or k>n:return None
r[k]+=b[i]*(math.comb(n,i)) * (math.comb(n-i,j)*(-1)**j if j<=n-i else 0)
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([-1, -1], [-1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0], [0]), ([1], [1]), ([2], [2]), ([-1, 0], [-1, 1]), ([-1, 1], [-1, 2])], [([-1, 1], [-1, 2]), ([-1, 2], [-1, 3]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, 0], [2, -2]), ([2, 1], [2, -1]), ([2, 2], [2, 0]), ([-1, -1, -1], [-1, 0, 0])], [([-1, 2], [-1, 3]), ([1, 1], [1, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([-1, 2, 1], [-1, 6, -4]), ([-1, 2, 2], [-1, 6, -3]), ([0, -1, -1], [0, -2, 1]), ([0, -1, 0], [0, -2, 2])], [([0, -1], [0, -1]), ([2, 0], [2, -2]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([0, 2, 2], [0, 4, -2]), ([1, -1, -1], [1, -4, 2]), ([1, -1, 0], [1, -4, 3]), ([1, -1, 1], [1, -4, 4])], [([0, 1], [0, 1]), ([-1, -1, -1], [-1, 0, 0]), ([-1], [-1]), ([2, 2, 2, 2, 2], [2, 0, 0, 0, 0]), ([2, -1, -1], [2, -6, 3]), ([2, -1, 0], [2, -6, 4]), ([2, -1, 1], [2, -6, 5]), ([2, -1, 2], [2, -6, 6])]]
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] | Passed |
| explicit oracle 2 | [2, 0, 0, 0, 0] | [2, 0, 0, 0, 0] | Passed |
| explicit oracle 3 | [0] | [0] | Passed |
| explicit oracle 4 | [1] | [1] | Passed |
| explicit oracle 5 | [2] | [2] | Passed |
| explicit oracle 6 | [-1, 1] | [-1, 1] | Passed |
| explicit oracle 7 | [-1, 2] | [-1, 2] | Passed |
SHA-256 / e74d262c94d1b8b3c9be5baab7db438b7da1e1c4f0a5bfe225d516be9c2c3287
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:19.966129+00:00.
Case digest / b8e9cba55986adbf91c3e3e7e8288be82466ad6471ca02b19119cde85f0d6563