在之前的一篇文章中,证明了使用 Z3 SMT-LIB 的二面体组 D3 的一个定理。在这篇文章中,我们尝试使用以下 SMT-LIB 代码同时使用 Z3 和 CVC4 来证明这样的定理:
(set-logic AUFNIRA)
(set-option :produce-models true)
(set-option :incremental true)
(declare-sort S 0)
(declare-fun f (S S) S)
(declare-fun g (S) S)
(declare-fun E () S)
(declare-fun R1 () S)
(declare-fun R2 () S)
(declare-fun R3 () S)
(declare-fun R4 () S)
(declare-fun R5 () S)
(assert (forall ((x S))
(= (f x E) x)))
(assert (forall ((x S))
(= (f E x) x)))
(assert (= (f R1 R1) R2))
(assert (= (f R1 R2) E))
(assert (= (f R1 R3) R4))
(assert (= (f R1 R4) R5))
(assert (= (f R1 R5) R3))
(assert (= (f R2 R1) E))
(assert (= (f R2 R2) R1))
(assert (= (f R2 R3) R5))
(assert (= (f R2 R4) R3))
(assert (= (f R2 R5) R4))
(assert (= (f R3 R1) R5))
(assert (= (f R3 R2) R4))
(assert (= (f R3 R3) E))
(assert (= (f R3 R4) R2))
(assert (= (f R3 R5) R1))
(assert (= (f R4 R1) R3))
(assert (= (f R4 R2) R5))
(assert (= (f R4 R3) R1))
(assert (= (f R4 R4) E))
(assert (= (f R4 R5) R2))
(assert (= (f R5 R1) R4))
(assert (= (f R5 R2) R3))
(assert (= (f R5 R3) R2))
(assert (= (f R5 R4) R1))
(assert (= (f R5 R5) E))
(assert (= (g E) E))
(assert (= (g R1) R2))
(assert (= (g R2) R1))
(assert (= (g R3) R3))
(assert (= (g R4) R4))
(assert (= (g R5) R5))
(check-sat)
(get-model)
(get-value ((f (f R3 R1) (g R3))))
(get-value (R2))
(assert (not (= (f (f R3 R1) (g R3)) R2)))
(check-sat)
当使用 Z3 或 CVC4 执行此代码时,将获得正确的结果。在此处使用 Z3 在线运行此代码
问题是:
在 Z3 的情况下,
unsupported ; :incremental
会生成一条消息。这个消息似乎并没有改变结果,为什么?在 CVC4 的情况下,
unknown
在 Z3 生成时生成一条消息sat
。同样,这条消息似乎并没有改变结果,为什么?如何使用 Mathsat 执行 SMT-LIB 代码。