5
我想找到在簡單的 「結果= X * T + C」 配方C和T係數一些給定的結果/ X對:(Z3Py)聲明函數
from z3 import *
x=Int('x')
c=Int('c')
t=Int('t')
s=Solver()
f = Function('f', IntSort(), IntSort())
# x*t+c = result
# x, result = [(1,55), (12,34), (13,300)]
s.add (f(x)==(x*t+c))
s.add (f(1)==55, f(12)==34, f(13)==300)
t=s.check()
if t==sat:
print s.model()
else:
print t
...但結果顯然是錯誤的。我可能需要找出如何映射函數參數。
如何正確定義功能?
[Z3 API中define-fun的等價物]的可能重複(http://stackoverflow.com/questions/7740556/equivalent-of-define-fun-in-z3-api) – usr 2014-05-07 10:14:36