简体   繁体   中英

Unsat core from Z3 (version 4)

I have been using Ocaml API of Z3 version 4.0 for the last year or so, mainly the bitvector theory. Now I need to extract unsat cores after doing a Z3.solver_check and unfortunately version 4 doesn't have this ability. I can do a rewrite to use assumptions to stand for each bitvector equation in the formula and then get the unsat core but this being critical part of the code, it might affect the overall performance.

Is there a way of get unsat core without going through assumptions for version 4? The long term solution is of course to move to latest version but if there is a less disruptive solution that would be nice. For instance, is there a way to extract unsat core from the proof of unsat (returned by Z3.solver_get_proof)?

Thanks!

If you use the assert_and_track function from the Solver module, then get_unsat_core, also in the Solver module, returns the set of tracking literals corresponding to the tracked assertions. There is an example of using assert_and_track for the C# API in the method UnsatCoreAndProofExample2, and also in Java ( https://github.com/Z3Prover/z3/blob/master/examples/java/JavaExample.java ). There is no corresponding example in the ML sample, but translation to OCaml should not be too complicated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM