FA-14581 / Numerics / Open access
Rational mediant walk: left bound replacement · case 01
The exact rational mediant walk result violates the stated contract at left bound replacement.
ROOT CAUSE
The left bound replacement step uses lo=mid instead of hi=mid.
VERIFIED REPAIR
Use hi=mid at the left bound replacement step.
Unsuccessful approach: The partial repair hi=[mid[1],mid[0]] still violates the left bound replacement invariant.
Case contract
Input path over L/R; return Stern-Brocot interval bounds and its mediant.
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):
lo=[0,1]
hi=[1,0]
for step in x:
mid=[lo[0]+hi[0],lo[1]+hi[1]]
if step=='L': lo=mid
else: lo=mid
return [lo,hi,[lo[0]+hi[0],lo[1]+hi[1]]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('L', [[0, 1], [1, 1], [1, 2]]), ('LL', [[0, 1], [1, 2], [1, 3]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('R', [[1, 1], [1, 0], [2, 1]]), ('LR', [[1, 2], [1, 1], [2, 3]]), ('RL', [[1, 1], [2, 1], [3, 2]]), ('RR', [[2, 1], [1, 0], [3, 1]])], [('LL', [[0, 1], [1, 2], [1, 3]]), ('LLR', [[1, 3], [1, 2], [2, 5]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('LLRR', [[2, 5], [1, 2], [3, 7]]), ('LRLL', [[1, 2], [3, 5], [4, 7]]), ('LRLR', [[3, 5], [2, 3], [5, 8]])], [('LR', [[1, 2], [1, 1], [2, 3]]), ('RRL', [[2, 1], [3, 1], [5, 2]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRR', [[2, 7], [1, 3], [3, 10]]), ('LLRLL', [[1, 3], [3, 8], [4, 11]]), ('LLRLR', [[3, 8], [2, 5], [5, 13]]), ('LLRRL', [[2, 5], [3, 7], [5, 12]])], [('RL', [[1, 1], [2, 1], [3, 2]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('RLRLL', [[3, 2], [8, 5], [11, 7]]), ('RLRLR', [[8, 5], [5, 3], [13, 8]]), ('RLRRL', [[5, 3], [7, 4], [12, 7]]), ('RLRRR', [[7, 4], [2, 1], [9, 5]])], [('LLL', [[0, 1], [1, 3], [1, 4]]), ('LRLR', [[3, 5], [2, 3], [5, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRLR', [[3, 11], [2, 7], [5, 18]]), ('LLLRRL', [[2, 7], [3, 10], [5, 17]]), ('LLLRRR', [[3, 10], [1, 3], [4, 13]]), ('LLRLLL', [[1, 3], [4, 11], [5, 14]])]]
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 | [[1, 1], [1, 0], [2, 1]] | [[0, 1], [1, 1], [1, 2]] | Failed |
| explicit oracle 1 | [[2, 1], [1, 0], [3, 1]] | [[0, 1], [1, 2], [1, 3]] | Failed |
| explicit oracle 2 | [[0, 1], [1, 0], [1, 1]] | [[0, 1], [1, 0], [1, 1]] | Passed |
| explicit oracle 3 | [[6, 1], [1, 0], [7, 1]] | [[6, 1], [1, 0], [7, 1]] | Passed |
| explicit oracle 4 | [[1, 1], [1, 0], [2, 1]] | [[1, 1], [1, 0], [2, 1]] | Passed |
| explicit oracle 5 | [[2, 1], [1, 0], [3, 1]] | [[1, 2], [1, 1], [2, 3]] | Failed |
| explicit oracle 6 | [[2, 1], [1, 0], [3, 1]] | [[1, 1], [2, 1], [3, 2]] | Failed |
| explicit oracle 7 | [[2, 1], [1, 0], [3, 1]] | [[2, 1], [1, 0], [3, 1]] | Passed |
SHA-256 / e5dabbbb7622be7eff06015e2a6afaceee011b5a4be73ca2bcdf8f8fb6185020
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):
lo=[0,1]
hi=[1,0]
for step in x:
mid=[lo[0]+hi[0],lo[1]+hi[1]]
if step=='L': hi=[mid[1],mid[0]]
else: lo=mid
return [lo,hi,[lo[0]+hi[0],lo[1]+hi[1]]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('L', [[0, 1], [1, 1], [1, 2]]), ('LL', [[0, 1], [1, 2], [1, 3]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('R', [[1, 1], [1, 0], [2, 1]]), ('LR', [[1, 2], [1, 1], [2, 3]]), ('RL', [[1, 1], [2, 1], [3, 2]]), ('RR', [[2, 1], [1, 0], [3, 1]])], [('LL', [[0, 1], [1, 2], [1, 3]]), ('LLR', [[1, 3], [1, 2], [2, 5]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('LLRR', [[2, 5], [1, 2], [3, 7]]), ('LRLL', [[1, 2], [3, 5], [4, 7]]), ('LRLR', [[3, 5], [2, 3], [5, 8]])], [('LR', [[1, 2], [1, 1], [2, 3]]), ('RRL', [[2, 1], [3, 1], [5, 2]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRR', [[2, 7], [1, 3], [3, 10]]), ('LLRLL', [[1, 3], [3, 8], [4, 11]]), ('LLRLR', [[3, 8], [2, 5], [5, 13]]), ('LLRRL', [[2, 5], [3, 7], [5, 12]])], [('RL', [[1, 1], [2, 1], [3, 2]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('RLRLL', [[3, 2], [8, 5], [11, 7]]), ('RLRLR', [[8, 5], [5, 3], [13, 8]]), ('RLRRL', [[5, 3], [7, 4], [12, 7]]), ('RLRRR', [[7, 4], [2, 1], [9, 5]])], [('LLL', [[0, 1], [1, 3], [1, 4]]), ('LRLR', [[3, 5], [2, 3], [5, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRLR', [[3, 11], [2, 7], [5, 18]]), ('LLLRRL', [[2, 7], [3, 10], [5, 17]]), ('LLLRRR', [[3, 10], [1, 3], [4, 13]]), ('LLRLLL', [[1, 3], [4, 11], [5, 14]])]]
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 | [[0, 1], [1, 1], [1, 2]] | [[0, 1], [1, 1], [1, 2]] | Passed |
| explicit oracle 1 | [[0, 1], [2, 1], [2, 2]] | [[0, 1], [1, 2], [1, 3]] | Failed |
| explicit oracle 2 | [[0, 1], [1, 0], [1, 1]] | [[0, 1], [1, 0], [1, 1]] | Passed |
| explicit oracle 3 | [[6, 1], [1, 0], [7, 1]] | [[6, 1], [1, 0], [7, 1]] | Passed |
| explicit oracle 4 | [[1, 1], [1, 0], [2, 1]] | [[1, 1], [1, 0], [2, 1]] | Passed |
| explicit oracle 5 | [[1, 2], [1, 1], [2, 3]] | [[1, 2], [1, 1], [2, 3]] | Passed |
| explicit oracle 6 | [[1, 1], [1, 2], [2, 3]] | [[1, 1], [2, 1], [3, 2]] | Failed |
| explicit oracle 7 | [[2, 1], [1, 0], [3, 1]] | [[2, 1], [1, 0], [3, 1]] | Passed |
SHA-256 / f46c1583d622a5cb9b9d6df6ca39f7c862270f57f61e3097024b2a0493611c22
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):
lo=[0,1]
hi=[1,0]
for step in x:
mid=[lo[0]+hi[0],lo[1]+hi[1]]
if step=='L': hi=mid
else: lo=mid
return [lo,hi,[lo[0]+hi[0],lo[1]+hi[1]]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('L', [[0, 1], [1, 1], [1, 2]]), ('LL', [[0, 1], [1, 2], [1, 3]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('R', [[1, 1], [1, 0], [2, 1]]), ('LR', [[1, 2], [1, 1], [2, 3]]), ('RL', [[1, 1], [2, 1], [3, 2]]), ('RR', [[2, 1], [1, 0], [3, 1]])], [('LL', [[0, 1], [1, 2], [1, 3]]), ('LLR', [[1, 3], [1, 2], [2, 5]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('LLRR', [[2, 5], [1, 2], [3, 7]]), ('LRLL', [[1, 2], [3, 5], [4, 7]]), ('LRLR', [[3, 5], [2, 3], [5, 8]])], [('LR', [[1, 2], [1, 1], [2, 3]]), ('RRL', [[2, 1], [3, 1], [5, 2]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRR', [[2, 7], [1, 3], [3, 10]]), ('LLRLL', [[1, 3], [3, 8], [4, 11]]), ('LLRLR', [[3, 8], [2, 5], [5, 13]]), ('LLRRL', [[2, 5], [3, 7], [5, 12]])], [('RL', [[1, 1], [2, 1], [3, 2]]), ('LLRL', [[1, 3], [2, 5], [3, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('RLRLL', [[3, 2], [8, 5], [11, 7]]), ('RLRLR', [[8, 5], [5, 3], [13, 8]]), ('RLRRL', [[5, 3], [7, 4], [12, 7]]), ('RLRRR', [[7, 4], [2, 1], [9, 5]])], [('LLL', [[0, 1], [1, 3], [1, 4]]), ('LRLR', [[3, 5], [2, 3], [5, 8]]), ('', [[0, 1], [1, 0], [1, 1]]), ('RRRRRR', [[6, 1], [1, 0], [7, 1]]), ('LLLRLR', [[3, 11], [2, 7], [5, 18]]), ('LLLRRL', [[2, 7], [3, 10], [5, 17]]), ('LLLRRR', [[3, 10], [1, 3], [4, 13]]), ('LLRLLL', [[1, 3], [4, 11], [5, 14]])]]
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 | [[0, 1], [1, 1], [1, 2]] | [[0, 1], [1, 1], [1, 2]] | Passed |
| explicit oracle 1 | [[0, 1], [1, 2], [1, 3]] | [[0, 1], [1, 2], [1, 3]] | Passed |
| explicit oracle 2 | [[0, 1], [1, 0], [1, 1]] | [[0, 1], [1, 0], [1, 1]] | Passed |
| explicit oracle 3 | [[6, 1], [1, 0], [7, 1]] | [[6, 1], [1, 0], [7, 1]] | Passed |
| explicit oracle 4 | [[1, 1], [1, 0], [2, 1]] | [[1, 1], [1, 0], [2, 1]] | Passed |
| explicit oracle 5 | [[1, 2], [1, 1], [2, 3]] | [[1, 2], [1, 1], [2, 3]] | Passed |
| explicit oracle 6 | [[1, 1], [2, 1], [3, 2]] | [[1, 1], [2, 1], [3, 2]] | Passed |
| explicit oracle 7 | [[2, 1], [1, 0], [3, 1]] | [[2, 1], [1, 0], [3, 1]] | Passed |
SHA-256 / 0909c461d2efa2738c5a5c4148eaca9bed70b1e46641151d7db3adf08dff1af2
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:18.397704+00:00.
Case digest / 49053788d56a4caf0e907c2919dde5cd35f1d4f685a7988d58004b542ccc6505