Z3
 
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Friends
expr Class Reference

A Z3 expression is used to represent formulas and terms. For Z3, a formula is any expression of sort Boolean. Every expression has a sort. More...

#include <z3++.h>

+ Inheritance diagram for expr:

Data Structures

class  iterator
 

Public Member Functions

 expr (context &c)
 
 expr (context &c, Z3_ast n)
 
sort get_sort () const
 Return the sort of this expression.
 
bool is_bool () const
 Return true if this is a Boolean expression.
 
bool is_int () const
 Return true if this is an integer expression.
 
bool is_real () const
 Return true if this is a real expression.
 
bool is_arith () const
 Return true if this is an integer or real expression.
 
bool is_bv () const
 Return true if this is a Bit-vector expression.
 
bool is_array () const
 Return true if this is a Array expression.
 
bool is_datatype () const
 Return true if this is a Datatype expression.
 
bool is_relation () const
 Return true if this is a Relation expression.
 
bool is_seq () const
 Return true if this is a sequence expression.
 
bool is_re () const
 Return true if this is a regular expression.
 
bool is_finite_domain () const
 Return true if this is a Finite-domain expression.
 
bool is_fpa () const
 Return true if this is a FloatingPoint expression. .
 
bool is_numeral () const
 Return true if this expression is a numeral. Specialized functions also return representations for the numerals as small integers, 64 bit integers or rational or decimal strings.
 
bool is_numeral_i64 (int64_t &i) const
 
bool is_numeral_u64 (uint64_t &i) const
 
bool is_numeral_i (int &i) const
 
bool is_numeral_u (unsigned &i) const
 
bool is_numeral (std::string &s) const
 
bool is_numeral (std::string &s, unsigned precision) const
 
bool is_numeral (double &d) const
 
bool as_binary (std::string &s) const
 
double as_double () const
 
uint64_t as_uint64 () const
 
int64_t as_int64 () const
 
bool is_app () const
 Return true if this expression is an application.
 
bool is_const () const
 Return true if this expression is a constant (i.e., an application with 0 arguments).
 
bool is_quantifier () const
 Return true if this expression is a quantifier.
 
bool is_forall () const
 Return true if this expression is a universal quantifier.
 
bool is_exists () const
 Return true if this expression is an existential quantifier.
 
bool is_lambda () const
 Return true if this expression is a lambda expression.
 
bool is_var () const
 Return true if this expression is a variable.
 
bool is_algebraic () const
 Return true if expression is an algebraic number.
 
bool is_well_sorted () const
 Return true if this expression is well sorted (aka type correct).
 
expr mk_is_inf () const
 Return Boolean expression to test for whether an FP expression is inf.
 
expr mk_is_nan () const
 Return Boolean expression to test for whether an FP expression is a NaN.
 
expr mk_is_normal () const
 Return Boolean expression to test for whether an FP expression is a normal.
 
expr mk_is_subnormal () const
 Return Boolean expression to test for whether an FP expression is a subnormal.
 
expr mk_is_zero () const
 Return Boolean expression to test for whether an FP expression is a zero.
 
expr mk_to_ieee_bv () const
 Convert this fpa into an IEEE BV.
 
expr mk_from_ieee_bv (sort const &s) const
 Convert this IEEE BV into a fpa.
 
std::string get_decimal_string (int precision) const
 Return string representation of numeral or algebraic number This method assumes the expression is numeral or algebraic.
 
expr algebraic_lower (unsigned precision) const
 
expr algebraic_upper (unsigned precision) const
 
expr_vector algebraic_poly () const
 Return coefficients for p of an algebraic number (root-obj p i)
 
unsigned algebraic_i () const
 Return i of an algebraic number (root-obj p i)
 
unsigned id () const
 retrieve unique identifier for expression.
 
int get_numeral_int () const
 Return int value of numeral, throw if result cannot fit in machine int.
 
unsigned get_numeral_uint () const
 Return uint value of numeral, throw if result cannot fit in machine uint.
 
int64_t get_numeral_int64 () const
 Return int64_t value of numeral, throw if result cannot fit in int64_t.
 
uint64_t get_numeral_uint64 () const
 Return uint64_t value of numeral, throw if result cannot fit in uint64_t.
 
Z3_lbool bool_value () const
 
expr numerator () const
 
expr denominator () const
 
bool is_string_value () const
 Return true if this expression is a string literal. The string can be accessed using get_string() and get_escaped_string()
 
std::string get_string () const
 for a string value expression return an escaped string value.
 
std::u32string get_u32string () const
 for a string value expression return an unespaced string value.
 
 operator Z3_app () const
 
func_decl decl () const
 Return the declaration associated with this application. This method assumes the expression is an application.
 
unsigned num_args () const
 Return the number of arguments in this application. This method assumes the expression is an application.
 
expr arg (unsigned i) const
 Return the i-th argument of this application. This method assumes the expression is an application.
 
expr_vector args () const
 Return a vector of all the arguments of this application. This method assumes the expression is an application.
 
expr update (expr_vector const &args) const
 Update the arguments of this application. Return a new expression with the same function declaration and updated arguments. The number of new arguments must match the current number of arguments.
 
expr update_field (func_decl const &field_access, expr const &new_value) const
 Update a datatype field. Return a new datatype expression with the specified field updated to the new value. The remaining fields are unchanged.
 
expr body () const
 Return the 'body' of this quantifier.
 
bool is_true () const
 
bool is_false () const
 
bool is_not () const
 
bool is_and () const
 
bool is_or () const
 
bool is_xor () const
 
bool is_implies () const
 
bool is_eq () const
 
bool is_ite () const
 
bool is_distinct () const
 
expr rotate_left (unsigned i) const
 
expr rotate_right (unsigned i) const
 
expr repeat (unsigned i) const
 
expr extract (unsigned hi, unsigned lo) const
 
expr bit2bool (unsigned i) const
 
unsigned lo () const
 
unsigned hi () const
 
expr extract (expr const &offset, expr const &length) const
 sequence and regular expression operations.
 
expr replace (expr const &src, expr const &dst) const
 
expr unit () const
 
expr contains (expr const &s) const
 
expr at (expr const &index) const
 
expr nth (expr const &index) const
 
expr length () const
 
expr stoi () const
 
expr itos () const
 
expr ubvtos () const
 
expr sbvtos () const
 
expr char_to_int () const
 
expr char_to_bv () const
 
expr char_from_bv () const
 
expr is_digit () const
 
expr loop (unsigned lo)
 create a looping regular expression.
 
expr loop (unsigned lo, unsigned hi)
 
expr operator[] (expr const &index) const
 
expr operator[] (expr_vector const &index) const
 
expr simplify () const
 Return a simplified version of this expression.
 
expr simplify (params const &p) const
 Return a simplified version of this expression. The parameter p is a set of parameters for the Z3 simplifier.
 
expr substitute (expr_vector const &src, expr_vector const &dst)
 Apply substitution. Replace src expressions by dst.
 
expr substitute (expr_vector const &dst)
 Apply substitution. Replace bound variables by expressions.
 
expr substitute (func_decl_vector const &funs, expr_vector const &bodies)
 Apply function substitution by macro definitions.

 
iterator begin ()
 
iterator end ()
 
- 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

expr operator! (expr const &a)
 Return an expression representing not(a).
 
expr operator&& (expr const &a, expr const &b)
 Return an expression representing a and b.
 
expr operator&& (expr const &a, bool b)
 Return an expression representing a and b. The C++ Boolean value b is automatically converted into a Z3 Boolean constant.
 
expr operator&& (bool a, expr const &b)
 Return an expression representing a and b. The C++ Boolean value a is automatically converted into a Z3 Boolean constant.
 
expr operator|| (expr const &a, expr const &b)
 Return an expression representing a or b.
 
expr operator|| (expr const &a, bool b)
 Return an expression representing a or b. The C++ Boolean value b is automatically converted into a Z3 Boolean constant.
 
expr operator|| (bool a, expr const &b)
 Return an expression representing a or b. The C++ Boolean value a is automatically converted into a Z3 Boolean constant.
 
expr implies (expr const &a, expr const &b)
 
expr implies (expr const &a, bool b)
 
expr implies (bool a, expr const &b)
 
expr mk_or (expr_vector const &args)
 
expr mk_xor (expr_vector const &args)
 
expr mk_and (expr_vector const &args)
 
expr ite (expr const &c, expr const &t, expr const &e)
 Create the if-then-else expression ite(c, t, e)
 
expr distinct (expr_vector const &args)
 
expr concat (expr const &a, expr const &b)
 
expr concat (expr_vector const &args)
 
expr operator== (expr const &a, expr const &b)
 
expr operator== (expr const &a, int b)
 
expr operator== (int a, expr const &b)
 
expr operator!= (expr const &a, expr const &b)
 
expr operator!= (expr const &a, int b)
 
expr operator!= (int a, expr const &b)
 
expr operator+ (expr const &a, expr const &b)
 
expr operator+ (expr const &a, int b)
 
expr operator+ (int a, expr const &b)
 
expr sum (expr_vector const &args)
 
expr operator* (expr const &a, expr const &b)
 
expr operator* (expr const &a, int b)
 
expr operator* (int a, expr const &b)
 
expr pw (expr const &a, expr const &b)
 
expr pw (expr const &a, int b)
 
expr pw (int a, expr const &b)
 
expr mod (expr const &a, expr const &b)
 
expr mod (expr const &a, int b)
 
expr mod (int a, expr const &b)
 
expr rem (expr const &a, expr const &b)
 
expr rem (expr const &a, int b)
 
expr rem (int a, expr const &b)
 
expr is_int (expr const &e)
 
expr operator/ (expr const &a, expr const &b)
 
expr operator/ (expr const &a, int b)
 
expr operator/ (int a, expr const &b)
 
expr operator- (expr const &a)
 
expr operator- (expr const &a, expr const &b)
 
expr operator- (expr const &a, int b)
 
expr operator- (int a, expr const &b)
 
expr operator<= (expr const &a, expr const &b)
 
expr operator<= (expr const &a, int b)
 
expr operator<= (int a, expr const &b)
 
expr operator>= (expr const &a, expr const &b)
 
expr operator>= (expr const &a, int b)
 
expr operator>= (int a, expr const &b)
 
expr operator< (expr const &a, expr const &b)
 
expr operator< (expr const &a, int b)
 
expr operator< (int a, expr const &b)
 
expr operator> (expr const &a, expr const &b)
 
expr operator> (expr const &a, int b)
 
expr operator> (int a, expr const &b)
 
expr pble (expr_vector const &es, int const *coeffs, int bound)
 
expr pbge (expr_vector const &es, int const *coeffs, int bound)
 
expr pbeq (expr_vector const &es, int const *coeffs, int bound)
 
expr atmost (expr_vector const &es, unsigned bound)
 
expr atleast (expr_vector const &es, unsigned bound)
 
expr operator& (expr const &a, expr const &b)
 
expr operator& (expr const &a, int b)
 
expr operator& (int a, expr const &b)
 
expr operator^ (expr const &a, expr const &b)
 
expr operator^ (expr const &a, int b)
 
expr operator^ (int a, expr const &b)
 
expr operator| (expr const &a, expr const &b)
 
expr operator| (expr const &a, int b)
 
expr operator| (int a, expr const &b)
 
expr nand (expr const &a, expr const &b)
 
expr nor (expr const &a, expr const &b)
 
expr xnor (expr const &a, expr const &b)
 
expr min (expr const &a, expr const &b)
 
expr max (expr const &a, expr const &b)
 
expr bv2int (expr const &a, bool is_signed)
 bit-vector and integer conversions.
 
expr int2bv (unsigned n, expr const &a)
 
expr bvadd_no_overflow (expr const &a, expr const &b, bool is_signed)
 bit-vector overflow/underflow checks
 
expr bvadd_no_underflow (expr const &a, expr const &b)
 
expr bvsub_no_overflow (expr const &a, expr const &b)
 
expr bvsub_no_underflow (expr const &a, expr const &b, bool is_signed)
 
expr bvsdiv_no_overflow (expr const &a, expr const &b)
 
expr bvneg_no_overflow (expr const &a)
 
expr bvmul_no_overflow (expr const &a, expr const &b, bool is_signed)
 
expr bvmul_no_underflow (expr const &a, expr const &b)
 
expr bvredor (expr const &a)
 
expr bvredand (expr const &a)
 
expr abs (expr const &a)
 
expr sqrt (expr const &a, expr const &rm)
 
expr fp_eq (expr const &a, expr const &b)
 
expr operator~ (expr const &a)
 
expr fma (expr const &a, expr const &b, expr const &c, expr const &rm)
 FloatingPoint fused multiply-add.
 
expr fpa_fp (expr const &sgn, expr const &exp, expr const &sig)
 Create an expression of FloatingPoint sort from three bit-vector expressions.
 
expr fpa_to_sbv (expr const &t, unsigned sz)
 Conversion of a floating-point term into a signed bit-vector.
 
expr fpa_to_ubv (expr const &t, unsigned sz)
 Conversion of a floating-point term into an unsigned bit-vector.
 
expr sbv_to_fpa (expr const &t, sort s)
 Conversion of a signed bit-vector term into a floating-point.
 
expr ubv_to_fpa (expr const &t, sort s)
 Conversion of an unsigned bit-vector term into a floating-point.
 
expr fpa_to_fpa (expr const &t, sort s)
 Conversion of a floating-point term into another floating-point.
 
expr round_fpa_to_closest_integer (expr const &t)
 Round a floating-point term into its closest integer.
 
expr range (expr const &lo, expr const &hi)
 

Additional Inherited Members

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

Detailed Description

A Z3 expression is used to represent formulas and terms. For Z3, a formula is any expression of sort Boolean. Every expression has a sort.

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

Constructor & Destructor Documentation

◆ expr() [1/2]

expr ( context c)
inline

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

879:ast(c) {}
ast(context &c)
Definition z3++.h:621

◆ expr() [2/2]

expr ( context c,
Z3_ast  n 
)
inline

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

880:ast(c, reinterpret_cast<Z3_ast>(n)) {}
System.IntPtr Z3_ast

Member Function Documentation

◆ algebraic_i()

unsigned algebraic_i ( ) const
inline

Return i of an algebraic number (root-obj p i)

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

1113 {
1114 assert(is_algebraic());
1115 unsigned i = Z3_algebraic_get_i(ctx(), m_ast);
1116 check_error();
1117 return i;
1118 }
Z3_ast m_ast
Definition z3++.h:619
bool is_algebraic() const
Return true if expression is an algebraic number.
Definition z3++.h:995
Z3_error_code check_error() const
Definition z3++.h:541
context & ctx() const
Definition z3++.h:540
unsigned Z3_API Z3_algebraic_get_i(Z3_context c, Z3_ast a)
Return which root of the polynomial the algebraic number represents.

◆ algebraic_lower()

expr algebraic_lower ( unsigned  precision) const
inline

Retrieve lower and upper bounds for algebraic numerals based on a decimal precision

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

1086 {
1087 assert(is_algebraic());
1088 Z3_ast r = Z3_get_algebraic_number_lower(ctx(), m_ast, precision);
1089 check_error();
1090 return expr(ctx(), r);
1091 }
expr(context &c)
Definition z3++.h:879
Z3_ast Z3_API Z3_get_algebraic_number_lower(Z3_context c, Z3_ast a, unsigned precision)
Return a lower bound for the given real algebraic number. The interval isolating the number is smalle...

◆ algebraic_poly()

expr_vector algebraic_poly ( ) const
inline

Return coefficients for p of an algebraic number (root-obj p i)

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

1103 {
1104 assert(is_algebraic());
1106 check_error();
1107 return expr_vector(ctx(), r);
1108 }
Z3_ast_vector Z3_API Z3_algebraic_get_poly(Z3_context c, Z3_ast a)
Return the coefficients of the defining polynomial.
System.IntPtr Z3_ast_vector
ast_vector_tpl< expr > expr_vector
Definition z3++.h:77

◆ algebraic_upper()

expr algebraic_upper ( unsigned  precision) const
inline

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

1093 {
1094 assert(is_algebraic());
1095 Z3_ast r = Z3_get_algebraic_number_upper(ctx(), m_ast, precision);
1096 check_error();
1097 return expr(ctx(), r);
1098 }
Z3_ast Z3_API Z3_get_algebraic_number_upper(Z3_context c, Z3_ast a, unsigned precision)
Return a upper bound for the given real algebraic number. The interval isolating the number is smalle...

◆ arg()

expr arg ( unsigned  i) const
inline

Return the i-th argument of this application. This method assumes the expression is an application.

Precondition
is_app()
i < num_args()

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

1274{ Z3_ast r = Z3_get_app_arg(ctx(), *this, i); check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_get_app_arg(Z3_context c, Z3_app a, unsigned i)
Return the i-th argument of the given application.

Referenced by AstRef::__bool__(), expr::args(), ExprRef::children(), and expr::iterator::operator*().

◆ args()

expr_vector args ( ) const
inline

Return a vector of all the arguments of this application. This method assumes the expression is an application.

Precondition
is_app()

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

1281 {
1282 expr_vector vec(ctx());
1283 unsigned argCnt = num_args();
1284 for (unsigned i = 0; i < argCnt; ++i)
1285 vec.push_back(arg(i));
1286 return vec;
1287 }
unsigned num_args() const
Return the number of arguments in this application. This method assumes the expression is an applicat...
Definition z3++.h:1266
expr arg(unsigned i) const
Return the i-th argument of this application. This method assumes the expression is an application.
Definition z3++.h:1274

Referenced by expr::update().

◆ as_binary()

bool as_binary ( std::string &  s) const
inline

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

955{ if (!is_numeral()) return false; s = Z3_get_numeral_binary_string(ctx(), m_ast); check_error(); return true; }
bool is_numeral() const
Return true if this expression is a numeral. Specialized functions also return representations for th...
Definition z3++.h:947
Z3_string Z3_API Z3_get_numeral_binary_string(Z3_context c, Z3_ast a)
Return numeral value, as a binary string of a numeric constant term.

◆ as_double()

double as_double ( ) const
inline

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

957{ double d = 0; is_numeral(d); return d; }

◆ as_int64()

int64_t as_int64 ( ) const
inline

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

959{ int64_t r = 0; is_numeral_i64(r); return r; }
bool is_numeral_i64(int64_t &i) const
Definition z3++.h:948

◆ as_uint64()

uint64_t as_uint64 ( ) const
inline

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

958{ uint64_t r = 0; is_numeral_u64(r); return r; }
bool is_numeral_u64(uint64_t &i) const
Definition z3++.h:949

◆ at()

expr at ( expr const index) const
inline

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

1575 {
1576 check_context(*this, index);
1577 Z3_ast r = Z3_mk_seq_at(ctx(), *this, index);
1578 check_error();
1579 return expr(ctx(), r);
1580 }
friend void check_context(object const &a, object const &b)
Definition z3++.h:544
Z3_ast Z3_API Z3_mk_seq_at(Z3_context c, Z3_ast s, Z3_ast index)
Retrieve from s the unit sequence positioned at position index. The sequence is empty if the index is...

◆ begin()

iterator begin ( )
inline

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

1704{ return iterator(*this, 0); }

◆ bit2bool()

expr bit2bool ( unsigned  i) const
inline

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

1505{ Z3_ast r = Z3_mk_bit2bool(ctx(), i, *this); ctx().check_error(); return expr(ctx(), r); }
Z3_error_code check_error() const
Auxiliary method used to check for API usage errors.
Definition z3++.h:241
Z3_ast Z3_API Z3_mk_bit2bool(Z3_context c, unsigned i, Z3_ast t1)
Extracts the bit at position i of a bit-vector and yields a boolean.

◆ body()

expr body ( ) const
inline

Return the 'body' of this quantifier.

Precondition
is_quantifier()

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

1315{ assert(is_quantifier()); Z3_ast r = Z3_get_quantifier_body(ctx(), *this); check_error(); return expr(ctx(), r); }
bool is_quantifier() const
Return true if this expression is a quantifier.
Definition z3++.h:973
Z3_ast Z3_API Z3_get_quantifier_body(Z3_context c, Z3_ast a)
Return body of quantifier.

Referenced by QuantifierRef::children().

◆ bool_value()

Z3_lbool bool_value ( ) const
inline

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

1199 {
1200 return Z3_get_bool_value(ctx(), m_ast);
1201 }
Z3_lbool Z3_API Z3_get_bool_value(Z3_context c, Z3_ast a)
Return Z3_L_TRUE if a is true, Z3_L_FALSE if it is false, and Z3_L_UNDEF otherwise.

◆ char_from_bv()

expr char_from_bv ( ) const
inline

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

1622 {
1623 Z3_ast r = Z3_mk_char_from_bv(ctx(), *this);
1624 check_error();
1625 return expr(ctx(), r);
1626 }
Z3_ast Z3_API Z3_mk_char_from_bv(Z3_context c, Z3_ast bv)
Create a character from a bit-vector (code point).

◆ char_to_bv()

expr char_to_bv ( ) const
inline

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

1617 {
1618 Z3_ast r = Z3_mk_char_to_bv(ctx(), *this);
1619 check_error();
1620 return expr(ctx(), r);
1621 }
Z3_ast Z3_API Z3_mk_char_to_bv(Z3_context c, Z3_ast ch)
Create a bit-vector (code point) from character.

◆ char_to_int()

expr char_to_int ( ) const
inline

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

1612 {
1613 Z3_ast r = Z3_mk_char_to_int(ctx(), *this);
1614 check_error();
1615 return expr(ctx(), r);
1616 }
Z3_ast Z3_API Z3_mk_char_to_int(Z3_context c, Z3_ast ch)
Create an integer (code point) from character.

◆ contains()

expr contains ( expr const s) const
inline

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

1569 {
1570 check_context(*this, s);
1571 Z3_ast r = Z3_mk_seq_contains(ctx(), *this, s);
1572 check_error();
1573 return expr(ctx(), r);
1574 }
Z3_ast Z3_API Z3_mk_seq_contains(Z3_context c, Z3_ast container, Z3_ast containee)
Check if container contains containee.

◆ decl()

func_decl decl ( ) const
inline

Return the declaration associated with this application. This method assumes the expression is an application.

Precondition
is_app()

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

1259{ Z3_func_decl f = Z3_get_app_decl(ctx(), *this); check_error(); return func_decl(ctx(), f); }
Z3_func_decl Z3_API Z3_get_app_decl(Z3_context c, Z3_app a)
Return the declaration of a constant or function application.
System.IntPtr Z3_func_decl

Referenced by expr::hi(), 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(), expr::is_xor(), expr::lo(), and ExprRef::params().

◆ denominator()

expr denominator ( ) const
inline

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

1211 {
1212 assert(is_numeral());
1214 check_error();
1215 return expr(ctx(),r);
1216 }
Z3_ast Z3_API Z3_get_denominator(Z3_context c, Z3_ast a)
Return the denominator (as a numeral AST) of a numeral AST of sort Real.

Referenced by RatNumRef::denominator_as_long(), and RatNumRef::is_int_value().

◆ end()

iterator end ( )
inline

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

1705{ return iterator(*this, is_app() ? num_args() : 0); }
bool is_app() const
Return true if this expression is an application.
Definition z3++.h:965

◆ extract() [1/2]

expr extract ( expr const offset,
expr const length 
) const
inline

sequence and regular expression operations.

  • is overloaded as sequence concatenation and regular expression union. concat is overloaded to handle sequences and regular expressions

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

1554 {
1555 check_context(*this, offset); check_context(offset, length);
1556 Z3_ast r = Z3_mk_seq_extract(ctx(), *this, offset, length); check_error(); return expr(ctx(), r);
1557 }
expr length() const
Definition z3++.h:1587
Z3_ast Z3_API Z3_mk_seq_extract(Z3_context c, Z3_ast s, Z3_ast offset, Z3_ast length)
Extract subsequence starting at offset of length.

◆ extract() [2/2]

expr extract ( unsigned  hi,
unsigned  lo 
) const
inline

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

1504{ Z3_ast r = Z3_mk_extract(ctx(), hi, lo, *this); ctx().check_error(); return expr(ctx(), r); }
unsigned hi() const
Definition z3++.h:1507
unsigned lo() const
Definition z3++.h:1506
Z3_ast Z3_API Z3_mk_extract(Z3_context c, unsigned high, unsigned low, Z3_ast t1)
Extract the bits high down to low from a bit-vector of size m to yield a new bit-vector of size n,...

◆ get_decimal_string()

std::string get_decimal_string ( int  precision) const
inline

Return string representation of numeral or algebraic number This method assumes the expression is numeral or algebraic.

Precondition
is_numeral() || is_algebraic()

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

1078 {
1079 assert(is_numeral() || is_algebraic());
1080 return std::string(Z3_get_numeral_decimal_string(ctx(), m_ast, precision));
1081 }
Z3_string Z3_API Z3_get_numeral_decimal_string(Z3_context c, Z3_ast a, unsigned precision)
Return numeral as a string in decimal notation. The result has at most precision decimal places.

◆ get_numeral_int()

int get_numeral_int ( ) const
inline

Return int value of numeral, throw if result cannot fit in machine int.

It only makes sense to use this function if the caller can ensure that the result is an integer or if exceptions are enabled. If exceptions are disabled, then use the is_numeral_i function.

Precondition
is_numeral()

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

1135 {
1136 int result = 0;
1137 if (!is_numeral_i(result)) {
1138 assert(ctx().enable_exceptions());
1139 if (!ctx().enable_exceptions()) return 0;
1140 Z3_THROW(exception("numeral does not fit in machine int"));
1141 }
1142 return result;
1143 }
bool is_numeral_i(int &i) const
Definition z3++.h:950
#define Z3_THROW(x)
Definition z3++.h:134

◆ get_numeral_int64()

int64_t get_numeral_int64 ( ) const
inline

Return int64_t value of numeral, throw if result cannot fit in int64_t.

Precondition
is_numeral()

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

1171 {
1172 assert(is_numeral());
1173 int64_t result = 0;
1174 if (!is_numeral_i64(result)) {
1175 assert(ctx().enable_exceptions());
1176 if (!ctx().enable_exceptions()) return 0;
1177 Z3_THROW(exception("numeral does not fit in machine int64_t"));
1178 }
1179 return result;
1180 }

◆ get_numeral_uint()

unsigned get_numeral_uint ( ) const
inline

Return uint value of numeral, throw if result cannot fit in machine uint.

It only makes sense to use this function if the caller can ensure that the result is an integer or if exceptions are enabled. If exceptions are disabled, then use the is_numeral_u function.

Precondition
is_numeral()

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

1154 {
1155 assert(is_numeral());
1156 unsigned result = 0;
1157 if (!is_numeral_u(result)) {
1158 assert(ctx().enable_exceptions());
1159 if (!ctx().enable_exceptions()) return 0;
1160 Z3_THROW(exception("numeral does not fit in machine uint"));
1161 }
1162 return result;
1163 }
bool is_numeral_u(unsigned &i) const
Definition z3++.h:951

◆ get_numeral_uint64()

uint64_t get_numeral_uint64 ( ) const
inline

Return uint64_t value of numeral, throw if result cannot fit in uint64_t.

Precondition
is_numeral()

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

1188 {
1189 assert(is_numeral());
1190 uint64_t result = 0;
1191 if (!is_numeral_u64(result)) {
1192 assert(ctx().enable_exceptions());
1193 if (!ctx().enable_exceptions()) return 0;
1194 Z3_THROW(exception("numeral does not fit in machine uint64_t"));
1195 }
1196 return result;
1197 }

◆ get_sort()

sort get_sort ( ) const
inline

Return the sort of this expression.

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

885{ Z3_sort s = Z3_get_sort(*m_ctx, m_ast); check_error(); return sort(*m_ctx, s); }
context * m_ctx
Definition z3++.h:536
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a)
Return the sort of an AST node.
System.IntPtr Z3_sort

Referenced by expr::is_arith(), expr::is_array(), expr::is_bool(), expr::is_bv(), expr::is_datatype(), expr::is_finite_domain(), expr::is_fpa(), expr::is_int(), expr::is_re(), expr::is_real(), expr::is_relation(), expr::is_seq(), and ModelRef::sorts().

◆ get_string()

std::string get_string ( ) const
inline

for a string value expression return an escaped string value.

Precondition
expression is for a string value.

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

1230 {
1231 assert(is_string_value());
1232 char const* s = Z3_get_string(ctx(), m_ast);
1233 check_error();
1234 return std::string(s);
1235 }
bool is_string_value() const
Return true if this expression is a string literal. The string can be accessed using get_string() and...
Definition z3++.h:1223
Z3_string Z3_API Z3_get_string(Z3_context c, Z3_ast s)
Retrieve the string constant stored in s. Characters outside the basic printable ASCII range are esca...

◆ get_u32string()

std::u32string get_u32string ( ) const
inline

for a string value expression return an unespaced string value.

Precondition
expression is for a string value.

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

1242 {
1243 assert(is_string_value());
1244 unsigned n = Z3_get_string_length(ctx(), m_ast);
1245 std::u32string s;
1246 s.resize(n);
1247 Z3_get_string_contents(ctx(), m_ast, n, (unsigned*)s.data());
1248 return s;
1249 }
void Z3_API Z3_get_string_contents(Z3_context c, Z3_ast s, unsigned length, unsigned contents[])
Retrieve the unescaped string constant stored in s.
unsigned Z3_API Z3_get_string_length(Z3_context c, Z3_ast s)
Retrieve the length of the unescaped string constant stored in s.

◆ hi()

unsigned hi ( ) const
inline

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

1507{ assert (is_app() && Z3_get_decl_num_parameters(ctx(), decl()) == 2); return static_cast<unsigned>(Z3_get_decl_int_parameter(ctx(), decl(), 0)); }
func_decl decl() const
Return the declaration associated with this application. This method assumes the expression is an app...
Definition z3++.h:1259
unsigned Z3_API Z3_get_decl_num_parameters(Z3_context c, Z3_func_decl d)
Return the number of parameters associated with a declaration.
int Z3_API Z3_get_decl_int_parameter(Z3_context c, Z3_func_decl d, unsigned idx)
Return the integer value associated with an integer parameter.

Referenced by expr::extract(), and expr::loop().

◆ id()

unsigned id ( ) const
inline

retrieve unique identifier for expression.

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

1123{ unsigned r = Z3_get_ast_id(ctx(), m_ast); check_error(); return r; }
unsigned Z3_API Z3_get_ast_id(Z3_context c, Z3_ast t)
Return a unique identifier for t. The identifier is unique up to structural equality....

◆ is_algebraic()

bool is_algebraic ( ) const
inline

Return true if expression is an algebraic number.

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

995{ return Z3_is_algebraic_number(ctx(), m_ast); }
bool Z3_API Z3_is_algebraic_number(Z3_context c, Z3_ast a)
Return true if the given AST is a real algebraic number.

Referenced by expr::algebraic_i(), expr::algebraic_lower(), expr::algebraic_poly(), expr::algebraic_upper(), and expr::get_decimal_string().

◆ is_and()

bool is_and ( ) const
inline

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

1384{ return is_app() && Z3_OP_AND == decl().decl_kind(); }
Z3_decl_kind decl_kind() const
Definition z3++.h:841
@ Z3_OP_AND
Definition z3_api.h:969

◆ is_app()

bool is_app ( ) const
inline

Return true if this expression is an application.

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

965{ return kind() == Z3_APP_AST || kind() == Z3_NUMERAL_AST; }
Z3_ast_kind kind() const
Definition z3++.h:635
@ Z3_APP_AST
Definition z3_api.h:144
@ Z3_NUMERAL_AST
Definition z3_api.h:143

Referenced by expr::end(), expr::hi(), expr::is_and(), expr::is_const(), expr::is_distinct(), expr::is_eq(), expr::is_false(), expr::is_implies(), expr::is_ite(), expr::is_not(), expr::is_or(), expr::is_true(), expr::is_xor(), expr::lo(), and expr::operator Z3_app().

◆ is_arith()

bool is_arith ( ) const
inline

Return true if this is an integer or real expression.

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

902{ return get_sort().is_arith(); }
sort get_sort() const
Return the sort of this expression.
Definition z3++.h:885
bool is_arith() const
Return true if this sort is the Integer or Real sort.
Definition z3++.h:758

◆ is_array()

bool is_array ( ) const
inline

Return true if this is a Array expression.

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

910{ return get_sort().is_array(); }
bool is_array() const
Return true if this sort is a Array sort.
Definition z3++.h:766

Referenced by expr::operator[]().

◆ is_bool()

bool is_bool ( ) const
inline

Return true if this is a Boolean expression.

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

890{ return get_sort().is_bool(); }
bool is_bool() const
Return true if this sort is the Boolean sort.
Definition z3++.h:746

Referenced by solver::add(), optimize::add(), optimize::add(), solver::add(), optimize::add(), optimize::add_soft(), and optimize::add_soft().

◆ is_bv()

bool is_bv ( ) const
inline

Return true if this is a Bit-vector expression.

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

906{ return get_sort().is_bv(); }
bool is_bv() const
Return true if this sort is a Bit-vector sort.
Definition z3++.h:762

Referenced by expr::mk_from_ieee_bv().

◆ is_const()

bool is_const ( ) const
inline

Return true if this expression is a constant (i.e., an application with 0 arguments).

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

969{ return is_app() && num_args() == 0; }

Referenced by solver::add().

◆ is_datatype()

bool is_datatype ( ) const
inline

Return true if this is a Datatype expression.

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

914{ return get_sort().is_datatype(); }
bool is_datatype() const
Return true if this sort is a Datatype sort.
Definition z3++.h:770

Referenced by expr::update_field().

◆ is_digit()

expr is_digit ( ) const
inline

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

1627 {
1628 Z3_ast r = Z3_mk_char_is_digit(ctx(), *this);
1629 check_error();
1630 return expr(ctx(), r);
1631 }
Z3_ast Z3_API Z3_mk_char_is_digit(Z3_context c, Z3_ast ch)
Create a check if the character is a digit.

◆ is_distinct()

bool is_distinct ( ) const
inline

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

1390{ return is_app() && Z3_OP_DISTINCT == decl().decl_kind(); }
@ Z3_OP_DISTINCT
Definition z3_api.h:967

◆ is_eq()

bool is_eq ( ) const
inline

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

1388{ return is_app() && Z3_OP_EQ == decl().decl_kind(); }
@ Z3_OP_EQ
Definition z3_api.h:966

◆ is_exists()

bool is_exists ( ) const
inline

Return true if this expression is an existential quantifier.

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

982{ return Z3_is_quantifier_exists(ctx(), m_ast); }
bool Z3_API Z3_is_quantifier_exists(Z3_context c, Z3_ast a)
Determine if ast is an existential quantifier.

◆ is_false()

bool is_false ( ) const
inline

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

1382{ return is_app() && Z3_OP_FALSE == decl().decl_kind(); }
@ Z3_OP_FALSE
Definition z3_api.h:965

◆ is_finite_domain()

bool is_finite_domain ( ) const
inline

Return true if this is a Finite-domain expression.

Remarks
Finite-domain is special kind of interpreted sort: is_bool(), is_bv() and is_finite_domain() are mutually exclusive.

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

936{ return get_sort().is_finite_domain(); }
bool is_finite_domain() const
Return true if this sort is a Finite domain sort.
Definition z3++.h:786

◆ is_forall()

bool is_forall ( ) const
inline

Return true if this expression is a universal quantifier.

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

978{ return Z3_is_quantifier_forall(ctx(), m_ast); }
bool Z3_API Z3_is_quantifier_forall(Z3_context c, Z3_ast a)
Determine if an ast is a universal quantifier.

◆ is_fpa()

bool is_fpa ( ) const
inline

Return true if this is a FloatingPoint expression. .

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

940{ return get_sort().is_fpa(); }
bool is_fpa() const
Return true if this sort is a Floating point sort.
Definition z3++.h:790

Referenced by expr::mk_is_inf(), expr::mk_is_nan(), expr::mk_is_normal(), expr::mk_is_subnormal(), expr::mk_is_zero(), and expr::mk_to_ieee_bv().

◆ is_implies()

bool is_implies ( ) const
inline

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

1387{ return is_app() && Z3_OP_IMPLIES == decl().decl_kind(); }
@ Z3_OP_IMPLIES
Definition z3_api.h:974

◆ is_int()

bool is_int ( ) const
inline

Return true if this is an integer expression.

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

894{ return get_sort().is_int(); }
bool is_int() const
Return true if this sort is the Integer sort.
Definition z3++.h:750

Referenced by IntNumRef::as_long(), and ArithSortRef::subsort().

◆ is_ite()

bool is_ite ( ) const
inline

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

1389{ return is_app() && Z3_OP_ITE == decl().decl_kind(); }
@ Z3_OP_ITE
Definition z3_api.h:968

◆ is_lambda()

bool is_lambda ( ) const
inline

Return true if this expression is a lambda expression.

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

986{ return Z3_is_lambda(ctx(), m_ast); }
bool Z3_API Z3_is_lambda(Z3_context c, Z3_ast a)
Determine if ast is a lambda expression.

Referenced by QuantifierRef::__getitem__(), and QuantifierRef::sort().

◆ is_not()

bool is_not ( ) const
inline

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

1383{ return is_app() && Z3_OP_NOT == decl().decl_kind(); }
@ Z3_OP_NOT
Definition z3_api.h:973

◆ is_numeral() [1/4]

bool is_numeral ( ) const
inline

Return true if this expression is a numeral. Specialized functions also return representations for the numerals as small integers, 64 bit integers or rational or decimal strings.

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

947{ return kind() == Z3_NUMERAL_AST; }

Referenced by expr::as_binary(), expr::as_double(), expr::denominator(), expr::get_decimal_string(), expr::get_numeral_int64(), expr::get_numeral_uint(), expr::get_numeral_uint64(), and expr::numerator().

◆ is_numeral() [2/4]

bool is_numeral ( double &  d) const
inline

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

954{ if (!is_numeral()) return false; d = Z3_get_numeral_double(ctx(), m_ast); check_error(); return true; }
double Z3_API Z3_get_numeral_double(Z3_context c, Z3_ast a)
Return numeral as a double.

Referenced by expr::is_numeral().

◆ is_numeral() [3/4]

bool is_numeral ( std::string &  s) const
inline

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

952{ if (!is_numeral()) return false; s = Z3_get_numeral_string(ctx(), m_ast); check_error(); return true; }
Z3_string Z3_API Z3_get_numeral_string(Z3_context c, Z3_ast a)
Return numeral value, as a decimal string of a numeric constant term.

Referenced by expr::is_numeral().

◆ is_numeral() [4/4]

bool is_numeral ( std::string &  s,
unsigned  precision 
) const
inline

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

953{ if (!is_numeral()) return false; s = Z3_get_numeral_decimal_string(ctx(), m_ast, precision); check_error(); return true; }

Referenced by expr::is_numeral().

◆ is_numeral_i()

bool is_numeral_i ( int &  i) const
inline

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

950{ bool r = Z3_get_numeral_int(ctx(), m_ast, &i); check_error(); return r;}
bool Z3_API Z3_get_numeral_int(Z3_context c, Z3_ast v, int *i)
Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine int....

Referenced by expr::get_numeral_int().

◆ is_numeral_i64()

bool is_numeral_i64 ( int64_t i) const
inline

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

948{ bool r = Z3_get_numeral_int64(ctx(), m_ast, &i); check_error(); return r;}
bool Z3_API Z3_get_numeral_int64(Z3_context c, Z3_ast v, int64_t *i)
Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine int64_t int....

Referenced by expr::as_int64(), and expr::get_numeral_int64().

◆ is_numeral_u()

bool is_numeral_u ( unsigned &  i) const
inline

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

951{ bool r = Z3_get_numeral_uint(ctx(), m_ast, &i); check_error(); return r;}
bool Z3_API Z3_get_numeral_uint(Z3_context c, Z3_ast v, unsigned *u)
Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine unsigned int....

Referenced by expr::get_numeral_uint().

◆ is_numeral_u64()

bool is_numeral_u64 ( uint64_t i) const
inline

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

949{ bool r = Z3_get_numeral_uint64(ctx(), m_ast, &i); check_error(); return r;}
bool Z3_API Z3_get_numeral_uint64(Z3_context c, Z3_ast v, uint64_t *u)
Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine uint64_t int....

Referenced by expr::as_uint64(), and expr::get_numeral_uint64().

◆ is_or()

bool is_or ( ) const
inline

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

1385{ return is_app() && Z3_OP_OR == decl().decl_kind(); }
@ Z3_OP_OR
Definition z3_api.h:970

◆ is_quantifier()

bool is_quantifier ( ) const
inline

Return true if this expression is a quantifier.

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

973{ return kind() == Z3_QUANTIFIER_AST; }
@ Z3_QUANTIFIER_AST
Definition z3_api.h:146

Referenced by expr::body().

◆ is_re()

bool is_re ( ) const
inline

Return true if this is a regular expression.

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

926{ return get_sort().is_re(); }
bool is_re() const
Return true if this sort is a regular expression sort.
Definition z3++.h:782

◆ is_real()

bool is_real ( ) const
inline

Return true if this is a real expression.

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

898{ return get_sort().is_real(); }
bool is_real() const
Return true if this sort is the Real sort.
Definition z3++.h:754

◆ is_relation()

bool is_relation ( ) const
inline

Return true if this is a Relation expression.

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

918{ return get_sort().is_relation(); }
bool is_relation() const
Return true if this sort is a Relation sort.
Definition z3++.h:774

◆ is_seq()

bool is_seq ( ) const
inline

Return true if this is a sequence expression.

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

922{ return get_sort().is_seq(); }
bool is_seq() const
Return true if this sort is a Sequence sort.
Definition z3++.h:778

Referenced by expr::operator[]().

◆ is_string_value()

bool is_string_value ( ) const
inline

Return true if this expression is a string literal. The string can be accessed using get_string() and get_escaped_string()

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

1223{ return Z3_is_string(ctx(), m_ast); }
bool Z3_API Z3_is_string(Z3_context c, Z3_ast s)
Determine if s is a string constant.

Referenced by expr::get_string(), and expr::get_u32string().

◆ is_true()

bool is_true ( ) const
inline

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

1381{ return is_app() && Z3_OP_TRUE == decl().decl_kind(); }
@ Z3_OP_TRUE
Definition z3_api.h:964

◆ is_var()

bool is_var ( ) const
inline

Return true if this expression is a variable.

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

991{ return kind() == Z3_VAR_AST; }
@ Z3_VAR_AST
Definition z3_api.h:145

◆ is_well_sorted()

bool is_well_sorted ( ) const
inline

Return true if this expression is well sorted (aka type correct).

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

1000{ bool r = Z3_is_well_sorted(ctx(), m_ast); check_error(); return r; }
bool Z3_API Z3_is_well_sorted(Z3_context c, Z3_ast t)
Return true if the given expression t is well sorted.

◆ is_xor()

bool is_xor ( ) const
inline

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

1386{ return is_app() && Z3_OP_XOR == decl().decl_kind(); }
@ Z3_OP_XOR
Definition z3_api.h:972

◆ itos()

expr itos ( ) const
inline

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

1597 {
1598 Z3_ast r = Z3_mk_int_to_str(ctx(), *this);
1599 check_error();
1600 return expr(ctx(), r);
1601 }
Z3_ast Z3_API Z3_mk_int_to_str(Z3_context c, Z3_ast s)
Integer to string conversion.

◆ length()

expr length ( ) const
inline

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

1587 {
1588 Z3_ast r = Z3_mk_seq_length(ctx(), *this);
1589 check_error();
1590 return expr(ctx(), r);
1591 }
Z3_ast Z3_API Z3_mk_seq_length(Z3_context c, Z3_ast s)
Return the length of the sequence s.

Referenced by expr::extract().

◆ lo()

unsigned lo ( ) const
inline

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

1506{ assert (is_app() && Z3_get_decl_num_parameters(ctx(), decl()) == 2); return static_cast<unsigned>(Z3_get_decl_int_parameter(ctx(), decl(), 1)); }

Referenced by expr::extract(), expr::loop(), and expr::loop().

◆ loop() [1/2]

expr loop ( unsigned  lo)
inline

create a looping regular expression.

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

1637 {
1638 Z3_ast r = Z3_mk_re_loop(ctx(), m_ast, lo, 0);
1639 check_error();
1640 return expr(ctx(), r);
1641 }
Z3_ast Z3_API Z3_mk_re_loop(Z3_context c, Z3_ast r, unsigned lo, unsigned hi)
Create a regular expression loop. The supplied regular expression r is repeated between lo and hi tim...

◆ loop() [2/2]

expr loop ( unsigned  lo,
unsigned  hi 
)
inline

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

1642 {
1643 Z3_ast r = Z3_mk_re_loop(ctx(), m_ast, lo, hi);
1644 check_error();
1645 return expr(ctx(), r);
1646 }

◆ mk_from_ieee_bv()

expr mk_from_ieee_bv ( sort const s) const
inline

Convert this IEEE BV into a fpa.

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

1065 {
1066 assert(is_bv());
1068 check_error();
1069 return expr(ctx(), r);
1070 }
bool is_bv() const
Return true if this is a Bit-vector expression.
Definition z3++.h:906
Z3_ast Z3_API Z3_mk_fpa_to_fp_bv(Z3_context c, Z3_ast bv, Z3_sort s)
Conversion of a single IEEE 754-2008 bit-vector into a floating-point number.

◆ mk_is_inf()

expr mk_is_inf ( ) const
inline

Return Boolean expression to test for whether an FP expression is inf.

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

1005 {
1006 assert(is_fpa());
1008 check_error();
1009 return expr(ctx(), r);
1010 }
bool is_fpa() const
Return true if this is a FloatingPoint expression. .
Definition z3++.h:940
Z3_ast Z3_API Z3_mk_fpa_is_infinite(Z3_context c, Z3_ast t)
Predicate indicating whether t is a floating-point number representing +oo or -oo.

◆ mk_is_nan()

expr mk_is_nan ( ) const
inline

Return Boolean expression to test for whether an FP expression is a NaN.

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

1015 {
1016 assert(is_fpa());
1018 check_error();
1019 return expr(ctx(), r);
1020 }
Z3_ast Z3_API Z3_mk_fpa_is_nan(Z3_context c, Z3_ast t)
Predicate indicating whether t is a NaN.

◆ mk_is_normal()

expr mk_is_normal ( ) const
inline

Return Boolean expression to test for whether an FP expression is a normal.

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

1025 {
1026 assert(is_fpa());
1028 check_error();
1029 return expr(ctx(), r);
1030 }
Z3_ast Z3_API Z3_mk_fpa_is_normal(Z3_context c, Z3_ast t)
Predicate indicating whether t is a normal floating-point number.

◆ mk_is_subnormal()

expr mk_is_subnormal ( ) const
inline

Return Boolean expression to test for whether an FP expression is a subnormal.

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

1035 {
1036 assert(is_fpa());
1038 check_error();
1039 return expr(ctx(), r);
1040 }
Z3_ast Z3_API Z3_mk_fpa_is_subnormal(Z3_context c, Z3_ast t)
Predicate indicating whether t is a subnormal floating-point number.

◆ mk_is_zero()

expr mk_is_zero ( ) const
inline

Return Boolean expression to test for whether an FP expression is a zero.

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

1045 {
1046 assert(is_fpa());
1048 check_error();
1049 return expr(ctx(), r);
1050 }
Z3_ast Z3_API Z3_mk_fpa_is_zero(Z3_context c, Z3_ast t)
Predicate indicating whether t is a floating-point number with zero value, i.e., +zero or -zero.

◆ mk_to_ieee_bv()

expr mk_to_ieee_bv ( ) const
inline

Convert this fpa into an IEEE BV.

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

1055 {
1056 assert(is_fpa());
1058 check_error();
1059 return expr(ctx(), r);
1060 }
Z3_ast Z3_API Z3_mk_fpa_to_ieee_bv(Z3_context c, Z3_ast t)
Conversion of a floating-point term into a bit-vector term in IEEE 754-2008 format.

◆ nth()

expr nth ( expr const index) const
inline

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

1581 {
1582 check_context(*this, index);
1583 Z3_ast r = Z3_mk_seq_nth(ctx(), *this, index);
1584 check_error();
1585 return expr(ctx(), r);
1586 }
Z3_ast Z3_API Z3_mk_seq_nth(Z3_context c, Z3_ast s, Z3_ast index)
Retrieve from s the element positioned at position index. The function is under-specified if the inde...

Referenced by expr::operator[]().

◆ num_args()

unsigned num_args ( ) const
inline

Return the number of arguments in this application. This method assumes the expression is an application.

Precondition
is_app()

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

1266{ unsigned r = Z3_get_app_num_args(ctx(), *this); check_error(); return r; }
unsigned Z3_API Z3_get_app_num_args(Z3_context c, Z3_app a)
Return the number of argument of an application. If t is an constant, then the number of arguments is...

Referenced by AstRef::__bool__(), ExprRef::arg(), FuncEntry::arg_value(), expr::args(), FuncEntry::as_list(), ExprRef::children(), expr::end(), expr::is_const(), and ExprRef::update().

◆ numerator()

expr numerator ( ) const
inline

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

1203 {
1204 assert(is_numeral());
1206 check_error();
1207 return expr(ctx(),r);
1208 }
Z3_ast Z3_API Z3_get_numerator(Z3_context c, Z3_ast a)
Return the numerator (as a numeral AST) of a numeral AST of sort Real.

Referenced by RatNumRef::numerator_as_long().

◆ operator Z3_app()

operator Z3_app ( ) const
inline

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

1251{ assert(is_app()); return reinterpret_cast<Z3_app>(m_ast); }
System.IntPtr Z3_app

◆ operator[]() [1/2]

expr operator[] ( expr const index) const
inline

index operator defined on arrays and sequences.

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

1651 {
1652 assert(is_array() || is_seq());
1653 if (is_array()) {
1654 return select(*this, index);
1655 }
1656 return nth(index);
1657 }
bool is_array() const
Return true if this is a Array expression.
Definition z3++.h:910
expr nth(expr const &index) const
Definition z3++.h:1581
bool is_seq() const
Return true if this is a sequence expression.
Definition z3++.h:922
expr select(expr const &a, expr const &i)
forward declarations
Definition z3++.h:4148

◆ operator[]() [2/2]

expr operator[] ( expr_vector const index) const
inline

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

1659 {
1660 return select(*this, index);
1661 }

◆ repeat()

expr repeat ( unsigned  i) const
inline

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

1494{ Z3_ast r = Z3_mk_repeat(ctx(), i, *this); ctx().check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_mk_repeat(Z3_context c, unsigned i, Z3_ast t1)
Repeat the given bit-vector up length i.

◆ replace()

expr replace ( expr const src,
expr const dst 
) const
inline

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

1558 {
1559 check_context(*this, src); check_context(src, dst);
1560 Z3_ast r = Z3_mk_seq_replace(ctx(), *this, src, dst);
1561 check_error();
1562 return expr(ctx(), r);
1563 }
Z3_ast Z3_API Z3_mk_seq_replace(Z3_context c, Z3_ast s, Z3_ast src, Z3_ast dst)
Replace the first occurrence of src with dst in s.

◆ rotate_left()

expr rotate_left ( unsigned  i) const
inline

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

1492{ Z3_ast r = Z3_mk_rotate_left(ctx(), i, *this); ctx().check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_mk_rotate_left(Z3_context c, unsigned i, Z3_ast t1)
Rotate bits of t1 to the left i times.

◆ rotate_right()

expr rotate_right ( unsigned  i) const
inline

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

1493{ Z3_ast r = Z3_mk_rotate_right(ctx(), i, *this); ctx().check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_mk_rotate_right(Z3_context c, unsigned i, Z3_ast t1)
Rotate bits of t1 to the right i times.

◆ sbvtos()

expr sbvtos ( ) const
inline

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

1607 {
1608 Z3_ast r = Z3_mk_sbv_to_str(ctx(), *this);
1609 check_error();
1610 return expr(ctx(), r);
1611 }
Z3_ast Z3_API Z3_mk_sbv_to_str(Z3_context c, Z3_ast s)
Signed bit-vector to string conversion.

◆ simplify() [1/2]

expr simplify ( ) const
inline

Return a simplified version of this expression.

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

1666{ Z3_ast r = Z3_simplify(ctx(), m_ast); check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_simplify(Z3_context c, Z3_ast a)
Interface to simplifier.

◆ simplify() [2/2]

expr simplify ( params const p) const
inline

Return a simplified version of this expression. The parameter p is a set of parameters for the Z3 simplifier.

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

1670{ Z3_ast r = Z3_simplify_ex(ctx(), m_ast, p); check_error(); return expr(ctx(), r); }
Z3_ast Z3_API Z3_simplify_ex(Z3_context c, Z3_ast a, Z3_params p)
Interface to simplifier.

◆ stoi()

expr stoi ( ) const
inline

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

1592 {
1593 Z3_ast r = Z3_mk_str_to_int(ctx(), *this);
1594 check_error();
1595 return expr(ctx(), r);
1596 }
Z3_ast Z3_API Z3_mk_str_to_int(Z3_context c, Z3_ast s)
Convert string to integer.

◆ substitute() [1/3]

expr substitute ( expr_vector const dst)
inline

Apply substitution. Replace bound variables by expressions.

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

4449 {
4450 array<Z3_ast> _dst(dst.size());
4451 for (unsigned i = 0; i < dst.size(); ++i) {
4452 _dst[i] = dst[i];
4453 }
4454 Z3_ast r = Z3_substitute_vars(ctx(), m_ast, dst.size(), _dst.ptr());
4455 check_error();
4456 return expr(ctx(), r);
4457 }
Z3_ast Z3_API Z3_substitute_vars(Z3_context c, Z3_ast a, unsigned num_exprs, Z3_ast const to[])
Substitute the variables in a with the expressions in to. For every i smaller than num_exprs,...

◆ substitute() [2/3]

expr substitute ( expr_vector const src,
expr_vector const dst 
)
inline

Apply substitution. Replace src expressions by dst.

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

4436 {
4437 assert(src.size() == dst.size());
4438 array<Z3_ast> _src(src.size());
4439 array<Z3_ast> _dst(dst.size());
4440 for (unsigned i = 0; i < src.size(); ++i) {
4441 _src[i] = src[i];
4442 _dst[i] = dst[i];
4443 }
4444 Z3_ast r = Z3_substitute(ctx(), m_ast, src.size(), _src.ptr(), _dst.ptr());
4445 check_error();
4446 return expr(ctx(), r);
4447 }
Z3_ast Z3_API Z3_substitute(Z3_context c, Z3_ast a, unsigned num_exprs, Z3_ast const from[], Z3_ast const to[])
Substitute every occurrence of from[i] in a with to[i], for i smaller than num_exprs....

◆ substitute() [3/3]

expr substitute ( func_decl_vector const funs,
expr_vector const bodies 
)
inline

Apply function substitution by macro definitions.

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

4459 {
4460 array<Z3_ast> _dst(dst.size());
4461 array<Z3_func_decl> _funs(funs.size());
4462 if (dst.size() != funs.size()) {
4463 Z3_THROW(exception("length of argument lists don't align"));
4464 return expr(ctx(), nullptr);
4465 }
4466 for (unsigned i = 0; i < dst.size(); ++i) {
4467 _dst[i] = dst[i];
4468 _funs[i] = funs[i];
4469 }
4470 Z3_ast r = Z3_substitute_funs(ctx(), m_ast, dst.size(), _funs.ptr(), _dst.ptr());
4471 check_error();
4472 return expr(ctx(), r);
4473 }
Z3_ast Z3_API Z3_substitute_funs(Z3_context c, Z3_ast a, unsigned num_funs, Z3_func_decl const from[], Z3_ast const to[])
Substitute functions in from with new expressions in to.

◆ ubvtos()

expr ubvtos ( ) const
inline

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

1602 {
1603 Z3_ast r = Z3_mk_ubv_to_str(ctx(), *this);
1604 check_error();
1605 return expr(ctx(), r);
1606 }
Z3_ast Z3_API Z3_mk_ubv_to_str(Z3_context c, Z3_ast s)
Unsigned bit-vector to string conversion.

◆ unit()

expr unit ( ) const
inline

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

1564 {
1565 Z3_ast r = Z3_mk_seq_unit(ctx(), *this);
1566 check_error();
1567 return expr(ctx(), r);
1568 }
Z3_ast Z3_API Z3_mk_seq_unit(Z3_context c, Z3_ast a)
Create a unit sequence of a.

◆ update()

expr update ( expr_vector const args) const
inline

Update the arguments of this application. Return a new expression with the same function declaration and updated arguments. The number of new arguments must match the current number of arguments.

Precondition
is_app()
args.size() == num_args()

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

4475 {
4476 array<Z3_ast> _args(args.size());
4477 for (unsigned i = 0; i < args.size(); ++i) {
4478 _args[i] = args[i];
4479 }
4480 Z3_ast r = Z3_update_term(ctx(), m_ast, args.size(), _args.ptr());
4481 check_error();
4482 return expr(ctx(), r);
4483 }
unsigned size() const
Definition z3++.h:664
expr_vector args() const
Return a vector of all the arguments of this application. This method assumes the expression is an ap...
Definition z3++.h:1281
Z3_ast Z3_API Z3_update_term(Z3_context c, Z3_ast a, unsigned num_args, Z3_ast const args[])
Update the arguments of term a using the arguments args. The number of arguments num_args should coin...

◆ update_field()

expr update_field ( func_decl const field_access,
expr const new_value 
) const
inline

Update a datatype field. Return a new datatype expression with the specified field updated to the new value. The remaining fields are unchanged.

Precondition
is_datatype()
Parameters
field_accessThe accessor function declaration for the field to update
new_valueThe new value for the field

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

4485 {
4486 assert(is_datatype());
4487 Z3_ast r = Z3_datatype_update_field(ctx(), field_access, m_ast, new_value);
4488 check_error();
4489 return expr(ctx(), r);
4490 }
bool is_datatype() const
Return true if this is a Datatype expression.
Definition z3++.h:914
Z3_ast Z3_API Z3_datatype_update_field(Z3_context c, Z3_func_decl field_access, Z3_ast t, Z3_ast value)
Update record field with a value.

Friends And Related Symbol Documentation

◆ abs

expr abs ( expr const a)
friend

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

2082 {
2083 Z3_ast r;
2084 if (a.is_int()) {
2085 expr zero = a.ctx().int_val(0);
2086 expr ge = a >= zero;
2087 expr na = -a;
2088 r = Z3_mk_ite(a.ctx(), ge, a, na);
2089 }
2090 else if (a.is_real()) {
2091 expr zero = a.ctx().real_val(0);
2092 expr ge = a >= zero;
2093 expr na = -a;
2094 r = Z3_mk_ite(a.ctx(), ge, a, na);
2095 }
2096 else {
2097 r = Z3_mk_fpa_abs(a.ctx(), a);
2098 }
2099 a.check_error();
2100 return expr(a.ctx(), r);
2101 }
Z3_ast Z3_API Z3_mk_ite(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_ast t3)
Create an AST node representing an if-then-else: ite(t1, t2, t3).
Z3_ast Z3_API Z3_mk_fpa_abs(Z3_context c, Z3_ast t)
Floating-point absolute value.

◆ atleast

expr atleast ( expr_vector const es,
unsigned  bound 
)
friend

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

2538 {
2539 assert(es.size() > 0);
2540 context& ctx = es[0u].ctx();
2541 array<Z3_ast> _es(es);
2542 Z3_ast r = Z3_mk_atleast(ctx, _es.size(), _es.ptr(), bound);
2543 ctx.check_error();
2544 return expr(ctx, r);
2545 }
Z3_ast Z3_API Z3_mk_atleast(Z3_context c, unsigned num_args, Z3_ast const args[], unsigned k)
Pseudo-Boolean relations.

◆ atmost

expr atmost ( expr_vector const es,
unsigned  bound 
)
friend

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

2530 {
2531 assert(es.size() > 0);
2532 context& ctx = es[0u].ctx();
2533 array<Z3_ast> _es(es);
2534 Z3_ast r = Z3_mk_atmost(ctx, _es.size(), _es.ptr(), bound);
2535 ctx.check_error();
2536 return expr(ctx, r);
2537 }
Z3_ast Z3_API Z3_mk_atmost(Z3_context c, unsigned num_args, Z3_ast const args[], unsigned k)
Pseudo-Boolean relations.

◆ bv2int

expr bv2int ( expr const a,
bool  is_signed 
)
friend

bit-vector and integer conversions.

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

2328{ Z3_ast r = Z3_mk_bv2int(a.ctx(), a, is_signed); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bv2int(Z3_context c, Z3_ast t1, bool is_signed)
Create an integer from the bit-vector argument t1. If is_signed is false, then the bit-vector t1 is t...

◆ bvadd_no_overflow

expr bvadd_no_overflow ( expr const a,
expr const b,
bool  is_signed 
)
friend

bit-vector overflow/underflow checks

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

2334 {
2335 check_context(a, b); Z3_ast r = Z3_mk_bvadd_no_overflow(a.ctx(), a, b, is_signed); a.check_error(); return expr(a.ctx(), r);
2336 }
Z3_ast Z3_API Z3_mk_bvadd_no_overflow(Z3_context c, Z3_ast t1, Z3_ast t2, bool is_signed)
Create a predicate that checks that the bit-wise addition of t1 and t2 does not overflow.

◆ bvadd_no_underflow

expr bvadd_no_underflow ( expr const a,
expr const b 
)
friend

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

2337 {
2338 check_context(a, b); Z3_ast r = Z3_mk_bvadd_no_underflow(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r);
2339 }
Z3_ast Z3_API Z3_mk_bvadd_no_underflow(Z3_context c, Z3_ast t1, Z3_ast t2)
Create a predicate that checks that the bit-wise signed addition of t1 and t2 does not underflow.

◆ bvmul_no_overflow

expr bvmul_no_overflow ( expr const a,
expr const b,
bool  is_signed 
)
friend

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

2352 {
2353 check_context(a, b); Z3_ast r = Z3_mk_bvmul_no_overflow(a.ctx(), a, b, is_signed); a.check_error(); return expr(a.ctx(), r);
2354 }
Z3_ast Z3_API Z3_mk_bvmul_no_overflow(Z3_context c, Z3_ast t1, Z3_ast t2, bool is_signed)
Create a predicate that checks that the bit-wise multiplication of t1 and t2 does not overflow.

◆ bvmul_no_underflow

expr bvmul_no_underflow ( expr const a,
expr const b 
)
friend

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

2355 {
2356 check_context(a, b); Z3_ast r = Z3_mk_bvmul_no_underflow(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r);
2357 }
Z3_ast Z3_API Z3_mk_bvmul_no_underflow(Z3_context c, Z3_ast t1, Z3_ast t2)
Create a predicate that checks that the bit-wise signed multiplication of t1 and t2 does not underflo...

◆ bvneg_no_overflow

expr bvneg_no_overflow ( expr const a)
friend

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

2349 {
2350 Z3_ast r = Z3_mk_bvneg_no_overflow(a.ctx(), a); a.check_error(); return expr(a.ctx(), r);
2351 }
Z3_ast Z3_API Z3_mk_bvneg_no_overflow(Z3_context c, Z3_ast t1)
Check that bit-wise negation does not overflow when t1 is interpreted as a signed bit-vector.

◆ bvredand

expr bvredand ( expr const a)
friend

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

2076 {
2077 assert(a.is_bv());
2078 Z3_ast r = Z3_mk_bvredand(a.ctx(), a);
2079 a.check_error();
2080 return expr(a.ctx(), r);
2081 }
Z3_ast Z3_API Z3_mk_bvredand(Z3_context c, Z3_ast t1)
Take conjunction of bits in vector, return vector of length 1.

◆ bvredor

expr bvredor ( expr const a)
friend

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

2070 {
2071 assert(a.is_bv());
2072 Z3_ast r = Z3_mk_bvredor(a.ctx(), a);
2073 a.check_error();
2074 return expr(a.ctx(), r);
2075 }
Z3_ast Z3_API Z3_mk_bvredor(Z3_context c, Z3_ast t1)
Take disjunction of bits in vector, return vector of length 1.

◆ bvsdiv_no_overflow

expr bvsdiv_no_overflow ( expr const a,
expr const b 
)
friend

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

2346 {
2347 check_context(a, b); Z3_ast r = Z3_mk_bvsdiv_no_overflow(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r);
2348 }
Z3_ast Z3_API Z3_mk_bvsdiv_no_overflow(Z3_context c, Z3_ast t1, Z3_ast t2)
Create a predicate that checks that the bit-wise signed division of t1 and t2 does not overflow.

◆ bvsub_no_overflow

expr bvsub_no_overflow ( expr const a,
expr const b 
)
friend

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

2340 {
2341 check_context(a, b); Z3_ast r = Z3_mk_bvsub_no_overflow(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r);
2342 }
Z3_ast Z3_API Z3_mk_bvsub_no_overflow(Z3_context c, Z3_ast t1, Z3_ast t2)
Create a predicate that checks that the bit-wise signed subtraction of t1 and t2 does not overflow.

◆ bvsub_no_underflow

expr bvsub_no_underflow ( expr const a,
expr const b,
bool  is_signed 
)
friend

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

2343 {
2344 check_context(a, b); Z3_ast r = Z3_mk_bvsub_no_underflow(a.ctx(), a, b, is_signed); a.check_error(); return expr(a.ctx(), r);
2345 }
Z3_ast Z3_API Z3_mk_bvsub_no_underflow(Z3_context c, Z3_ast t1, Z3_ast t2, bool is_signed)
Create a predicate that checks that the bit-wise subtraction of t1 and t2 does not underflow.

◆ concat [1/2]

expr concat ( expr const a,
expr const b 
)
friend

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

2564 {
2565 check_context(a, b);
2566 Z3_ast r;
2567 if (Z3_is_seq_sort(a.ctx(), a.get_sort())) {
2568 Z3_ast _args[2] = { a, b };
2569 r = Z3_mk_seq_concat(a.ctx(), 2, _args);
2570 }
2571 else if (Z3_is_re_sort(a.ctx(), a.get_sort())) {
2572 Z3_ast _args[2] = { a, b };
2573 r = Z3_mk_re_concat(a.ctx(), 2, _args);
2574 }
2575 else {
2576 r = Z3_mk_concat(a.ctx(), a, b);
2577 }
2578 a.ctx().check_error();
2579 return expr(a.ctx(), r);
2580 }
bool Z3_API Z3_is_seq_sort(Z3_context c, Z3_sort s)
Check if s is a sequence sort.
Z3_ast Z3_API Z3_mk_seq_concat(Z3_context c, unsigned n, Z3_ast const args[])
Concatenate sequences.
Z3_ast Z3_API Z3_mk_re_concat(Z3_context c, unsigned n, Z3_ast const args[])
Create the concatenation of the regular languages.
Z3_ast Z3_API Z3_mk_concat(Z3_context c, Z3_ast t1, Z3_ast t2)
Concatenate the given bit-vectors.
bool Z3_API Z3_is_re_sort(Z3_context c, Z3_sort s)
Check if s is a regular expression sort.

◆ concat [2/2]

expr concat ( expr_vector const args)
friend

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

2582 {
2583 Z3_ast r;
2584 assert(args.size() > 0);
2585 if (args.size() == 1) {
2586 return args[0u];
2587 }
2588 context& ctx = args[0u].ctx();
2589 array<Z3_ast> _args(args);
2590 if (Z3_is_seq_sort(ctx, args[0u].get_sort())) {
2591 r = Z3_mk_seq_concat(ctx, _args.size(), _args.ptr());
2592 }
2593 else if (Z3_is_re_sort(ctx, args[0u].get_sort())) {
2594 r = Z3_mk_re_concat(ctx, _args.size(), _args.ptr());
2595 }
2596 else {
2597 r = _args[args.size()-1];
2598 for (unsigned i = args.size()-1; i > 0; ) {
2599 --i;
2600 r = Z3_mk_concat(ctx, _args[i], r);
2601 ctx.check_error();
2602 }
2603 }
2604 ctx.check_error();
2605 return expr(ctx, r);
2606 }

◆ distinct

expr distinct ( expr_vector const args)
friend

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

2555 {
2556 assert(args.size() > 0);
2557 context& ctx = args[0u].ctx();
2558 array<Z3_ast> _args(args);
2559 Z3_ast r = Z3_mk_distinct(ctx, _args.size(), _args.ptr());
2560 ctx.check_error();
2561 return expr(ctx, r);
2562 }
Z3_ast Z3_API Z3_mk_distinct(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing distinct(args[0], ..., args[num_args-1]).

◆ fma

expr fma ( expr const a,
expr const b,
expr const c,
expr const rm 
)
friend

FloatingPoint fused multiply-add.

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

2118 {
2119 check_context(a, b); check_context(a, c); check_context(a, rm);
2120 assert(a.is_fpa() && b.is_fpa() && c.is_fpa());
2121 Z3_ast r = Z3_mk_fpa_fma(a.ctx(), rm, a, b, c);
2122 a.check_error();
2123 return expr(a.ctx(), r);
2124 }
Z3_ast Z3_API Z3_mk_fpa_fma(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2, Z3_ast t3)
Floating-point fused multiply-add.

◆ fp_eq

expr fp_eq ( expr const a,
expr const b 
)
friend

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

2109 {
2110 check_context(a, b);
2111 assert(a.is_fpa());
2112 Z3_ast r = Z3_mk_fpa_eq(a.ctx(), a, b);
2113 a.check_error();
2114 return expr(a.ctx(), r);
2115 }
Z3_ast Z3_API Z3_mk_fpa_eq(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point equality.

◆ fpa_fp

expr fpa_fp ( expr const sgn,
expr const exp,
expr const sig 
)
friend

Create an expression of FloatingPoint sort from three bit-vector expressions.

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

2126 {
2127 check_context(sgn, exp); check_context(exp, sig);
2128 assert(sgn.is_bv() && exp.is_bv() && sig.is_bv());
2129 Z3_ast r = Z3_mk_fpa_fp(sgn.ctx(), sgn, exp, sig);
2130 sgn.check_error();
2131 return expr(sgn.ctx(), r);
2132 }
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig)
Create an expression of FloatingPoint sort from three bit-vector expressions.

◆ fpa_to_fpa

expr fpa_to_fpa ( expr const t,
sort  s 
)
friend

Conversion of a floating-point term into another floating-point.

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

2162 {
2163 assert(t.is_fpa());
2164 Z3_ast r = Z3_mk_fpa_to_fp_float(t.ctx(), t.ctx().fpa_rounding_mode(), t, s);
2165 t.check_error();
2166 return expr(t.ctx(), r);
2167 }
Z3_ast Z3_API Z3_mk_fpa_to_fp_float(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s)
Conversion of a FloatingPoint term into another term of different FloatingPoint sort.

◆ fpa_to_sbv

expr fpa_to_sbv ( expr const t,
unsigned  sz 
)
friend

Conversion of a floating-point term into a signed bit-vector.

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

2134 {
2135 assert(t.is_fpa());
2136 Z3_ast r = Z3_mk_fpa_to_sbv(t.ctx(), t.ctx().fpa_rounding_mode(), t, sz);
2137 t.check_error();
2138 return expr(t.ctx(), r);
2139 }
Z3_ast Z3_API Z3_mk_fpa_to_sbv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz)
Conversion of a floating-point term into a signed bit-vector.

◆ fpa_to_ubv

expr fpa_to_ubv ( expr const t,
unsigned  sz 
)
friend

Conversion of a floating-point term into an unsigned bit-vector.

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

2141 {
2142 assert(t.is_fpa());
2143 Z3_ast r = Z3_mk_fpa_to_ubv(t.ctx(), t.ctx().fpa_rounding_mode(), t, sz);
2144 t.check_error();
2145 return expr(t.ctx(), r);
2146 }
Z3_ast Z3_API Z3_mk_fpa_to_ubv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz)
Conversion of a floating-point term into an unsigned bit-vector.

◆ implies [1/3]

expr implies ( bool  a,
expr const b 
)
friend

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

1721{ return implies(b.ctx().bool_val(a), b); }
friend expr implies(expr const &a, expr const &b)
Definition z3++.h:1716

◆ implies [2/3]

expr implies ( expr const a,
bool  b 
)
friend

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

1720{ return implies(a, a.ctx().bool_val(b)); }

◆ implies [3/3]

expr implies ( expr const a,
expr const b 
)
friend

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

1716 {
1717 assert(a.is_bool() && b.is_bool());
1719 }
Z3_ast Z3_API Z3_mk_implies(Z3_context c, Z3_ast t1, Z3_ast t2)
Create an AST node representing t1 implies t2.
#define _Z3_MK_BIN_(a, b, binop)
Definition z3++.h:1709

◆ int2bv

expr int2bv ( unsigned  n,
expr const a 
)
friend

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

2329{ Z3_ast r = Z3_mk_int2bv(a.ctx(), n, a); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_int2bv(Z3_context c, unsigned n, Z3_ast t1)
Create an n bit bit-vector from the integer argument t1.

◆ is_int

expr is_int ( expr const e)
friend

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

1764{ _Z3_MK_UN_(e, Z3_mk_is_int); }
Z3_ast Z3_API Z3_mk_is_int(Z3_context c, Z3_ast t1)
Check if a real number is an integer.
#define _Z3_MK_UN_(a, mkun)
Definition z3++.h:1756

Referenced by IntNumRef::as_long(), and ArithSortRef::subsort().

◆ ite

expr ite ( expr const c,
expr const t,
expr const e 
)
friend

Create the if-then-else expression ite(c, t, e)

Precondition
c.is_bool()

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

2181 {
2182 check_context(c, t); check_context(c, e);
2183 assert(c.is_bool());
2184 Z3_ast r = Z3_mk_ite(c.ctx(), c, t, e);
2185 c.check_error();
2186 return expr(c.ctx(), r);
2187 }

◆ max

expr max ( expr const a,
expr const b 
)
friend

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

2054 {
2055 check_context(a, b);
2056 Z3_ast r;
2057 if (a.is_arith()) {
2058 r = Z3_mk_ite(a.ctx(), Z3_mk_ge(a.ctx(), a, b), a, b);
2059 }
2060 else if (a.is_bv()) {
2061 r = Z3_mk_ite(a.ctx(), Z3_mk_bvuge(a.ctx(), a, b), a, b);
2062 }
2063 else {
2064 assert(a.is_fpa());
2065 r = Z3_mk_fpa_max(a.ctx(), a, b);
2066 }
2067 a.check_error();
2068 return expr(a.ctx(), r);
2069 }
Z3_ast Z3_API Z3_mk_ge(Z3_context c, Z3_ast t1, Z3_ast t2)
Create greater than or equal to.
Z3_ast Z3_API Z3_mk_fpa_max(Z3_context c, Z3_ast t1, Z3_ast t2)
Maximum of floating-point numbers.
Z3_ast Z3_API Z3_mk_bvuge(Z3_context c, Z3_ast t1, Z3_ast t2)
Unsigned greater than or equal to.

◆ min

expr min ( expr const a,
expr const b 
)
friend

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

2038 {
2039 check_context(a, b);
2040 Z3_ast r;
2041 if (a.is_arith()) {
2042 r = Z3_mk_ite(a.ctx(), Z3_mk_ge(a.ctx(), a, b), b, a);
2043 }
2044 else if (a.is_bv()) {
2045 r = Z3_mk_ite(a.ctx(), Z3_mk_bvuge(a.ctx(), a, b), b, a);
2046 }
2047 else {
2048 assert(a.is_fpa());
2049 r = Z3_mk_fpa_min(a.ctx(), a, b);
2050 }
2051 a.check_error();
2052 return expr(a.ctx(), r);
2053 }
Z3_ast Z3_API Z3_mk_fpa_min(Z3_context c, Z3_ast t1, Z3_ast t2)
Minimum of floating-point numbers.

◆ mk_and

expr mk_and ( expr_vector const args)
friend

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

2642 {
2643 array<Z3_ast> _args(args);
2644 Z3_ast r = Z3_mk_and(args.ctx(), _args.size(), _args.ptr());
2645 args.check_error();
2646 return expr(args.ctx(), r);
2647 }
Z3_ast Z3_API Z3_mk_and(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] and ... and args[num_args-1].

◆ mk_or

expr mk_or ( expr_vector const args)
friend

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

2636 {
2637 array<Z3_ast> _args(args);
2638 Z3_ast r = Z3_mk_or(args.ctx(), _args.size(), _args.ptr());
2639 args.check_error();
2640 return expr(args.ctx(), r);
2641 }
Z3_ast Z3_API Z3_mk_or(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] or ... or args[num_args-1].

◆ mk_xor

expr mk_xor ( expr_vector const args)
friend

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

2648 {
2649 if (args.empty())
2650 return args.ctx().bool_val(false);
2651 expr r = args[0u];
2652 for (unsigned i = 1; i < args.size(); ++i)
2653 r = r ^ args[i];
2654 return r;
2655 }
bool empty() const
Definition z3++.h:670
expr bool_val(bool b)
Definition z3++.h:3985

◆ mod [1/3]

expr mod ( expr const a,
expr const b 
)
friend

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

1728 {
1729 if (a.is_bv()) {
1730 _Z3_MK_BIN_(a, b, Z3_mk_bvsmod);
1731 }
1732 else {
1733 _Z3_MK_BIN_(a, b, Z3_mk_mod);
1734 }
1735 }
Z3_ast Z3_API Z3_mk_mod(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 mod arg2.
Z3_ast Z3_API Z3_mk_bvsmod(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed remainder (sign follows divisor).

◆ mod [2/3]

expr mod ( expr const a,
int  b 
)
friend

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

1736{ return mod(a, a.ctx().num_val(b, a.get_sort())); }
friend expr mod(expr const &a, expr const &b)
Definition z3++.h:1728

◆ mod [3/3]

expr mod ( int  a,
expr const b 
)
friend

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

1737{ return mod(b.ctx().num_val(a, b.get_sort()), b); }

◆ nand

expr nand ( expr const a,
expr const b 
)
friend

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

2035{ if (a.is_bool()) return !(a && b); check_context(a, b); Z3_ast r = Z3_mk_bvnand(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvnand(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise nand.

◆ nor

expr nor ( expr const a,
expr const b 
)
friend

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

2036{ if (a.is_bool()) return !(a || b); check_context(a, b); Z3_ast r = Z3_mk_bvnor(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvnor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise nor.

◆ operator!

expr operator! ( expr const a)
friend

Return an expression representing not(a).

Precondition
a.is_bool()

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

1762{ assert(a.is_bool()); _Z3_MK_UN_(a, Z3_mk_not); }
Z3_ast Z3_API Z3_mk_not(Z3_context c, Z3_ast a)
Create an AST node representing not(a).

◆ operator!= [1/3]

expr operator!= ( expr const a,
expr const b 
)
friend

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

1804 {
1805 check_context(a, b);
1806 Z3_ast args[2] = { a, b };
1807 Z3_ast r = Z3_mk_distinct(a.ctx(), 2, args);
1808 a.check_error();
1809 return expr(a.ctx(), r);
1810 }

◆ operator!= [2/3]

expr operator!= ( expr const a,
int  b 
)
friend

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

1811{ assert(a.is_arith() || a.is_bv() || a.is_fpa()); return a != a.ctx().num_val(b, a.get_sort()); }

◆ operator!= [3/3]

expr operator!= ( int  a,
expr const b 
)
friend

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

1812{ assert(b.is_arith() || b.is_bv() || b.is_fpa()); return b.ctx().num_val(a, b.get_sort()) != b; }

◆ operator& [1/3]

expr operator& ( expr const a,
expr const b 
)
friend

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

2023{ if (a.is_bool()) return a && b; check_context(a, b); Z3_ast r = Z3_mk_bvand(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvand(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise and.

◆ operator& [2/3]

expr operator& ( expr const a,
int  b 
)
friend

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

2024{ return a & a.ctx().num_val(b, a.get_sort()); }

◆ operator& [3/3]

expr operator& ( int  a,
expr const b 
)
friend

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

2025{ return b.ctx().num_val(a, b.get_sort()) & b; }

◆ operator&& [1/3]

expr operator&& ( bool  a,
expr const b 
)
friend

Return an expression representing a and b. The C++ Boolean value a is automatically converted into a Z3 Boolean constant.

Precondition
b.is_bool()

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

1778{ return b.ctx().bool_val(a) && b; }

◆ operator&& [2/3]

expr operator&& ( expr const a,
bool  b 
)
friend

Return an expression representing a and b. The C++ Boolean value b is automatically converted into a Z3 Boolean constant.

Precondition
a.is_bool()

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

1777{ return a && a.ctx().bool_val(b); }

◆ operator&& [3/3]

expr operator&& ( expr const a,
expr const b 
)
friend

Return an expression representing a and b.

Precondition
a.is_bool()
b.is_bool()

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

1768 {
1769 check_context(a, b);
1770 assert(a.is_bool() && b.is_bool());
1771 Z3_ast args[2] = { a, b };
1772 Z3_ast r = Z3_mk_and(a.ctx(), 2, args);
1773 a.check_error();
1774 return expr(a.ctx(), r);
1775 }

◆ operator* [1/3]

expr operator* ( expr const a,
expr const b 
)
friend

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

1846 {
1847 check_context(a, b);
1848 Z3_ast r = 0;
1849 if (a.is_arith() && b.is_arith()) {
1850 Z3_ast args[2] = { a, b };
1851 r = Z3_mk_mul(a.ctx(), 2, args);
1852 }
1853 else if (a.is_bv() && b.is_bv()) {
1854 r = Z3_mk_bvmul(a.ctx(), a, b);
1855 }
1856 else if (a.is_fpa() && b.is_fpa()) {
1857 r = Z3_mk_fpa_mul(a.ctx(), a.ctx().fpa_rounding_mode(), a, b);
1858 }
1859 else {
1860 // operator is not supported by given arguments.
1861 assert(false);
1862 }
1863 a.check_error();
1864 return expr(a.ctx(), r);
1865 }
Z3_ast Z3_API Z3_mk_mul(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] * ... * args[num_args-1].
Z3_ast Z3_API Z3_mk_bvmul(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement multiplication.
Z3_ast Z3_API Z3_mk_fpa_mul(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2)
Floating-point multiplication.

◆ operator* [2/3]

expr operator* ( expr const a,
int  b 
)
friend

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

1866{ return a * a.ctx().num_val(b, a.get_sort()); }

◆ operator* [3/3]

expr operator* ( int  a,
expr const b 
)
friend

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

1867{ return b.ctx().num_val(a, b.get_sort()) * b; }

◆ operator+ [1/3]

expr operator+ ( expr const a,
expr const b 
)
friend

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

1816 {
1817 check_context(a, b);
1818 Z3_ast r = 0;
1819 if (a.is_arith() && b.is_arith()) {
1820 Z3_ast args[2] = { a, b };
1821 r = Z3_mk_add(a.ctx(), 2, args);
1822 }
1823 else if (a.is_bv() && b.is_bv()) {
1824 r = Z3_mk_bvadd(a.ctx(), a, b);
1825 }
1826 else if (a.is_seq() && b.is_seq()) {
1827 return concat(a, b);
1828 }
1829 else if (a.is_re() && b.is_re()) {
1830 Z3_ast _args[2] = { a, b };
1831 r = Z3_mk_re_union(a.ctx(), 2, _args);
1832 }
1833 else if (a.is_fpa() && b.is_fpa()) {
1834 r = Z3_mk_fpa_add(a.ctx(), a.ctx().fpa_rounding_mode(), a, b);
1835 }
1836 else {
1837 // operator is not supported by given arguments.
1838 assert(false);
1839 }
1840 a.check_error();
1841 return expr(a.ctx(), r);
1842 }
friend expr concat(expr const &a, expr const &b)
Definition z3++.h:2564
Z3_ast Z3_API Z3_mk_re_union(Z3_context c, unsigned n, Z3_ast const args[])
Create the union of the regular languages.
Z3_ast Z3_API Z3_mk_bvadd(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement addition.
Z3_ast Z3_API Z3_mk_fpa_add(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2)
Floating-point addition.
Z3_ast Z3_API Z3_mk_add(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] + ... + args[num_args-1].

◆ operator+ [2/3]

expr operator+ ( expr const a,
int  b 
)
friend

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

1843{ return a + a.ctx().num_val(b, a.get_sort()); }

◆ operator+ [3/3]

expr operator+ ( int  a,
expr const b 
)
friend

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

1844{ return b.ctx().num_val(a, b.get_sort()) + b; }

◆ operator- [1/4]

expr operator- ( expr const a)
friend

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

1912 {
1913 Z3_ast r = 0;
1914 if (a.is_arith()) {
1915 r = Z3_mk_unary_minus(a.ctx(), a);
1916 }
1917 else if (a.is_bv()) {
1918 r = Z3_mk_bvneg(a.ctx(), a);
1919 }
1920 else if (a.is_fpa()) {
1921 r = Z3_mk_fpa_neg(a.ctx(), a);
1922 }
1923 else {
1924 // operator is not supported by given arguments.
1925 assert(false);
1926 }
1927 a.check_error();
1928 return expr(a.ctx(), r);
1929 }
Z3_ast Z3_API Z3_mk_unary_minus(Z3_context c, Z3_ast arg)
Create an AST node representing - arg.
Z3_ast Z3_API Z3_mk_fpa_neg(Z3_context c, Z3_ast t)
Floating-point negation.
Z3_ast Z3_API Z3_mk_bvneg(Z3_context c, Z3_ast t1)
Standard two's complement unary minus.

◆ operator- [2/4]

expr operator- ( expr const a,
expr const b 
)
friend

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

1931 {
1932 check_context(a, b);
1933 Z3_ast r = 0;
1934 if (a.is_arith() && b.is_arith()) {
1935 Z3_ast args[2] = { a, b };
1936 r = Z3_mk_sub(a.ctx(), 2, args);
1937 }
1938 else if (a.is_bv() && b.is_bv()) {
1939 r = Z3_mk_bvsub(a.ctx(), a, b);
1940 }
1941 else if (a.is_fpa() && b.is_fpa()) {
1942 r = Z3_mk_fpa_sub(a.ctx(), a.ctx().fpa_rounding_mode(), a, b);
1943 }
1944 else {
1945 // operator is not supported by given arguments.
1946 assert(false);
1947 }
1948 a.check_error();
1949 return expr(a.ctx(), r);
1950 }
Z3_ast Z3_API Z3_mk_fpa_sub(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2)
Floating-point subtraction.
Z3_ast Z3_API Z3_mk_bvsub(Z3_context c, Z3_ast t1, Z3_ast t2)
Standard two's complement subtraction.
Z3_ast Z3_API Z3_mk_sub(Z3_context c, unsigned num_args, Z3_ast const args[])
Create an AST node representing args[0] - ... - args[num_args - 1].

◆ operator- [3/4]

expr operator- ( expr const a,
int  b 
)
friend

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

1951{ return a - a.ctx().num_val(b, a.get_sort()); }

◆ operator- [4/4]

expr operator- ( int  a,
expr const b 
)
friend

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

1952{ return b.ctx().num_val(a, b.get_sort()) - b; }

◆ operator/ [1/3]

expr operator/ ( expr const a,
expr const b 
)
friend

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

1890 {
1891 check_context(a, b);
1892 Z3_ast r = 0;
1893 if (a.is_arith() && b.is_arith()) {
1894 r = Z3_mk_div(a.ctx(), a, b);
1895 }
1896 else if (a.is_bv() && b.is_bv()) {
1897 r = Z3_mk_bvsdiv(a.ctx(), a, b);
1898 }
1899 else if (a.is_fpa() && b.is_fpa()) {
1900 r = Z3_mk_fpa_div(a.ctx(), a.ctx().fpa_rounding_mode(), a, b);
1901 }
1902 else {
1903 // operator is not supported by given arguments.
1904 assert(false);
1905 }
1906 a.check_error();
1907 return expr(a.ctx(), r);
1908 }
Z3_ast Z3_API Z3_mk_div(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 div arg2.
Z3_ast Z3_API Z3_mk_bvsdiv(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed division.
Z3_ast Z3_API Z3_mk_fpa_div(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2)
Floating-point division.

◆ operator/ [2/3]

expr operator/ ( expr const a,
int  b 
)
friend

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

1909{ return a / a.ctx().num_val(b, a.get_sort()); }

◆ operator/ [3/3]

expr operator/ ( int  a,
expr const b 
)
friend

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

1910{ return b.ctx().num_val(a, b.get_sort()) / b; }

◆ operator< [1/3]

expr operator< ( expr const a,
expr const b 
)
friend

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

1979 {
1980 check_context(a, b);
1981 Z3_ast r = 0;
1982 if (a.is_arith() && b.is_arith()) {
1983 r = Z3_mk_lt(a.ctx(), a, b);
1984 }
1985 else if (a.is_bv() && b.is_bv()) {
1986 r = Z3_mk_bvslt(a.ctx(), a, b);
1987 }
1988 else if (a.is_fpa() && b.is_fpa()) {
1989 r = Z3_mk_fpa_lt(a.ctx(), a, b);
1990 }
1991 else {
1992 // operator is not supported by given arguments.
1993 assert(false);
1994 }
1995 a.check_error();
1996 return expr(a.ctx(), r);
1997 }
Z3_ast Z3_API Z3_mk_bvslt(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed less than.
Z3_ast Z3_API Z3_mk_lt(Z3_context c, Z3_ast t1, Z3_ast t2)
Create less than.
Z3_ast Z3_API Z3_mk_fpa_lt(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point less than.

◆ operator< [2/3]

expr operator< ( expr const a,
int  b 
)
friend

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

1998{ return a < a.ctx().num_val(b, a.get_sort()); }

◆ operator< [3/3]

expr operator< ( int  a,
expr const b 
)
friend

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

1999{ return b.ctx().num_val(a, b.get_sort()) < b; }

◆ operator<= [1/3]

expr operator<= ( expr const a,
expr const b 
)
friend

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

1954 {
1955 check_context(a, b);
1956 Z3_ast r = 0;
1957 if (a.is_arith() && b.is_arith()) {
1958 r = Z3_mk_le(a.ctx(), a, b);
1959 }
1960 else if (a.is_bv() && b.is_bv()) {
1961 r = Z3_mk_bvsle(a.ctx(), a, b);
1962 }
1963 else if (a.is_fpa() && b.is_fpa()) {
1964 r = Z3_mk_fpa_leq(a.ctx(), a, b);
1965 }
1966 else {
1967 // operator is not supported by given arguments.
1968 assert(false);
1969 }
1970 a.check_error();
1971 return expr(a.ctx(), r);
1972 }
Z3_ast Z3_API Z3_mk_bvsle(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed less than or equal to.
Z3_ast Z3_API Z3_mk_le(Z3_context c, Z3_ast t1, Z3_ast t2)
Create less than or equal to.
Z3_ast Z3_API Z3_mk_fpa_leq(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point less than or equal.

◆ operator<= [2/3]

expr operator<= ( expr const a,
int  b 
)
friend

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

1973{ return a <= a.ctx().num_val(b, a.get_sort()); }

◆ operator<= [3/3]

expr operator<= ( int  a,
expr const b 
)
friend

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

1974{ return b.ctx().num_val(a, b.get_sort()) <= b; }

◆ operator== [1/3]

expr operator== ( expr const a,
expr const b 
)
friend

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

1793 {
1794 check_context(a, b);
1795 Z3_ast r = Z3_mk_eq(a.ctx(), a, b);
1796 a.check_error();
1797 return expr(a.ctx(), r);
1798 }
Z3_ast Z3_API Z3_mk_eq(Z3_context c, Z3_ast l, Z3_ast r)
Create an AST node representing l = r.

◆ operator== [2/3]

expr operator== ( expr const a,
int  b 
)
friend

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

1799{ assert(a.is_arith() || a.is_bv() || a.is_fpa()); return a == a.ctx().num_val(b, a.get_sort()); }

◆ operator== [3/3]

expr operator== ( int  a,
expr const b 
)
friend

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

1800{ assert(b.is_arith() || b.is_bv() || b.is_fpa()); return b.ctx().num_val(a, b.get_sort()) == b; }

◆ operator> [1/3]

expr operator> ( expr const a,
expr const b 
)
friend

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

2001 {
2002 check_context(a, b);
2003 Z3_ast r = 0;
2004 if (a.is_arith() && b.is_arith()) {
2005 r = Z3_mk_gt(a.ctx(), a, b);
2006 }
2007 else if (a.is_bv() && b.is_bv()) {
2008 r = Z3_mk_bvsgt(a.ctx(), a, b);
2009 }
2010 else if (a.is_fpa() && b.is_fpa()) {
2011 r = Z3_mk_fpa_gt(a.ctx(), a, b);
2012 }
2013 else {
2014 // operator is not supported by given arguments.
2015 assert(false);
2016 }
2017 a.check_error();
2018 return expr(a.ctx(), r);
2019 }
Z3_ast Z3_API Z3_mk_bvsgt(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed greater than.
Z3_ast Z3_API Z3_mk_fpa_gt(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point greater than.
Z3_ast Z3_API Z3_mk_gt(Z3_context c, Z3_ast t1, Z3_ast t2)
Create greater than.

◆ operator> [2/3]

expr operator> ( expr const a,
int  b 
)
friend

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

2020{ return a > a.ctx().num_val(b, a.get_sort()); }

◆ operator> [3/3]

expr operator> ( int  a,
expr const b 
)
friend

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

2021{ return b.ctx().num_val(a, b.get_sort()) > b; }

◆ operator>= [1/3]

expr operator>= ( expr const a,
expr const b 
)
friend

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

1870 {
1871 check_context(a, b);
1872 Z3_ast r = 0;
1873 if (a.is_arith() && b.is_arith()) {
1874 r = Z3_mk_ge(a.ctx(), a, b);
1875 }
1876 else if (a.is_bv() && b.is_bv()) {
1877 r = Z3_mk_bvsge(a.ctx(), a, b);
1878 }
1879 else if (a.is_fpa() && b.is_fpa()) {
1880 r = Z3_mk_fpa_geq(a.ctx(), a, b);
1881 }
1882 else {
1883 // operator is not supported by given arguments.
1884 assert(false);
1885 }
1886 a.check_error();
1887 return expr(a.ctx(), r);
1888 }
Z3_ast Z3_API Z3_mk_bvsge(Z3_context c, Z3_ast t1, Z3_ast t2)
Two's complement signed greater than or equal to.
Z3_ast Z3_API Z3_mk_fpa_geq(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point greater than or equal.

◆ operator>= [2/3]

expr operator>= ( expr const a,
int  b 
)
friend

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

1976{ return a >= a.ctx().num_val(b, a.get_sort()); }

◆ operator>= [3/3]

expr operator>= ( int  a,
expr const b 
)
friend

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

1977{ return b.ctx().num_val(a, b.get_sort()) >= b; }

◆ operator^ [1/3]

expr operator^ ( expr const a,
expr const b 
)
friend

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

2027{ check_context(a, b); Z3_ast r = a.is_bool() ? Z3_mk_xor(a.ctx(), a, b) : Z3_mk_bvxor(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvxor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise exclusive-or.
Z3_ast Z3_API Z3_mk_xor(Z3_context c, Z3_ast t1, Z3_ast t2)
Create an AST node representing t1 xor t2.

◆ operator^ [2/3]

expr operator^ ( expr const a,
int  b 
)
friend

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

2028{ return a ^ a.ctx().num_val(b, a.get_sort()); }

◆ operator^ [3/3]

expr operator^ ( int  a,
expr const b 
)
friend

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

2029{ return b.ctx().num_val(a, b.get_sort()) ^ b; }

◆ operator| [1/3]

expr operator| ( expr const a,
expr const b 
)
friend

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

2031{ if (a.is_bool()) return a || b; check_context(a, b); Z3_ast r = Z3_mk_bvor(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise or.

◆ operator| [2/3]

expr operator| ( expr const a,
int  b 
)
friend

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

2032{ return a | a.ctx().num_val(b, a.get_sort()); }

◆ operator| [3/3]

expr operator| ( int  a,
expr const b 
)
friend

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

2033{ return b.ctx().num_val(a, b.get_sort()) | b; }

◆ operator|| [1/3]

expr operator|| ( bool  a,
expr const b 
)
friend

Return an expression representing a or b. The C++ Boolean value a is automatically converted into a Z3 Boolean constant.

Precondition
b.is_bool()

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

1791{ return b.ctx().bool_val(a) || b; }

◆ operator|| [2/3]

expr operator|| ( expr const a,
bool  b 
)
friend

Return an expression representing a or b. The C++ Boolean value b is automatically converted into a Z3 Boolean constant.

Precondition
a.is_bool()

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

1789{ return a || a.ctx().bool_val(b); }

◆ operator|| [3/3]

expr operator|| ( expr const a,
expr const b 
)
friend

Return an expression representing a or b.

Precondition
a.is_bool()
b.is_bool()

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

1780 {
1781 check_context(a, b);
1782 assert(a.is_bool() && b.is_bool());
1783 Z3_ast args[2] = { a, b };
1784 Z3_ast r = Z3_mk_or(a.ctx(), 2, args);
1785 a.check_error();
1786 return expr(a.ctx(), r);
1787 }

◆ operator~

expr operator~ ( expr const a)
friend

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

2116{ Z3_ast r = Z3_mk_bvnot(a.ctx(), a); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvnot(Z3_context c, Z3_ast t1)
Bitwise negation.

◆ pbeq

expr pbeq ( expr_vector const es,
int const coeffs,
int  bound 
)
friend

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

2522 {
2523 assert(es.size() > 0);
2524 context& ctx = es[0u].ctx();
2525 array<Z3_ast> _es(es);
2526 Z3_ast r = Z3_mk_pbeq(ctx, _es.size(), _es.ptr(), coeffs, bound);
2527 ctx.check_error();
2528 return expr(ctx, r);
2529 }
Z3_ast Z3_API Z3_mk_pbeq(Z3_context c, unsigned num_args, Z3_ast const args[], int const coeffs[], int k)
Pseudo-Boolean relations.

◆ pbge

expr pbge ( expr_vector const es,
int const coeffs,
int  bound 
)
friend

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

2514 {
2515 assert(es.size() > 0);
2516 context& ctx = es[0u].ctx();
2517 array<Z3_ast> _es(es);
2518 Z3_ast r = Z3_mk_pbge(ctx, _es.size(), _es.ptr(), coeffs, bound);
2519 ctx.check_error();
2520 return expr(ctx, r);
2521 }
Z3_ast Z3_API Z3_mk_pbge(Z3_context c, unsigned num_args, Z3_ast const args[], int const coeffs[], int k)
Pseudo-Boolean relations.

◆ pble

expr pble ( expr_vector const es,
int const coeffs,
int  bound 
)
friend

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

2506 {
2507 assert(es.size() > 0);
2508 context& ctx = es[0u].ctx();
2509 array<Z3_ast> _es(es);
2510 Z3_ast r = Z3_mk_pble(ctx, _es.size(), _es.ptr(), coeffs, bound);
2511 ctx.check_error();
2512 return expr(ctx, r);
2513 }
Z3_ast Z3_API Z3_mk_pble(Z3_context c, unsigned num_args, Z3_ast const args[], int const coeffs[], int k)
Pseudo-Boolean relations.

◆ pw [1/3]

expr pw ( expr const a,
expr const b 
)
friend

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

1724{ _Z3_MK_BIN_(a, b, Z3_mk_power); }
Z3_ast Z3_API Z3_mk_power(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 ^ arg2.

◆ pw [2/3]

expr pw ( expr const a,
int  b 
)
friend

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

1725{ return pw(a, a.ctx().num_val(b, a.get_sort())); }
friend expr pw(expr const &a, expr const &b)
Definition z3++.h:1724

◆ pw [3/3]

expr pw ( int  a,
expr const b 
)
friend

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

1726{ return pw(b.ctx().num_val(a, b.get_sort()), b); }

◆ range

expr range ( expr const lo,
expr const hi 
)
friend

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

4343 {
4345 Z3_ast r = Z3_mk_re_range(lo.ctx(), lo, hi);
4346 lo.check_error();
4347 return expr(lo.ctx(), r);
4348 }
Z3_ast Z3_API Z3_mk_re_range(Z3_context c, Z3_ast lo, Z3_ast hi)
Create the range regular expression over two sequences of length 1.

◆ rem [1/3]

expr rem ( expr const a,
expr const b 
)
friend

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

1744 {
1745 if (a.is_fpa() && b.is_fpa()) {
1747 } else {
1748 _Z3_MK_BIN_(a, b, Z3_mk_rem);
1749 }
1750 }
Z3_ast Z3_API Z3_mk_fpa_rem(Z3_context c, Z3_ast t1, Z3_ast t2)
Floating-point remainder.
Z3_ast Z3_API Z3_mk_rem(Z3_context c, Z3_ast arg1, Z3_ast arg2)
Create an AST node representing arg1 rem arg2.

◆ rem [2/3]

expr rem ( expr const a,
int  b 
)
friend

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

1751{ return rem(a, a.ctx().num_val(b, a.get_sort())); }
friend expr rem(expr const &a, expr const &b)
Definition z3++.h:1744

◆ rem [3/3]

expr rem ( int  a,
expr const b 
)
friend

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

1752{ return rem(b.ctx().num_val(a, b.get_sort()), b); }

◆ round_fpa_to_closest_integer

expr round_fpa_to_closest_integer ( expr const t)
friend

Round a floating-point term into its closest integer.

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

2169 {
2170 assert(t.is_fpa());
2171 Z3_ast r = Z3_mk_fpa_round_to_integral(t.ctx(), t.ctx().fpa_rounding_mode(), t);
2172 t.check_error();
2173 return expr(t.ctx(), r);
2174 }
Z3_ast Z3_API Z3_mk_fpa_round_to_integral(Z3_context c, Z3_ast rm, Z3_ast t)
Floating-point roundToIntegral. Rounds a floating-point number to the closest integer,...

◆ sbv_to_fpa

expr sbv_to_fpa ( expr const t,
sort  s 
)
friend

Conversion of a signed bit-vector term into a floating-point.

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

2148 {
2149 assert(t.is_bv());
2150 Z3_ast r = Z3_mk_fpa_to_fp_signed(t.ctx(), t.ctx().fpa_rounding_mode(), t, s);
2151 t.check_error();
2152 return expr(t.ctx(), r);
2153 }
Z3_ast Z3_API Z3_mk_fpa_to_fp_signed(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s)
Conversion of a 2's complement signed bit-vector term into a term of FloatingPoint sort.

◆ sqrt

expr sqrt ( expr const a,
expr const rm 
)
friend

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

2102 {
2103 check_context(a, rm);
2104 assert(a.is_fpa());
2105 Z3_ast r = Z3_mk_fpa_sqrt(a.ctx(), rm, a);
2106 a.check_error();
2107 return expr(a.ctx(), r);
2108 }
Z3_ast Z3_API Z3_mk_fpa_sqrt(Z3_context c, Z3_ast rm, Z3_ast t)
Floating-point square root.

◆ sum

expr sum ( expr_vector const args)
friend

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

2546 {
2547 assert(args.size() > 0);
2548 context& ctx = args[0u].ctx();
2549 array<Z3_ast> _args(args);
2550 Z3_ast r = Z3_mk_add(ctx, _args.size(), _args.ptr());
2551 ctx.check_error();
2552 return expr(ctx, r);
2553 }

◆ ubv_to_fpa

expr ubv_to_fpa ( expr const t,
sort  s 
)
friend

Conversion of an unsigned bit-vector term into a floating-point.

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

2155 {
2156 assert(t.is_bv());
2157 Z3_ast r = Z3_mk_fpa_to_fp_unsigned(t.ctx(), t.ctx().fpa_rounding_mode(), t, s);
2158 t.check_error();
2159 return expr(t.ctx(), r);
2160 }
Z3_ast Z3_API Z3_mk_fpa_to_fp_unsigned(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s)
Conversion of a 2's complement unsigned bit-vector term into a term of FloatingPoint sort.

◆ xnor

expr xnor ( expr const a,
expr const b 
)
friend

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

2037{ if (a.is_bool()) return !(a ^ b); check_context(a, b); Z3_ast r = Z3_mk_bvxnor(a.ctx(), a, b); a.check_error(); return expr(a.ctx(), r); }
Z3_ast Z3_API Z3_mk_bvxnor(Z3_context c, Z3_ast t1, Z3_ast t2)
Bitwise xnor.