FAILURE MAP
← Case archive

FA-14451 / Numerics / Open access

Continued fraction convergents: numerator recurrence · case 01

The exact continued fraction convergents result violates the stated contract at numerator recurrence.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The numerator recurrence step uses c+p0 instead of c*p1+p0.

VERIFIED REPAIR

Use c*p1+p0 at the numerator recurrence step.

Unsuccessful approach: The partial repair c*p1-p0 still violates the numerator recurrence invariant.

Case contract

Input nonempty coefficients with positive terms after first; return every convergent as [numerator,positive denominator].

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=x
    p0,p1=0,1
    q0,q1=1,0
    out=[]
    for c in a:
     p=c+p0
     q=c*q1+q0
     out.append([p,q])
     p0,p1,q0,q1=p1,p,q1,q
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], [[2, 1], [3, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 2], [[1, 1], [3, 2]])], [([2, 2], [[2, 1], [5, 2]]), ([1, 4], [[1, 1], [5, 4]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 2], [[4, 1], [9, 2]]), ([4, 3], [[4, 1], [13, 3]]), ([4, 4], [[4, 1], [17, 4]]), ([1, 1, 1], [[1, 1], [2, 1], [3, 2]])], [([2, 3], [[2, 1], [7, 3]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([1, 4, 3], [[1, 1], [5, 4], [16, 13]]), ([1, 4, 4], [[1, 1], [5, 4], [21, 17]]), ([2, 1, 1], [[2, 1], [3, 1], [5, 2]]), ([2, 1, 2], [[2, 1], [3, 1], [8, 3]]), ([2, 1, 3], [[2, 1], [3, 1], [11, 4]])], [([2, 4], [[2, 1], [9, 4]]), ([3, 2], [[3, 1], [7, 2]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2, 4, 4], [[2, 1], [9, 4], [38, 17]]), ([3, 1, 1], [[3, 1], [4, 1], [7, 2]]), ([3, 1, 2], [[3, 1], [4, 1], [11, 3]]), ([3, 1, 3], [[3, 1], [4, 1], [15, 4]])], [([3, 1], [[3, 1], [4, 1]]), ([4, 1], [[4, 1], [5, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 1, 1], [[4, 1], [5, 1], [9, 2]]), ([4, 1, 2], [[4, 1], [5, 1], [14, 3]]), ([4, 1, 3], [[4, 1], [5, 1], [19, 4]]), ([4, 1, 4], [[4, 1], [5, 1], [24, 5]])]]
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 fixtureActualExpectedOutcome
explicit oracle 0[[2, 1], [2, 1]][[2, 1], [3, 1]]Failed
explicit oracle 1[[1, 1], [2, 1]][[1, 1], [2, 1]]Passed
explicit oracle 2[[1, 1]][[1, 1]]Passed
explicit oracle 3[[-2, 1], [4, 3], [2, 13]][[-2, 1], [-5, 3], [-22, 13]]Failed
explicit oracle 4[[2, 1]][[2, 1]]Passed
explicit oracle 5[[3, 1]][[3, 1]]Passed
explicit oracle 6[[4, 1]][[4, 1]]Passed
explicit oracle 7[[1, 1], [3, 2]][[1, 1], [3, 2]]Passed

SHA-256 / bf520b58b3dafae09194e07e7c333fd85d6cd9a8ebc192eaaf20063f1f484322

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=x
    p0,p1=0,1
    q0,q1=1,0
    out=[]
    for c in a:
     p=c*p1-p0
     q=c*q1+q0
     out.append([p,q])
     p0,p1,q0,q1=p1,p,q1,q
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], [[2, 1], [3, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 2], [[1, 1], [3, 2]])], [([2, 2], [[2, 1], [5, 2]]), ([1, 4], [[1, 1], [5, 4]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 2], [[4, 1], [9, 2]]), ([4, 3], [[4, 1], [13, 3]]), ([4, 4], [[4, 1], [17, 4]]), ([1, 1, 1], [[1, 1], [2, 1], [3, 2]])], [([2, 3], [[2, 1], [7, 3]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([1, 4, 3], [[1, 1], [5, 4], [16, 13]]), ([1, 4, 4], [[1, 1], [5, 4], [21, 17]]), ([2, 1, 1], [[2, 1], [3, 1], [5, 2]]), ([2, 1, 2], [[2, 1], [3, 1], [8, 3]]), ([2, 1, 3], [[2, 1], [3, 1], [11, 4]])], [([2, 4], [[2, 1], [9, 4]]), ([3, 2], [[3, 1], [7, 2]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2, 4, 4], [[2, 1], [9, 4], [38, 17]]), ([3, 1, 1], [[3, 1], [4, 1], [7, 2]]), ([3, 1, 2], [[3, 1], [4, 1], [11, 3]]), ([3, 1, 3], [[3, 1], [4, 1], [15, 4]])], [([3, 1], [[3, 1], [4, 1]]), ([4, 1], [[4, 1], [5, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 1, 1], [[4, 1], [5, 1], [9, 2]]), ([4, 1, 2], [[4, 1], [5, 1], [14, 3]]), ([4, 1, 3], [[4, 1], [5, 1], [19, 4]]), ([4, 1, 4], [[4, 1], [5, 1], [24, 5]])]]
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 fixtureActualExpectedOutcome
explicit oracle 0[[2, 1], [1, 1]][[2, 1], [3, 1]]Failed
explicit oracle 1[[1, 1], [0, 1]][[1, 1], [2, 1]]Failed
explicit oracle 2[[1, 1]][[1, 1]]Passed
explicit oracle 3[[-2, 1], [-7, 3], [-26, 13]][[-2, 1], [-5, 3], [-22, 13]]Failed
explicit oracle 4[[2, 1]][[2, 1]]Passed
explicit oracle 5[[3, 1]][[3, 1]]Passed
explicit oracle 6[[4, 1]][[4, 1]]Passed
explicit oracle 7[[1, 1], [1, 2]][[1, 1], [3, 2]]Failed

SHA-256 / 19e7aef2374f35d6f2d64ca59a19138572136a11d7066e74539c585ac9f67897

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):
    a=x
    p0,p1=0,1
    q0,q1=1,0
    out=[]
    for c in a:
     p=c*p1+p0
     q=c*q1+q0
     out.append([p,q])
     p0,p1,q0,q1=p1,p,q1,q
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], [[2, 1], [3, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 2], [[1, 1], [3, 2]])], [([2, 2], [[2, 1], [5, 2]]), ([1, 4], [[1, 1], [5, 4]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 2], [[4, 1], [9, 2]]), ([4, 3], [[4, 1], [13, 3]]), ([4, 4], [[4, 1], [17, 4]]), ([1, 1, 1], [[1, 1], [2, 1], [3, 2]])], [([2, 3], [[2, 1], [7, 3]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([1, 4, 3], [[1, 1], [5, 4], [16, 13]]), ([1, 4, 4], [[1, 1], [5, 4], [21, 17]]), ([2, 1, 1], [[2, 1], [3, 1], [5, 2]]), ([2, 1, 2], [[2, 1], [3, 1], [8, 3]]), ([2, 1, 3], [[2, 1], [3, 1], [11, 4]])], [([2, 4], [[2, 1], [9, 4]]), ([3, 2], [[3, 1], [7, 2]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2, 4, 4], [[2, 1], [9, 4], [38, 17]]), ([3, 1, 1], [[3, 1], [4, 1], [7, 2]]), ([3, 1, 2], [[3, 1], [4, 1], [11, 3]]), ([3, 1, 3], [[3, 1], [4, 1], [15, 4]])], [([3, 1], [[3, 1], [4, 1]]), ([4, 1], [[4, 1], [5, 1]]), ([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([4, 1, 1], [[4, 1], [5, 1], [9, 2]]), ([4, 1, 2], [[4, 1], [5, 1], [14, 3]]), ([4, 1, 3], [[4, 1], [5, 1], [19, 4]]), ([4, 1, 4], [[4, 1], [5, 1], [24, 5]])]]
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 fixtureActualExpectedOutcome
explicit oracle 0[[2, 1], [3, 1]][[2, 1], [3, 1]]Passed
explicit oracle 1[[1, 1], [2, 1]][[1, 1], [2, 1]]Passed
explicit oracle 2[[1, 1]][[1, 1]]Passed
explicit oracle 3[[-2, 1], [-5, 3], [-22, 13]][[-2, 1], [-5, 3], [-22, 13]]Passed
explicit oracle 4[[2, 1]][[2, 1]]Passed
explicit oracle 5[[3, 1]][[3, 1]]Passed
explicit oracle 6[[4, 1]][[4, 1]]Passed
explicit oracle 7[[1, 1], [3, 2]][[1, 1], [3, 2]]Passed

SHA-256 / 9561e7435c078aaa411cf4bab318b08426a7a6887b975223e5693aac39aeb9ba

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:17.087207+00:00.

Case digest / e638cda14948563e908545f0824e4fd168eb2eed15a47c16e8633062ab101bcf