在 Z3Py 中取实数的地板

Taking the floor of a real number in Z3Py

在 Z3Py 中给定一个像 Real('x') 这样的实数,我如何得到它的下限或上限?等价地,我如何舍入它?我看到 to_int 是 SMT 规范中的一个东西,但我不知道如何从 Python.

中调用它

函数 "ToInt" 发言。

from z3 import *

x = Real('x')
print ToInt(x)
print ToInt(RealVal("1/2"))
print simplify(ToInt(RealVal("1/2")))