Z3
Public Member Functions
func_decl Class Reference

Function declaration (aka function definition). It is the signature of interpreted and uninterpreted functions in Z3. The basic building block in Z3 is the function application. More...

+ Inheritance diagram for func_decl:

Public Member Functions

 func_decl (context &c)
 
 func_decl (context &c, Z3_func_decl n)
 
 operator Z3_func_decl () const
 
unsigned id () const
 retrieve unique identifier for func_decl. More...
 
unsigned arity () const
 
sort domain (unsigned i) const
 
sort range () const
 
symbol name () const
 
Z3_decl_kind decl_kind () const
 
func_decl transitive_closure (func_decl const &)
 
bool is_const () const
 
expr operator() () const
 
expr operator() (unsigned n, expr const *args) const
 
expr operator() (expr_vector const &v) const
 
expr operator() (expr const &a) const
 
expr operator() (int a) const
 
expr operator() (expr const &a1, expr const &a2) const
 
expr operator() (expr const &a1, int a2) const
 
expr operator() (int a1, expr const &a2) const
 
expr operator() (expr const &a1, expr const &a2, expr const &a3) const
 
expr operator() (expr const &a1, expr const &a2, expr const &a3, expr const &a4) const
 
expr operator() (expr const &a1, expr const &a2, expr const &a3, expr const &a4, expr const &a5) const
 
- Public Member Functions inherited from ast
 ast (context &c)
 
 ast (context &c, Z3_ast n)
 
 ast (ast const &s)
 
 ~ast ()
 
 operator Z3_ast () const
 
 operator bool () const
 
astoperator= (ast const &s)
 
Z3_ast_kind kind () const
 
unsigned hash () const
 
std::string to_string () const
 
- Public Member Functions inherited from object
 object (context &c)
 
contextctx () const
 
Z3_error_code check_error () const
 

Additional Inherited Members

- Protected Attributes inherited from ast
Z3_ast m_ast
 
- Protected Attributes inherited from object
contextm_ctx
 

Detailed Description

Function declaration (aka function definition). It is the signature of interpreted and uninterpreted functions in Z3. The basic building block in Z3 is the function application.

Definition at line 709 of file z3++.h.

Constructor & Destructor Documentation

func_decl ( context c)
inline

Definition at line 711 of file z3++.h.

Referenced by func_decl::transitive_closure().

711 :ast(c) {}
ast(context &c)
Definition: z3++.h:508
func_decl ( context c,
Z3_func_decl  n 
)
inline

Definition at line 712 of file z3++.h.

712 :ast(c, reinterpret_cast<Z3_ast>(n)) {}
ast(context &c)
Definition: z3++.h:508

Member Function Documentation

unsigned arity ( ) const
inline

Definition at line 720 of file z3++.h.

Referenced by fixedpoint::add_fact(), func_decl::domain(), and func_decl::is_const().

720 { return Z3_get_arity(ctx(), *this); }
context & ctx() const
Definition: z3++.h:428
unsigned Z3_API Z3_get_arity(Z3_context c, Z3_func_decl d)
Alias for Z3_get_domain_size.
Z3_decl_kind decl_kind ( ) const
inline

Definition at line 724 of file z3++.h.

Referenced by expr::is_and(), expr::is_distinct(), expr::is_eq(), expr::is_false(), expr::is_implies(), expr::is_ite(), expr::is_not(), expr::is_or(), expr::is_true(), and expr::is_xor().

724 { return Z3_get_decl_kind(ctx(), *this); }
Z3_decl_kind Z3_API Z3_get_decl_kind(Z3_context c, Z3_func_decl d)
Return declaration kind corresponding to declaration.
context & ctx() const
Definition: z3++.h:428
sort domain ( unsigned  i) const
inline

Definition at line 721 of file z3++.h.

Referenced by func_decl::operator()().

721 { assert(i < arity()); Z3_sort r = Z3_get_domain(ctx(), *this, i); check_error(); return sort(ctx(), r); }
Z3_error_code check_error() const
Definition: z3++.h:429
unsigned arity() const
Definition: z3++.h:720
context & ctx() const
Definition: z3++.h:428
Z3_sort Z3_API Z3_get_domain(Z3_context c, Z3_func_decl d, unsigned i)
Return the sort of the i-th parameter of the given function declaration.
unsigned id ( ) const
inline

retrieve unique identifier for func_decl.

Definition at line 718 of file z3++.h.

718 { unsigned r = Z3_get_func_decl_id(ctx(), *this); check_error(); return r; }
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
unsigned Z3_API Z3_get_func_decl_id(Z3_context c, Z3_func_decl f)
Return a unique identifier for f.
bool is_const ( ) const
inline

Definition at line 730 of file z3++.h.

730 { return arity() == 0; }
unsigned arity() const
Definition: z3++.h:720
symbol name ( ) const
inline

Definition at line 723 of file z3++.h.

723 { Z3_symbol s = Z3_get_decl_name(ctx(), *this); check_error(); return symbol(ctx(), s); }
Z3_symbol Z3_API Z3_get_decl_name(Z3_context c, Z3_func_decl d)
Return the constant declaration name as a symbol.
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
operator Z3_func_decl ( ) const
inline

Definition at line 713 of file z3++.h.

713 { return reinterpret_cast<Z3_func_decl>(m_ast); }
Z3_ast m_ast
Definition: z3++.h:506
expr operator() ( ) const
inline

Definition at line 3515 of file z3++.h.

3515  {
3516  Z3_ast r = Z3_mk_app(ctx(), *this, 0, 0);
3517  ctx().check_error();
3518  return expr(ctx(), r);
3519  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( unsigned  n,
expr const *  args 
) const
inline

Definition at line 3494 of file z3++.h.

3494  {
3495  array<Z3_ast> _args(n);
3496  for (unsigned i = 0; i < n; i++) {
3497  check_context(*this, args[i]);
3498  _args[i] = args[i];
3499  }
3500  Z3_ast r = Z3_mk_app(ctx(), *this, n, _args.ptr());
3501  check_error();
3502  return expr(ctx(), r);
3503 
3504  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
expr operator() ( expr_vector const &  v) const
inline

Definition at line 3505 of file z3++.h.

3505  {
3506  array<Z3_ast> _args(args.size());
3507  for (unsigned i = 0; i < args.size(); i++) {
3508  check_context(*this, args[i]);
3509  _args[i] = args[i];
3510  }
3511  Z3_ast r = Z3_mk_app(ctx(), *this, args.size(), _args.ptr());
3512  check_error();
3513  return expr(ctx(), r);
3514  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
expr operator() ( expr const &  a) const
inline

Definition at line 3520 of file z3++.h.

3520  {
3521  check_context(*this, a);
3522  Z3_ast args[1] = { a };
3523  Z3_ast r = Z3_mk_app(ctx(), *this, 1, args);
3524  ctx().check_error();
3525  return expr(ctx(), r);
3526  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( int  a) const
inline

Definition at line 3527 of file z3++.h.

3527  {
3528  Z3_ast args[1] = { ctx().num_val(a, domain(0)) };
3529  Z3_ast r = Z3_mk_app(ctx(), *this, 1, args);
3530  ctx().check_error();
3531  return expr(ctx(), r);
3532  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
expr num_val(int n, sort const &s)
Definition: z3++.h:3492
sort domain(unsigned i) const
Definition: z3++.h:721
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( expr const &  a1,
expr const &  a2 
) const
inline

Definition at line 3533 of file z3++.h.

3533  {
3534  check_context(*this, a1); check_context(*this, a2);
3535  Z3_ast args[2] = { a1, a2 };
3536  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
3537  ctx().check_error();
3538  return expr(ctx(), r);
3539  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( expr const &  a1,
int  a2 
) const
inline

Definition at line 3540 of file z3++.h.

3540  {
3541  check_context(*this, a1);
3542  Z3_ast args[2] = { a1, ctx().num_val(a2, domain(1)) };
3543  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
3544  ctx().check_error();
3545  return expr(ctx(), r);
3546  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
expr num_val(int n, sort const &s)
Definition: z3++.h:3492
sort domain(unsigned i) const
Definition: z3++.h:721
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( int  a1,
expr const &  a2 
) const
inline

Definition at line 3547 of file z3++.h.

3547  {
3548  check_context(*this, a2);
3549  Z3_ast args[2] = { ctx().num_val(a1, domain(0)), a2 };
3550  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
3551  ctx().check_error();
3552  return expr(ctx(), r);
3553  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
expr num_val(int n, sort const &s)
Definition: z3++.h:3492
sort domain(unsigned i) const
Definition: z3++.h:721
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3 
) const
inline

Definition at line 3554 of file z3++.h.

3554  {
3555  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3);
3556  Z3_ast args[3] = { a1, a2, a3 };
3557  Z3_ast r = Z3_mk_app(ctx(), *this, 3, args);
3558  ctx().check_error();
3559  return expr(ctx(), r);
3560  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3,
expr const &  a4 
) const
inline

Definition at line 3561 of file z3++.h.

3561  {
3562  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3); check_context(*this, a4);
3563  Z3_ast args[4] = { a1, a2, a3, a4 };
3564  Z3_ast r = Z3_mk_app(ctx(), *this, 4, args);
3565  ctx().check_error();
3566  return expr(ctx(), r);
3567  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3,
expr const &  a4,
expr const &  a5 
) const
inline

Definition at line 3568 of file z3++.h.

3568  {
3569  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3); check_context(*this, a4); check_context(*this, a5);
3570  Z3_ast args[5] = { a1, a2, a3, a4, a5 };
3571  Z3_ast r = Z3_mk_app(ctx(), *this, 5, args);
3572  ctx().check_error();
3573  return expr(ctx(), r);
3574  }
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const args[])
Create a constant or function application.
context & ctx() const
Definition: z3++.h:428
friend void check_context(object const &a, object const &b)
Definition: z3++.h:432
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:188
sort range ( ) const
inline

Definition at line 722 of file z3++.h.

722 { Z3_sort r = Z3_get_range(ctx(), *this); check_error(); return sort(ctx(), r); }
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428
Z3_sort Z3_API Z3_get_range(Z3_context c, Z3_func_decl d)
Return the range of the given declaration.
func_decl transitive_closure ( func_decl const &  )
inline

Definition at line 726 of file z3++.h.

726  {
727  Z3_func_decl tc = Z3_mk_transitive_closure(ctx(), *this); check_error(); return func_decl(ctx(), tc);
728  }
Z3_func_decl Z3_API Z3_mk_transitive_closure(Z3_context c, Z3_func_decl f)
create transitive closure of binary relation.
func_decl(context &c)
Definition: z3++.h:711
Z3_error_code check_error() const
Definition: z3++.h:429
context & ctx() const
Definition: z3++.h:428