Z3 python treats x**2 different than x*x?

本小妞迷上赌 提交于 2019-12-10 15:55:40

问题


It seems that Z3 Python interface doesn't like the ** operator , it can deal with x*x but not x**2 as shown in the example below

>>> x,y = x,y=Reals('x y')
>>> z3.prove(Implies(x -6 == 0,x**2 -36 == 0))
failed to prove
[x = 6]
>>> z3.prove(Implies(x -6 == 0,x*x -36 == 0))
proved

回答1:


You are probably using version 4.3.0 on Linux or OSX. Version 4.3.0 has a configuration problem on these platforms. If that is the case, I suggest you download version 4.3.1. Version 4.3.1 will prove both queries on Linux and OSX. In version 4.3.0 auto-configuration is not enabled by default on Linux and OSX. Thus, Z3 will always use a general purpose solver that is not complete for nonlinear arithmetic, nor has support for the power operator. When auto-configuration is enabled, Z3 detects that these two problems are in the nonlinear real arithmetic fragment, and switches to the nlsat solver.

BTW, to manually enable auto-configuration on version 4.3.0, you may use the command z3.set_option(auto_config=True).



来源:https://stackoverflow.com/questions/13446967/z3-python-treats-x2-different-than-xx

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