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)
 
 func_decl (func_decl const &s)
 
 operator Z3_func_decl () const
 
func_decloperator= (func_decl const &s)
 
unsigned arity () const
 
sort domain (unsigned i) const
 
sort range () const
 
symbol name () const
 
Z3_decl_kind decl_kind () 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)
 
 object (object const &s)
 
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 561 of file z3++.h.

Constructor & Destructor Documentation

§ func_decl() [1/3]

func_decl ( context c)
inline

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

563 :ast(c) {}
ast(context &c)
Definition: z3++.h:445

§ func_decl() [2/3]

func_decl ( context c,
Z3_func_decl  n 
)
inline

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

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

§ func_decl() [3/3]

func_decl ( func_decl const &  s)
inline

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

565 :ast(s) {}
ast(context &c)
Definition: z3++.h:445

Member Function Documentation

§ arity()

unsigned arity ( ) const
inline

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

Referenced by fixedpoint::add_fact().

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

§ decl_kind()

Z3_decl_kind decl_kind ( ) const
inline

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

573 { 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:364

§ domain()

sort domain ( unsigned  i) const
inline

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

570 { 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:365
context & ctx() const
Definition: z3++.h:364
unsigned arity() const
Definition: z3++.h:569
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.

§ is_const()

bool is_const ( ) const
inline

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

575 { return arity() == 0; }
unsigned arity() const
Definition: z3++.h:569

§ name()

symbol name ( ) const
inline

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

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

§ operator Z3_func_decl()

operator Z3_func_decl ( ) const
inline

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

566 { return reinterpret_cast<Z3_func_decl>(m_ast); }
Z3_ast m_ast
Definition: z3++.h:443

§ operator()() [1/11]

expr operator() ( ) const
inline

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

2562  {
2563  Z3_ast r = Z3_mk_app(ctx(), *this, 0, 0);
2564  ctx().check_error();
2565  return expr(ctx(), r);
2566  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364

§ operator()() [2/11]

expr operator() ( unsigned  n,
expr const *  args 
) const
inline

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

2541  {
2542  array<Z3_ast> _args(n);
2543  for (unsigned i = 0; i < n; i++) {
2544  check_context(*this, args[i]);
2545  _args[i] = args[i];
2546  }
2547  Z3_ast r = Z3_mk_app(ctx(), *this, n, _args.ptr());
2548  check_error();
2549  return expr(ctx(), r);
2550 
2551  }
Z3_error_code check_error() const
Definition: z3++.h:365
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [3/11]

expr operator() ( expr_vector const &  v) const
inline

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

2552  {
2553  array<Z3_ast> _args(args.size());
2554  for (unsigned i = 0; i < args.size(); i++) {
2555  check_context(*this, args[i]);
2556  _args[i] = args[i];
2557  }
2558  Z3_ast r = Z3_mk_app(ctx(), *this, args.size(), _args.ptr());
2559  check_error();
2560  return expr(ctx(), r);
2561  }
Z3_error_code check_error() const
Definition: z3++.h:365
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [4/11]

expr operator() ( expr const &  a) const
inline

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

2567  {
2568  check_context(*this, a);
2569  Z3_ast args[1] = { a };
2570  Z3_ast r = Z3_mk_app(ctx(), *this, 1, args);
2571  ctx().check_error();
2572  return expr(ctx(), r);
2573  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [5/11]

expr operator() ( int  a) const
inline

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

2574  {
2575  Z3_ast args[1] = { ctx().num_val(a, domain(0)) };
2576  Z3_ast r = Z3_mk_app(ctx(), *this, 1, args);
2577  ctx().check_error();
2578  return expr(ctx(), r);
2579  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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.
sort domain(unsigned i) const
Definition: z3++.h:570
context & ctx() const
Definition: z3++.h:364
expr num_val(int n, sort const &s)
Definition: z3++.h:2539

§ operator()() [6/11]

expr operator() ( expr const &  a1,
expr const &  a2 
) const
inline

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

2580  {
2581  check_context(*this, a1); check_context(*this, a2);
2582  Z3_ast args[2] = { a1, a2 };
2583  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
2584  ctx().check_error();
2585  return expr(ctx(), r);
2586  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [7/11]

expr operator() ( expr const &  a1,
int  a2 
) const
inline

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

2587  {
2588  check_context(*this, a1);
2589  Z3_ast args[2] = { a1, ctx().num_val(a2, domain(1)) };
2590  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
2591  ctx().check_error();
2592  return expr(ctx(), r);
2593  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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.
sort domain(unsigned i) const
Definition: z3++.h:570
context & ctx() const
Definition: z3++.h:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368
expr num_val(int n, sort const &s)
Definition: z3++.h:2539

§ operator()() [8/11]

expr operator() ( int  a1,
expr const &  a2 
) const
inline

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

2594  {
2595  check_context(*this, a2);
2596  Z3_ast args[2] = { ctx().num_val(a1, domain(0)), a2 };
2597  Z3_ast r = Z3_mk_app(ctx(), *this, 2, args);
2598  ctx().check_error();
2599  return expr(ctx(), r);
2600  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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.
sort domain(unsigned i) const
Definition: z3++.h:570
context & ctx() const
Definition: z3++.h:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368
expr num_val(int n, sort const &s)
Definition: z3++.h:2539

§ operator()() [9/11]

expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3 
) const
inline

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

2601  {
2602  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3);
2603  Z3_ast args[3] = { a1, a2, a3 };
2604  Z3_ast r = Z3_mk_app(ctx(), *this, 3, args);
2605  ctx().check_error();
2606  return expr(ctx(), r);
2607  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [10/11]

expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3,
expr const &  a4 
) const
inline

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

2608  {
2609  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3); check_context(*this, a4);
2610  Z3_ast args[4] = { a1, a2, a3, a4 };
2611  Z3_ast r = Z3_mk_app(ctx(), *this, 4, args);
2612  ctx().check_error();
2613  return expr(ctx(), r);
2614  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator()() [11/11]

expr operator() ( expr const &  a1,
expr const &  a2,
expr const &  a3,
expr const &  a4,
expr const &  a5 
) const
inline

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

2615  {
2616  check_context(*this, a1); check_context(*this, a2); check_context(*this, a3); check_context(*this, a4); check_context(*this, a5);
2617  Z3_ast args[5] = { a1, a2, a3, a4, a5 };
2618  Z3_ast r = Z3_mk_app(ctx(), *this, 5, args);
2619  ctx().check_error();
2620  return expr(ctx(), r);
2621  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
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:364
friend void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ operator=()

func_decl& operator= ( func_decl const &  s)
inline

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

567 { return static_cast<func_decl&>(ast::operator=(s)); }
func_decl(context &c)
Definition: z3++.h:563
ast & operator=(ast const &s)
Definition: z3++.h:451

§ range()

sort range ( ) const
inline

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

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