Z3
Public Member Functions | Friends
sort Class Reference

A Z3 sort (aka type). Every expression (i.e., formula or term) in Z3 has a sort. More...

+ Inheritance diagram for sort:

Public Member Functions

 sort (context &c)
 
 sort (context &c, Z3_sort s)
 
 sort (context &c, Z3_ast a)
 
 operator Z3_sort () const
 
unsigned id () const
 retrieve unique identifier for func_decl. More...
 
Z3_sort_kind sort_kind () const
 Return the internal sort kind. More...
 
symbol name () const
 Return name of sort. More...
 
bool is_bool () const
 Return true if this sort is the Boolean sort. More...
 
bool is_int () const
 Return true if this sort is the Integer sort. More...
 
bool is_real () const
 Return true if this sort is the Real sort. More...
 
bool is_arith () const
 Return true if this sort is the Integer or Real sort. More...
 
bool is_bv () const
 Return true if this sort is a Bit-vector sort. More...
 
bool is_array () const
 Return true if this sort is a Array sort. More...
 
bool is_datatype () const
 Return true if this sort is a Datatype sort. More...
 
bool is_relation () const
 Return true if this sort is a Relation sort. More...
 
bool is_seq () const
 Return true if this sort is a Sequence sort. More...
 
bool is_re () const
 Return true if this sort is a regular expression sort. More...
 
bool is_finite_domain () const
 Return true if this sort is a Finite domain sort. More...
 
bool is_fpa () const
 Return true if this sort is a Floating point sort. More...
 
unsigned bv_size () const
 Return the size of this Bit-vector sort. More...
 
unsigned fpa_ebits () const
 
unsigned fpa_sbits () const
 
sort array_domain () const
 Return the domain of this Array sort. More...
 
sort array_range () const
 Return the range of this Array sort. More...
 
func_decl_vector constructors ()
 
func_decl_vector recognizers ()
 
- Public Member Functions inherited from ast
 ast (context &c)
 
 ast (context &c, Z3_ast n)
 
 ast (ast const &s)
 
 ~ast () override
 
 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)
 
virtual ~object ()=default
 
contextctx () const
 
Z3_error_code check_error () const
 

Friends

std::ostream & operator<< (std::ostream &out, sort const &s)
 

Additional Inherited Members

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

Detailed Description

A Z3 sort (aka type). Every expression (i.e., formula or term) in Z3 has a sort.

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

Constructor & Destructor Documentation

sort ( context c)
inline

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

Referenced by sort::array_domain(), and sort::array_range().

659 :ast(c) {}
ast(context &c)
Definition: z3++.h:555
sort ( context c,
Z3_sort  s 
)
inline

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

660 :ast(c, reinterpret_cast<Z3_ast>(s)) {}
ast(context &c)
Definition: z3++.h:555
sort ( context c,
Z3_ast  a 
)
inline

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

661 :ast(c, a) {}
ast(context &c)
Definition: z3++.h:555

Member Function Documentation

sort array_domain ( ) const
inline

Return the domain of this Array sort.

Precondition
is_array()

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

Referenced by z3::select(), and z3::store().

741 { assert(is_array()); Z3_sort s = Z3_get_array_sort_domain(ctx(), *this); check_error(); return sort(ctx(), s); }
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
Z3_sort Z3_API Z3_get_array_sort_domain(Z3_context c, Z3_sort t)
Return the domain of the given array sort. In the case of a multi-dimensional array, this function returns the sort of the first dimension.
sort(context &c)
Definition: z3++.h:659
bool is_array() const
Return true if this sort is a Array sort.
Definition: z3++.h:700
sort array_range ( ) const
inline

Return the range of this Array sort.

Precondition
is_array()

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

Referenced by z3::store().

747 { assert(is_array()); Z3_sort s = Z3_get_array_sort_range(ctx(), *this); check_error(); return sort(ctx(), s); }
Z3_sort Z3_API Z3_get_array_sort_range(Z3_context c, Z3_sort t)
Return the range of the given array sort.
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
sort(context &c)
Definition: z3++.h:659
bool is_array() const
Return true if this sort is a Array sort.
Definition: z3++.h:700
unsigned bv_size ( ) const
inline

Return the size of this Bit-vector sort.

Precondition
is_bv()

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

731 { assert(is_bv()); unsigned r = Z3_get_bv_sort_size(ctx(), *this); check_error(); return r; }
bool is_bv() const
Return true if this sort is a Bit-vector sort.
Definition: z3++.h:696
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
unsigned Z3_API Z3_get_bv_sort_size(Z3_context c, Z3_sort t)
Return the size of the given bit-vector sort.

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

4192  {
4193  assert(is_datatype());
4194  func_decl_vector cs(ctx());
4195  unsigned n = Z3_get_datatype_sort_num_constructors(ctx(), *this);
4196  for (unsigned i = 0; i < n; ++i)
4197  cs.push_back(func_decl(ctx(), Z3_get_datatype_sort_constructor(ctx(), *this, i)));
4198  return cs;
4199  }
ast_vector_tpl< func_decl > func_decl_vector
Definition: z3++.h:78
context & ctx() const
Definition: z3++.h:474
unsigned Z3_API Z3_get_datatype_sort_num_constructors(Z3_context c, Z3_sort t)
Return number of constructors for datatype.
bool is_datatype() const
Return true if this sort is a Datatype sort.
Definition: z3++.h:704
Z3_func_decl Z3_API Z3_get_datatype_sort_constructor(Z3_context c, Z3_sort t, unsigned idx)
Return idx'th constructor.
unsigned fpa_ebits ( ) const
inline

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

733 { assert(is_fpa()); unsigned r = Z3_fpa_get_ebits(ctx(), *this); check_error(); return r; }
unsigned Z3_API Z3_fpa_get_ebits(Z3_context c, Z3_sort s)
Retrieves the number of bits reserved for the exponent in a FloatingPoint sort.
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
bool is_fpa() const
Return true if this sort is a Floating point sort.
Definition: z3++.h:724
unsigned fpa_sbits ( ) const
inline

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

735 { assert(is_fpa()); unsigned r = Z3_fpa_get_sbits(ctx(), *this); check_error(); return r; }
unsigned Z3_API Z3_fpa_get_sbits(Z3_context c, Z3_sort s)
Retrieves the number of bits reserved for the significand in a FloatingPoint sort.
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
bool is_fpa() const
Return true if this sort is a Floating point sort.
Definition: z3++.h:724
unsigned id ( ) const
inline

retrieve unique identifier for func_decl.

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

667 { unsigned r = Z3_get_sort_id(ctx(), *this); check_error(); return r; }
unsigned Z3_API Z3_get_sort_id(Z3_context c, Z3_sort s)
Return a unique identifier for s.
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
bool is_arith ( ) const
inline

Return true if this sort is the Integer or Real sort.

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

Referenced by expr::is_arith().

692 { return is_int() || is_real(); }
bool is_int() const
Return true if this sort is the Integer sort.
Definition: z3++.h:684
bool is_real() const
Return true if this sort is the Real sort.
Definition: z3++.h:688
bool is_array ( ) const
inline

Return true if this sort is a Array sort.

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

Referenced by sort::array_domain(), sort::array_range(), and expr::is_array().

700 { return sort_kind() == Z3_ARRAY_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_bool ( ) const
inline

Return true if this sort is the Boolean sort.

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

Referenced by expr::is_bool().

680 { return sort_kind() == Z3_BOOL_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_bv ( ) const
inline

Return true if this sort is a Bit-vector sort.

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

Referenced by sort::bv_size(), and expr::is_bv().

696 { return sort_kind() == Z3_BV_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_datatype ( ) const
inline

Return true if this sort is a Datatype sort.

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

Referenced by func_decl::accessors(), sort::constructors(), expr::is_datatype(), and sort::recognizers().

704 { return sort_kind() == Z3_DATATYPE_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_finite_domain ( ) const
inline

Return true if this sort is a Finite domain sort.

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

Referenced by expr::is_finite_domain().

720 { return sort_kind() == Z3_FINITE_DOMAIN_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_fpa ( ) const
inline

Return true if this sort is a Floating point sort.

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

Referenced by sort::fpa_ebits(), sort::fpa_sbits(), and expr::is_fpa().

724 { return sort_kind() == Z3_FLOATING_POINT_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_int ( ) const
inline

Return true if this sort is the Integer sort.

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

Referenced by sort::is_arith(), and expr::is_int().

684 { return sort_kind() == Z3_INT_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_re ( ) const
inline

Return true if this sort is a regular expression sort.

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

Referenced by expr::is_re().

716 { return sort_kind() == Z3_RE_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_real ( ) const
inline

Return true if this sort is the Real sort.

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

Referenced by sort::is_arith(), and expr::is_real().

688 { return sort_kind() == Z3_REAL_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_relation ( ) const
inline

Return true if this sort is a Relation sort.

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

Referenced by expr::is_relation().

708 { return sort_kind() == Z3_RELATION_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
bool is_seq ( ) const
inline

Return true if this sort is a Sequence sort.

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

Referenced by expr::is_seq().

712 { return sort_kind() == Z3_SEQ_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:672
symbol name ( ) const
inline

Return name of sort.

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

676 { Z3_symbol s = Z3_get_sort_name(ctx(), *this); check_error(); return symbol(ctx(), s); }
Z3_error_code check_error() const
Definition: z3++.h:475
context & ctx() const
Definition: z3++.h:474
Z3_symbol Z3_API Z3_get_sort_name(Z3_context c, Z3_sort d)
Return the sort name as a symbol.
operator Z3_sort ( ) const
inline

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

662 { return reinterpret_cast<Z3_sort>(m_ast); }
Z3_ast m_ast
Definition: z3++.h:553
func_decl_vector recognizers ( )
inline

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

4201  {
4202  assert(is_datatype());
4203  func_decl_vector rs(ctx());
4204  unsigned n = Z3_get_datatype_sort_num_constructors(ctx(), *this);
4205  for (unsigned i = 0; i < n; ++i)
4206  rs.push_back(func_decl(ctx(), Z3_get_datatype_sort_recognizer(ctx(), *this, i)));
4207  return rs;
4208  }
Z3_func_decl Z3_API Z3_get_datatype_sort_recognizer(Z3_context c, Z3_sort t, unsigned idx)
Return idx'th recognizer.
ast_vector_tpl< func_decl > func_decl_vector
Definition: z3++.h:78
context & ctx() const
Definition: z3++.h:474
unsigned Z3_API Z3_get_datatype_sort_num_constructors(Z3_context c, Z3_sort t)
Return number of constructors for datatype.
bool is_datatype() const
Return true if this sort is a Datatype sort.
Definition: z3++.h:704
Z3_sort_kind sort_kind ( ) const
inline

Return the internal sort kind.

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

Referenced by sort::is_array(), sort::is_bool(), sort::is_bv(), sort::is_datatype(), sort::is_finite_domain(), sort::is_fpa(), sort::is_int(), sort::is_re(), sort::is_real(), sort::is_relation(), and sort::is_seq().

672 { return Z3_get_sort_kind(*m_ctx, *this); }
Z3_sort_kind Z3_API Z3_get_sort_kind(Z3_context c, Z3_sort t)
Return the sort kind (e.g., array, tuple, int, bool, etc).
context * m_ctx
Definition: z3++.h:470

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
sort const &  s 
)
friend

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

749 { return out << Z3_sort_to_string(s.ctx(), Z3_sort(s.m_ast)); }
Z3_string Z3_API Z3_sort_to_string(Z3_context c, Z3_sort s)