Z3 QBVF问题

发布于 2024-12-03 11:19:40 字数 737 浏览 3 评论 0原文

继之前的讨论之后:Z3:提取存在模型值

有什么区别之间:

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (forall ((y (_ BitVec 16))) (bvuge y (sx y))))

至于

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))

Z3呢?也就是说,我仍然会自动获得后者的 QBVF 求解器吗?

另外,经过实验,我发现如果我发出:

(eval (sx #x8000))

(check-sat) 调用之后,它工作正常(这很棒)。 那就更好了

(eval (sx (get-value (y))))

如果我还可以说:唉,对于该查询,Z3 抱怨它是一个无效的函数应用程序, 。有没有办法以这种方式使用eval函数?

谢谢!

Following up to the previous discussion: Z3: Extracting existential model-values

Is there a difference between:

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (forall ((y (_ BitVec 16))) (bvuge y (sx y))))

And

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))

As far as Z3 is concerned? That is, will I still get the QBVF solver for the latter automatically?

Also, upon experimentation I found that if I issue:

(eval (sx #x8000))

After a (check-sat) call, it works fine (which is great). What would be better is if I could also say:

(eval (sx (get-value (y))))

Alas, for that query Z3 complains that it's an invalid function application. Is there a way to use the eval function in that manner?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷离° 2024-12-10 11:19:40

脚本

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (forall ((y (_ BitVec 16))) (bvuge y (sx y))))

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))

并不等效。第二个实际上可以满足

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (exists ((y (_ BitVec 16))) (bvuge y (sx y))))

关于eval命令,您可以引用任何未解释的常量和函数符号。因此,您可以编写:

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))
(check-sat)
(eval (sx y))

命令 (eval (sx y)) 对于第一个脚本不起作用,因为 y 是通用变量。

The scripts

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (forall ((y (_ BitVec 16))) (bvuge y (sx y))))

and

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))

are not equivalent. The second is actually equisatisfiable to

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(assert (exists ((y (_ BitVec 16))) (bvuge y (sx y))))

Regarding the eval command, you can reference any uninterpreted constant and function symbol. Thus, you can write:

(declare-fun sx ((_ BitVec 16)) (_ BitVec 16))
(declare-fun y () (_ BitVec 16))
(assert (bvuge y (sx y)))
(check-sat)
(eval (sx y))

The command (eval (sx y)) will not work for the first script because y is a universal variable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文