{"abstract":"The exact montgomery residue product result violates the stated contract at negative modulus inverse.","category":"Numerics","checks":8,"contract":"Input [a,b,m,R], odd modulus m<R and R power of2, 0<=a,b<m; return a*b*R^-1 modulo m using Montgomery reduction.","contract_signature":"x","evaluation_group":"s3-numerics-montgomery-residue-product","failed_approach":"The partial repair (-pow(R,-1,m))%m still violates the negative modulus inverse invariant.","family":"s3-numerics-montgomery-residue-product-negative-modulus-inverse","id":"FA-15766","implementations":{"attempt":{"sha256":"dc13e7333adea4a36c0993e296ec918611a8eb243029c8f3ad18b5be742fd63a","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    a,b,m,R=x\n    nprime=(-pow(R,-1,m))%m\n    t=a*b\n    u=(t*nprime)%R\n    v=(t+u*m)//R\n    if v>=m:v-=m\n    return v\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([1, 1, 3, 8], 2), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([0, 1, 3, 8], 0), ([0, 2, 3, 8], 0), ([1, 0, 3, 8], 0), ([1, 2, 3, 8], 1), ([2, 0, 3, 8], 0)], [([1, 2, 3, 8], 1), ([1, 3, 7, 8], 3), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([1, 3, 5, 8], 1), ([1, 4, 5, 8], 3), ([2, 0, 5, 8], 0), ([2, 1, 5, 8], 4)], [([2, 1, 3, 8], 1), ([2, 1, 7, 8], 2), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([0, 0, 7, 8], 0), ([0, 1, 7, 8], 0), ([0, 2, 7, 8], 0), ([0, 3, 7, 8], 0)], [([1, 1, 5, 8], 2), ([2, 5, 7, 8], 3), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([2, 3, 7, 8], 6), ([2, 4, 7, 8], 1), ([2, 6, 7, 8], 5), ([3, 0, 7, 8], 0)], [([1, 2, 5, 8], 4), ([3, 2, 7, 8], 6), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([4, 6, 7, 8], 3), ([5, 0, 7, 8], 0), ([5, 1, 7, 8], 5), ([5, 2, 7, 8], 3)]]\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":"6943f97e9febb8b790a87eb40408947533bffa511511bb3ddc5174694638df19","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    a,b,m,R=x\n    nprime=pow(m,-1,R)\n    t=a*b\n    u=(t*nprime)%R\n    v=(t+u*m)//R\n    if v>=m:v-=m\n    return v\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[([1, 1, 3, 8], 2), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([0, 1, 3, 8], 0), ([0, 2, 3, 8], 0), ([1, 0, 3, 8], 0), ([1, 2, 3, 8], 1), ([2, 0, 3, 8], 0)], [([1, 2, 3, 8], 1), ([1, 3, 7, 8], 3), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([1, 3, 5, 8], 1), ([1, 4, 5, 8], 3), ([2, 0, 5, 8], 0), ([2, 1, 5, 8], 4)], [([2, 1, 3, 8], 1), ([2, 1, 7, 8], 2), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([0, 0, 7, 8], 0), ([0, 1, 7, 8], 0), ([0, 2, 7, 8], 0), ([0, 3, 7, 8], 0)], [([1, 1, 5, 8], 2), ([2, 5, 7, 8], 3), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([2, 3, 7, 8], 6), ([2, 4, 7, 8], 1), ([2, 6, 7, 8], 5), ([3, 0, 7, 8], 0)], [([1, 2, 5, 8], 4), ([3, 2, 7, 8], 6), ([0, 0, 3, 8], 0), ([30, 30, 31, 32], 1), ([4, 6, 7, 8], 3), ([5, 0, 7, 8], 0), ([5, 1, 7, 8], 5), ([5, 2, 7, 8], 3)]]\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-montgomery-residue-product-negative-modulus-inverse","generated_at":"2026-09-29T14:39:30.113819+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 negative modulus inverse step uses pow(m,-1,R) instead of (-pow(m,-1,R))%R.","sha256":"2de99d53a26c26cc28bb8c590af656384b45d6b500052133add9593b0e24b8fb","title":"Montgomery residue product: negative modulus inverse · 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":43.259,"exit_code":1,"observations":[{"actual":0,"check":"explicit oracle 0","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 1","expected":0,"passed":true},{"actual":20,"check":"explicit oracle 2","expected":1,"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":0,"passed":true},{"actual":1,"check":"explicit oracle 6","expected":1,"passed":true},{"actual":0,"check":"explicit oracle 7","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 0, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 20, \"expected\": 1, \"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\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.848,"exit_code":1,"observations":[{"actual":1,"check":"explicit oracle 0","expected":2,"passed":false},{"actual":0,"check":"explicit oracle 1","expected":0,"passed":true},{"actual":24,"check":"explicit oracle 2","expected":1,"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":0,"passed":true},{"actual":2,"check":"explicit oracle 6","expected":1,"passed":false},{"actual":0,"check":"explicit oracle 7","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"explicit oracle 0\", \"actual\": 1, \"expected\": 2, \"passed\": false}, {\"check\": \"explicit oracle 1\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"explicit oracle 2\", \"actual\": 24, \"expected\": 1, \"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\": 0, \"passed\": true}, {\"check\": \"explicit oracle 6\", \"actual\": 2, \"expected\": 1, \"passed\": false}, {\"check\": \"explicit oracle 7\", \"actual\": 0, \"expected\": 0, \"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."}}