Z3
Data Structures | Public Member Functions
context Class Reference

A Context manages all other Z3 objects, global configuration options, etc. More...

Data Structures

struct  interpolation
 

Public Member Functions

 context ()
 
 context (config &c)
 
 context (config &c, interpolation)
 
 ~context ()
 
 operator Z3_context () const
 
Z3_error_code check_error () const
 Auxiliary method used to check for API usage errors. More...
 
void check_parser_error () const
 
void set_enable_exceptions (bool f)
 The C++ API uses by defaults exceptions on errors. For applications that don't work well with exceptions (there should be only few) you have the ability to turn off exceptions. The tradeoffs are that applications have to very careful about using check_error() after calls that may result in an errornous state. More...
 
bool enable_exceptions () const
 
void set (char const *param, char const *value)
 Update global parameter param with string value. More...
 
void set (char const *param, bool value)
 Update global parameter param with Boolean value. More...
 
void set (char const *param, int value)
 Update global parameter param with Integer value. More...
 
void interrupt ()
 Interrupt the current procedure being executed by any object managed by this context. This is a soft interruption: there is no guarantee the object will actualy stop. More...
 
symbol str_symbol (char const *s)
 Create a Z3 symbol based on the given string. More...
 
symbol int_symbol (int n)
 Create a Z3 symbol based on the given integer. More...
 
sort bool_sort ()
 Return the Boolean sort. More...
 
sort int_sort ()
 Return the integer sort. More...
 
sort real_sort ()
 Return the Real sort. More...
 
sort bv_sort (unsigned sz)
 Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz. More...
 
sort string_sort ()
 Return the sort for ASCII strings. More...
 
sort seq_sort (sort &s)
 Return a sequence sort over base sort s. More...
 
sort re_sort (sort &seq_sort)
 Return a regular expression sort over sequences seq_sort. More...
 
sort array_sort (sort d, sort r)
 Return an array sort for arrays from d to r. More...
 
sort array_sort (sort_vector const &d, sort r)
 
sort enumeration_sort (char const *name, unsigned n, char const *const *enum_names, func_decl_vector &cs, func_decl_vector &ts)
 Return an enumeration sort: enum_names[0], ..., enum_names[n-1]. cs and ts are output parameters. The method stores in cs the constants corresponding to the enumerated elements, and in ts the predicates for testing if terms of the enumeration sort correspond to an enumeration. More...
 
sort uninterpreted_sort (char const *name)
 create an uninterpreted sort with the name given by the string or symbol. More...
 
sort uninterpreted_sort (symbol const &name)
 
func_decl function (symbol const &name, unsigned arity, sort const *domain, sort const &range)
 
func_decl function (char const *name, unsigned arity, sort const *domain, sort const &range)
 
func_decl function (symbol const &name, sort_vector const &domain, sort const &range)
 
func_decl function (char const *name, sort_vector const &domain, sort const &range)
 
func_decl function (char const *name, sort const &domain, sort const &range)
 
func_decl function (char const *name, sort const &d1, sort const &d2, sort const &range)
 
func_decl function (char const *name, sort const &d1, sort const &d2, sort const &d3, sort const &range)
 
func_decl function (char const *name, sort const &d1, sort const &d2, sort const &d3, sort const &d4, sort const &range)
 
func_decl function (char const *name, sort const &d1, sort const &d2, sort const &d3, sort const &d4, sort const &d5, sort const &range)
 
expr constant (symbol const &name, sort const &s)
 
expr constant (char const *name, sort const &s)
 
expr bool_const (char const *name)
 
expr int_const (char const *name)
 
expr real_const (char const *name)
 
expr bv_const (char const *name, unsigned sz)
 
expr bool_val (bool b)
 
expr int_val (int n)
 
expr int_val (unsigned n)
 
expr int_val (__int64 n)
 
expr int_val (__uint64 n)
 
expr int_val (char const *n)
 
expr real_val (int n, int d)
 
expr real_val (int n)
 
expr real_val (unsigned n)
 
expr real_val (__int64 n)
 
expr real_val (__uint64 n)
 
expr real_val (char const *n)
 
expr bv_val (int n, unsigned sz)
 
expr bv_val (unsigned n, unsigned sz)
 
expr bv_val (__int64 n, unsigned sz)
 
expr bv_val (__uint64 n, unsigned sz)
 
expr bv_val (char const *n, unsigned sz)
 
expr bv_val (unsigned n, bool const *bits)
 
expr string_val (char const *s)
 
expr string_val (std::string const &s)
 
expr num_val (int n, sort const &s)
 
expr parse_string (char const *s)
 parsing More...
 
expr parse_file (char const *file)
 
expr parse_string (char const *s, sort_vector const &sorts, func_decl_vector const &decls)
 
expr parse_file (char const *s, sort_vector const &sorts, func_decl_vector const &decls)
 
check_result compute_interpolant (expr const &pat, params const &p, expr_vector &interp, model &m)
 Interpolation support. More...
 
expr_vector get_interpolant (expr const &proof, expr const &pat, params const &p)
 

Detailed Description

A Context manages all other Z3 objects, global configuration options, etc.

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

Constructor & Destructor Documentation

§ context() [1/3]

context ( )
inline

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

161 { config c; init(c); }

§ context() [2/3]

context ( config c)
inline

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

162 { init(c); }

§ context() [3/3]

context ( config c,
interpolation   
)
inline

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

163 { init_interp(c); }

§ ~context()

~context ( )
inline

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

164 { Z3_del_context(m_ctx); }
void Z3_API Z3_del_context(Z3_context c)
Delete the given logical context.

Member Function Documentation

§ array_sort() [1/2]

sort array_sort ( sort  d,
sort  r 
)
inline

Return an array sort for arrays from d to r.

Example: Given a context c, c.array_sort(c.int_sort(), c.bool_sort()) is an array sort from integer to Boolean.

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

2403 { Z3_sort s = Z3_mk_array_sort(m_ctx, d, r); check_error(); return sort(*this, s); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_array_sort(Z3_context c, Z3_sort domain, Z3_sort range)
Create an array type.

§ array_sort() [2/2]

sort array_sort ( sort_vector const &  d,
sort  r 
)
inline

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

2404  {
2405  array<Z3_sort> dom(d);
2406  Z3_sort s = Z3_mk_array_sort_n(m_ctx, dom.size(), dom.ptr(), r); check_error(); return sort(*this, s);
2407  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const *domain, Z3_sort range)
Create an array type with N arguments.

§ bool_const()

expr bool_const ( char const *  name)
inline

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

2505 { return constant(name, bool_sort()); }
sort bool_sort()
Return the Boolean sort.
Definition: z3++.h:2395
expr constant(symbol const &name, sort const &s)
Definition: z3++.h:2499

§ bool_sort()

sort bool_sort ( )
inline

Return the Boolean sort.

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

2395 { Z3_sort s = Z3_mk_bool_sort(m_ctx); check_error(); return sort(*this, s); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_bool_sort(Z3_context c)
Create the Boolean type.

§ bool_val()

expr bool_val ( bool  b)
inline

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

Referenced by z3::implies(), z3::operator &&(), and z3::operator||().

2510 { return b ? expr(*this, Z3_mk_true(m_ctx)) : expr(*this, Z3_mk_false(m_ctx)); }
Z3_ast Z3_API Z3_mk_true(Z3_context c)
Create an AST node representing true.
Z3_ast Z3_API Z3_mk_false(Z3_context c)
Create an AST node representing false.

§ bv_const()

expr bv_const ( char const *  name,
unsigned  sz 
)
inline

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

2508 { return constant(name, bv_sort(sz)); }
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398
expr constant(symbol const &name, sort const &s)
Definition: z3++.h:2499

§ bv_sort()

sort bv_sort ( unsigned  sz)
inline

Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.

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

2398 { Z3_sort s = Z3_mk_bv_sort(m_ctx, sz); check_error(); return sort(*this, s); }
Z3_sort Z3_API Z3_mk_bv_sort(Z3_context c, unsigned sz)
Create a bit-vector type of the given size.
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170

§ bv_val() [1/6]

expr bv_val ( int  n,
unsigned  sz 
)
inline

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

2525 { Z3_ast r = Z3_mk_int(m_ctx, n, bv_sort(sz)); check_error(); return expr(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398
Z3_ast Z3_API Z3_mk_int(Z3_context c, int v, Z3_sort ty)
Create a numeral of an int, bit-vector, or finite-domain sort.

§ bv_val() [2/6]

expr bv_val ( unsigned  n,
unsigned  sz 
)
inline

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

2526 { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, bv_sort(sz)); check_error(); return expr(*this, r); }
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398

§ bv_val() [3/6]

expr bv_val ( __int64  n,
unsigned  sz 
)
inline

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

2527 { Z3_ast r = Z3_mk_int64(m_ctx, n, bv_sort(sz)); check_error(); return expr(*this, r); }
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_int64(Z3_context c, __int64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398

§ bv_val() [4/6]

expr bv_val ( __uint64  n,
unsigned  sz 
)
inline

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

2528 { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, bv_sort(sz)); check_error(); return expr(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398
Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, __uint64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.

§ bv_val() [5/6]

expr bv_val ( char const *  n,
unsigned  sz 
)
inline

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

2529 { Z3_ast r = Z3_mk_numeral(m_ctx, n, bv_sort(sz)); check_error(); return expr(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort bv_sort(unsigned sz)
Return the Bit-vector sort of size sz. That is, the sort for bit-vectors of size sz.
Definition: z3++.h:2398
Z3_ast Z3_API Z3_mk_numeral(Z3_context c, Z3_string numeral, Z3_sort ty)
Create a numeral of a given sort.

§ bv_val() [6/6]

expr bv_val ( unsigned  n,
bool const *  bits 
)
inline

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

2530  {
2531  array<Z3_bool> _bits(n);
2532  for (unsigned i = 0; i < n; ++i) _bits[i] = bits[i] ? 1 : 0;
2533  Z3_ast r = Z3_mk_bv_numeral(m_ctx, n, _bits.ptr()); check_error(); return expr(*this, r);
2534  }
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_bv_numeral(Z3_context c, unsigned sz, Z3_bool const *bits)
create a bit-vector numeral from a vector of Booleans.

§ check_error()

Z3_error_code check_error ( ) const
inline

Auxiliary method used to check for API usage errors.

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

Referenced by object::check_error(), z3::concat(), z3::to_expr(), z3::to_func_decl(), and z3::to_sort().

170  {
171  Z3_error_code e = Z3_get_error_code(m_ctx);
172  if (e != Z3_OK && enable_exceptions())
173  Z3_THROW(exception(Z3_get_error_msg(m_ctx, e)));
174  return e;
175  }
Z3_string Z3_API Z3_get_error_msg(Z3_context c, Z3_error_code err)
Return a string describing the given error code.
#define Z3_THROW(x)
Definition: z3++.h:93
Definition: z3_api.h:1345
Z3_error_code
Z3 error codes (See Z3_get_error_code).
Definition: z3_api.h:1343
bool enable_exceptions() const
Definition: z3++.h:195
Z3_error_code Z3_API Z3_get_error_code(Z3_context c)
Return the error code for the last API call.

§ check_parser_error()

void check_parser_error ( ) const
inline

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

177  {
178  Z3_error_code e = Z3_get_error_code(*this);
179  if (e != Z3_OK && enable_exceptions()) {
180  Z3_string s = Z3_get_parser_error(*this);
181  if (s && *s) Z3_THROW(exception(s));
182  }
183  check_error();
184  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
#define Z3_THROW(x)
Definition: z3++.h:93
Definition: z3_api.h:1345
Z3_error_code
Z3 error codes (See Z3_get_error_code).
Definition: z3_api.h:1343
bool enable_exceptions() const
Definition: z3++.h:195
Z3_error_code Z3_API Z3_get_error_code(Z3_context c)
Return the error code for the last API call.
Z3_string Z3_API Z3_get_parser_error(Z3_context c)
Retrieve that last error message information generated from parsing.
const char * Z3_string
Z3 string type. It is just an alias for const char *.
Definition: z3_api.h:90

§ compute_interpolant()

check_result compute_interpolant ( expr const &  pat,
params const &  p,
expr_vector interp,
model m 
)
inline

Interpolation support.

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

2872  {
2873  Z3_ast_vector interp = 0;
2874  Z3_model mdl = 0;
2875  Z3_lbool r = Z3_compute_interpolant(*this, pat, p, &interp, &mdl);
2876  switch (r) {
2877  case Z3_L_FALSE:
2878  i = expr_vector(*this, interp);
2879  break;
2880  case Z3_L_TRUE:
2881  m = model(*this, mdl);
2882  break;
2883  case Z3_L_UNDEF:
2884  break;
2885  }
2886  return to_check_result(r);
2887  }
Z3_lbool Z3_API Z3_compute_interpolant(Z3_context c, Z3_ast pat, Z3_params p, Z3_ast_vector *interp, Z3_model *model)
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition: z3_api.h:106
check_result to_check_result(Z3_lbool l)
Definition: z3++.h:130
ast_vector_tpl< expr > expr_vector
Definition: z3++.h:68

§ constant() [1/2]

expr constant ( symbol const &  name,
sort const &  s 
)
inline

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

2499  {
2500  Z3_ast r = Z3_mk_const(m_ctx, name, s);
2501  check_error();
2502  return expr(*this, r);
2503  }
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_const(Z3_context c, Z3_symbol s, Z3_sort ty)
Declare and create a constant.

§ constant() [2/2]

expr constant ( char const *  name,
sort const &  s 
)
inline

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

2504 { return constant(str_symbol(name), s); }
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr constant(symbol const &name, sort const &s)
Definition: z3++.h:2499

§ enable_exceptions()

bool enable_exceptions ( ) const
inline

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

195 { return m_enable_exceptions; }

§ enumeration_sort()

sort enumeration_sort ( char const *  name,
unsigned  n,
char const *const *  enum_names,
func_decl_vector cs,
func_decl_vector ts 
)
inline

Return an enumeration sort: enum_names[0], ..., enum_names[n-1]. cs and ts are output parameters. The method stores in cs the constants corresponding to the enumerated elements, and in ts the predicates for testing if terms of the enumeration sort correspond to an enumeration.

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

2409  {
2410  array<Z3_symbol> _enum_names(n);
2411  for (unsigned i = 0; i < n; i++) { _enum_names[i] = Z3_mk_string_symbol(*this, enum_names[i]); }
2412  array<Z3_func_decl> _cs(n);
2413  array<Z3_func_decl> _ts(n);
2414  Z3_symbol _name = Z3_mk_string_symbol(*this, name);
2415  sort s = to_sort(*this, Z3_mk_enumeration_sort(*this, _name, n, _enum_names.ptr(), _cs.ptr(), _ts.ptr()));
2416  check_error();
2417  for (unsigned i = 0; i < n; i++) { cs.push_back(func_decl(*this, _cs[i])); ts.push_back(func_decl(*this, _ts[i])); }
2418  return s;
2419  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, Z3_string s)
Create a Z3 symbol using a C string.
Z3_sort Z3_API Z3_mk_enumeration_sort(Z3_context c, Z3_symbol name, unsigned n, Z3_symbol const enum_names[], Z3_func_decl enum_consts[], Z3_func_decl enum_testers[])
Create a enumeration sort.
sort to_sort(context &c, Z3_sort s)
Definition: z3++.h:1388

§ function() [1/9]

func_decl function ( symbol const &  name,
unsigned  arity,
sort const *  domain,
sort const &  range 
)
inline

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

Referenced by z3::function().

2428  {
2429  array<Z3_sort> args(arity);
2430  for (unsigned i = 0; i < arity; i++) {
2431  check_context(domain[i], range);
2432  args[i] = domain[i];
2433  }
2434  Z3_func_decl f = Z3_mk_func_decl(m_ctx, name, arity, args.ptr(), range);
2435  check_error();
2436  return func_decl(*this, f);
2437  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [2/9]

func_decl function ( char const *  name,
unsigned  arity,
sort const *  domain,
sort const &  range 
)
inline

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

2439  {
2440  return function(range.ctx().str_symbol(name), arity, domain, range);
2441  }
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
context & ctx() const
Definition: z3++.h:364

§ function() [3/9]

func_decl function ( symbol const &  name,
sort_vector const &  domain,
sort const &  range 
)
inline

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

2443  {
2444  array<Z3_sort> args(domain.size());
2445  for (unsigned i = 0; i < domain.size(); i++) {
2446  check_context(domain[i], range);
2447  args[i] = domain[i];
2448  }
2449  Z3_func_decl f = Z3_mk_func_decl(m_ctx, name, domain.size(), args.ptr(), range);
2450  check_error();
2451  return func_decl(*this, f);
2452  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [4/9]

func_decl function ( char const *  name,
sort_vector const &  domain,
sort const &  range 
)
inline

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

2454  {
2455  return function(range.ctx().str_symbol(name), domain, range);
2456  }
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
context & ctx() const
Definition: z3++.h:364

§ function() [5/9]

func_decl function ( char const *  name,
sort const &  domain,
sort const &  range 
)
inline

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

2459  {
2460  check_context(domain, range);
2461  Z3_sort args[1] = { domain };
2462  Z3_func_decl f = Z3_mk_func_decl(m_ctx, str_symbol(name), 1, args, range);
2463  check_error();
2464  return func_decl(*this, f);
2465  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [6/9]

func_decl function ( char const *  name,
sort const &  d1,
sort const &  d2,
sort const &  range 
)
inline

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

2467  {
2469  Z3_sort args[2] = { d1, d2 };
2470  Z3_func_decl f = Z3_mk_func_decl(m_ctx, str_symbol(name), 2, args, range);
2471  check_error();
2472  return func_decl(*this, f);
2473  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [7/9]

func_decl function ( char const *  name,
sort const &  d1,
sort const &  d2,
sort const &  d3,
sort const &  range 
)
inline

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

2475  {
2477  Z3_sort args[3] = { d1, d2, d3 };
2478  Z3_func_decl f = Z3_mk_func_decl(m_ctx, str_symbol(name), 3, args, range);
2479  check_error();
2480  return func_decl(*this, f);
2481  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [8/9]

func_decl function ( char const *  name,
sort const &  d1,
sort const &  d2,
sort const &  d3,
sort const &  d4,
sort const &  range 
)
inline

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

2483  {
2485  Z3_sort args[4] = { d1, d2, d3, d4 };
2486  Z3_func_decl f = Z3_mk_func_decl(m_ctx, str_symbol(name), 4, args, range);
2487  check_error();
2488  return func_decl(*this, f);
2489  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ function() [9/9]

func_decl function ( char const *  name,
sort const &  d1,
sort const &  d2,
sort const &  d3,
sort const &  d4,
sort const &  d5,
sort const &  range 
)
inline

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

2491  {
2493  Z3_sort args[5] = { d1, d2, d3, d4, d5 };
2494  Z3_func_decl f = Z3_mk_func_decl(m_ctx, str_symbol(name), 5, args, range);
2495  check_error();
2496  return func_decl(*this, f);
2497  }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
symbol str_symbol(char const *s)
Create a Z3 symbol based on the given string.
Definition: z3++.h:2392
expr range(expr const &lo, expr const &hi)
Definition: z3++.h:2813
Z3_func_decl Z3_API Z3_mk_func_decl(Z3_context c, Z3_symbol s, unsigned domain_size, Z3_sort const domain[], Z3_sort range)
Declare a constant or function.
void check_context(object const &a, object const &b)
Definition: z3++.h:368

§ get_interpolant()

expr_vector get_interpolant ( expr const &  proof,
expr const &  pat,
params const &  p 
)
inline

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

2889  {
2890  return expr_vector(*this, Z3_get_interpolant(*this, proof, pat, p));
2891  }
ast_vector_tpl< expr > expr_vector
Definition: z3++.h:68
Z3_ast_vector Z3_API Z3_get_interpolant(Z3_context c, Z3_ast pf, Z3_ast pat, Z3_params p)

§ int_const()

expr int_const ( char const *  name)
inline

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

2506 { return constant(name, int_sort()); }
expr constant(symbol const &name, sort const &s)
Definition: z3++.h:2499
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ int_sort()

sort int_sort ( )
inline

Return the integer sort.

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

2396 { Z3_sort s = Z3_mk_int_sort(m_ctx); check_error(); return sort(*this, s); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_int_sort(Z3_context c)
Create the integer type.

§ int_symbol()

symbol int_symbol ( int  n)
inline

Create a Z3 symbol based on the given integer.

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

2393 { Z3_symbol r = Z3_mk_int_symbol(m_ctx, n); check_error(); return symbol(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_symbol Z3_API Z3_mk_int_symbol(Z3_context c, int i)
Create a Z3 symbol using an integer.

§ int_val() [1/5]

expr int_val ( int  n)
inline

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

2512 { Z3_ast r = Z3_mk_int(m_ctx, n, int_sort()); check_error(); return expr(*this, r); }
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_int(Z3_context c, int v, Z3_sort ty)
Create a numeral of an int, bit-vector, or finite-domain sort.
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ int_val() [2/5]

expr int_val ( unsigned  n)
inline

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

2513 { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, int_sort()); check_error(); return expr(*this, r); }
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ int_val() [3/5]

expr int_val ( __int64  n)
inline

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

2514 { Z3_ast r = Z3_mk_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); }
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_int64(Z3_context c, __int64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ int_val() [4/5]

expr int_val ( __uint64  n)
inline

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

2515 { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, int_sort()); check_error(); return expr(*this, r); }
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_unsigned_int64(Z3_context c, __uint64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ int_val() [5/5]

expr int_val ( char const *  n)
inline

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

2516 { Z3_ast r = Z3_mk_numeral(m_ctx, n, int_sort()); check_error(); return expr(*this, r); }
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_numeral(Z3_context c, Z3_string numeral, Z3_sort ty)
Create a numeral of a given sort.
sort int_sort()
Return the integer sort.
Definition: z3++.h:2396

§ interrupt()

void interrupt ( )
inline

Interrupt the current procedure being executed by any object managed by this context. This is a soft interruption: there is no guarantee the object will actualy stop.

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

218 { Z3_interrupt(m_ctx); }
void Z3_API Z3_interrupt(Z3_context c)
Interrupt the execution of a Z3 procedure. This procedure can be used to interrupt: solvers...

§ num_val()

expr num_val ( int  n,
sort const &  s 
)
inline

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

Referenced by z3::ashr(), z3::lshr(), z3::mod(), z3::operator &(), z3::operator!=(), z3::operator*(), z3::operator+(), z3::operator-(), z3::operator/(), z3::operator<(), z3::operator<=(), z3::operator==(), z3::operator>(), z3::operator>=(), z3::operator^(), z3::operator|(), z3::pw(), z3::rem(), z3::select(), z3::shl(), z3::smod(), z3::srem(), z3::store(), z3::udiv(), z3::uge(), z3::ugt(), z3::ule(), z3::ult(), and z3::urem().

2539 { Z3_ast r = Z3_mk_int(m_ctx, n, s); check_error(); return expr(*this, r); }
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_int(Z3_context c, int v, Z3_sort ty)
Create a numeral of an int, bit-vector, or finite-domain sort.

§ operator Z3_context()

operator Z3_context ( ) const
inline

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

165 { return m_ctx; }

§ parse_file() [1/2]

expr parse_file ( char const *  file)
inline

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

2833  {
2834  Z3_ast r = Z3_parse_smtlib2_file(*this, s, 0, 0, 0, 0, 0, 0);
2836  return expr(*this, r);
2837  }
Z3_ast Z3_API Z3_parse_smtlib2_file(Z3_context c, Z3_string file_name, unsigned num_sorts, Z3_symbol const sort_names[], Z3_sort const sorts[], unsigned num_decls, Z3_symbol const decl_names[], Z3_func_decl const decls[])
Similar to Z3_parse_smtlib2_string, but reads the benchmark from a file.
void check_parser_error() const
Definition: z3++.h:177

§ parse_file() [2/2]

expr parse_file ( char const *  s,
sort_vector const &  sorts,
func_decl_vector const &  decls 
)
inline

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

2855  {
2856  array<Z3_symbol> sort_names(sorts.size());
2857  array<Z3_symbol> decl_names(decls.size());
2858  array<Z3_sort> sorts1(sorts);
2859  array<Z3_func_decl> decls1(decls);
2860  for (unsigned i = 0; i < sorts.size(); ++i) {
2861  sort_names[i] = sorts[i].name();
2862  }
2863  for (unsigned i = 0; i < decls.size(); ++i) {
2864  decl_names[i] = decls[i].name();
2865  }
2866  Z3_ast r = Z3_parse_smtlib2_file(*this, s, sorts.size(), sort_names.ptr(), sorts1.ptr(), decls.size(), decl_names.ptr(), decls1.ptr());
2868  return expr(*this, r);
2869  }
Z3_ast Z3_API Z3_parse_smtlib2_file(Z3_context c, Z3_string file_name, unsigned num_sorts, Z3_symbol const sort_names[], Z3_sort const sorts[], unsigned num_decls, Z3_symbol const decl_names[], Z3_func_decl const decls[])
Similar to Z3_parse_smtlib2_string, but reads the benchmark from a file.
void check_parser_error() const
Definition: z3++.h:177

§ parse_string() [1/2]

expr parse_string ( char const *  s)
inline

parsing

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

2828  {
2829  Z3_ast r = Z3_parse_smtlib2_string(*this, s, 0, 0, 0, 0, 0, 0);
2831  return expr(*this, r);
2832  }
Z3_ast Z3_API Z3_parse_smtlib2_string(Z3_context c, Z3_string str, unsigned num_sorts, Z3_symbol const sort_names[], Z3_sort const sorts[], unsigned num_decls, Z3_symbol const decl_names[], Z3_func_decl const decls[])
Parse the given string using the SMT-LIB2 parser.
void check_parser_error() const
Definition: z3++.h:177

§ parse_string() [2/2]

expr parse_string ( char const *  s,
sort_vector const &  sorts,
func_decl_vector const &  decls 
)
inline

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

2839  {
2840  array<Z3_symbol> sort_names(sorts.size());
2841  array<Z3_symbol> decl_names(decls.size());
2842  array<Z3_sort> sorts1(sorts);
2843  array<Z3_func_decl> decls1(decls);
2844  for (unsigned i = 0; i < sorts.size(); ++i) {
2845  sort_names[i] = sorts[i].name();
2846  }
2847  for (unsigned i = 0; i < decls.size(); ++i) {
2848  decl_names[i] = decls[i].name();
2849  }
2850  Z3_ast r = Z3_parse_smtlib2_string(*this, s, sorts.size(), sort_names.ptr(), sorts1.ptr(), decls.size(), decl_names.ptr(), decls1.ptr());
2852  return expr(*this, r);
2853  }
Z3_ast Z3_API Z3_parse_smtlib2_string(Z3_context c, Z3_string str, unsigned num_sorts, Z3_symbol const sort_names[], Z3_sort const sorts[], unsigned num_decls, Z3_symbol const decl_names[], Z3_func_decl const decls[])
Parse the given string using the SMT-LIB2 parser.
void check_parser_error() const
Definition: z3++.h:177

§ re_sort()

sort re_sort ( sort seq_sort)
inline

Return a regular expression sort over sequences seq_sort.

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

2401 { Z3_sort r = Z3_mk_re_sort(m_ctx, s); check_error(); return sort(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_re_sort(Z3_context c, Z3_sort seq)
Create a regular expression sort out of a sequence sort.

§ real_const()

expr real_const ( char const *  name)
inline

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

2507 { return constant(name, real_sort()); }
expr constant(symbol const &name, sort const &s)
Definition: z3++.h:2499
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397

§ real_sort()

sort real_sort ( )
inline

Return the Real sort.

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

2397 { Z3_sort s = Z3_mk_real_sort(m_ctx); check_error(); return sort(*this, s); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_real_sort(Z3_context c)
Create the real type.

§ real_val() [1/6]

expr real_val ( int  n,
int  d 
)
inline

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

2518 { Z3_ast r = Z3_mk_real(m_ctx, n, d); check_error(); return expr(*this, r); }
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_real(Z3_context c, int num, int den)
Create a real from a fraction.

§ real_val() [2/6]

expr real_val ( int  n)
inline

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

2519 { Z3_ast r = Z3_mk_int(m_ctx, n, real_sort()); check_error(); return expr(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397
Z3_ast Z3_API Z3_mk_int(Z3_context c, int v, Z3_sort ty)
Create a numeral of an int, bit-vector, or finite-domain sort.

§ real_val() [3/6]

expr real_val ( unsigned  n)
inline

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

2520 { Z3_ast r = Z3_mk_unsigned_int(m_ctx, n, real_sort()); check_error(); return expr(*this, r); }
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397

§ real_val() [4/6]

expr real_val ( __int64  n)
inline

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

2521 { Z3_ast r = Z3_mk_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); }
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_int64(Z3_context c, __int64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397

§ real_val() [5/6]

expr real_val ( __uint64  n)
inline

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

2522 { Z3_ast r = Z3_mk_unsigned_int64(m_ctx, n, real_sort()); check_error(); return expr(*this, r); }
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_unsigned_int64(Z3_context c, __uint64 v, Z3_sort ty)
Create a numeral of a int, bit-vector, or finite-domain sort.
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397

§ real_val() [6/6]

expr real_val ( char const *  n)
inline

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

2523 { Z3_ast r = Z3_mk_numeral(m_ctx, n, real_sort()); check_error(); return expr(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
sort real_sort()
Return the Real sort.
Definition: z3++.h:2397
Z3_ast Z3_API Z3_mk_numeral(Z3_context c, Z3_string numeral, Z3_sort ty)
Create a numeral of a given sort.

§ seq_sort()

sort seq_sort ( sort s)
inline

Return a sequence sort over base sort s.

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

2400 { Z3_sort r = Z3_mk_seq_sort(m_ctx, s); check_error(); return sort(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_seq_sort(Z3_context c, Z3_sort s)
Create a sequence sort out of the sort for the elements.

§ set() [1/3]

void set ( char const *  param,
char const *  value 
)
inline

Update global parameter param with string value.

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

200 { Z3_update_param_value(m_ctx, param, value); }
void Z3_API Z3_update_param_value(Z3_context c, Z3_string param_id, Z3_string param_value)
Set a value of a context parameter.

§ set() [2/3]

void set ( char const *  param,
bool  value 
)
inline

Update global parameter param with Boolean value.

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

204 { Z3_update_param_value(m_ctx, param, value ? "true" : "false"); }
void Z3_API Z3_update_param_value(Z3_context c, Z3_string param_id, Z3_string param_value)
Set a value of a context parameter.

§ set() [3/3]

void set ( char const *  param,
int  value 
)
inline

Update global parameter param with Integer value.

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

208  {
209  std::ostringstream oss;
210  oss << value;
211  Z3_update_param_value(m_ctx, param, oss.str().c_str());
212  }
void Z3_API Z3_update_param_value(Z3_context c, Z3_string param_id, Z3_string param_value)
Set a value of a context parameter.

§ set_enable_exceptions()

void set_enable_exceptions ( bool  f)
inline

The C++ API uses by defaults exceptions on errors. For applications that don't work well with exceptions (there should be only few) you have the ability to turn off exceptions. The tradeoffs are that applications have to very careful about using check_error() after calls that may result in an errornous state.

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

193 { m_enable_exceptions = f; }

§ str_symbol()

symbol str_symbol ( char const *  s)
inline

Create a Z3 symbol based on the given string.

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

Referenced by context::function(), and solver::solver().

2392 { Z3_symbol r = Z3_mk_string_symbol(m_ctx, s); check_error(); return symbol(*this, r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, Z3_string s)
Create a Z3 symbol using a C string.

§ string_sort()

sort string_sort ( )
inline

Return the sort for ASCII strings.

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

2399 { Z3_sort s = Z3_mk_string_sort(m_ctx); check_error(); return sort(*this, s); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition: z3++.h:170
Z3_sort Z3_API Z3_mk_string_sort(Z3_context c)
Create a sort for 8 bit strings.

§ string_val() [1/2]

expr string_val ( char const *  s)
inline

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

2536 { Z3_ast r = Z3_mk_string(m_ctx, s); check_error(); return expr(*this, r); }
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_string(Z3_context c, Z3_string s)
Create a string constant out of the string that is passed in.

§ string_val() [2/2]

expr string_val ( std::string const &  s)
inline

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

2537 { Z3_ast r = Z3_mk_string(m_ctx, s.c_str()); check_error(); return expr(*this, r); }
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_string(Z3_context c, Z3_string s)
Create a string constant out of the string that is passed in.

§ uninterpreted_sort() [1/2]

sort uninterpreted_sort ( char const *  name)
inline

create an uninterpreted sort with the name given by the string or symbol.

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

2420  {
2421  Z3_symbol _name = Z3_mk_string_symbol(*this, name);
2422  return to_sort(*this, Z3_mk_uninterpreted_sort(*this, _name));
2423  }
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, Z3_string s)
Create a Z3 symbol using a C string.
Z3_sort Z3_API Z3_mk_uninterpreted_sort(Z3_context c, Z3_symbol s)
Create a free (uninterpreted) type using the given name (symbol).
sort to_sort(context &c, Z3_sort s)
Definition: z3++.h:1388

§ uninterpreted_sort() [2/2]

sort uninterpreted_sort ( symbol const &  name)
inline

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

2424  {
2425  return to_sort(*this, Z3_mk_uninterpreted_sort(*this, name));
2426  }
Z3_sort Z3_API Z3_mk_uninterpreted_sort(Z3_context c, Z3_symbol s)
Create a free (uninterpreted) type using the given name (symbol).
sort to_sort(context &c, Z3_sort s)
Definition: z3++.h:1388