Skip to content

Rename the two-qubit replacement-branch label prefix from *XX to ~XX or :replace:XX - #679

Open
ciaranra wants to merge 1 commit into
devfrom
replacement-label-rename
Open

Rename the two-qubit replacement-branch label prefix from *XX to ~XX or :replace:XX#679
ciaranra wants to merge 1 commit into
devfrom
replacement-label-rename

Conversation

@ciaranra

@ciaranra ciaranra commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

p2_weights dictionaries for DEM building accept two-qubit Pauli labels such as XX as post-gate Pauli branches. A replacement branch, which omits the ideal two-qubit gate before applying the Pauli, was spelled with a * prefix (*XX, *II). The * symbol is being reserved for a different meaning in upcoming noise APIs, so replacement branches are now spelled ~XX or :replace:XX (and ~II / :replace:II for omission only).

Behavior change (breaking for configurations)

  • ~XX and :replace:XX are accepted, equivalent, case-insensitive, and whitespace-trimmed.
  • *XX is rejected with a ValueError that names both new spellings.
  • Supplying both spellings for the same Pauli in one dictionary is rejected as a duplicate.
  • Plain II remains rejected, and its message now points at ~II / :replace:II. That message was unreachable before, because plain II failed the label check first; it is reachable now.
  • DEM builder behavior (PauliWeights::replacement_entries, approximation modes) is unchanged. Docs, diagnostics, and test messages in the DEM builder, the bindings, and the Python NoiseParameters docstrings use the new vocabulary.

Existing user configurations that use *XX will fail at construction with the migration message.

Tests

Rust, in the bindings parser: both spellings parse, case-insensitively; ~II parses as omission-only; *XX is rejected with a hint containing ~XX and :replace:XX; duplicate aliases are rejected; plain II names the new spellings. Python, in the surface-code noise-parameter tests: a ~XX replacement branch builds a DEM and samples; *XX raises ValueError mentioning ~XX.

Verification

  • cargo test -p pecos-qec
  • cargo test -p pecos-rslib p2_weight_parser_tests
  • cargo clippy -p pecos-qec -p pecos-rslib --all-targets -- -D warnings
  • cargo fmt -p pecos-qec -p pecos-rslib -- --check
  • just python-ci-build-test, then pytest on the QEC surface and DEM test files: 338 passed, 18 xfailed
  • just lint check

Context

Second of the separable changes ahead of the state-transition noise channel work.

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