Z3 currently supports the DIMACS format for input. Is there any way to output the DIMACS format for the problem before solution? I mean converting the problem to a system CNFs and output it in a DIMACS format. If not, any ideas towards this direction would be more than helpful.
相关问题
- How to compute with Quaternion numbers in Z3?
- Z3 real arithmetics and data types theories integr
- Timeout for Z3 Optimize
- Adjusting `simplify` tactic in Z3
- How to setup a Java development environment for Z3
相关文章
- retrieve the matched model in Z3py?
- Simplex in z3 via for-all
- How do I get Z3 to return minimal model?
- How to get z3 to return multiple unsat cores, mult
- ld linking error while compiling z3
- Horn clauses in Z3
- Getting a “good” unsat-core with z3 (logic QF_BV)
- how to get multiple solutions for z3 solver in smt
Thanks to Leonardo's answer I came up with this code that will do what you want:
For it to work you should add all your constraints to the solver directly, by calling
slv.Assert(...)
.The DIMACS format is very primitive, it supports only Boolean variables. Z3 does not reduce every problem into SAT. Some problems are solved using a propositional SAT solver, but this is not the rule. This usually only happens if the input contains only Boolean and/or Bit-vector variables. Moreover, even if the input problem contains only Boolean and Bit-vector variables, there is no guarantee that Z3 will use a pure SAT solver to solve it.
That being said, you can use the tactic framework to control Z3. For example, for Bit-vector problems, the following tactic will convert it into a propositional formula in CNF format. It should be straightforward to convert it into DIMACS. Here is the example. You can try it online at: http://rise4fun.com/Z3Py/E1s