{"abstract":"cx 2 2 is reported as [\"unroutable\", i] instead of [\"invalid\", i], hiding a malformed circuit behind a hardware message.","category":"Quantum circuit simulation","checks":7,"contract":"Input [edges, ops]; edges are directed native CNOT pairs [c, t]. Each [\"cx\", c, t] is kept if [c, t] is native, else rewritten as h c, h t, cx t c, h c, h t if [t, c] is native, else the result is [\"unroutable\", op index]; c == t gives [\"invalid\", op index]. Other ops pass through. A final stack pass cancels an [\"h\", q] against an identical immediately preceding [\"h\", q].","contract_signature":"x","evaluation_group":"w2-quantum_circuit_simulation-coupling-direction-fix","failed_approach":"The attempted repair silently drops self-targeting CNOTs instead of reporting them.","family":"w2-quantum_circuit_simulation-coupling-direction-fix-self-loop-validation","id":"FA-91056","implementations":{"attempt":{"sha256":"9580e692730b88d0dc74d03d6fb9a196ebf55a1de48c2f725019e0a43562ba24","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    edges, ops = x\n    allowed = {(a, b) for a, b in edges}\n    out = []\n    for idx, op in enumerate(ops):\n        if op[0] != 'cx':\n            out.append(list(op))\n            continue\n        c, t = op[1], op[2]\n        if c == t:\n            continue\n        if (c, t) in allowed:\n            out.append(['cx', c, t])\n        elif (t, c) in allowed:\n            out += [['h', c], ['h', t], ['cx', t, c], ['h', c], ['h', t]]\n        else:\n            return ['unroutable', idx]\n    res = []\n    for op in out:\n        if op[0] == 'h' and res and res[-1] == op:\n            res.pop()\n        else:\n            res.append(op)\n    return res\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: self loop', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['cx', 2, 2]]], ['invalid', 1]], ['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['control: native direction', [[[0, 1], [1, 2], [2, 3]], [['cx', 0, 1]]], [['cx', 0, 1]]], ['control: reversed direction', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1], ['h', 0]]], ['control: bidirectional edge', [[[0, 1], [1, 0]], [['cx', 1, 0]]], [['cx', 1, 0]]], ['control: unroutable pair', [[[0, 1], [1, 2], [2, 3]], [['h', 1], ['cx', 0, 2]]], ['unroutable', 1]]], [['regression: random coupling 42', [[[1, 0], [0, 2], [1, 2]], [['h', 1], ['cx', 1, 1], ['cx', 2, 0], ['h', 2], ['h', 3]]], ['invalid', 1]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['control: hadamards cancel', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['h', 0], ['x', 1]]], [['x', 1]]], ['control: hadamards on different qubits', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['h', 1]]], [['h', 0], ['h', 1]]], ['control: flip then h cancels', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0], ['h', 0]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1]]], ['control: flip then h on target cancels', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0], ['h', 1], ['cx', 0, 1]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1], ['h', 0], ['h', 1], ['cx', 0, 1]]]], [['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['control: random coupling 0', [[[2, 1], [3, 2], [1, 2], [1, 0]], [['h', 2], ['cx', 1, 0], ['cx', 2, 0], ['x', 1]]], ['unroutable', 2]], ['control: random coupling 1', [[[2, 3], [3, 2], [0, 1], [0, 2]], [['h', 1]]], [['h', 1]]], ['control: random coupling 2', [[[0, 2], [2, 3], [2, 1]], [['h', 3]]], [['h', 3]]], ['control: random coupling 3', [[[1, 0], [2, 3]], [['cx', 1, 2], ['h', 1], ['x', 2]]], ['unroutable', 0]]], [['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['regression: self loop', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['cx', 2, 2]]], ['invalid', 1]], ['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['control: random coupling 4', [[[0, 2], [2, 3]], [['h', 0], ['cx', 0, 3], ['cx', 2, 0], ['x', 3]]], ['unroutable', 1]], ['control: random coupling 5', [[[3, 2], [0, 2], [2, 3], [1, 2]], [['cx', 1, 0], ['h', 3], ['h', 0], ['cx', 0, 3]]], ['unroutable', 0]], ['control: random coupling 6', [[[0, 1], [2, 1]], [['cx', 2, 0], ['x', 2], ['cx', 0, 2], ['cx', 3, 0], ['h', 3], ['h', 3]]], ['unroutable', 0]], ['control: random coupling 7', [[[0, 1], [2, 3], [2, 1], [1, 2]], [['cx', 1, 3]]], ['unroutable', 0]]], [['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['regression: random coupling 42', [[[1, 0], [0, 2], [1, 2]], [['h', 1], ['cx', 1, 1], ['cx', 2, 0], ['h', 2], ['h', 3]]], ['invalid', 1]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['control: random coupling 8', [[[2, 1], [1, 2], [3, 2]], [['x', 0], ['h', 3]]], [['x', 0], ['h', 3]]], ['control: random coupling 9', [[[0, 2], [0, 1], [1, 2], [3, 2]], [['h', 1], ['cx', 0, 2]]], [['h', 1], ['cx', 0, 2]]], ['control: random coupling 10', [[[0, 2], [2, 1], [3, 2]], [['h', 2], ['cx', 1, 0]]], ['unroutable', 1]], ['control: random coupling 12', [[[0, 2], [3, 2]], [['x', 2], ['cx', 3, 1], ['h', 2], ['h', 3]]], ['unroutable', 1]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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":"8bb8e730b434e9f083056960a8c2b610c48485d7e47f9f0d8041f3f635870d2f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    edges, ops = x\n    allowed = {(a, b) for a, b in edges}\n    out = []\n    for idx, op in enumerate(ops):\n        if op[0] != 'cx':\n            out.append(list(op))\n            continue\n        c, t = op[1], op[2]\n        if (c, t) in allowed:\n            out.append(['cx', c, t])\n        elif (t, c) in allowed:\n            out += [['h', c], ['h', t], ['cx', t, c], ['h', c], ['h', t]]\n        else:\n            return ['unroutable', idx]\n    res = []\n    for op in out:\n        if op[0] == 'h' and res and res[-1] == op:\n            res.pop()\n        else:\n            res.append(op)\n    return res\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: self loop', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['cx', 2, 2]]], ['invalid', 1]], ['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['control: native direction', [[[0, 1], [1, 2], [2, 3]], [['cx', 0, 1]]], [['cx', 0, 1]]], ['control: reversed direction', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1], ['h', 0]]], ['control: bidirectional edge', [[[0, 1], [1, 0]], [['cx', 1, 0]]], [['cx', 1, 0]]], ['control: unroutable pair', [[[0, 1], [1, 2], [2, 3]], [['h', 1], ['cx', 0, 2]]], ['unroutable', 1]]], [['regression: random coupling 42', [[[1, 0], [0, 2], [1, 2]], [['h', 1], ['cx', 1, 1], ['cx', 2, 0], ['h', 2], ['h', 3]]], ['invalid', 1]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['control: hadamards cancel', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['h', 0], ['x', 1]]], [['x', 1]]], ['control: hadamards on different qubits', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['h', 1]]], [['h', 0], ['h', 1]]], ['control: flip then h cancels', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0], ['h', 0]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1]]], ['control: flip then h on target cancels', [[[0, 1], [1, 2], [2, 3]], [['cx', 1, 0], ['h', 1], ['cx', 0, 1]]], [['h', 1], ['h', 0], ['cx', 0, 1], ['h', 1], ['h', 0], ['h', 1], ['cx', 0, 1]]]], [['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['control: random coupling 0', [[[2, 1], [3, 2], [1, 2], [1, 0]], [['h', 2], ['cx', 1, 0], ['cx', 2, 0], ['x', 1]]], ['unroutable', 2]], ['control: random coupling 1', [[[2, 3], [3, 2], [0, 1], [0, 2]], [['h', 1]]], [['h', 1]]], ['control: random coupling 2', [[[0, 2], [2, 3], [2, 1]], [['h', 3]]], [['h', 3]]], ['control: random coupling 3', [[[1, 0], [2, 3]], [['cx', 1, 2], ['h', 1], ['x', 2]]], ['unroutable', 0]]], [['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['regression: self loop', [[[0, 1], [1, 2], [2, 3]], [['h', 0], ['cx', 2, 2]]], ['invalid', 1]], ['regression: random coupling 11', [[[2, 3], [1, 2], [3, 2], [0, 2]], [['cx', 2, 3], ['cx', 0, 2], ['h', 2], ['cx', 1, 1], ['h', 0]]], ['invalid', 3]], ['control: random coupling 4', [[[0, 2], [2, 3]], [['h', 0], ['cx', 0, 3], ['cx', 2, 0], ['x', 3]]], ['unroutable', 1]], ['control: random coupling 5', [[[3, 2], [0, 2], [2, 3], [1, 2]], [['cx', 1, 0], ['h', 3], ['h', 0], ['cx', 0, 3]]], ['unroutable', 0]], ['control: random coupling 6', [[[0, 1], [2, 1]], [['cx', 2, 0], ['x', 2], ['cx', 0, 2], ['cx', 3, 0], ['h', 3], ['h', 3]]], ['unroutable', 0]], ['control: random coupling 7', [[[0, 1], [2, 3], [2, 1], [1, 2]], [['cx', 1, 3]]], ['unroutable', 0]]], [['regression: random coupling 31', [[[1, 2], [1, 0], [0, 1], [0, 2]], [['cx', 1, 1]]], ['invalid', 0]], ['regression: random coupling 42', [[[1, 0], [0, 2], [1, 2]], [['h', 1], ['cx', 1, 1], ['cx', 2, 0], ['h', 2], ['h', 3]]], ['invalid', 1]], ['regression: random coupling 48', [[[2, 1], [0, 2], [2, 3], [3, 2], [0, 1]], [['cx', 1, 1], ['cx', 1, 2], ['cx', 1, 2], ['cx', 0, 3], ['h', 0], ['cx', 0, 2]]], ['invalid', 0]], ['control: random coupling 8', [[[2, 1], [1, 2], [3, 2]], [['x', 0], ['h', 3]]], [['x', 0], ['h', 3]]], ['control: random coupling 9', [[[0, 2], [0, 1], [1, 2], [3, 2]], [['h', 1], ['cx', 0, 2]]], [['h', 1], ['cx', 0, 2]]], ['control: random coupling 10', [[[0, 2], [2, 1], [3, 2]], [['h', 2], ['cx', 1, 0]]], ['unroutable', 1]], ['control: random coupling 12', [[[0, 2], [3, 2]], [['x', 2], ['cx', 3, 1], ['h', 2], ['h', 3]]], ['unroutable', 1]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, 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 with a stipulated toy contract; amplitudes are rounded to fixed decimals for strict JSON output. It is not a production quantum SDK and claims no standards conformance. 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":"w2-quantum_circuit_simulation-coupling-direction-fix-self-loop-validation","generated_at":"2026-09-29T14:51:32.333181+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Direction fixing is a mandatory transpiler pass for devices with directed couplers; errors either break hardware constraints or bloat circuits.","root_cause":"The c == t guard is missing, so the op falls through to the coupling lookup.","sha256":"b769436402de334e904fcb02807e7279223a50115d262129e17c9df7042942af","title":"Direction fixer reports self-targeting CNOT as unroutable · 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.95,"exit_code":1,"observations":[{"actual":[["h",0]],"check":"regression: self loop","expected":["invalid",1],"passed":false},{"actual":[["cx",2,3],["cx",0,2],["h",2],["h",0]],"check":"regression: random coupling 11","expected":["invalid",3],"passed":false},{"actual":[],"check":"regression: random coupling 31","expected":["invalid",0],"passed":false},{"actual":[["cx",0,1]],"check":"control: native direction","expected":[["cx",0,1]],"passed":true},{"actual":[["h",1],["h",0],["cx",0,1],["h",1],["h",0]],"check":"control: reversed direction","expected":[["h",1],["h",0],["cx",0,1],["h",1],["h",0]],"passed":true},{"actual":[["cx",1,0]],"check":"control: bidirectional edge","expected":[["cx",1,0]],"passed":true},{"actual":["unroutable",1],"check":"control: unroutable pair","expected":["unroutable",1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: self loop\", \"actual\": [[\"h\", 0]], \"expected\": [\"invalid\", 1], \"passed\": false}, {\"check\": \"regression: random coupling 11\", \"actual\": [[\"cx\", 2, 3], [\"cx\", 0, 2], [\"h\", 2], [\"h\", 0]], \"expected\": [\"invalid\", 3], \"passed\": false}, {\"check\": \"regression: random coupling 31\", \"actual\": [], \"expected\": [\"invalid\", 0], \"passed\": false}, {\"check\": \"control: native direction\", \"actual\": [[\"cx\", 0, 1]], \"expected\": [[\"cx\", 0, 1]], \"passed\": true}, {\"check\": \"control: reversed direction\", \"actual\": [[\"h\", 1], [\"h\", 0], [\"cx\", 0, 1], [\"h\", 1], [\"h\", 0]], \"expected\": [[\"h\", 1], [\"h\", 0], [\"cx\", 0, 1], [\"h\", 1], [\"h\", 0]], \"passed\": true}, {\"check\": \"control: bidirectional edge\", \"actual\": [[\"cx\", 1, 0]], \"expected\": [[\"cx\", 1, 0]], \"passed\": true}, {\"check\": \"control: unroutable pair\", \"actual\": [\"unroutable\", 1], \"expected\": [\"unroutable\", 1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.921,"exit_code":1,"observations":[{"actual":["unroutable",1],"check":"regression: self loop","expected":["invalid",1],"passed":false},{"actual":["unroutable",3],"check":"regression: random coupling 11","expected":["invalid",3],"passed":false},{"actual":["unroutable",0],"check":"regression: random coupling 31","expected":["invalid",0],"passed":false},{"actual":[["cx",0,1]],"check":"control: native direction","expected":[["cx",0,1]],"passed":true},{"actual":[["h",1],["h",0],["cx",0,1],["h",1],["h",0]],"check":"control: reversed direction","expected":[["h",1],["h",0],["cx",0,1],["h",1],["h",0]],"passed":true},{"actual":[["cx",1,0]],"check":"control: bidirectional edge","expected":[["cx",1,0]],"passed":true},{"actual":["unroutable",1],"check":"control: unroutable pair","expected":["unroutable",1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: self loop\", \"actual\": [\"unroutable\", 1], \"expected\": [\"invalid\", 1], \"passed\": false}, {\"check\": \"regression: random coupling 11\", \"actual\": [\"unroutable\", 3], \"expected\": [\"invalid\", 3], \"passed\": false}, {\"check\": \"regression: random coupling 31\", \"actual\": [\"unroutable\", 0], \"expected\": [\"invalid\", 0], \"passed\": false}, {\"check\": \"control: native direction\", \"actual\": [[\"cx\", 0, 1]], \"expected\": [[\"cx\", 0, 1]], \"passed\": true}, {\"check\": \"control: reversed direction\", \"actual\": [[\"h\", 1], [\"h\", 0], [\"cx\", 0, 1], [\"h\", 1], [\"h\", 0]], \"expected\": [[\"h\", 1], [\"h\", 0], [\"cx\", 0, 1], [\"h\", 1], [\"h\", 0]], \"passed\": true}, {\"check\": \"control: bidirectional edge\", \"actual\": [[\"cx\", 1, 0]], \"expected\": [[\"cx\", 1, 0]], \"passed\": true}, {\"check\": \"control: unroutable pair\", \"actual\": [\"unroutable\", 1], \"expected\": [\"unroutable\", 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."}}