Summary
The Clifford-only entry points for the two XY-plane rotations reject some inputs that are Clifford, and one of them is inconsistent with its own single-angle helper about what "zero rotation" means.
try_rxyxy2q (crates/pecos-simulators/src/clifford_rotation.rs, added in #788)
-
The early return tests theta == Angle64::ZERO exactly, whereas try_rxx snaps theta within the Clifford tolerance. A theta within tolerance of zero combined with a non-Clifford phi is rejected even though the gate is the identity. try_simplify_rxy1q snaps theta before comparing; the same should happen here. The Selene stabilizer plugin (python/selene-plugins/pecos-selene-stabilizer/src/lib.rs) already snaps on its side, so it does not see this.
-
theta = pi with phi an odd multiple of pi/4 is Clifford: the gate is -i P(phi) (x) P(phi) and P(pi/4) = (X + Y) / sqrt(2) conjugates X to Y, Y to X and Z to -Z. Selene's own Stim simulator accepts these cases (see its rpp table). PECOS rejects them because the precheck asks for RZ(phi) to be Clifford, which is a sufficient condition, not a necessary one.
try_rxy1q / try_simplify_rxy1q (crates/pecos-core/src/clifford_simplify.rs)
The same gap as (2) exists for the single-qubit gate: RXY1Q(pi, pi/4) is -i (X + Y) / sqrt(2), a Clifford, and is rejected. The documented table in try_simplify_rxy1q lists only quarter-turn axes.
Expected
- Snap theta before the zero check in
try_rxyxy2q.
- Accept
theta = pi with phi any multiple of pi/4 in both gates, dispatching to the appropriate named Cliffords (SZdg; X; Z-style sequences per Selene's table, or whatever the tableau lookup gives). Phase must be tracked, not dropped; the existing phase-exactness tests are the gate for that.
- Extend
try_rxyxy2q_matches_xx_and_yy_rotations and the RXY1Q tests with the new axes, using an independent oracle.
Provenance
Found during an AI-assisted review of #788 and deferred out of that PR so it can merge. Not a correctness bug: every rejected case fails loudly.
Summary
The Clifford-only entry points for the two XY-plane rotations reject some inputs that are Clifford, and one of them is inconsistent with its own single-angle helper about what "zero rotation" means.
try_rxyxy2q(crates/pecos-simulators/src/clifford_rotation.rs, added in #788)The early return tests
theta == Angle64::ZEROexactly, whereastry_rxxsnaps theta within the Clifford tolerance. A theta within tolerance of zero combined with a non-Clifford phi is rejected even though the gate is the identity.try_simplify_rxy1qsnaps theta before comparing; the same should happen here. The Selene stabilizer plugin (python/selene-plugins/pecos-selene-stabilizer/src/lib.rs) already snaps on its side, so it does not see this.theta = piwithphian odd multiple ofpi/4is Clifford: the gate is-i P(phi) (x) P(phi)andP(pi/4) = (X + Y) / sqrt(2)conjugates X to Y, Y to X and Z to -Z. Selene's own Stim simulator accepts these cases (see itsrpptable). PECOS rejects them because the precheck asks forRZ(phi)to be Clifford, which is a sufficient condition, not a necessary one.try_rxy1q/try_simplify_rxy1q(crates/pecos-core/src/clifford_simplify.rs)The same gap as (2) exists for the single-qubit gate:
RXY1Q(pi, pi/4)is-i (X + Y) / sqrt(2), a Clifford, and is rejected. The documented table intry_simplify_rxy1qlists only quarter-turn axes.Expected
try_rxyxy2q.theta = piwithphiany multiple ofpi/4in both gates, dispatching to the appropriate named Cliffords (SZdg; X; Z-style sequences per Selene's table, or whatever the tableau lookup gives). Phase must be tracked, not dropped; the existing phase-exactness tests are the gate for that.try_rxyxy2q_matches_xx_and_yy_rotationsand theRXY1Qtests with the new axes, using an independent oracle.Provenance
Found during an AI-assisted review of #788 and deferred out of that PR so it can merge. Not a correctness bug: every rejected case fails loudly.