Skip to content

Qutrit conformance: pinned css-decoupling SUM/SWAP and toric fixtures - #624

Merged
EmergentMonk merged 2 commits into
mainfrom
test/qutrit-css-decoupling-conformance
Nov 1, 2026
Merged

EmergentMonk merged 2 commits into
mainfrom
test/qutrit-css-decoupling-conformance

Conversation

@EmergentMonk

@EmergentMonk EmergentMonk commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

QEC's exact qutrit tests now have an external prime-field donor from He et al., Toric codes all the way down (arXiv:2610.40592v1). Pin css-decoupling at a48048c1097f4d1b37a55eca9a1796a823f0c124 and add six small circuit fixtures, including the general algorithm's verified 17-gate toric output with four input ancillas.

The 27 new offline tests independently replay SUM/SWAP actions and inverses on finite tori, check GF(3) symplectic pairings, detect four wrong gate conventions, compare toric ranks and syndrome covariance, and correct all 144 single-site errors on the 3×3 torus using QEC's unchanged decoder. The optional generator verifies the donor result against its input, checks source/import and dependency pins, compares every fixture byte, and refuses output overwrites. README, a linked research/roadmap supplement, source notes and MIT attribution are included. The migration-bound roadmap and preservation manifest remain unchanged.

Claim boundaries: the separate Lean formalization does not verify Python; the default SymPy backend does not inherit Proposition 1's polynomial runtime guarantee. These are finite software comparisons, not hardware, threshold, speedup, acoustic-protection or decoder-promotion evidence. Offline tests do not independently verify the full upstream decoupling certificate. No production decoder source, historical fixture, release number or core dependency changes.

Validation at 8851e4ad5792d3434cc3885ad08da48ef307ad31

  • Full repository suite: 21,328 passed, 103 skipped, four passing subtests, four existing dependency-deprecation warnings; exit 0.
  • New conformance suite plus existing qutrit stabilizer suite: 39 passed. Preservation tests: 7 passed. Import-hygiene tests: 9 passed.
  • Pinned donor regeneration: byte-identical match. Wrong-revision and existing-output rejection checks passed.
  • git diff --check: passed; pushed tree matches local files.

Skipped paths include unavailable cryptography, Stim/PyMatching, CuPy and other optional modules, an unbuilt Rust TUI, a Windows-only case and a sandbox socket restriction. No GPU execution or Lean build is claimed.

GitHub Crossbar validation and Proof HTML checks have succeeded. The GitHub full regression/container pipeline is still in progress; local results above are complete. PR remains unmerged.

Summary by Sourcery

Add bounded, independently replayed GF(3) qutrit conformance coverage using pinned SUM/SWAP and toric-code fixtures without changing production decoders or core dependencies.

New Features:

  • Add pinned GF(3) qutrit SUM/SWAP and toric-code conformance fixtures for independent finite-torus replay.
  • Provide optional donor-based fixture regeneration with revision, dependency, provenance, and overwrite safeguards.

Enhancements:

  • Add independent validation of qutrit gate actions, inverse and symplectic properties, toric ranks, syndrome covariance, and single-site error correction.
  • Document the conformance scope, claim boundaries, donor attribution, and licensing.

Documentation:

  • Document qutrit circuit conformance, reproduction steps, limitations, and third-party licensing.

Tests:

  • Add 27 offline conformance tests covering gate conventions, toric-code invariants, and correction of all single-site qutrit errors on the 3×3 torus.

@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an offline, finite GF(3) qutrit conformance suite backed by a reproducibly pinned css-decoupling donor: a guarded generator produces canonical SUM/SWAP and toric fixtures, independent tests replay and validate their algebra and QEC behavior, and documentation records provenance, licensing, reproduction steps, and strict claim boundaries without altering production decoder code or dependencies.

Sequence diagram for pinned qutrit fixture regeneration

sequenceDiagram
    participant Generator as generate_qutrit_css_fixtures.py
    participant Donor as Pinned css_decoupling checkout
    participant SymPy as SymPy and mpmath
    participant Fixture as JSON fixture

    Generator->>Donor: check_checkout()
    Donor-->>Generator: pinned clean commit
    Generator->>Donor: import Matrix, Ring, decouple, verify_result
    Generator->>SymPy: verify pinned versions
    Generator->>Donor: decouple(hx, hz, algorithm="general", output="circuit")
    Donor-->>Generator: circuit_ready toric result
    Generator->>Donor: verify_result(result, expected_HX=hx, expected_HZ=hz)
    Donor-->>Generator: valid
    Generator->>Fixture: canonical_bytes(build_fixture())
    alt --check
        Generator->>Fixture: compare bytes
    else --output
        Generator->>Fixture: open("xb") and write new artifact
    end
Loading

Flow diagram for offline GF(3) qutrit conformance

flowchart LR
    Fixture[Saved SUM/SWAP and toric fixtures] --> Replay[Independent finite-torus gate replay]
    Replay --> Actions[Compare X/Z and inverse actions]
    Replay --> Pairing["Preserve GF(3) symplectic pairings"]
    Fixture --> Toric[Expand toric input on finite tori]
    Toric --> Ranks[Compare ranks and logical dimensions]
    Toric --> Syndrome[Check syndrome covariance]
    Toric --> Decoder[ExactDecoder corrects 144 single-site errors]
    Actions --> Result[Finite software conformance]
    Pairing --> Result
    Ranks --> Result
    Syndrome --> Result
    Decoder --> Result
Loading

File-Level Changes

Change Details Files
Adds a pinned, optional donor-based fixture-generation workflow for exact GF(3) qutrit circuit and toric-code conformance.
  • Pins the css-decoupling donor commit and SymPy/mpmath versions, validates checkout cleanliness/import provenance, and verifies the donor toric result before export.
  • Generates canonical JSON containing SUM/SWAP cases, inverse actions, a verified 17-gate general toric circuit, finite-torus rank metadata, provenance, and claim-boundary flags.
  • Prevents accidental fixture overwrites and supports byte-for-byte regeneration checks.
scripts/generate_qutrit_css_fixtures.py
tests/fixtures/research/qutrit-css-decoupling-v1.json
Introduces independent offline replay tests that validate saved circuit actions and integrate the toric fixtures with existing qutrit QEC functionality.
  • Replays SUM/SWAP gates directly on finite tori and compares forward/inverse X/Z actions, two-sided inverses, and GF(3) symplectic preservation across collapsed and nontrivial periods.
  • Uses negative controls to detect incorrect weights, displacement signs, gate order, and missing SWAP operations.
  • Checks toric ranks, logical dimensions, syndrome covariance, and correction of all 144 single-site nonidentity qutrit Paulis on the 3×3 torus with the unchanged ExactDecoder.
tests/test_qutrit_css_decoupling_conformance.py
Documents the conformance scope, provenance, licensing, reproduction process, and explicit scientific claim limitations.
  • Adds research documentation covering donor attribution, conventions, fixture contents, reproduction commands, and boundaries around Lean, runtime, theorem, hardware, and decoder claims.
  • Records the donor MIT license and optional-tool status in third-party licensing documentation.
  • Links the bounded qutrit conformance work from the README, roadmap, and scientific references without changing production dependencies or release milestones.
docs/research/QUTRIT_CSS_DECOUPLING_CONFORMANCE.md
THIRD_PARTY_LICENSES/css-decoupling-MIT.txt
docs/LEGAL_THIRD_PARTY.md
README.md
docs/roadmap/ROADMAP.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@EmergentMonk
EmergentMonk marked this pull request as ready for review November 1, 2026 22:58
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Sorry @EmergentMonk, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 8 hours and 17 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T22:59:28.679177Z dcaa663 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-01T23:00:14.797679Z dcaa663 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@EmergentMonk
EmergentMonk merged commit ee3c207 into main Nov 1, 2026
6 checks passed
@EmergentMonk
EmergentMonk deleted the test/qutrit-css-decoupling-conformance branch November 1, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant