Skip to content

Clifford-only RXYXY2Q and RXY1Q reject theta = pi with pi/4 axes, and RXYXY2Q compares theta to exact zero #804

Description

@ciaranra

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)

  1. 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.

  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions