I'm using latest z3 master code from Codeplex, tagged as v4.3.1.
I want a function like prove
that has a useful return value and does not print. So, I wrote what seemed obvious:
def prove2(claim):
s = Solver()
s.add(Not(claim))
if s.check() == unsat:
return True, []
return False, s.model()
However, this code runs dramatically slower than the default prove
function.
The code for prove
(slimmed) in src/api/python/z3.py
is:
def prove(claim, **keywords):
s = Solver()
s.set(**keywords)
s.add(Not(claim))
if keywords.get('show', False):
print s
r = s.check()
if r == unsat:
print "proved"
elif r == unknown:
print "failed to prove"
print s.model()
else:
print "counterexample"
print s.model()
When I add s.set()
to my code, it is fast and finds the same counterexample.
What is going on here?
- Does that empty call to
s.set()
somehow clear some option that is bad in general? - .. bad for my particular test?
- Something else?
I tried to find out what the default solver options were, but str(s)
repr(s)
, s.__dict__
, and google didn't really help.
Any advice is appreciated!