我在尝试证明这个相当简单的 Z3 查询时遇到了麻烦。
(set-option :smt.auto-config false) ; disable automatic self configuration
(set-option :smt.mbqi false) ; disable model-based quantifier instantiation
(declare-fun sum (Int) Int)
(declare-fun list () (Array Int Int))
(declare-fun i0 () Int)
(declare-fun s0 () Int)
(declare-fun i1 () Int)
(declare-fun s1 () Int)
(assert (forall ((n Int))
(! (or (not (<= n 0)) (= (sum n) 0))
:pattern ((sum n)))))
(assert (forall ((n Int))
(! (let ((a1 (= (sum n)
(+ (select list (- n 1))
(sum (- n 1))))))
(or (<= n 0) a1))
:pattern ((sum n)))))
(assert (>= i0 0))
(assert (= s0 (sum i0)))
(assert (= i1 (+ 1 i0)))
(assert (= s1 (+ 1 s0 (select list i0))))
(assert (not (= s1 (sum i1))))
(check-sat)
在我看来,最终断言应该实例化 i1 的第二个量化语句,而涉及 s0 的断言应该实例化 i0 的量词。这两个应该很容易导致UNSAT。
但是,Z3 返回未知。我错过了什么?
没关系,我的查询中有一个愚蠢的错误。
这段代码:
(assert (= s1 (+ 1 s0 (select list i0))))
本来应该:
(assert (= s1 (+ s0 (select list i0))))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句