-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I would like to inquire your opinion on a feature idea that would IMHO make the use of Z3 significantly more flexible as well as open up new application areas.
It would be great if Z3 was at certain points in time (during (check-sat) and while waiting for further input) able to persist its internal state to disk and quickly resume its operation from such a persisted state. On the user-interface-level this could be realised by adding a key combination to make it dump its state and terminate as well as a SMTLIB-style command like (persist <filename>) and a command-line argument like --resume <state-file>.
This would have the following advantages:
- Incrementalization
Using Z3 incrementally (telling it about a large problem/formula once and then only telling it about the changes to that formula (as the user makes them) in order to update it) currently requires leaving a Z3 process running in the background. This becomes a problem when the user closes the application or restarts the computer as the Z3 process is terminated in both cases and the next time the user starts up the application, a new Z3 process will have to be started and the entire problem will have to be communicated and solved from scratch, which can take quite a while if the problem is large.
This could be avoided by storing a dumped Z3 state alongside the formula and updating it whenever the user changes the formula by resuming from it, updating Z3's state using pop and push and then dumping the new state.
This way the effort spend by Z3 for deriving learned clauses, etc. could be re-used even across application and computer restarts.
- Parallelisation
When having a large formula (think: system model) and a large number of queries (think: properties to check) about it, it would be nice to parallelise the solving. However, currently this would mean that n computers would each start a Z3 process, read in the entire formula in and solve one query about it.
As there is usually a base-query (for instance: consistency of the system model), which already requires the solver to analyse the entire model and would thus derive a lot of learned clauses, it would be desirable to do this instead:
- Read the entire formula in and run the base-query on a single computer, which derives the learned clauses
- dump the Z3 state of that process afterwards
- copy it to all n computers and let each computer resume from that state and process other queries in a push/pop manner until everything is solved.
This would maximise the reuse of work while not requiring the n computers to communicate.
- Moving long-running queries
When using Z3 for solving hard problems (for instance: deriving winning strategies for games), one often encounters long-running queries. Usually, I use my laptop to write the queries and test them until everything is in order and Z3 does not find any trivial solutions anymore and starts to work on the hard part. Unfortunately, sometimes it does not terminate until I need to clock out and get home. It would be great if I could just tell the Z3 process to persist its state onto disk, copy this state to a server and let the server resume it from there. This way I could come to work the next day and find the solution to my problem on the server instead of either letting the server redo all the work my laptop already invested or waking up my laptop the next morning and waiting for Z3 to compute another couple of hours.
I know that Z3 did not support this a while ago (#1044), but I would like to know
a) Do you consider this idea useful or is there a simpler way to achieve the stated benefits?
b) Are you (or someone else you know of) already working in this direction? And if not,
c) Are you planning to add support for this in the future?