How to activate partial mode in Z3py?

117 views Asked by At

I am using Z3's Python bindings and am curious wether partial mode would speed up my model. However there doesn't seem to be a way to do this in Python. (set_param(...) doesn"t seem to have a parameter for it)

I considered migrating to pySMT since it claims to support partial mode for Z3, but I would prefer to keep Z3Py.

Bonus question: Would partial mode actually do me any good? I am simulating computer memory in Arrays and want Z3 to ignore entries that are never referenced.

1

There are 1 answers

0
alias On BEST ANSWER

This is how you can set partial models:

from z3 import *

print get_param('model.partial')
set_param('model.partial', True)
print get_param('model.partial')

This prints:

false
true

Regarding your bonus question: I doubt partial models will buy you anything. SMT solvers typically find a model in case of sat and then complete the model as necessary. The "finding the model" part is typically the costly action, not completing the model. But it of course depends on your particular problem; so it wouldn't hurt to try.