FA-15061 / Numerics / Open access
Negative radix encoding: nonzero digit preservation · case 01
The exact negative radix encoding result violates the stated contract at nonzero digit preservation.
ROOT CAUSE
The nonzero digit preservation step uses len(out)>1 instead of bool(out).
VERIFIED REPAIR
Use bool(out) at the nonzero digit preservation step.
Unsuccessful approach: The partial repair len(out)%2==0 still violates the nonzero digit preservation invariant.
Case contract
Input [integer, magnitude base>=2]; return most-significant-first digits 0..base-1 representing integer in radix -base. Bounds: |integer|<=100 and base<=8.
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):
n,b=x
if n==0:return [0]
out=[]
for _ in range(60):
if n==0:break
r=n%b
out.append(r)
n=(n-r)//(-b)
return out[::-1] if len(out)>1 else []
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 2], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-100, 3], [1, 2, 1, 1, 1, 2]), ([-100, 4], [2, 2, 1, 0]), ([-100, 5], [1, 1, 0, 0]), ([-100, 6], [1, 4, 5, 2]), ([-100, 7], [1, 5, 1, 5])], [([1, 3], [1]), ([1, 5], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-98, 5], [1, 1, 0, 2]), ([-98, 6], [1, 4, 5, 4]), ([-98, 7], [1, 5, 0, 0]), ([-98, 8], [1, 7, 5, 6])], [([1, 4], [1]), ([1, 8], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-96, 8], [1, 7, 4, 0]), ([-95, 2], [1, 1, 1, 0, 0, 0, 0, 1]), ([-95, 3], [1, 2, 1, 2, 2, 1]), ([-95, 4], [2, 2, 0, 1])], [([1, 5], [1]), ([2, 4], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-93, 4], [2, 2, 0, 3]), ([-93, 5], [1, 2, 4, 2]), ([-93, 6], [1, 4, 4, 3]), ([-93, 7], [1, 5, 0, 5])], [([1, 6], [1]), ([2, 7], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-91, 7], [1, 6, 6, 0]), ([-91, 8], [1, 7, 4, 5]), ([-90, 2], [1, 1, 1, 1, 1, 0, 1, 0]), ([-90, 3], [1, 2, 1, 2, 0, 0])]]
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] | Failed |
| explicit oracle 1 | [1, 1, 1, 0, 1, 1, 0, 0] | [1, 1, 1, 0, 1, 1, 0, 0] | Passed |
| explicit oracle 2 | [2, 4, 4] | [2, 4, 4] | Passed |
| explicit oracle 3 | [1, 2, 1, 1, 1, 2] | [1, 2, 1, 1, 1, 2] | Passed |
| explicit oracle 4 | [2, 2, 1, 0] | [2, 2, 1, 0] | Passed |
| explicit oracle 5 | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| explicit oracle 6 | [1, 4, 5, 2] | [1, 4, 5, 2] | Passed |
| explicit oracle 7 | [1, 5, 1, 5] | [1, 5, 1, 5] | Passed |
SHA-256 / 5beac0662a85b3978c3253e5d50087192666c18f4468172a011fcf40a18ff1e2
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):
n,b=x
if n==0:return [0]
out=[]
for _ in range(60):
if n==0:break
r=n%b
out.append(r)
n=(n-r)//(-b)
return out[::-1] if len(out)%2==0 else []
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 2], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-100, 3], [1, 2, 1, 1, 1, 2]), ([-100, 4], [2, 2, 1, 0]), ([-100, 5], [1, 1, 0, 0]), ([-100, 6], [1, 4, 5, 2]), ([-100, 7], [1, 5, 1, 5])], [([1, 3], [1]), ([1, 5], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-98, 5], [1, 1, 0, 2]), ([-98, 6], [1, 4, 5, 4]), ([-98, 7], [1, 5, 0, 0]), ([-98, 8], [1, 7, 5, 6])], [([1, 4], [1]), ([1, 8], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-96, 8], [1, 7, 4, 0]), ([-95, 2], [1, 1, 1, 0, 0, 0, 0, 1]), ([-95, 3], [1, 2, 1, 2, 2, 1]), ([-95, 4], [2, 2, 0, 1])], [([1, 5], [1]), ([2, 4], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-93, 4], [2, 2, 0, 3]), ([-93, 5], [1, 2, 4, 2]), ([-93, 6], [1, 4, 4, 3]), ([-93, 7], [1, 5, 0, 5])], [([1, 6], [1]), ([2, 7], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-91, 7], [1, 6, 6, 0]), ([-91, 8], [1, 7, 4, 5]), ([-90, 2], [1, 1, 1, 1, 1, 0, 1, 0]), ([-90, 3], [1, 2, 1, 2, 0, 0])]]
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] | Failed |
| explicit oracle 1 | [1, 1, 1, 0, 1, 1, 0, 0] | [1, 1, 1, 0, 1, 1, 0, 0] | Passed |
| explicit oracle 2 | [] | [2, 4, 4] | Failed |
| explicit oracle 3 | [1, 2, 1, 1, 1, 2] | [1, 2, 1, 1, 1, 2] | Passed |
| explicit oracle 4 | [2, 2, 1, 0] | [2, 2, 1, 0] | Passed |
| explicit oracle 5 | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| explicit oracle 6 | [1, 4, 5, 2] | [1, 4, 5, 2] | Passed |
| explicit oracle 7 | [1, 5, 1, 5] | [1, 5, 1, 5] | Passed |
SHA-256 / 253cd6aac8cd6b29eea2dccb254612bc5f9158bba04a2f8ace83bcc1d03db688
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):
n,b=x
if n==0:return [0]
out=[]
for _ in range(60):
if n==0:break
r=n%b
out.append(r)
n=(n-r)//(-b)
return out[::-1] if bool(out) else []
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, 2], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-100, 3], [1, 2, 1, 1, 1, 2]), ([-100, 4], [2, 2, 1, 0]), ([-100, 5], [1, 1, 0, 0]), ([-100, 6], [1, 4, 5, 2]), ([-100, 7], [1, 5, 1, 5])], [([1, 3], [1]), ([1, 5], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-98, 5], [1, 1, 0, 2]), ([-98, 6], [1, 4, 5, 4]), ([-98, 7], [1, 5, 0, 0]), ([-98, 8], [1, 7, 5, 6])], [([1, 4], [1]), ([1, 8], [1]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-96, 8], [1, 7, 4, 0]), ([-95, 2], [1, 1, 1, 0, 0, 0, 0, 1]), ([-95, 3], [1, 2, 1, 2, 2, 1]), ([-95, 4], [2, 2, 0, 1])], [([1, 5], [1]), ([2, 4], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-93, 4], [2, 2, 0, 3]), ([-93, 5], [1, 2, 4, 2]), ([-93, 6], [1, 4, 4, 3]), ([-93, 7], [1, 5, 0, 5])], [([1, 6], [1]), ([2, 7], [2]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-91, 7], [1, 6, 6, 0]), ([-91, 8], [1, 7, 4, 5]), ([-90, 2], [1, 1, 1, 1, 1, 0, 1, 0]), ([-90, 3], [1, 2, 1, 2, 0, 0])]]
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] | [1] | Passed |
| explicit oracle 1 | [1, 1, 1, 0, 1, 1, 0, 0] | [1, 1, 1, 0, 1, 1, 0, 0] | Passed |
| explicit oracle 2 | [2, 4, 4] | [2, 4, 4] | Passed |
| explicit oracle 3 | [1, 2, 1, 1, 1, 2] | [1, 2, 1, 1, 1, 2] | Passed |
| explicit oracle 4 | [2, 2, 1, 0] | [2, 2, 1, 0] | Passed |
| explicit oracle 5 | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| explicit oracle 6 | [1, 4, 5, 2] | [1, 4, 5, 2] | Passed |
| explicit oracle 7 | [1, 5, 1, 5] | [1, 5, 1, 5] | Passed |
SHA-256 / e80f93104f2b41ded9d69c57eb95cb1c110f79354f54f5bfc2c338e812a6aeb8
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:23.142246+00:00.
Case digest / e0b7b52109fc469bf95ade7002a7e08b3921796a9ac062ec8274af99d977569e