Function Declarations.
Function declaration. Every constant and function have an associated declaration.
The declaration assigns a name, a sort (i.e., type), and for function
the sort (i.e., type) of each of its arguments. Note that, in Z3,
a constant is a function with 0 arguments.
Definition at line 553 of file z3py.py.
| def __call__ |
( |
|
self, |
|
|
|
args |
|
) |
| |
Create a Z3 application expression using the function `self`, and the given arguments.
The arguments must be Z3 expressions. This method assumes that
the sorts of the elements in `args` match the sorts of the
domain. Limited coersion is supported. For example, if
args[0] is a Python integer, and the function expects a Z3
integer, then the argument is automatically converted into a
Z3 integer.
>>> f = Function('f', IntSort(), RealSort(), BoolSort())
>>> x = Int('x')
>>> y = Real('y')
>>> f(x, y)
f(x, y)
>>> f(x, x)
f(x, ToReal(x))
Definition at line 617 of file z3py.py.
619 """Create a Z3 application expression using the function `self`, and the given arguments.
621 The arguments must be Z3 expressions. This method assumes that
622 the sorts of the elements in `args` match the sorts of the
623 domain. Limited coersion is supported. For example, if
624 args[0] is a Python integer, and the function expects a Z3
625 integer, then the argument is automatically converted into a
628 >>> f = Function('f', IntSort(), RealSort(), BoolSort())
636 args = _get_args(args)
639 _z3_assert(num == self.arity(),
"Incorrect number of arguments")
640 _args = (Ast * num)()
645 tmp = self.domain(i).cast(args[i])
647 _args[i] = tmp.as_ast()
648 return _to_expr_ref(
Z3_mk_app(self.ctx_ref(), self.ast, len(args), _args), self.ctx)