在使用 z3-solver 模块 (4.8.0.0) 在 Python 3.6.7 上运行此代码时,z3 返回的模型似乎对公理无效。
f = z3.Function('f', z3.IntSort(), z3.IntSort(), z3.IntSort())
x = z3.Int('x')
s = z3.Solver()
s.add(f(1, 10) == 42)
s.add(z3.ForAll([x], f(2, x) == f(1, x)))
s.check()
m = s.model()
print(m.eval(f(1, 10))) # print 0
print(m.eval(f(2, 10))) # print 0
为什么我们没有达到预期的 42 ?公理或函数有问题吗?