{"abstract":"The exact best bounded rational result violates the stated contract at rational distance.","category":"Numerics","checks":8,"contract":"Input [p,q,B], q>0 B>0; nearest rational to p/q with denominator<=B, ties choose smaller rational then denominator.","contract_signature":"x","evaluation_group":"s3-numerics-best-bounded-rational","failed_approach":"The partial repair abs(Fraction(n-p,d)) still violates the rational distance invariant.","family":"s3-numerics-best-bounded-rational-rational-distance","id":"FA-15006","implementations":{"attempt":{"sha256":"7d3e4c0580b2e6f30da2197512e818441f7c1cec528cfad01f3f7d76d7cc2be1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport itertools\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    p,q,B=x;target=Fraction(p,q);candidates=[]\n    for d in range(1,B+1):\n     a=(p*d)//q\n     for n in (a,a+1):\n      r=Fraction(n,d)\n      candidates.append((abs(Fraction(n-p,d)),r,d))\n    if not candidates:return None\n    best=min(candidates)\n    r=best[1]\n    return [r.numerator,r.denominator]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([-12, 5, 1], [-2, 1]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 1, 2], [-12, 1]), ([-12, 1, 3], [-12, 1]), ([-12, 1, 4], [-12, 1]), ([-12, 1, 5], [-12, 1]), ([-12, 1, 6], [-12, 1])], [([-12, 5, 2], [-5, 2]), ([-12, 7, 2], [-3, 2]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 3, 4], [-4, 1]), ([-12, 3, 5], [-4, 1]), ([-12, 3, 6], [-4, 1]), ([-12, 3, 7], [-4, 1])], [([-12, 5, 3], [-7, 3]), ([-12, 7, 6], [-7, 4]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 5, 7], [-12, 5]), ([-12, 6, 1], [-2, 1]), ([-12, 6, 2], [-2, 1]), ([-12, 6, 3], [-2, 1])], [([-12, 5, 4], [-7, 3]), ([-12, 8, 7], [-3, 2]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 8, 3], [-3, 2]), ([-12, 8, 4], [-3, 2]), ([-12, 8, 5], [-3, 2]), ([-12, 8, 6], [-3, 2])], [([-12, 5, 5], [-12, 5]), ([-12, 9, 5], [-4, 3]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 10, 6], [-6, 5]), ([-12, 10, 7], [-6, 5]), ([-12, 11, 1], [-1, 1]), ([-12, 11, 2], [-1, 1])]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"explicit oracle %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"5ae4117e767653acc6dbb16bfbfa32a620d0e9b26b1cc92d3b8a989ba480f992","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport itertools\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    p,q,B=x;target=Fraction(p,q);candidates=[]\n    for d in range(1,B+1):\n     a=(p*d)//q\n     for n in (a,a+1):\n      r=Fraction(n,d)\n      candidates.append((r-target,r,d))\n    if not candidates:return None\n    best=min(candidates)\n    r=best[1]\n    return [r.numerator,r.denominator]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([-12, 5, 1], [-2, 1]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 1, 2], [-12, 1]), ([-12, 1, 3], [-12, 1]), ([-12, 1, 4], [-12, 1]), ([-12, 1, 5], [-12, 1]), ([-12, 1, 6], [-12, 1])], [([-12, 5, 2], [-5, 2]), ([-12, 7, 2], [-3, 2]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 3, 4], [-4, 1]), ([-12, 3, 5], [-4, 1]), ([-12, 3, 6], [-4, 1]), ([-12, 3, 7], [-4, 1])], [([-12, 5, 3], [-7, 3]), ([-12, 7, 6], [-7, 4]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 5, 7], [-12, 5]), ([-12, 6, 1], [-2, 1]), ([-12, 6, 2], [-2, 1]), ([-12, 6, 3], [-2, 1])], [([-12, 5, 4], [-7, 3]), ([-12, 8, 7], [-3, 2]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 8, 3], [-3, 2]), ([-12, 8, 4], [-3, 2]), ([-12, 8, 5], [-3, 2]), ([-12, 8, 6], [-3, 2])], [([-12, 5, 5], [-12, 5]), ([-12, 9, 5], [-4, 3]), ([-12, 1, 1], [-12, 1]), ([12, 11, 7], [8, 7]), ([-12, 10, 6], [-6, 5]), ([-12, 10, 7], [-6, 5]), ([-12, 11, 1], [-1, 1]), ([-12, 11, 2], [-1, 1])]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"explicit oracle %d\" % i, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-numerics-best-bounded-rational-rational-distance","generated_at":"2026-09-29T14:39:22.514076+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.","root_cause":"The rational distance step uses r-target instead of abs(r-target).","sha256":"fb2967a7be097b1a17fd5a14a82e853f3d1c01e5525325facbf5319c6bf5b855","title":"Best bounded rational: rational distance · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":44.539,"exit_code":1,"observations":[{"actual":[-3,1],"check":"explicit oracle 0","expected":[-2,1],"passed":false},{"actual":[-12,1],"check":"explicit oracle 1","expected":[-12,1],"passed":true},{"actual":[8,7],"check":"explicit oracle 2","expected":[8,7],"passed":true},{"actual":[-12,1],"check":"explicit oracle 3","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 4","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 5","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 6","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 7","expected":[-12,1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": [-3, 1], \"expected\": [-2, 1], \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": [8, 7], \"expected\": [8, 7], \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.123,"exit_code":1,"observations":[{"actual":[-3,1],"check":"explicit oracle 0","expected":[-2,1],"passed":false},{"actual":[-12,1],"check":"explicit oracle 1","expected":[-12,1],"passed":true},{"actual":[1,1],"check":"explicit oracle 2","expected":[8,7],"passed":false},{"actual":[-12,1],"check":"explicit oracle 3","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 4","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 5","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 6","expected":[-12,1],"passed":true},{"actual":[-12,1],"check":"explicit oracle 7","expected":[-12,1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": [-3, 1], \"expected\": [-2, 1], \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": [1, 1], \"expected\": [8, 7], \"passed\": false}, {\"check\": \"explicit oracle 3\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": [-12, 1], \"expected\": [-12, 1], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}