简体   繁体   English

z3 / python实数

[英]z3/python reals

With the z3/python web interface, if I ask: 如果我要求使用z3 / python网络界面,请执行以下操作:

x = Real ('x')
solve(x * x == 2, show=True)

I nicely get: 我很高兴得到:

Problem:
[x·x = 2]
Solution:
[x = -1.4142135623?]

I thought the following smt-lib2 script would have the same solution: 我认为以下smt-lib2脚本将具有相同的解决方案:

(set-option :produce-models true)
(declare-fun s0 () Real)
(assert (= 2.0 (* s0 s0)))
(check-sat)

Alas, I get unknown with z3 (v3.2). ,我对z3(v3.2) unknown

I suspect the problem is with the non-linear term (* s0 s0) , which the python interface somehow doesn't suffer from. 我怀疑问题出在非线性术语(* s0 s0) ,python接口不会受到某种影响。 Is there a way to code the same in smt-lib2 to get a model? 有没有一种方法可以在smt-lib2中对相同的代码进行编码以获得模型?

Try your example with Z3 web interface, I get a result of sat . 使用Z3 Web界面尝试您的示例 ,我得到了sat的结果。

Z3 web interface and Z3Py are based on Z3 v4.0, so I think the problem is fixed in the upcoming release. Z3 Web界面和Z3Py基于Z3 v4.0,因此我认为此问题已在即将发布的版本中解决。

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

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