FA-14531 / Numerics / Open access
Stern brocot path: right edge label · case 01
The exact stern brocot path result violates the stated contract at right edge label.
ROOT CAUSE
The right edge label step uses 'L' instead of 'R'.
VERIFIED REPAIR
Use 'R' at the right edge label step.
Unsuccessful approach: The partial repair '' still violates the right edge label invariant.
Case contract
Input reduced positive [p,q]; return run-expanded L/R path from 1/1. Bounds: 1<=p,q<=24.
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(100):
if p==q: break
if p<q:
out.append('L')
q=q-p
else:
out.append('L')
p=p-q
return ''.join(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], 'R'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 2], 'L'), ([1, 3], 'LL'), ([1, 4], 'LLL'), ([1, 5], 'LLLL'), ([1, 6], 'LLLLL')], [([2, 3], 'LR'), ([2, 7], 'LLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 18], 'LLLLLLLLLLLLLLLLL'), ([1, 19], 'LLLLLLLLLLLLLLLLLL'), ([1, 20], 'LLLLLLLLLLLLLLLLLLL'), ([1, 21], 'LLLLLLLLLLLLLLLLLLLL')], [([2, 5], 'LLR'), ([2, 13], 'LLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([2, 21], 'LLLLLLLLLLR'), ([2, 23], 'LLLLLLLLLLLR'), ([3, 1], 'RR'), ([3, 2], 'RL')], [([2, 7], 'LLLR'), ([2, 19], 'LLLLLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([3, 23], 'LLLLLLLRL'), ([4, 1], 'RRR'), ([4, 3], 'RLL'), ([4, 5], 'LRRR')], [([2, 9], 'LLLLR'), ([3, 1], 'RR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([5, 6], 'LRRRR'), ([5, 7], 'LRRL'), ([5, 8], 'LRLR'), ([5, 9], 'LRLLL')]]
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 | L | R | Failed |
| explicit oracle 1 | | | Passed |
| explicit oracle 2 | LLLLLLLLLLLLLLLLLLLLLLL | RLLLLLLLLLLLLLLLLLLLLLL | Failed |
| explicit oracle 3 | L | L | Passed |
| explicit oracle 4 | LL | LL | Passed |
| explicit oracle 5 | LLL | LLL | Passed |
| explicit oracle 6 | LLLL | LLLL | Passed |
| explicit oracle 7 | LLLLL | LLLLL | Passed |
SHA-256 / ad4ee2f9b637862012ee1c81be0d3340789dbb55a59a9f6f636b443437a7235d
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(100):
if p==q: break
if p<q:
out.append('L')
q=q-p
else:
out.append('')
p=p-q
return ''.join(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], 'R'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 2], 'L'), ([1, 3], 'LL'), ([1, 4], 'LLL'), ([1, 5], 'LLLL'), ([1, 6], 'LLLLL')], [([2, 3], 'LR'), ([2, 7], 'LLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 18], 'LLLLLLLLLLLLLLLLL'), ([1, 19], 'LLLLLLLLLLLLLLLLLL'), ([1, 20], 'LLLLLLLLLLLLLLLLLLL'), ([1, 21], 'LLLLLLLLLLLLLLLLLLLL')], [([2, 5], 'LLR'), ([2, 13], 'LLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([2, 21], 'LLLLLLLLLLR'), ([2, 23], 'LLLLLLLLLLLR'), ([3, 1], 'RR'), ([3, 2], 'RL')], [([2, 7], 'LLLR'), ([2, 19], 'LLLLLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([3, 23], 'LLLLLLLRL'), ([4, 1], 'RRR'), ([4, 3], 'RLL'), ([4, 5], 'LRRR')], [([2, 9], 'LLLLR'), ([3, 1], 'RR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([5, 6], 'LRRRR'), ([5, 7], 'LRRL'), ([5, 8], 'LRLR'), ([5, 9], 'LRLLL')]]
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 | | R | Failed |
| explicit oracle 1 | | | Passed |
| explicit oracle 2 | LLLLLLLLLLLLLLLLLLLLLL | RLLLLLLLLLLLLLLLLLLLLLL | Failed |
| explicit oracle 3 | L | L | Passed |
| explicit oracle 4 | LL | LL | Passed |
| explicit oracle 5 | LLL | LLL | Passed |
| explicit oracle 6 | LLLL | LLLL | Passed |
| explicit oracle 7 | LLLLL | LLLLL | Passed |
SHA-256 / bbf5dc3e8cd855d86d5e78125ebca1ca3cc2ac3588b0f4bff4736da36336d0c0
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):
p,q=x
out=[]
for _ in range(100):
if p==q: break
if p<q:
out.append('L')
q=q-p
else:
out.append('R')
p=p-q
return ''.join(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([2, 1], 'R'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 2], 'L'), ([1, 3], 'LL'), ([1, 4], 'LLL'), ([1, 5], 'LLLL'), ([1, 6], 'LLLLL')], [([2, 3], 'LR'), ([2, 7], 'LLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([1, 18], 'LLLLLLLLLLLLLLLLL'), ([1, 19], 'LLLLLLLLLLLLLLLLLL'), ([1, 20], 'LLLLLLLLLLLLLLLLLLL'), ([1, 21], 'LLLLLLLLLLLLLLLLLLLL')], [([2, 5], 'LLR'), ([2, 13], 'LLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([2, 21], 'LLLLLLLLLLR'), ([2, 23], 'LLLLLLLLLLLR'), ([3, 1], 'RR'), ([3, 2], 'RL')], [([2, 7], 'LLLR'), ([2, 19], 'LLLLLLLLLR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([3, 23], 'LLLLLLLRL'), ([4, 1], 'RRR'), ([4, 3], 'RLL'), ([4, 5], 'LRRR')], [([2, 9], 'LLLLR'), ([3, 1], 'RR'), ([1, 1], ''), ([24, 23], 'RLLLLLLLLLLLLLLLLLLLLLL'), ([5, 6], 'LRRRR'), ([5, 7], 'LRRL'), ([5, 8], 'LRLR'), ([5, 9], 'LRLLL')]]
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 | R | R | Passed |
| explicit oracle 1 | | | Passed |
| explicit oracle 2 | RLLLLLLLLLLLLLLLLLLLLLL | RLLLLLLLLLLLLLLLLLLLLLL | Passed |
| explicit oracle 3 | L | L | Passed |
| explicit oracle 4 | LL | LL | Passed |
| explicit oracle 5 | LLL | LLL | Passed |
| explicit oracle 6 | LLLL | LLLL | Passed |
| explicit oracle 7 | LLLLL | LLLLL | Passed |
SHA-256 / 7833f3175a2490a5449ee98216bf68158e4f8117a190006d1a252fea39dce059
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.815577+00:00.
Case digest / 0edff543dad0870d5d44f0552938eb70f6e5c18b4f34453a4b0fc6a920e8b2d6