Is there any difference between Z3 versions 2.19 and 3.2 w.r.t. SMTLIB-2 code syntax?

若如初见. 提交于 2020-01-16 00:55:17

问题


After installing Z3 V3.1, following SMT-LIB code is not working. It was quite good in my earlier version (Z3 V2.19).

(define-fun getIP ((o0 Int) (o1 Int) (o2 Int) (o3 Int)) BitVec[32]

     (bvor (bvshl (int2bv[32] o0) (int2bv[32] 24))

          (bvshl (int2bv[32] o1) (int2bv[32] 16))))       

(declare-funs ((dip BitVec[32]) (m BitVec[32])))

(declare-funs ((s Bool) (d Bool) (y Int) (z Int)))

(declare-funs ((r0 Bool) (r1 Bool) (f Bool)))

(declare-funs ((r0do0 Int) (r0do1 Int) (r0do2 Int) (r0do3 Int) (r0m Int) (r0nh Int)))

(declare-funs ((r1do0 Int) (r1do1 Int) (r1do2 Int) (r1do3 Int) (r1m Int) (r1nh Int)))

(declare-funs ((fso0 Int) (fso1 Int) (fso2 Int) (fso3 Int) (fsm Int)))

(declare-funs ((fdo0 Int) (fdo1 Int) (fdo2 Int) (fdo3 Int) (fdm Int) (fp Int) (fnh Int)))

(declare-funs ((so0 Int) (so1 Int) (so2 Int) (so3 Int)))

(declare-funs ((do0 Int) (do1 Int) (do2 Int) (do3 Int)))

(assert (=> f (and (= fso0 172) (= fso1 16) (= fso2 0) (= fso3 0) (= fsm 16) 

          (= fdo0 150) (= fdo1 96) (= fdo2 1) (= fdo3 0) (= fdm 24) 

          (= fp 0))))

(assert (=> r0 (and (= r0do0 150) (= r0do1 96) (= r0do2 0) (= r0do3 0) (= r0m 16))))

(assert (=> r1 (and (= r1do0 172) (= r1do1 16) (= r1do2 0) (= r1do3 0) (= r1m 16))))

(assert (=> s (and (= so0 172) (= so1 16) (= so2 0) (= so3 1))))

(assert (=> d (and (= do0 150) (= do1 96) (= do2 1) (= do3 120))))

(assert (= m (int2bv[32] 16)))


(assert ((= dip (getIP so0 so1 so2 so3))))

(check-sat) ; sat

(model)

What do I need to change in the above code to run it in the version 3.1.


回答1:


Z3 3.x is compliant with the SMT 2.0 standard. Versions 2.x were not. For example, there is no declare-funs command in SMT 2.0; the 32-bitvector sort is (_ BitVec 32) instead of BitVec[32]. Z3 still supports the old non-compliant SMT 2.0 parser. You just have to provide the command line option -smtc. That being said, I suggest you move to SMT 2.0 standard. The SMT 2.0 input language is the official input language for Z3. Moreover, many new features are only available in this frontend (Example: parametric types).



来源:https://stackoverflow.com/questions/8719764/is-there-any-difference-between-z3-versions-2-19-and-3-2-w-r-t-smtlib-2-code-sy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!