Z3 中的量词模式

Quantifier patterns in Z3

我在尝试证明这个相当简单的 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。

然而,Z3returns未知。我错过了什么?

没关系,我的查询中出现了一个愚蠢的错误。

此代码:

(assert (= s1 (+ 1 s0 (select list i0))))

应该是:

(assert (= s1 (+ s0 (select list i0))))