FA-14426 / Numerics / Open access
Rational continued fraction: reciprocal state · case 01
The exact rational continued fraction result violates the stated contract at reciprocal state.
ROOT CAUSE
The reciprocal state step uses r,q instead of q,r.
THE FAILURE
The reciprocal state step uses r,q instead of q,r.
Unsuccessful approach: The partial repair abs(q-p),r still violates the reciprocal state 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-a*q
p,q=r,q
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, 1], [-25]), ([-25, 2], [-13, 2]), ([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, 2], [-13, 2]), ([-25, 6], [-5, 1, 5]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-24, 1], [-24]), ([-24, 2], [-12]), ([-24, 3], [-8]), ([-24, 4], [-6])], [([-25, 3], [-9, 1, 2]), ([-25, 9], [-3, 4, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-23, 1], [-23]), ([-23, 2], [-12, 2]), ([-23, 3], [-8, 3]), ([-23, 4], [-6, 4])], [([-25, 4], [-7, 1, 3]), ([-25, 12], [-3, 1, 11]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-22, 1], [-22]), ([-22, 2], [-11]), ([-22, 3], [-8, 1, 2]), ([-22, 4], [-6, 2])], [([-25, 5], [-5]), ([-25, 15], [-2, 3]), ([-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 | [-25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-25] | Failed |
| explicit oracle 1 | [-13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-13, 2] | Failed |
| explicit oracle 2 | [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [1, 2, 8] | Failed |
| explicit oracle 3 | [-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-9, 1, 2] | Failed |
| explicit oracle 4 | [-7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-7, 1, 3] | Failed |
| explicit oracle 5 | [-5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-5] | Failed |
| explicit oracle 6 | [-5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-5, 1, 5] | Failed |
| explicit oracle 7 | [-4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | [-4, 2, 3] | Failed |
SHA-256 / 5e96c553ed36eace84a471ae4e5064f0446bfeb107d3264cb2fefa6f101ae95c
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*q
p,q=abs(q-p),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, 1], [-25]), ([-25, 2], [-13, 2]), ([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, 2], [-13, 2]), ([-25, 6], [-5, 1, 5]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-24, 1], [-24]), ([-24, 2], [-12]), ([-24, 3], [-8]), ([-24, 4], [-6])], [([-25, 3], [-9, 1, 2]), ([-25, 9], [-3, 4, 2]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-23, 1], [-23]), ([-23, 2], [-12, 2]), ([-23, 3], [-8, 3]), ([-23, 4], [-6, 4])], [([-25, 4], [-7, 1, 3]), ([-25, 12], [-3, 1, 11]), ([-25, 1], [-25]), ([25, 17], [1, 2, 8]), ([-22, 1], [-22]), ([-22, 2], [-11]), ([-22, 3], [-8, 1, 2]), ([-22, 4], [-6, 2])], [([-25, 5], [-5]), ([-25, 15], [-2, 3]), ([-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 | [-25] | [-25] | Passed |
| explicit oracle 1 | [-13, 27] | [-13, 2] | Failed |
| explicit oracle 2 | [2] | [1, 2, 8] | Failed |
| explicit oracle 3 | [-9, 14] | [-9, 1, 2] | Failed |
| explicit oracle 4 | [-7, 9, 13] | [-7, 1, 3] | Failed |
| explicit oracle 5 | [-5] | [-5] | Passed |
| explicit oracle 6 | [-5, 6, 26] | [-5, 1, 5] | Failed |
| explicit oracle 7 | [-4, 10, 14, 27] | [-4, 2, 3] | Failed |
SHA-256 / f3640ae158c0afa882689fce9938cee7affe02e842fe027b8ee003d1a1949970
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.719717+00:00.
Case digest / 60f3f37aa1504e3b6edfa5379e726aad4dceb49c8957225556a83684d391f05b