(check-sat) then (check-sat-using qfnra-nlsat)

自闭症网瘾萝莉.ら 提交于 2019-12-12 03:37:01

问题


What I want to do: I would like to call (check-sat), and then if the result is unknown, call (check-sat-using qfnra-nlsat).

Why do I want to do this?: For my application the Z3 default tactics applied with (check-sat) are superior to anything I have devised using (check-sat-using). However, there are a few situations where (check-sat) returns unknown, but (check-sat-using ...) with judiciously chosen tactics finds a result. Here is an example:

(declare-fun x () Real)
(declare-fun y () Real)
(declare-fun z () Real)

(declare-fun i () Int)
(declare-fun j () Int)
(declare-fun k () Int)

(assert (= z (* x y)))
(assert (= k (* i j)))
(assert (< k z))

; This returns unknown
(check-sat)

; This gives a solution
(check-sat-using qfnra-nlsat)
(get-value (x y z i j k))

What have I tried?: The closest I've come in a single SMT file is(check-sat-using (or-else smt qfnra-nlsat)). Unfortunately (check-sat-using smt) does not perform as well as (check-sat) for my purposes, so this is not an option.


回答1:


This is not possible directly using (check-sat), but the default tactic used by (check-sat) was exposed following this question. So, in the current master branch of Z3, it's possible to write:

(check-sat-using (or-else default qfnra-nlsat))

This feature should be available with Z3 4.4.2 and greater.



来源:https://stackoverflow.com/questions/37306629/check-sat-then-check-sat-using-qfnra-nlsat

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