我有以下使用z3py消除量词的示例。但是我想用SMTLIB语法(python代码下面的代码)重写它。不知何故,我得到的输出与我从python中得到的公式相同。我想知道是否有人能指出我的问题。
from z3 import *
a, five = Ints('a five')
cmp = Bool('cmp')
j = Goal()
j.add(Exists([five, cmp], And(five == a,
cmp == (five < 1000),
False == cmp)))
t = Tactic('qe')
print(t(j)) # output [[1000 <= a]]
(declare-fun five () Int)
(declare-fun a () Int)
(declare-fun cmp () Bool)
(assert (exists ((five Int) (cmp Bool)) (and (= five a)
(= cmp (< five 1000))
(= cmp false) )))
(apply (then qe smt))
输出 (进球 (目标 :精度精确:深度1) )
答案 0 :(得分:2)
我太快问了这个问题。经过更多搜索(Quantifier Elimination - More questions)后,我在下面找到了解决方案。
(declare-fun five () Int)
(declare-fun a () Int)
(declare-fun cmp () Bool)
(assert (exists ((five Int) (cmp Bool)) (and (= five a)
(= cmp (< five 1000))
(= cmp false) )))
(apply (using-params qe :qe-nonlinear true))