Skip to content

feat(PBV): Convert multiplication of masks into shifts of popcounts. - #1565

Merged
luigirinaldi merged 4 commits into
mainfrom
luigirinaldi/bpbv-perf
Sep 30, 2026
Merged

luigirinaldi merged 4 commits into
mainfrom
luigirinaldi/bpbv-perf

Conversation

@luigirinaldi

@luigirinaldi luigirinaldi commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Change push theorem of append and the theorem relating additions of masks, to shift instead of multiplying masks. The value of the width can be retrieved from its mask by computing the popcount of the mask, which is a much more efficient circuit for bit-blasting.

add_widening_generic proofs for 64 bits goes from 4.5s → 539ms (8.4×) and from timing out at 128-bits to 1.2s. Similar speed ups on the examples in BoundedBitblasting containing append operations.

While implementing this, ran into a bug in grind, so had to update how masks of literals are stated. This also meant some of the code for pretty counterexample printing became redundant.

@tobiasgrosser

Copy link
Copy Markdown
Collaborator

Nice. Luigi, can you add the perf improvements into the commit message. Also, tag Luisa when this is ready to review. I am sure she is curious about this change.

@luigirinaldi
luigirinaldi force-pushed the luigirinaldi/bpbv-perf branch 2 times, most recently from 12ba99a to 9eec291 Compare September 28, 2026 16:40
@luigirinaldi

Copy link
Copy Markdown
Contributor Author

Nice. Luigi, can you add the perf improvements into the commit message. Also, tag Luisa when this is ready to review. I am sure she is curious about this change.

will do, I ran into some grind bug I had to work around.

@luigirinaldi
luigirinaldi marked this pull request as ready for review September 28, 2026 16:41
@luigirinaldi

Copy link
Copy Markdown
Contributor Author

@luisacicolini

@naveen-seth naveen-seth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool! When this has landed, I'll see if #1524 could work with a 64 bit bound!

Comment thread Veir/Data/PBV/Mask.lean Outdated
Comment thread UnitTest/BoundedBitblasting/CounterExamples.lean Outdated
Comment thread Veir/Data/PBV/Mask.lean Outdated
Comment thread Veir/Data/PBV/Mask.lean Outdated

@luisacicolini luisacicolini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm (only reviewed style)

@tobiasgrosser tobiasgrosser 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.

Nice.

Comment thread Veir/Data/PBV/Mask.lean Outdated
Co-authored-by: Tobias Christian Grosser <tobias@grosser.es>
@luigirinaldi
luigirinaldi added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit ece918e Sep 30, 2026
6 checks passed
@luigirinaldi
luigirinaldi deleted the luigirinaldi/bpbv-perf branch September 30, 2026 09:46
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.

4 participants