FAILURE MAP
← Case archive

FA-14456 / Numerics / Open access

Continued fraction convergents: denominator recurrence · case 01

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

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

ROOT CAUSE

The denominator recurrence step uses c+q0 instead of c*q1+q0.

VERIFIED REPAIR

Use c*q1+q0 at the denominator recurrence step.

Unsuccessful approach: The partial repair c*q1-q0 still violates the denominator 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*p1+p0
     q=c+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 = [[([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1, 2], [[1, 1], [3, 2]]), ([1, 3], [[1, 1], [4, 3]])], [([2], [[2, 1]]), ([4], [[4, 1]]), ([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]])], [([3], [[3, 1]]), ([1, 3], [[1, 1], [4, 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]])], [([4], [[4, 1]]), ([2, 2], [[2, 1], [5, 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]])], [([1, 1], [[1, 1], [2, 1]]), ([3, 1], [[3, 1], [4, 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[[1, 2]][[1, 1]]Failed
explicit oracle 1[[-2, -1], [-5, 3], [-22, 3]][[-2, 1], [-5, 3], [-22, 13]]Failed
explicit oracle 2[[2, 3]][[2, 1]]Failed
explicit oracle 3[[3, 4]][[3, 1]]Failed
explicit oracle 4[[4, 5]][[4, 1]]Failed
explicit oracle 5[[1, 2], [2, 1]][[1, 1], [2, 1]]Failed
explicit oracle 6[[1, 2], [3, 2]][[1, 1], [3, 2]]Failed
explicit oracle 7[[1, 2], [4, 3]][[1, 1], [4, 3]]Failed

SHA-256 / 5dabe85bc587badf57caf3bb3446d80f632b43d33400b12a26258dbd272dfe77

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 = [[([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1, 2], [[1, 1], [3, 2]]), ([1, 3], [[1, 1], [4, 3]])], [([2], [[2, 1]]), ([4], [[4, 1]]), ([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]])], [([3], [[3, 1]]), ([1, 3], [[1, 1], [4, 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]])], [([4], [[4, 1]]), ([2, 2], [[2, 1], [5, 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]])], [([1, 1], [[1, 1], [2, 1]]), ([3, 1], [[3, 1], [4, 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[[1, -1]][[1, 1]]Failed
explicit oracle 1[[-2, -1], [-5, -3], [-22, -11]][[-2, 1], [-5, 3], [-22, 13]]Failed
explicit oracle 2[[2, -1]][[2, 1]]Failed
explicit oracle 3[[3, -1]][[3, 1]]Failed
explicit oracle 4[[4, -1]][[4, 1]]Failed
explicit oracle 5[[1, -1], [2, -1]][[1, 1], [2, 1]]Failed
explicit oracle 6[[1, -1], [3, -2]][[1, 1], [3, 2]]Failed
explicit oracle 7[[1, -1], [4, -3]][[1, 1], [4, 3]]Failed

SHA-256 / 2e4b203e9ffe1e73dd9c8d0a9c7a9869d0592253d43ebe414fbcc1ddad31ac9d

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 = [[([1], [[1, 1]]), ([-2, 3, 4], [[-2, 1], [-5, 3], [-22, 13]]), ([2], [[2, 1]]), ([3], [[3, 1]]), ([4], [[4, 1]]), ([1, 1], [[1, 1], [2, 1]]), ([1, 2], [[1, 1], [3, 2]]), ([1, 3], [[1, 1], [4, 3]])], [([2], [[2, 1]]), ([4], [[4, 1]]), ([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]])], [([3], [[3, 1]]), ([1, 3], [[1, 1], [4, 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]])], [([4], [[4, 1]]), ([2, 2], [[2, 1], [5, 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]])], [([1, 1], [[1, 1], [2, 1]]), ([3, 1], [[3, 1], [4, 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[[1, 1]][[1, 1]]Passed
explicit oracle 1[[-2, 1], [-5, 3], [-22, 13]][[-2, 1], [-5, 3], [-22, 13]]Passed
explicit oracle 2[[2, 1]][[2, 1]]Passed
explicit oracle 3[[3, 1]][[3, 1]]Passed
explicit oracle 4[[4, 1]][[4, 1]]Passed
explicit oracle 5[[1, 1], [2, 1]][[1, 1], [2, 1]]Passed
explicit oracle 6[[1, 1], [3, 2]][[1, 1], [3, 2]]Passed
explicit oracle 7[[1, 1], [4, 3]][[1, 1], [4, 3]]Passed

SHA-256 / 35601ec2051f7eabda85e599e5fbaac24205a11079292e343163e70da9ebfc4b

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

Case digest / 0951adffecab0fb86aca53679d8bb1190c1c90cb4ca4cfa9679ff06c233d1b44