我想使用 muZ 将 z3 用于 BMC。也许我遗漏了有关查询可满足性定义的一些内容。但是,在以下情况下,我有一个不可满足的查询示例(即,返回“false”),但是当添加一个额外的约束(有效地给出令人满意的分配)时,会返回一个有效的分配。
是否有任何文档有助于理解 z3 的 muZ 语言扩展的确切语义?
谢谢和最好的问候!!
使用 Z3 版本 4.3.2 执行以下 .smt2 文件会导致以下结果:
formula undetermined in model: (= (head query!0_0_n) (state c1 1))
sat
false
sat
(let ((a!1 (insert (state c1 1) (insert (state c2 0) (insert (state c1 0) nil))))
(a!2 (TransClosure (insert (state c2 0) (insert (state c1 0) nil)))))
(and (TransClosure a!1) a!2 (TransClosure (insert (state c1 0) nil))))
对应的 .smt2 文件是:
;; Application of z3Mu for BMC of EFSM
;; Behavior of EFSM is defined recursively as a predicate over finite sequences (Lists) of states
;; Declaration of state space
(declare-datatypes () ((Control c1 c2)))
(declare-datatypes () ((State (state (cstate Control) (var Int)))))
;; Definition of transition relation and initial state
(declare-rel Trans (State State))
(declare-var pre State)
(declare-var post State)
(rule (=> (and (= (cstate pre) c1) (= (cstate post) c2) (= (+ (var pre) 0) (var post))) (Trans post pre)))
(rule (=> (and (= (cstate pre) c2) (= (cstate post) c1) (= (+ (var pre) 1) (var post))) (Trans post pre)))
;; Definition of fixed-point closure
(declare-var init State)
(declare-var trace (List State))
(declare-rel Init (State))
(rule (Init (state c1 0)))
(declare-rel TransClosure ((List State)))
(rule (=> (and (Trans (head trace) (head (tail trace))) (TransClosure (tail trace)))
(TransClosure trace)))
(rule (=> (Init init) (TransClosure (insert init nil))))
;; Query for a witness which is satifiable in three steps
;; Query without explicit witness construction fails
(query (and (= (head trace) (state c1 1))
(TransClosure trace)
)
:print-answer true)
;; Same query with explicit witness succeeds
(query (and (= (head trace) (state c1 1))
(TransClosure trace)
(= trace (insert (state c1 1) (insert (state c2 0) (insert (state c1 0) nil))))
)
:print-answer true)