z3/python reals

天涯浪子 提交于 2019-12-20 04:23:49

问题


With the z3/python web interface, if I ask:

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:

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

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

I suspect the problem is with the non-linear term (* s0 s0), which the python interface somehow doesn't suffer from. Is there a way to code the same in smt-lib2 to get a model?


回答1:


Try your example with Z3 web interface, I get a result of sat.

Z3 web interface and Z3Py are based on Z3 v4.0, so I think the problem is fixed in the upcoming release.



来源:https://stackoverflow.com/questions/9969616/z3-python-reals

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