-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Does Z3 use bounds on Bitvectors to reduce them to lower size/width? #6137
Comments
It tries to, but in the current tactic called reduce-bv-size it doesn't detect this pattern.
Bit-size reduction would only be available as pre-processing so your BMC queries cannot use the incremental mode. |
I understand the problem with incrementality if I add such bounds later on. |
- add option smt.bv.reduce_size. - it allows to apply incremental pre-processing of bit-vectors by identifying ranges that are known to be constant. This rewrite is beneficial, for instance, when bit-vectors are constrained to have many high-level bits set to 0.
You can try it out smt.bv.size_reduce=true |
I have a bounded model checking application which encodes the data-flow of a program with 64-bit bitvectors.
Using static analysis, it may be possible to derive a priori bounds on bv-variables, that would allow them to be encoded with less bits.
Say I know that some variable is bounded by
2^16
, I'm wondering if there is a difference in directly encoding the variable as 16-bit or as 64-bit but asserting0 <= V <= 2^16
as an additional constraint.Will this constraint be used to effectively reduce the variable down to 16 bit during Bit-blasting and then get discarded entirely?
I'm asking this for two reasons:
As a side question: Does Z3 try to infer bounds automatically to reduce the Bit-Blasting? If so, is it possible to check how many boolean variables it actually ended up creating to get a gist of how well it derived bounds? In particular, It would be interesting to see if adding explicit bounds to some variables actually reduces the bit-blasted formula (if not, then Z3 was able to derive the bounds by itself).
The text was updated successfully, but these errors were encountered: