Closed edenfrenkel closed 1 year ago
@tchajed When trying to factor out try_conf
I realized I should probably just implement multi-solvers more generally using a solver trait, like you said. This turned out to be more tricky than expected, unless I reduced solver behavior to something very basic, which is now implemented in the BasicSolver
trait in solver/src/basics.rs
. This trait allows making very simple check_sat
queries which return sat+trace, unsat+unsat-core, or unknown. I implemented this trait for a single SolverConf
, as well as for a vector of SolverConf
's twice, first as fallback solvers and second as parallel solvers. Solver cancellation has also been moved out of the inference code and made more generic.
Let me know what you think. I'll rebase and update the pull request description soon.
@tchajed updated and rebased
This defines a
BasicSolver
trait insolver/src/basics.rs
, which allows making very basiccheck-sat
queries which return asat
result together with a trace, anunsat
result together with an unsat-core, orunknown
. By abstracting this basic functionality it is possible to implement this trait for a singleSolverConf
, as well as for a vector ofSolverConf
's in two different ways, once asFallbackSolvers
tried sequentially and second asParallelSolvers
tried in parallel. This is utilized inqalpha
, which now usesParallelSolvers
for its inductiveness and safety checks by default, and is configurable to useFallbackSolvers
instead via--fallback
. The simulation queries inqalpha
still use a singleSolverConf
, now abstracted behind theBasicSolver
trait as well.Solver cancellation has also been moved out of the inference code and made more generic, using the new
BasicSolverCanceler
trait andSolverCancelers
struct, which aggregates multipleBasicSolverCanceler
's and itself implementsBasicSolverCanceler
. This is used recursively to create hierarchical tree-like cancellation, where the cancellation of a node cancels all of its descendants. The idea is that functions should only cancel queries which they (perhaps recursively) launched and not assume anything about the behavior of their callers. When the result is bubbled up to those callers, they should cancel their queries according to their own desired behavior. This allows more general applicablity which is independent of the specific goals of any single use-case, (in this caseqalpha
, which cancels all solvers on the firstsat
result.)Another change is that now transition queries parallelize over disjunctive transitions, with proper cancellation if a
sat
response is encountered.