FA-14421 / Numerics / Open access
Rational continued fraction: euclidean remainder · case 01
The exact rational continued fraction result violates the stated contract at euclidean remainder.
ROOT CAUSE
The euclidean remainder step uses p%q if p>=0 else -(abs(p)%q) instead of p-a*q.
THE FAILURE
The euclidean remainder step uses p%q if p>=0 else -(abs(p)%q) instead of p-a*q.
Unsuccessful approach: The partial repair p-a still violates the euclidean remainder invariant.
Case contract
Input [p,q], q>0; canonical simple continued fraction of p/q with last term>1 unless singleton. Bounds: -25<=p<=25 and 1<=q<=17.
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):
p,q=x
out=[]
for _ in range(30):
if q==0: break
a=p//q
out.append(a)
r=p%q if p>=0 else -(abs(p)%q)
p,q=q,r
if len(out)>1 and out[-1]==1:
out[-2]+=1
out.pop()
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([-25, 2], [-13, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-25, 3], [-9, 1, 2]), ([-25, 4], [-7, 1, 3]), ([-25, 5], [-5]), ([-25, 6], [-5, 1, 5]), ([-25, 7], [-4, 2, 3])], [([-25, 3], [-9, 1, 2]), ([-25, 5], [-5]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-24, 1], [-24]), ([-24, 2], [-12]), ([-24, 3], [-8]), ([-24, 4], [-6])], [([-25, 4], [-7, 1, 3]), ([-25, 8], [-4, 1, 7]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-23, 1], [-23]), ([-23, 2], [-12, 2]), ([-23, 3], [-8, 3]), ([-23, 4], [-6, 4])], [([-25, 6], [-5, 1, 5]), ([-25, 11], [-3, 1, 2, 1, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-22, 1], [-22]), ([-22, 2], [-11]), ([-22, 3], [-8, 1, 2]), ([-22, 4], [-6, 2])], [([-25, 7], [-4, 2, 3]), ([-25, 14], [-2, 4, 1, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-21, 1], [-21]), ([-21, 2], [-11, 2]), ([-21, 3], [-7]), ([-21, 4], [-6, 1, 3])]]
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 | [-13, -2] | [-13, 2] | Failed |
| explicit oracle 1 | [-25] | [-25] | Passed |
| explicit oracle 2 | [1, 2, 8] | [1, 2, 8] | Passed |
| explicit oracle 3 | [-9, -3] | [-9, 1, 2] | Failed |
| explicit oracle 4 | [-7, -4] | [-7, 1, 3] | Failed |
| explicit oracle 5 | [-5] | [-5] | Passed |
| explicit oracle 6 | [-5, -6] | [-5, 1, 5] | Failed |
| explicit oracle 7 | [-4, -2, 4] | [-4, 2, 3] | Failed |
SHA-256 / c0282839dddb11bc014ff70bd2d40f8658aace2c17f1347785eed5e112fe0c15
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):
p,q=x
out=[]
for _ in range(30):
if q==0: break
a=p//q
out.append(a)
r=p-a
p,q=q,r
if len(out)>1 and out[-1]==1:
out[-2]+=1
out.pop()
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([-25, 2], [-13, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-25, 3], [-9, 1, 2]), ([-25, 4], [-7, 1, 3]), ([-25, 5], [-5]), ([-25, 6], [-5, 1, 5]), ([-25, 7], [-4, 2, 3])], [([-25, 3], [-9, 1, 2]), ([-25, 5], [-5]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-24, 1], [-24]), ([-24, 2], [-12]), ([-24, 3], [-8]), ([-24, 4], [-6])], [([-25, 4], [-7, 1, 3]), ([-25, 8], [-4, 1, 7]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-23, 1], [-23]), ([-23, 2], [-12, 2]), ([-23, 3], [-8, 3]), ([-23, 4], [-6, 4])], [([-25, 6], [-5, 1, 5]), ([-25, 11], [-3, 1, 2, 1, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-22, 1], [-22]), ([-22, 2], [-11]), ([-22, 3], [-8, 1, 2]), ([-22, 4], [-6, 2])], [([-25, 7], [-4, 2, 3]), ([-25, 14], [-2, 4, 1, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-21, 1], [-21]), ([-21, 2], [-11, 2]), ([-21, 3], [-7]), ([-21, 4], [-6, 1, 3])]]
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 | [-13, -1, -4, -1, -2, -1, -2, -2, -1, -3, -1, -5, -1, -15, -1] | [-13, 2] | Failed |
| explicit oracle 1 | [-25] | [-25] | Passed |
| explicit oracle 2 | [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2] | [1, 2, 8] | Failed |
| explicit oracle 3 | [-9, -1, -4, -1, -3, -1, -2, -1, -1, -2, -1, -2, -1, -3, -1, -5, -1, -10, -1, -29, -1] | [-9, 1, 2] | Failed |
| explicit oracle 4 | [-7, -1, -4, -1, -3, -1, -2, -1, -2, -2, -1, -2, -1, -3, -1, -4, -1, -7, -1, -13, -1, -39, -1] | [-7, 1, 3] | Failed |
| explicit oracle 5 | [-5, -1, -4, -1, -3, -1, -2, -1, -2, -1, -1, -2, -1, -2, -1, -3, -1, -4, -1, -6, -1, -9, -1, -18, -1, -54, -1] | [-5] | Failed |
| explicit oracle 6 | [-5, -1, -3, -1, -3, -1, -2, -1, -2, -1, -1, -2, -1, -2, -1, -3, -1, -3, -1, -5, -1, -7, -1, -11, -1, -22, -1, -66, -1] | [-5, 1, 5] | Failed |
| explicit oracle 7 | [-4, -1, -3, -1, -2, -1, -2, -1, -2, -1, -1, -2, -1, -2, -1, -2, -1, -3, -1, -3, -1, -4, -1, -6, -1, -9, -1, -15, -1, -29] | [-4, 2, 3] | Failed |
SHA-256 / 7bdbb2153a1aa0ab095024a113bcb1e4a33c43078b6a5826169ead21921dbf5d
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:16.674770+00:00.
Case digest / d32bab21817f67e662dfa515540e1a04647c2254938cc283250e5cabcf2fc5ed