how to get multiple solutions for z3 solver in smt2 format example?

北慕城南 提交于 2019-12-02 13:31:15

The usual approach is to add a new constraint that excludes the first model. In this example, this would look like so:

(check-sat)

(assert (and (not (= k16 #x2c7d))  (not (= ... ))
(check-sat)

There is no SMT2 command to get all solutions or the number of solutions. If something depends on the fact that some property holds for all solutions, we can encode that using quantifiers, e.g.

(assert (forall ((x (_ BitVec 16))) (... property depending on x ...))) 

However, those types of problems are of course harder to solve and Z3 will use different decision procedures under the hood.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!