简体   繁体   English

z3与SMTlib2输入

[英]z3 with SMTlib2 input

I just upgraded z3 from 4.1 to 4.3.1, and it seems that the smtlib2 input has changed : now, a function/constant declaration is not deleted by a pop statement. 我刚刚将z3从4.1升级到4.3.1,似乎smtlib2输入已经改变:现在,pop语句不会删除函数/常量声明。

Here is the SMTlib2 input that works fine with z3 4.1 (and other SMT solvers...), but return with an error with z3 4.3.1 : (error "line 19 column 25: invalid declaration, constant 'bs_2' (whith the given signature) already declared") 这是SMTlib2输入,可以与z3 4.1(以及其他SMT求解器......)一起使用,但返回时带有z3 4.3.1的错误:(错误“第19行第25列:无效声明,常量'bs_2'(其中给定签名)已经宣布“)

(set-option :produce-models true)
(set-option :produce-unsat-cores true)
(set-option :interactive-mode true)
(set-option :print-success false)
(push 1)
(declare-fun bs_1 () Bool)
(push 1)
(declare-fun bs_2 () Bool)
(assert (and  bs_1 (not bs_2)))
(check-sat)
(pop 1)
(push 1)
(declare-fun bs_2 () Bool)
(assert (and  bs_1 (not bs_2)))
(check-sat)
(pop 1)
(pop 1)
(exit)

Removing the last bs_2 declaration works fine with z3 4.3.1, but not for z3 4.1. 删除最后一个bs_2声明适用于z3 4.3.1,但不适用于z3 4.1。 Am I using the push/pop wrong ? 我使用推/弹错了吗?

In Z3 4.3.1, we tried to relax some of the SMT-LIB 2.0 restrictions to make Z3 more convenient to use. 在Z3 4.3.1中,我们试图放宽一些SMT-LIB 2.0限制,以使Z3更方便使用。 For example, we can now write (+ x 2) instead of (+ x 2.0) when x is Real . 例如,当xReal时,我们现在可以写(+ x 2)而不是(+ x 2.0) Declarations are global instead of scoped like in Z3 4.1. 声明是全局的,而不是像Z3 4.1中的作用域。 The motivation was to allow users to encode problems more succinctly. 动机是允许用户更简洁地编码问题。 We can use the following option to enable scoped declarations like in Z3 4.1 我们可以使用以下选项来启用范围声明,如Z3 4.1中所示

(set-option :global-decls false)

That being said, I understand this change is very confusing and counter-intuitive for users that are used to other SMT solvers, or read a manual describing the SMT-LIB standard. 话虽如此,我理解这种变化对于习惯于其他SMT求解器的用户来说非常混乱和反直觉,或者阅读了描述SMT-LIB标准的手册。 Thus, we will change the default back to (set-option :global-decls false) . 因此,我们将默认值更改回(set-option :global-decls false)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM