Z3
Public Member Functions
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 (sort const &s)
 
 operator Z3_sort () const
 
sortoperator= (sort const &s)
 Return true if this sort and s are equal. 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...
 
unsigned bv_size () const
 Return the size of this Bit-vector sort. More...
 
sort array_domain () const
 Return the domain of this Array sort. More...
 
sort array_range () const
 Return the range of this Array sort. More...
 
- 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

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

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

Constructor & Destructor Documentation

◆ sort() [1/3]

sort ( context c)
inline

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

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

484 :ast(c) {}
ast(context &c)
Definition: z3++.h:454

◆ sort() [2/3]

sort ( context c,
Z3_sort  s 
)
inline

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

485 :ast(c, reinterpret_cast<Z3_ast>(s)) {}
ast(context &c)
Definition: z3++.h:454

◆ sort() [3/3]

sort ( sort const &  s)
inline

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

486 :ast(s) {}
ast(context &c)
Definition: z3++.h:454

Member Function Documentation

◆ array_domain()

sort array_domain ( ) const
inline

Return the domain of this Array sort.

Precondition
is_array()

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

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

557 { 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:374
context & ctx() const
Definition: z3++.h:373
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.
bool is_array() const
Return true if this sort is a Array sort.
Definition: z3++.h:523
sort(context &c)
Definition: z3++.h:484

◆ array_range()

sort array_range ( ) const
inline

Return the range of this Array sort.

Precondition
is_array()

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

Referenced by z3::store().

563 { assert(is_array()); Z3_sort s = Z3_get_array_sort_range(ctx(), *this); check_error(); return sort(ctx(), s); }
Z3_error_code check_error() const
Definition: z3++.h:374
Z3_sort Z3_API Z3_get_array_sort_range(Z3_context c, Z3_sort t)
Return the range of the given array sort.
context & ctx() const
Definition: z3++.h:373
bool is_array() const
Return true if this sort is a Array sort.
Definition: z3++.h:523
sort(context &c)
Definition: z3++.h:484

◆ bv_size()

unsigned bv_size ( ) const
inline

Return the size of this Bit-vector sort.

Precondition
is_bv()

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

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

◆ is_arith()

bool is_arith ( ) const
inline

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

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

Referenced by expr::is_arith().

515 { return is_int() || is_real(); }
bool is_int() const
Return true if this sort is the Integer sort.
Definition: z3++.h:507
bool is_real() const
Return true if this sort is the Real sort.
Definition: z3++.h:511

◆ is_array()

bool is_array ( ) const
inline

Return true if this sort is a Array sort.

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

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

523 { return sort_kind() == Z3_ARRAY_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_bool()

bool is_bool ( ) const
inline

Return true if this sort is the Boolean sort.

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

Referenced by expr::is_bool().

503 { return sort_kind() == Z3_BOOL_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_bv()

bool is_bv ( ) const
inline

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

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

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

519 { return sort_kind() == Z3_BV_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_datatype()

bool is_datatype ( ) const
inline

Return true if this sort is a Datatype sort.

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

Referenced by expr::is_datatype().

527 { return sort_kind() == Z3_DATATYPE_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_finite_domain()

bool is_finite_domain ( ) const
inline

Return true if this sort is a Finite domain sort.

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

Referenced by expr::is_finite_domain().

543 { return sort_kind() == Z3_FINITE_DOMAIN_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_int()

bool is_int ( ) const
inline

Return true if this sort is the Integer sort.

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

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

507 { return sort_kind() == Z3_INT_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_re()

bool is_re ( ) const
inline

Return true if this sort is a regular expression sort.

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

Referenced by expr::is_re().

539 { return sort_kind() == Z3_RE_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_real()

bool is_real ( ) const
inline

Return true if this sort is the Real sort.

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

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

511 { return sort_kind() == Z3_REAL_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_relation()

bool is_relation ( ) const
inline

Return true if this sort is a Relation sort.

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

Referenced by expr::is_relation().

531 { return sort_kind() == Z3_RELATION_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ is_seq()

bool is_seq ( ) const
inline

Return true if this sort is a Sequence sort.

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

Referenced by expr::is_seq().

535 { return sort_kind() == Z3_SEQ_SORT; }
Z3_sort_kind sort_kind() const
Return the internal sort kind.
Definition: z3++.h:495

◆ name()

symbol name ( ) const
inline

Return name of sort.

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

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

◆ operator Z3_sort()

operator Z3_sort ( ) const
inline

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

487 { return reinterpret_cast<Z3_sort>(m_ast); }
Z3_ast m_ast
Definition: z3++.h:452

◆ operator=()

sort& operator= ( sort const &  s)
inline

Return true if this sort and s are equal.

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

491 { return static_cast<sort&>(ast::operator=(s)); }
sort(context &c)
Definition: z3++.h:484
ast & operator=(ast const &s)
Definition: z3++.h:460

◆ sort_kind()

Z3_sort_kind sort_kind ( ) const
inline

Return the internal sort kind.

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

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

495 { 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:369