-
Notifications
You must be signed in to change notification settings - Fork 92
Enhance div_xy_y to support signed and unsigned division simplification
#576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
587ac5e to
f3ee43e
Compare
0xkarmacoma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @sidarth16, note that it would cool to add a couple unit tests to verify the functionality
deferring to @daejunpark for the actual div_xy_y logic safety.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the div_xy_y helper function to handle simplifications for both unsigned (DIV) and signed (SDIV) EVM operations. The enhancement allows expressions like (x * y) / x or (x * y) / y to be simplified automatically, improving symbolic reasoning performance in arithmetic analysis.
Key changes:
- Extended
div_xy_yto support signed division with a newsignedparameter - Updated the arithmetic operation handler to use
div_xy_yfor both DIV and SDIV operations - Removed TODO comments indicating this functionality was planned
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/halmos/sevm.py | Enhanced div_xy_y with signed division support and integrated it into DIV/SDIV operations |
| src/halmos/bitvec.py | Removed TODO comments for division simplification functionality |
Summary
This PR updates the
div_xy_yhelper to handle simplifications for both unsigned (DIV) and signed (SDIV) EVM operations. It allows expressions like(x * y) / xor(x * y) / yto be simplified automatically, improving symbolic reasoning and reducing complexity in arithmetic analysis.Changes
signed: boolparameter todiv_xy_y.arithto calldiv_xy_yfor both DIV and SDIV before falling back to generic operations.Notes