An assertion f(x) == x*t + cdoes not define a function ffor everyone x. He simply says that the value ffor this xis x*t + c. Z3 supports universal quantifiers. However, they are very expensive, and Z3 is not complete when the set of constraints contains universal quantifiers, since the problem becomes unsolvable. That is, Z3 may return unknownfor this problem.
, f "" script. Z3 "" Python, . , Python, , Z3, Z3. script. script : http://rise4fun.com/Z3Py/Yoi
script, c t Real Int: http://rise4fun.com/Z3Py/uZl
from z3 import *
c=Int('c')
t=Int('t')
def f(x):
return x*t + c
def find(data):
s=Solver()
s.add([ f(x) == r for (x, r) in data ])
t = s.check()
if s.check() == sat:
print s.model()
else:
print t
find([(1, 55)])
find([(1, 55), (12, 34)])
find([(1, 55), (12, 34), (13, 300)])
. SMT 2.0 define-fun.