{"abstract":"Locking a ranked pair closes an indirect preference cycle.","category":"Voting rule computation","checks":6,"contract":"Given n candidates indexed 0..n-1 and unique directed victories already ordered by strength and a predetermined tie order, return locked edges in processing order. Reject any edge that would introduce a directed cycle. This models only the ranked-pairs locking stage.","contract_signature":"n, victories","evaluation_group":"model-3b356c0f59e9a004","failed_approach":"Rejecting only direct reverse edges misses cycles spanning three or more candidates.","family":"z-voting_rules-ranked-pairs-lock","id":"FA-12786","implementations":{"attempt":{"sha256":"f54cd7500b86c7e6dcac9f8ce41cda36059d041e6c1c1a42f8b1dc2e26d37d71","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(n, victories):\n    locked=[]\n    for a,b in victories:\n        if [b,a] not in locked: locked.append([a,b])\n    return locked\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nchain=[[i,i+1] for i in range(N+2)]\ncheck('long indirect cycle is rejected', solve(N+3,chain+[[N+2,0]]), chain)\ncheck('acyclic transitive edge remains', solve(3,[[0,1],[1,2],[0,2]]), [[0,1],[1,2],[0,2]])\ncheck('empty victories', solve(N+1,[]), [])\ncheck('reverse contest rejected', solve(2,[[0,1],[1,0]]), [[0,1]])\ncheck('rejected edge cannot affect later reachability', solve(4,[[0,1],[1,2],[2,0],[2,3],[3,0]]), [[0,1],[1,2],[2,3]])\ncheck('disconnected components', solve(4,[[0,1],[2,3]]), [[0,1],[2,3]])\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":"3afe95f1884afee6b576bc9b163efe17f36e7882b0a77f121da0c671912b099f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(n, victories):\n    return [list(edge) for edge in victories]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nchain=[[i,i+1] for i in range(N+2)]\ncheck('long indirect cycle is rejected', solve(N+3,chain+[[N+2,0]]), chain)\ncheck('acyclic transitive edge remains', solve(3,[[0,1],[1,2],[0,2]]), [[0,1],[1,2],[0,2]])\ncheck('empty victories', solve(N+1,[]), [])\ncheck('reverse contest rejected', solve(2,[[0,1],[1,0]]), [[0,1]])\ncheck('rejected edge cannot affect later reachability', solve(4,[[0,1],[1,2],[2,0],[2,3],[3,0]]), [[0,1],[1,2],[2,3]])\ncheck('disconnected components', solve(4,[[0,1],[2,3]]), [[0,1],[2,3]])\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":"Abstract counting rules only; excludes jurisdictional law, ballot authentication and election operations. 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":"z-voting_rules-ranked-pairs-lock","generated_at":"2026-09-29T14:39:00.125020+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic toy ballot model makes the stated counting convention executable.","root_cause":"Every ordered pairwise victory is locked without checking whether its loser already reaches its winner.","sha256":"6ed8652de34fb59bc202d4418369e7cd74c85732860722949aa371dda268cf00","title":"Locking a ranked pair closes an indirect preference cycle · 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":45.25,"exit_code":1,"observations":[{"actual":[[0,1],[1,2],[2,3],[3,0]],"check":"long indirect cycle is rejected","expected":[[0,1],[1,2],[2,3]],"passed":false},{"actual":[[0,1],[1,2],[0,2]],"check":"acyclic transitive edge remains","expected":[[0,1],[1,2],[0,2]],"passed":true},{"actual":[],"check":"empty victories","expected":[],"passed":true},{"actual":[[0,1]],"check":"reverse contest rejected","expected":[[0,1]],"passed":true},{"actual":[[0,1],[1,2],[2,0],[2,3],[3,0]],"check":"rejected edge cannot affect later reachability","expected":[[0,1],[1,2],[2,3]],"passed":false},{"actual":[[0,1],[2,3]],"check":"disconnected components","expected":[[0,1],[2,3]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"long indirect cycle is rejected\", \"actual\": [[0, 1], [1, 2], [2, 3], [3, 0]], \"expected\": [[0, 1], [1, 2], [2, 3]], \"passed\": false}, {\"check\": \"acyclic transitive edge remains\", \"actual\": [[0, 1], [1, 2], [0, 2]], \"expected\": [[0, 1], [1, 2], [0, 2]], \"passed\": true}, {\"check\": \"empty victories\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"reverse contest rejected\", \"actual\": [[0, 1]], \"expected\": [[0, 1]], \"passed\": true}, {\"check\": \"rejected edge cannot affect later reachability\", \"actual\": [[0, 1], [1, 2], [2, 0], [2, 3], [3, 0]], \"expected\": [[0, 1], [1, 2], [2, 3]], \"passed\": false}, {\"check\": \"disconnected components\", \"actual\": [[0, 1], [2, 3]], \"expected\": [[0, 1], [2, 3]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.937,"exit_code":1,"observations":[{"actual":[[0,1],[1,2],[2,3],[3,0]],"check":"long indirect cycle is rejected","expected":[[0,1],[1,2],[2,3]],"passed":false},{"actual":[[0,1],[1,2],[0,2]],"check":"acyclic transitive edge remains","expected":[[0,1],[1,2],[0,2]],"passed":true},{"actual":[],"check":"empty victories","expected":[],"passed":true},{"actual":[[0,1],[1,0]],"check":"reverse contest rejected","expected":[[0,1]],"passed":false},{"actual":[[0,1],[1,2],[2,0],[2,3],[3,0]],"check":"rejected edge cannot affect later reachability","expected":[[0,1],[1,2],[2,3]],"passed":false},{"actual":[[0,1],[2,3]],"check":"disconnected components","expected":[[0,1],[2,3]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"long indirect cycle is rejected\", \"actual\": [[0, 1], [1, 2], [2, 3], [3, 0]], \"expected\": [[0, 1], [1, 2], [2, 3]], \"passed\": false}, {\"check\": \"acyclic transitive edge remains\", \"actual\": [[0, 1], [1, 2], [0, 2]], \"expected\": [[0, 1], [1, 2], [0, 2]], \"passed\": true}, {\"check\": \"empty victories\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"reverse contest rejected\", \"actual\": [[0, 1], [1, 0]], \"expected\": [[0, 1]], \"passed\": false}, {\"check\": \"rejected edge cannot affect later reachability\", \"actual\": [[0, 1], [1, 2], [2, 0], [2, 3], [3, 0]], \"expected\": [[0, 1], [1, 2], [2, 3]], \"passed\": false}, {\"check\": \"disconnected components\", \"actual\": [[0, 1], [2, 3]], \"expected\": [[0, 1], [2, 3]], \"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."}}