我需要你帮助用Z3
Java API定义一个函数.
我尝试解决这样的问题(使用z3.exe进程可以正常工作):
(declare-fun a () Real)
(declare-fun b () Real)
(declare-fun c () Bool)
(define-fun max2 ((x Real) (y Real)) Real (ite (<= x y) y x))
(assert (and (>= a 0.0) (<= a 100.0)))
(assert (or (= (max2 (+ 100.0 (* (- 1.0) a)) (/ 1.0 1000.0)) 0.0) c (not (= b 0.0))))
(check-sat-using (then simplify bit-blast qfnra))
(get-model)
这个smt文件的结果是:
sat
(model
(define-fun a () Real
1.0)
(define-fun c () Bool
false)
(define-fun b () Real
1.0)
)
现在的问题是:没有选项,用java API定义一个函数.在另一篇文章(Equivalent of define-fun in Z3 API)中,我注意到在java API中使用以下语句:
(declare-fun max2 (Real Real) Real)
(assert (forall ((y Real) (x Real)) (= (max2 y x) (ite (<= x y) y x))))
所以我在我的smt文件中替换了(define-fun max2((x Real)(y Real))Real(ite(< = x y)y x))并再次启动了z3.exe进程.结果如下:
unknown
(model
(define-fun b () Real
0.0)
)
所以,正如你所看到的,再也没有令人满意的结果了.在java中翻译它将获得相同的结果UNKNOWN.
任何想法,我能做什么?