{"abstract":"The exact dyck word ranking result violates the stated contract at prefix balance rejection.","category":"Numerics","checks":8,"contract":"Input balanced parentheses word with every prefix nonnegative; return zero-based lexicographic rank where opening precedes closing. Bounds: at most five opening parentheses.","evaluation_group":"s3-numerics-dyck-word-ranking","failed_approach":"The partial repair c>o or o>=n still violates the prefix balance rejection invariant.","family":"s3-numerics-dyck-word-ranking-prefix-balance-rejection","id":"FA-15191","implementations":{"attempt":{"sha256":"c2139c5c1c0e0ce1fc8ad055db8a4005dad6f29765e2515513d987ffe4c0838d","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    word=x;n=len(word)//2\n    from functools import lru_cache\n    @lru_cache(None)\n    def count(o,c):\n     if c>o or o>=n:return 0\n     if o==n and c==n:return 1\n     return (count(o+1,c) if o<n else 0)+(count(o,c+1) if c<o else 0)\n    r=0;o=c=0\n    for ch in word:\n     if ch==')':\n      r+=count(o+1,c)\n      c=c+1\n     else:o=o+1\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('()()', 1), ('()', 0), ('()()()()()', 41), ('(())', 0), ('((()))', 0), ('(()())', 1), ('(())()', 2), ('()(())', 3)], [('(()())', 1), ('()(())', 3), ('()', 0), ('()()()()()', 41), ('()((()))', 9), ('()(()())', 10), ('()(())()', 11), ('()()(())', 12)], [('(())()', 2), ('((())())', 2), ('()', 0), ('()()()()()', 41), ('((()))(())', 12), ('((()))()()', 13), ('(()((())))', 14), ('(()(()()))', 15)], [('()(())', 3), ('(()()())', 5), ('()', 0), ('()()()()()', 41), ('()((()()))', 29), ('()((())())', 30), ('()((()))()', 31), ('()(()(()))', 32)], [('()()()', 4), ('(())()()', 8), ('()', 0), ('()()()()()', 41), ('(()())', 1), ('(())()', 2), ('()(())', 3), ('(((())))', 0)]]\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":"e5f075a81f383ce3ef2abbf711f8ecd042f998371411a5b6ae5da48f5b1c72f2","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    word=x;n=len(word)//2\n    from functools import lru_cache\n    @lru_cache(None)\n    def count(o,c):\n     if c>=o or o>n:return 0\n     if o==n and c==n:return 1\n     return (count(o+1,c) if o<n else 0)+(count(o,c+1) if c<o else 0)\n    r=0;o=c=0\n    for ch in word:\n     if ch==')':\n      r+=count(o+1,c)\n      c=c+1\n     else:o=o+1\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('()()', 1), ('()', 0), ('()()()()()', 41), ('(())', 0), ('((()))', 0), ('(()())', 1), ('(())()', 2), ('()(())', 3)], [('(()())', 1), ('()(())', 3), ('()', 0), ('()()()()()', 41), ('()((()))', 9), ('()(()())', 10), ('()(())()', 11), ('()()(())', 12)], [('(())()', 2), ('((())())', 2), ('()', 0), ('()()()()()', 41), ('((()))(())', 12), ('((()))()()', 13), ('(()((())))', 14), ('(()(()()))', 15)], [('()(())', 3), ('(()()())', 5), ('()', 0), ('()()()()()', 41), ('()((()()))', 29), ('()((())())', 30), ('()((()))()', 31), ('()(()(()))', 32)], [('()()()', 4), ('(())()()', 8), ('()', 0), ('()()()()()', 41), ('(()())', 1), ('(())()', 2), ('()(())', 3), ('(((())))', 0)]]\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"},"fixed":{"sha256":"39a8643e54f8efd5d7fd0c667ef38a59508d6aa2f25f76dfae6e148faca012bf","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    word=x;n=len(word)//2\n    from functools import lru_cache\n    @lru_cache(None)\n    def count(o,c):\n     if c>o or o>n:return 0\n     if o==n and c==n:return 1\n     return (count(o+1,c) if o<n else 0)+(count(o,c+1) if c<o else 0)\n    r=0;o=c=0\n    for ch in word:\n     if ch==')':\n      r+=count(o+1,c)\n      c=c+1\n     else:o=o+1\n    return r\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('()()', 1), ('()', 0), ('()()()()()', 41), ('(())', 0), ('((()))', 0), ('(()())', 1), ('(())()', 2), ('()(())', 3)], [('(()())', 1), ('()(())', 3), ('()', 0), ('()()()()()', 41), ('()((()))', 9), ('()(()())', 10), ('()(())()', 11), ('()()(())', 12)], [('(())()', 2), ('((())())', 2), ('()', 0), ('()()()()()', 41), ('((()))(())', 12), ('((()))()()', 13), ('(()((())))', 14), ('(()(()()))', 15)], [('()(())', 3), ('(()()())', 5), ('()', 0), ('()()()()()', 41), ('()((()()))', 29), ('()((())())', 30), ('()((()))()', 31), ('()(()(()))', 32)], [('()()()', 4), ('(())()()', 8), ('()', 0), ('()()()()()', 41), ('(()())', 1), ('(())()', 2), ('()(())', 3), ('(((())))', 0)]]\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-dyck-word-ranking-prefix-balance-rejection","generated_at":"2026-09-29T14:39:24.288757+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.","repair":"Use c>o or o>n at the prefix balance rejection step.","root_cause":"The prefix balance rejection step uses c>=o or o>n instead of c>o or o>n.","sha256":"6da053743b6ddb2eb01095f56a547d8ca52bd7d15d8b4f7751a895eb15ff4f44","title":"Dyck word ranking: prefix balance rejection · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.257,"exit_code":1,"observations":[{"actual":0,"check":"explicit oracle 0","expected":1,"passed":false},{"actual":0,"check":"explicit oracle 1","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 2","expected":41,"passed":false},{"actual":0,"check":"explicit oracle 3","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":1,"passed":false},{"actual":0,"check":"explicit oracle 6","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 7","expected":3,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 0, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 41, \"passed\": false}, {\"check\": \"explicit oracle 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 6\", \"actual\": 0, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 3, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.704,"exit_code":1,"observations":[{"actual":0,"check":"explicit oracle 0","expected":1,"passed":false},{"actual":0,"check":"explicit oracle 1","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 2","expected":41,"passed":false},{"actual":0,"check":"explicit oracle 3","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":1,"passed":false},{"actual":0,"check":"explicit oracle 6","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 7","expected":3,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 0, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 41, \"passed\": false}, {\"check\": \"explicit oracle 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 6\", \"actual\": 0, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 3, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.179,"exit_code":0,"observations":[{"actual":1,"check":"explicit oracle 0","expected":1,"passed":true},{"actual":0,"check":"explicit oracle 1","expected":0,"passed":true},{"actual":41,"check":"explicit oracle 2","expected":41,"passed":true},{"actual":0,"check":"explicit oracle 3","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 5","expected":1,"passed":true},{"actual":2,"check":"explicit oracle 6","expected":2,"passed":true},{"actual":3,"check":"explicit oracle 7","expected":3,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 41, \"expected\": 41, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 3, \"expected\": 3, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}