Skip to content
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

Why Can't (V & 65535) >> 15 Be Simplified Further in Z3? #7460

Open
Invincibl-e opened this issue Nov 22, 2024 · 0 comments
Open

Why Can't (V & 65535) >> 15 Be Simplified Further in Z3? #7460

Invincibl-e opened this issue Nov 22, 2024 · 0 comments

Comments

@Invincibl-e
Copy link

I am working with Z3 and encountered an issue where an expression involving bitwise operations is not being simplified as expected. Here's the Python code snippet:

from z3 import *

V = BitVec('V', 32)

expr = simplify((V & 65535) << 17 | (V & 65535) >> 15)
print(expr)

In the output, the right-shift operation (V & 65535) >> 15 is not further simplified. I originally expected Z3 to optimize this expression, particularly by eliminating the redundant (V & 65535).

My questions are:

  1. Why does Z3 retain the current form of the expression without simplifying the redundancy in (V & 65535)?
  2. Are there specific settings, tactics or options that can force Z3 to further optimize this?
  3. If this is a known limitation or intentional behavior in Z3, what are the recommended approaches or alternatives for optimizing such expressions?
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

No branches or pull requests

1 participant