Description
When processing an "execute"
request, we are rewriting from one Pattern
to one or more Pattern
s. In Booster, we assume definedness of the initial Pattern
, i.e. it must have no "bad" applications of partial functions and the constrains should not be inconsistent.
Since the introduction of the SMT solver into Booster, we have been very conservative in how we interact with it, potentially leaving a lot of performance on the table. We should optimise the communication of the constraints of the initial Pattern
, aka the known predicates, aka "the path condition" to the solver:
- when starting an execute request, we should check the consistency of the constraints to make sure we are not rewriting inside a
vacuous
state (this is done in 4012 evaluate pattern pruning #4020) - if the constraints are consistent, we will reuse the created Z3 scope for all subsequent queries, hopefully making the side condition checks very fast
- when we add new constraints to the current
Pattern
withing the same "execute
" request, we have two options:- the conservative option would be to
pop
the scope, add the ensured condition to the known predicates,push
them chcheck-sat
; - the more performant option is to
push
the scope before checking theensures
conditions and avoid re-checking the previous know truth.
- the conservative option would be to
We will need to re-think how we do solver retries. Currently, we do a hard reset every time we retry, which restarts the solver. We should instead to a soft reset:
pop
the last scope, which includes the predicate we are checking- reuse the previous scopes that contain the known predicates
- change the timeout setting, push and check sat
The comments to this issue will outline the specific changes that need to be done to the SMT-related types and function in Booster to implement this approach.