我发现有限域排序的绑定变量的行为 令人费解。以下代码显示它们不满足 is_finite_domain_sort谓词。知道为什么吗?
from z3 import *
U=FiniteDomainSort('U', 3)
V=FiniteDomainSort('V', 2)
u=Const('u', U)
x=Const('x', U)
y=Const('y', V)
p=Function('p', U, V, BoolSort())
expr=Exists([x, y], And(p(x,y), Not(x == u)))
print "Z3 version"
print ">>> get_version()"
print get_version()
print "Is U finite?"
print ">>> is_finite_domain_sort(U)"
print is_finite_domain_sort(U)
print "Is sort of bound var equal to U?"
print ">>> expr.var_sort(0)==U"
print expr.var_sort(0)==U
print "Is sort of bound var finite?"
print ">>> is_finite_domain_sort(expr.var_sort(0))"
print is_finite_domain_sort(expr.var_sort(0))
print "Why isn't the sort of the bound variable finite?"
Mac上的输出:
$ python findom.py
Z3 version
>>> get_version()
(4L, 4L, 2L, 1L)
Is U finite?
>>> is_finite_domain_sort(U)
True
Is sort of bound var equal to U?
>>> expr.var_sort(0)==U
True
Is sort of bound var finite?
>>> is_finite_domain_sort(expr.var_sort(0))
False
Why isn't the sort of the bound variable finite?
$