Skip to content

PPVM-traits-2 Patch - #219

Open
JonhasA wants to merge 13 commits into
mainfrom
trait-2/ppvm-traits-2
Open

JonhasA wants to merge 13 commits into
mainfrom
trait-2/ppvm-traits-2

Conversation

@JonhasA

@JonhasA JonhasA commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

A patch to move the changes to ppvm-trait from roger's PR #204

Additionally, the following changes were made:

  1. Added arithmetic module for defining traits to numeric types
  2. added gates module for defining traits for Clifford/ channel / measure/ rotation ops
  3. container module now has additional files related to storage or engine configuration
  4. Moved PREFER_MOVED_RKEY outside of coefficient and into storage.rs in containers/. Engine will configure the key rather than having coefficient module be responsible for it.
  5. Added a LossState trait to be associated with word sites rather than having it in PauliBits.
  6. Isolated functionality related to fermionic factors into fermion_factor.rs
  7. Pauli type is used explicitly for rotation operations
  8. Moves container tests beside their implementations and adds regression coverage for batch hash invalidation and Pauli-channel factors.
  9. Moves pauli_error_factors into the optional PauliErrorFactors channel capability, preserving the generic default and numeric specializations.

…em for ppvm. Focused on moving files to more isolated modules to have better appreciation on module responsibility

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Thanks for opening your first pull request against PPVM!

A quick note on contribution terms: by submitting this PR you
agree that your contribution is licensed under the
Apache License 2.0
and that you accept the
PPVM Contributor License Agreement.
Please skim those before a maintainer reviews — opening this PR
counts as your acceptance.

A few things that will speed up review:

  • Read CONTRIBUTING.md
    for the workflow, build commands, and style notes.
  • Run prek run --all-files locally; CI runs the same checks.
  • Use Conventional Commits
    for commit messages.

We'll get to your PR as soon as we can. Thanks for contributing!

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://QuEraComputing.github.io/ppvm/pr-preview/pr-219/

Built to branch gh-pages at 2026-09-16 17:19 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@david-pl david-pl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall a solid first breakdown of the huge PR, but I think we should make some changes here.

Also, on a more general note: while I get that proving things with lean is beneficial, I think this introduces unneeded complexity at points. For example, to fulfill criteria so this is provably a ring we introduce some traits that are sometimes a bit odd, e.g. Halvable.
cc @Roger-luo

Comment thread crates/ppvm-traits-2/src/arithmetic/coefficient.rs
impl Halvable for f64 {
#[inline]
fn half(&self) -> Self {
*self / 2.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this holds up in the exact x.half() + x.half() == x condition.

Comment thread crates/ppvm-traits-2/src/containers/batch.rs Outdated
/// knows its planes). Operates plane by plane, never scalar on the hot path.
///
/// Design: §"The batch contract".
pub trait KeyColumn: Default + Clone {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this trait seems a bit complex. Can we split it maybe?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When split into a package or a separate module?

Comment thread crates/ppvm-traits-2/src/containers/graded.rs Outdated
Comment thread crates/ppvm-traits-2/src/algebra.rs Outdated
Comment thread crates/ppvm-traits-2/src/fermion_factor.rs Outdated
Comment thread crates/ppvm-traits-2/src/fermion_factor.rs Outdated
Comment thread crates/ppvm-traits-2/src/loss.rs
Comment thread crates/ppvm-traits-2/src/word.rs Outdated
@Roger-luo

Copy link
Copy Markdown
Collaborator

Also, on a more general note: while I get that proving things with lean is beneficial, I think this introduces unneeded complexity at points. For example, to fulfill criteria so this is provably a ring we introduce some traits that are sometimes a bit odd, e.g. Halvable.

For reference, One use case is symbolic expressions. The minimum requirement of a symbolic expression is that it can be divided by half, and it doesn't matter what number that half comes from.

&mut self,
qubit0: usize,
qubit1: usize,
p: [C; 3],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might need similar treatment, like the pauli channrl error coefficient factors, too, because we assume the three parameters also satisfy the normalization condition, right?

}

/// Batched Clifford gates: apply the same gate to many qubits in one call.
pub trait CliffordBatch: Clifford {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking if there is a way to generalize this based on the Clifford trait, but I didn't really find a good way to define a broadcast trait in general, so I ended up doing this.

@Roger-luo
Roger-luo requested a review from david-pl September 20, 2026 23:42
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.

3 participants