Skip to content

Fix RV32IM bitwise M31 word collisions#25

Merged
this-vishalsingh merged 1 commit intomainfrom
fix/rv32im-bitwise-limb-constraints
May 1, 2026
Merged

Fix RV32IM bitwise M31 word collisions#25
this-vishalsingh merged 1 commit intomainfrom
fix/rv32im-bitwise-limb-constraints

Conversation

@this-vishalsingh
Copy link
Copy Markdown
Collaborator

Summary

  • bind RV32IM AND/OR/XOR and ANDI/ORI/XORI bit witnesses to low/high 16-bit limbs instead of reconstructing full 32-bit words in M31
  • emit individual bit, limb, and logic constraints from evaluate_all instead of one cancelable aggregate per bitwise instruction
  • derive STARK constraint alpha count from the actual AIR constraint vector so the expanded constraints are included
  • update bitwise benchmarks for vector-valued bitwise constraints

Closes #11.

Review notes

PR #12 is not sufficient: it avoids the collision by ignoring bit 31, which rejects valid RV32 values such as 0x80000000 ^ 0 = 0x80000000. This PR preserves full RV32 semantics.

Verification

  • cargo test -p zp1-air
  • cargo test -p zp1-air --benches
  • cargo check --workspace
  • cargo check -p zp1-prover
  • cargo bench -p zp1-air --bench constraint_bench Bitwise_Constraints

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.

Issue in M31 Field Arithmetic in xor_constraint Constraint Verification

1 participant