FA-91052 / Quantum circuit simulation / Member archive
Direction fixer wraps Hadamards around the unflipped CNOT · case 02
A reversed CNOT is emitted as h c, h t, cx c t, h c, h t, still in the non-native direction.
Case 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].
Why this case matters
Direction fixing is a mandatory transpiler pass for devices with directed couplers; errors either break hardware constraints or bloat circuits.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: random coupling 25 | [["h", 1], ["h", 0], ["cx", 1, 0], ["h", 1], ["h", 0], ["cx", 0, 2], ["x", 1], ["x", 3], ["h", 3]] | [["h", 1], ["h", 0], ["cx", 0, 1], ["h", 1], ["h", 0], ["cx", 0, 2], ["x", 1], ["x", 3], ["h", 3]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗