{"abstract":"The exact lehmer permutation rank result violates the stated contract at factoradic place weighting.","category":"Numerics","checks":8,"contract":"Input permutation of 0..n-1 with n<=7; return zero-based lexicographic rank.","evaluation_group":"s3-numerics-lehmer-permutation-rank","failed_approach":"The partial repair rank+digit still violates the factoradic place weighting invariant.","family":"s3-numerics-lehmer-permutation-rank-factoradic-place-weighting","id":"FA-15101","implementations":{"attempt":{"sha256":"696246c9a4930d4dc6fcf8bd2136af64bceaddece1f1a39dc9caa040d04284ff","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=x;n=len(p)\n    remaining=list(range(n));rank=0\n    for i,v in enumerate(p):\n     if v not in remaining:return None\n     digit=remaining.index(v)\n     rank=rank+digit\n     remaining.pop(remaining.index(v))\n    return rank\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([1, 0], 1), ([1, 0, 2], 2), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1], 0), ([0, 1, 2], 0), ([0, 2, 1], 1), ([1, 2, 0], 3)], [([0, 2, 1], 1), ([2, 1, 0], 5), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 0, 3], 8), ([1, 2, 3, 0], 9), ([1, 3, 0, 2], 10), ([1, 3, 2, 0], 11)], [([1, 0, 2], 2), ([0, 3, 1, 2], 4), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1, 2, 4, 3], 1), ([0, 1, 3, 2, 4], 2), ([0, 1, 3, 4, 2], 3), ([0, 1, 4, 2, 3], 4)], [([1, 2, 0], 3), ([1, 0, 3, 2], 7), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 4, 1, 2, 3], 18), ([0, 4, 1, 3, 2], 19), ([0, 4, 2, 1, 3], 20), ([0, 4, 2, 3, 1], 21)], [([2, 0, 1], 4), ([1, 3, 0, 2], 10), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 4, 3, 0], 35), ([1, 3, 0, 2, 4], 36), ([1, 3, 0, 4, 2], 37), ([1, 3, 2, 0, 4], 38)]]\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":"b6aa12bef4bf0dc45d740587979c4e3db0f0b24f11469fa065df6bc2c39580af","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=x;n=len(p)\n    remaining=list(range(n));rank=0\n    for i,v in enumerate(p):\n     if v not in remaining:return None\n     digit=remaining.index(v)\n     rank=rank+digit*math.factorial(n-i)\n     remaining.pop(remaining.index(v))\n    return rank\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([1, 0], 1), ([1, 0, 2], 2), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1], 0), ([0, 1, 2], 0), ([0, 2, 1], 1), ([1, 2, 0], 3)], [([0, 2, 1], 1), ([2, 1, 0], 5), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 0, 3], 8), ([1, 2, 3, 0], 9), ([1, 3, 0, 2], 10), ([1, 3, 2, 0], 11)], [([1, 0, 2], 2), ([0, 3, 1, 2], 4), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1, 2, 4, 3], 1), ([0, 1, 3, 2, 4], 2), ([0, 1, 3, 4, 2], 3), ([0, 1, 4, 2, 3], 4)], [([1, 2, 0], 3), ([1, 0, 3, 2], 7), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 4, 1, 2, 3], 18), ([0, 4, 1, 3, 2], 19), ([0, 4, 2, 1, 3], 20), ([0, 4, 2, 3, 1], 21)], [([2, 0, 1], 4), ([1, 3, 0, 2], 10), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 4, 3, 0], 35), ([1, 3, 0, 2, 4], 36), ([1, 3, 0, 4, 2], 37), ([1, 3, 2, 0, 4], 38)]]\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":"928a46e2c6e913bc74fe3d6c7c581304dfef33be6c37c15d289b1f01aba57764","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=x;n=len(p)\n    remaining=list(range(n));rank=0\n    for i,v in enumerate(p):\n     if v not in remaining:return None\n     digit=remaining.index(v)\n     rank=rank+digit*math.factorial(n-i-1)\n     remaining.pop(remaining.index(v))\n    return rank\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([1, 0], 1), ([1, 0, 2], 2), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1], 0), ([0, 1, 2], 0), ([0, 2, 1], 1), ([1, 2, 0], 3)], [([0, 2, 1], 1), ([2, 1, 0], 5), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 0, 3], 8), ([1, 2, 3, 0], 9), ([1, 3, 0, 2], 10), ([1, 3, 2, 0], 11)], [([1, 0, 2], 2), ([0, 3, 1, 2], 4), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 1, 2, 4, 3], 1), ([0, 1, 3, 2, 4], 2), ([0, 1, 3, 4, 2], 3), ([0, 1, 4, 2, 3], 4)], [([1, 2, 0], 3), ([1, 0, 3, 2], 7), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([0, 4, 1, 2, 3], 18), ([0, 4, 1, 3, 2], 19), ([0, 4, 2, 1, 3], 20), ([0, 4, 2, 3, 1], 21)], [([2, 0, 1], 4), ([1, 3, 0, 2], 10), ([0], 0), ([5, 4, 3, 2, 1, 0], 719), ([1, 2, 4, 3, 0], 35), ([1, 3, 0, 2, 4], 36), ([1, 3, 0, 4, 2], 37), ([1, 3, 2, 0, 4], 38)]]\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-lehmer-permutation-rank-factoradic-place-weighting","generated_at":"2026-09-29T14:39:23.371695+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 rank+digit*math.factorial(n-i-1) at the factoradic place weighting step.","root_cause":"The factoradic place weighting step uses rank+digit*math.factorial(n-i) instead of rank+digit*math.factorial(n-i-1).","sha256":"c522922910c48043c0d6179eaf9a1450bb40fd579e69d53e8a3578bd14d03a1c","title":"Lehmer permutation rank: factoradic place weighting · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.788,"exit_code":1,"observations":[{"actual":1,"check":"explicit oracle 0","expected":1,"passed":true},{"actual":1,"check":"explicit oracle 1","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 2","expected":0,"passed":true},{"actual":15,"check":"explicit oracle 3","expected":719,"passed":false},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 6","expected":1,"passed":true},{"actual":2,"check":"explicit oracle 7","expected":3,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 1\", \"actual\": 1, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 15, \"expected\": 719, \"passed\": false}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 2, \"expected\": 3, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.273,"exit_code":1,"observations":[{"actual":2,"check":"explicit oracle 0","expected":1,"passed":false},{"actual":6,"check":"explicit oracle 1","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 2","expected":0,"passed":true},{"actual":4166,"check":"explicit oracle 3","expected":719,"passed":false},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":0,"passed":true},{"actual":2,"check":"explicit oracle 6","expected":1,"passed":false},{"actual":8,"check":"explicit oracle 7","expected":3,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 2, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 6, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 4166, \"expected\": 719, \"passed\": false}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 2, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 7\", \"actual\": 8, \"expected\": 3, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.767,"exit_code":0,"observations":[{"actual":1,"check":"explicit oracle 0","expected":1,"passed":true},{"actual":2,"check":"explicit oracle 1","expected":2,"passed":true},{"actual":0,"check":"explicit oracle 2","expected":0,"passed":true},{"actual":719,"check":"explicit oracle 3","expected":719,"passed":true},{"actual":0,"check":"explicit oracle 4","expected":0,"passed":true},{"actual":0,"check":"explicit oracle 5","expected":0,"passed":true},{"actual":1,"check":"explicit oracle 6","expected":1,"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\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 3\", \"actual\": 719, \"expected\": 719, \"passed\": true}, {\"check\": \"explicit oracle 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 3, \"expected\": 3, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}