为什么强制绑定变量的类型不是finite_domain_sort?

时间:2016-09-20 02:23:21

标签: z3 z3py

我发现有限域排序的绑定变量的行为 令人费解。以下代码显示它们不满足 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?
$ 

1 个答案:

答案 0 :(得分:0)

此行为是由于我们的Python API中存在错误。现在已经修复了这个问题(从this commit开始),并且它在给定的示例中表现得如预期的那样。