since current version, there is some problem in "ctx-solver-simplify"like in the example http://rise4fun.com/Z3/CqRv z3 gives the wrong answer. I replace "ctx-solver-simplify" by "simplify" like http://rise4fun.com/Z3/x9X4 I am wondering, what's the difference between these two tactic "simplify" and "ctx-solver-simplify"?
1 Answers
The tactic simplify
only performs "local simplifications". For every term t
, we have that simplify(t)
is a new term equivalent to t
. Moreover, the result of simplify(t)
does not depend on the context where t
occurs. By context, I meant the assertion F
where t
occurs and all other assertions. Since, simplify
is local, it is very efficient. The implementation is essentially based on a bottom up application of simplification rules. Moreover, since the result of simplify(t)
does not depend on contextual information, we can cache it. Thus, even if t
occurs N
times in a formula F
, we only need to simplify it once. All builtin solvers in Z3 apply this kind of simplification. Thus, tactics such as simplify
have been extensively tested.
The tactic ctx-solver-simplify
uses the context where t
occurs to apply simplifications. The basic idea is to simplify a formula F
by traversing it using a solver S
. The solver S
essentially contains the "context". Whenever S.check()
returns unsat
, we know the current context is inconsistent, then we can replace the current formula by false
. The ctx-solver-simplify
is much more expensive. First, it performs many calls to S.check()
. Each one of these calls is potentially very expensive. It is also much harder to cache intermediate results. Z3 may have to simplify a subformula t
many times because it occurs in different contexts.
The bug you reported in your question have been fixed. The fix will be available in the next release (version 4.1). If you need we can provide you a pre-release version of Z3 4.1