Stores the interpretation of a function in a Z3 model.
Definition at line 6179 of file z3py.py.
Return the function interpretation as a Python list.
>>> f = Function('f', IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
>>> s.check()
sat
>>> m = s.model()
>>> m[f]
[2 -> 0, else -> 1]
>>> m[f].as_list()
[[2, 0], 1]
Definition at line 6276 of file z3py.py.
6277 """Return the function interpretation as a Python list.
6278 >>> f = Function('f', IntSort(), IntSort())
6280 >>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
6289 r = [self.entry(i).as_list()
for i
in range(self.num_entries())]
6290 r.append(self.else_value())
Return the `else` value for a function interpretation.
Return None if Z3 did not specify the `else` value for
this object.
>>> f = Function('f', IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
>>> s.check()
sat
>>> m = s.model()
>>> m[f]
[2 -> 0, else -> 1]
>>> m[f].else_value()
1
Definition at line 6192 of file z3py.py.
6192 def else_value(self):
6194 Return the `else` value for a function interpretation.
6195 Return None if Z3 did not specify the `else` value for
6198 >>> f = Function('f', IntSort(), IntSort())
6200 >>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
6206 >>> m[f].else_value()
6211 return _to_expr_ref(r, self.ctx)
Referenced by FuncInterp.as_list().
Return an entry at position `idx < self.num_entries()` in the function interpretation `self`.
>>> f = Function('f', IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
>>> s.check()
sat
>>> m = s.model()
>>> m[f]
[2 -> 0, else -> 1]
>>> m[f].num_entries()
1
>>> m[f].entry(0)
[2, 0]
Definition at line 6245 of file z3py.py.
6245 def entry(self, idx):
6246 """Return an entry at position `idx < self.num_entries()` in the function interpretation `self`.
6248 >>> f = Function('f', IntSort(), IntSort())
6250 >>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
6256 >>> m[f].num_entries()
6261 if idx >= self.num_entries():
Referenced by FuncInterp.as_list().
Return the number of entries/points in the function interpretation `self`.
>>> f = Function('f', IntSort(), IntSort())
>>> s = Solver()
>>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
>>> s.check()
sat
>>> m = s.model()
>>> m[f]
[2 -> 0, else -> 1]
>>> m[f].num_entries()
1
Definition at line 6215 of file z3py.py.
6215 def num_entries(self):
6216 """Return the number of entries/points in the function interpretation `self`.
6218 >>> f = Function('f', IntSort(), IntSort())
6220 >>> s.add(f(0) == 1, f(1) == 1, f(2) == 0)
6226 >>> m[f].num_entries()
Referenced by FuncInterp.as_list(), and FuncInterp.entry().