3

After reading the strategies guide of Z3, and this answer by Leo, I expected that (check-sat) and (check-sat-using smt) are equivalent. However, when running Z3 4.3.2 three times against our test suite (230 SMTLIB2 files), it took 198s/192s/195s seconds with (check-sat), but 275s/283s/270s with (check-sat-using smt). I also tried the nightly build Z3 4.4.0 d3fb5f2a4cda, and the difference was similar.

Why might that be?

A bit more information that might be relevant:

  • Windows 7 x64, Z3 x64
  • All our tests are configured with auto_config false and smt.mbqi false
  • All use quantifiers and uninterpreted functions
  • Some use (non-linear) int and/or real arithmetic
  • All make heavy use of push-pop blocks

Edit: What I ultimately would like to do is to set a timeout for some check-sat calls, but not for all. AFAIK, this is not possible with check-sat itself, but check-sat-using (using-params smt :soft_timeout $timeout) should work. Is that right?

Community
  • 1
  • 1
Malte Schwerhoff
  • 12,684
  • 4
  • 41
  • 71
  • Looks as if http://stackoverflow.com/questions/23973453/ were potentially related – Malte Schwerhoff Feb 22 '15 at 12:51
  • FYI in the current master branch of Z3, it's possible to get the effect you're looking for using `(check-sat-using default)`. See [this question](https://stackoverflow.com/questions/37443308/check-sat-using-default-or-similar). – Douglas B. Staple Jun 21 '16 at 12:59

1 Answers1

2

I assume you're running Z3 on an SMT2 file?

Z3 has facilities for determining the logic of the benchmark when none is specified (see e.g., default_tactic.cpp). The smt tactic is the fallback when no other tactic applies. When Z3 is run with -v:10, it will show which (sub)-tactic is run.

In the recent past we also had some problems with configuration parameters not making it through to the smt kernel. We've fixed those, but it's of course possible that there's still a bug somewhere.

Christoph Wintersteiger
  • 8,234
  • 1
  • 16
  • 30
  • So it could be that `(check-sat)` chooses a more specialised (and efficient) solver than `smt`, and hence the difference in run-time? Please also see my edited questions. – Malte Schwerhoff Feb 20 '15 at 11:42
  • Yes, that could be, it depends on what is used in the benchmarks. Did you try (reset) (set-option :timeout or :soft_timeout ...) [stuff] (check-sat)? – Christoph Wintersteiger Feb 20 '15 at 23:13
  • Nice! For some reason I thought that you cannot change options once the first assertion has been, but setting `:timeout` before each `check-sat` seems to work just fine (`:soft_timeout` was rejected because the option was apparently renamed to `:timeout`). Using `reset` as well is probably not so easy because it also resets symbol declarations (and I use `:global-decls` to make symbol declarations survive pops), and it seems to reset the push-pop stack. – Malte Schwerhoff Feb 22 '15 at 17:54
  • Yes, there's a bit of an inconsistency with respect to those two option names at the moment. We decided to remove the soft_timeout option, but haven't done that in all parts of the code yet. – Christoph Wintersteiger Feb 24 '15 at 18:41