Closed logicReasoner closed 4 years ago
If you want it fast: 1) don't use user-defined sorts. Use a small bit-vector instead if possible 2) Combine all assert into one, with a single forall quantifier 3) maybe negate the formula to swap the exists/forall quantifiers if appropriate 4) Play with tactics. qe may or may not be good for you. There's also qe-light. Or ufbv if using bit-vectors 5) Consider doing some pre-processing on your side to remove some of the quantifiers. Some seem like trivial axioms that you can inline. 6) etc.
I'm not aware of any tutorial on how to make SMT solvers run fast. It's all in people's brains. It comes with experience.
@nunoplopes thanks for the tips! Can you give some examples on how to rewrite my code above regarding your points 1, 2, 5 (using bit-vectors; combining asserts; and inlining axioms)? The code is auto-generated but I could tweak the generator where suitable.
Thanks in advance!
I use Z3 from inside a C++ program. Currently it takes more than 5 seconds on a rather powerful machine to check the satisfiability of some auto-generated constraints. Can you please give me any tips on how to optimize Z3 (its code or switching to another tactic) or to rewrite my SMT lib code in order to make it much faster?
I create the solver using:
As evident below, there are lots of
forall
and a fewexists
quantifiers. Here is a sample snippet (a part of a larger program):