1#ifndef _ESBMC_SOLVERS_Z3_Z3_CONV_H
2#define _ESBMC_SOLVERS_Z3_Z3_CONV_H
18 const expr2tc &idx_expr)
const override;
22 void dump()
const override;
55 mk_tuple_update(
const z3::expr &t,
unsigned i,
const z3::expr &new_val);
166 const std::string &name,
171 const std::string &name,
172 const std::vector<smt_astt> &args,
189 const type2tc &subtype)
override;
209 unsigned int major, minor, build, revision;
210 Z3_get_version(&major, &minor, &build, &revision);
211 std::stringstream ss;
212 ss <<
"Z3 v" << major <<
"." << minor <<
"." << build;
220 std::vector<smt_astt> lhs,
224 void print_smt_formulae(std::ostream &dest);
226 parse_rational_bigint(Z3_string str,
BigInt &numerator,
BigInt &denominator);
array_iface(bool _b, bool inf)
Definition smt_array.h:14
fp_convt(smt_solver_baset *_ctx)
Definition fp_conv.cpp:26
Definition ieee_float.h:75
rounding_modet
Definition ieee_float.h:78
Definition namespace.h:10
The base SMT-conversion class/interface.
Definition smt_solver.h:170
smt_solver_baset(const namespacet &_ns, const optionst &_options)
Primary constructor.
Definition smt_solver.cpp:78
const optionst & options
Definition smt_solver.h:1130
const namespacet & ns
A namespace containing all the types in the program.
Definition smt_solver.h:1128
std::vector< smt_astt > ast_vec
Shorthand for a vector of smt_ast's.
Definition smt_solver.h:173
solver_smt_ast(smt_solver_baset *ctx, z3::expr _a, smt_sortt s)
Definition smt_ast.h:103
Definition smt_tuple.h:27
smt_astt mk_smt_fpbv_eq(smt_astt lhs, smt_astt rhs) override
Convert an ieee equality.
Definition z3_conv.cpp:1836
~z3_convt() override
Definition z3_conv.cpp:76
z3::expr mk_tuple_update(const z3::expr &t, unsigned i, const z3::expr &new_val)
Definition z3_conv.cpp:133
smt_astt mk_bvashr(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:392
smt_sortt mk_int_sort() override
Create a int sort.
Definition z3_conv.cpp:1640
smt_astt mk_shl(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:366
smt_astt tuple_array_create(const type2tc &array_type, smt_astt *input_args, bool const_array, const smt_sort *domain) override
Definition z3_conv.cpp:1173
smt_astt mk_bvugt(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:653
smt_astt mk_bvsgt(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:668
z3_convt(const namespacet &ns, const optionst &options)
Definition z3_conv.cpp:48
smt_astt mk_bvsdiv(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:336
smt_sortt mk_array_sort(smt_sortt domain, smt_sortt range) override
Create an array sort.
Definition z3_conv.cpp:1657
smt_astt mk_smt_symbol(const std::string &name, const smt_sort *s) override
Definition z3_conv.cpp:1026
smt_astt mk_smt_fpbv_gte(smt_astt lhs, smt_astt rhs) override
Convert an ieee greater than or equal.
Definition z3_conv.cpp:1569
const std::string solver_text() override
Solver name fetcher.
Definition z3_conv.h:207
smt_astt mk_store(smt_astt a, smt_astt b, smt_astt c) override
Definition z3_conv.cpp:790
smt_astt mk_bvor(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:487
void pop_ctx() override
Pop one context on the SMT assertion stack.
Definition z3_conv.cpp:88
smt_astt mk_smt_fpbv_sqrt(smt_astt rd, smt_astt rm) override
Convert the ieee arithmetic square-root (sqrt).
Definition z3_conv.cpp:1768
smt_astt mk_bvsmod(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:291
z3::context z3_ctx
Definition z3_conv.h:231
smt_astt mk_bvumod(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:306
smt_sortt mk_bvfp_rm_sort() override
Create a floating-point rounding mode sort, using bitvectors.
Definition z3_conv.cpp:1625
BigInt get_bv(smt_astt a, bool is_signed) override
Extract the assignment to a bitvector from the SMT solver's model.
Definition z3_conv.cpp:1342
smt_astt mk_smt_int(const BigInt &theint) override
Create an integer smt_ast.
Definition z3_conv.cpp:900
smt_astt mk_div(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:321
smt_astt mk_bvadd(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:201
std::string dump_smt() override
Method to dump the SMT formula.
Definition z3_conv.cpp:1513
smt_astt mk_int2real(smt_astt a) override
Definition z3_conv.cpp:823
smt_astt mk_bvnot(smt_astt a) override
Definition z3_conv.cpp:434
smt_astt mk_smt_typecast_sbv_to_fpbv(smt_astt from, smt_sortt to, smt_astt rm) override
Typecast to a floating point.
Definition z3_conv.cpp:1747
smt_astt mk_smt_fpbv(const ieee_floatt &thereal) override
Create a floating point bitvector.
Definition z3_conv.cpp:940
expr2tc tuple_get(const expr2tc &expr) override
Extract the assignment to a tuple-typed symbol from the SMT solvers model.
Definition z3_conv.cpp:1277
smt_astt mk_or(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:569
smt_astt mk_array_symbol(const std::string &name, const smt_sort *s, smt_sortt array_subtype) override
Definition z3_conv.cpp:1018
smt_astt mk_bvmul(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:241
smt_sortt mk_fpbv_rm_sort() override
Create a sort representing a floating-point rounding mode.
Definition z3_conv.cpp:1611
expr2tc tuple_get_array_elem(smt_astt array, uint64_t index, const type2tc &subtype) override
Definition z3_conv.cpp:1478
z3::solver solver
Definition z3_conv.h:232
smt_astt convert_array_of(smt_astt init_val, unsigned long domain_width) override
Create an array with a single initializer.
Definition z3_conv.cpp:1161
smt_astt mk_tuple_array_symbol(const expr2tc &expr) override
Like mk_tuple_symbol, but for arrays.
Definition z3_conv.cpp:1224
smt_astt mk_smt_fpbv_is_positive(smt_astt op) override
Convert an ieee is_pos operation.
Definition z3_conv.cpp:1891
smt_astt mk_mod(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:276
smt_astt mk_smt_fpbv_nan(bool sgn, unsigned ew, unsigned sw) override
Create a NaN floating point bitvector.
Definition z3_conv.cpp:965
smt_astt mk_bvsge(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:758
ieee_floatt get_fpbv(smt_astt a) override
Extract the assignment to a floating-point from the SMT solvers model.
Definition z3_conv.cpp:1425
smt_astt mk_smt_fpbv_gt(smt_astt lhs, smt_astt rhs) override
Convert an ieee greater than.
Definition z3_conv.cpp:1545
smt_astt mk_ite(smt_astt cond, smt_astt t, smt_astt f) override
Create an ite operation.
Definition z3_conv.cpp:887
smt_astt mk_bvshl(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:377
smt_astt mk_bvsle(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:713
smt_sortt mk_bvfp_sort(std::size_t ew, std::size_t sw) override
Create a floating-point sort, using bitvectors.
Definition z3_conv.cpp:1619
smt_astt mk_bvlshr(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:407
smt_astt mk_mul(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:231
smt_astt mk_real2int(smt_astt a) override
Definition z3_conv.cpp:814
smt_astt mk_xor(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:556
smt_astt mk_sign_ext(smt_astt a, unsigned int topwidth) override
Given a signed, upwards cast, extends the sign of the given AST to the desired length.
Definition z3_conv.cpp:855
smt_sortt mk_bool_sort() override
Create a bool sort.
Definition z3_conv.cpp:1630
smt_astt mk_bvule(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:698
smt_astt mk_concat(smt_astt a, smt_astt b) override
Concatenate two smt expressions.
Definition z3_conv.cpp:872
smt_astt mk_smt_nearbyint_from_float(smt_astt from, smt_astt rm) override
Calculate the nearby int from a floating point, considering the rounding mode.
Definition z3_conv.cpp:1759
smt_astt mk_neq(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:781
smt_astt mk_bvsub(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:221
smt_astt mk_smt_fpbv_inf(bool sgn, unsigned ew, unsigned sw) override
Create a (+/-)inf floating point bitvector.
Definition z3_conv.cpp:979
void print_model() override
Method to print the SMT model.
Definition z3_conv.cpp:1598
smt_astt mk_and(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:578
smt_resultt dec_solve_assuming(const ast_vec &assumptions) override
Solve with each boolean ast in assumptions held true for this query only.
Definition z3_conv.cpp:110
smt_sortt mk_real_sort() override
Create a real sort.
Definition z3_conv.cpp:1635
smt_astt mk_extract(smt_astt a, unsigned int high, unsigned int low) override
Create an 'extract' func app.
Definition z3_conv.cpp:841
smt_astt mk_smt_fpbv_lt(smt_astt lhs, smt_astt rhs) override
Convert an ieee less than.
Definition z3_conv.cpp:1557
void push_ctx() override
Push one context on the SMT assertion stack.
Definition z3_conv.cpp:82
smt_astt mk_lt(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:593
smt_astt mk_select(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:804
smt_astt mk_smt_typecast_from_fpbv_to_sbv(smt_astt from, std::size_t width) override
Typecast from a floating point.
Definition z3_conv.cpp:1705
smt_astt mk_smt_fpbv_is_normal(smt_astt op) override
Convert an ieee is_normal operation.
Definition z3_conv.cpp:1865
smt_astt mk_neg(smt_astt a) override
Definition z3_conv.cpp:422
smt_astt mk_isint(smt_astt a) override
Definition z3_conv.cpp:832
smt_astt mk_smt_typecast_from_fpbv_to_fpbv(smt_astt from, smt_sortt to, smt_astt rm) override
Typecast from a floating point.
Definition z3_conv.cpp:1718
smt_astt mk_bvslt(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:623
smt_astt mk_smt_fpbv_is_nan(smt_astt op) override
Convert an ieee is_nan operation.
Definition z3_conv.cpp:1848
smt_astt mk_bvudiv(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:351
smt_astt mk_smt_fpbv_fma(smt_astt v1, smt_astt v2, smt_astt v3, smt_astt rm) override
Convert the ieee arithmetic fused-multiply add (fma): round((v1 * v2) + v3).
Definition z3_conv.cpp:1777
smt_sortt mk_struct_sort(const type2tc &type) override
Create a sort representing a struct.
Definition z3_conv.cpp:1054
smt_astt tuple_create(const expr2tc &structdef) override
Create a new tuple from a struct definition.
Definition z3_conv.cpp:1129
smt_astt mk_smt_fpbv_is_inf(smt_astt op) override
Convert an ieee is_inf operation.
Definition z3_conv.cpp:1856
smt_astt mk_bvneg(smt_astt a) override
Definition z3_conv.cpp:428
smt_resultt dec_solve() override
Solve the formula given to the solver.
Definition z3_conv.cpp:94
smt_astt mk_quantifier(bool is_forall, std::vector< smt_astt > lhs, smt_astt rhs) override
Definition z3_conv.cpp:1909
smt_astt mk_bvult(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:608
smt_astt mk_bvand(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:517
smt_astt mk_smt_fpbv_abs(smt_astt op) override
Convert an ieee abs operation.
Definition z3_conv.cpp:1900
z3::expr mk_tuple_select(const z3::expr &t, unsigned i)
Definition z3_conv.cpp:169
smt_astt mk_add(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:191
smt_astt mk_bvuge(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:743
smt_astt mk_from_fp_to_bv(smt_astt op) override
Convert FP to BV.
Definition z3_conv.cpp:1679
tvt get_bool(smt_astt a) override
Extract the assignment to a boolean variable from the SMT solver's model.
Definition z3_conv.cpp:1320
smt_astt mk_zero_ext(smt_astt a, unsigned int topwidth) override
Identical to mk_sign_ext, but extends AST with zeros.
Definition z3_conv.cpp:865
smt_astt mk_smt_fpbv_add(smt_astt lhs, smt_astt rhs, smt_astt rm) override
Convert a ieee addition.
Definition z3_conv.cpp:1788
smt_astt mk_smt_fpbv_sub(smt_astt lhs, smt_astt rhs, smt_astt rm) override
Convert a ieee subtraction.
Definition z3_conv.cpp:1798
smt_astt mk_smt_fpbv_mul(smt_astt lhs, smt_astt rhs, smt_astt rm) override
Convert a ieee multiplication.
Definition z3_conv.cpp:1808
smt_astt mk_implies(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:547
smt_astt mk_bvxor(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:457
smt_astt mk_smt_fpbv_is_negative(smt_astt op) override
Convert an ieee is_neg operation.
Definition z3_conv.cpp:1882
smt_astt mk_smt_fpbv_lte(smt_astt lhs, smt_astt rhs) override
Convert an ieee less than or equal.
Definition z3_conv.cpp:1581
smt_astt mk_not(smt_astt a) override
Definition z3_conv.cpp:587
bool supports_assumptions() const override
Definition z3_conv.h:41
smt_astt mk_smt_bv(const BigInt &theint, smt_sortt s) override
Create a bitvector.
Definition z3_conv.cpp:922
smt_astt mk_ge(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:728
smt_astt mk_smt_fpbv_neg(smt_astt op) override
Convert an ieee negation operation.
Definition z3_conv.cpp:1593
smt_astt mk_gt(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:638
smt_sortt mk_bv_sort(std::size_t width) override
Create a bv sort.
Definition z3_conv.cpp:1645
smt_astt mk_smt_fpbv_is_zero(smt_astt op) override
Convert an ieee is_zero operation.
Definition z3_conv.cpp:1874
smt_astt mk_smt_uninterpreted_function(const std::string &name, const std::vector< smt_astt > &args, smt_sortt rangesort) override
Apply an uninterpreted function.
Definition z3_conv.cpp:1032
smt_astt mk_eq(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:773
smt_astt tuple_array_of(const expr2tc &init, unsigned long domain_width) override
Create a potentially /large/ array of tuples.
Definition z3_conv.cpp:1231
smt_sortt mk_fbv_sort(std::size_t width) override
Create a fixed-point sort.
Definition z3_conv.cpp:1651
smt_astt mk_smt_fpbv_rem(smt_astt lhs, smt_astt rhs) override
Convert the ieee remainder (SMT-LIB fp.rem, C's remainder()).
Definition z3_conv.cpp:1828
smt_astt mk_from_bv_to_fp(smt_astt op, smt_sortt to) override
Convert BV to FP.
Definition z3_conv.cpp:1667
smt_astt mk_le(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:683
smt_astt overflow_arith(const expr2tc &expr) override
Detect integer arithmetic overflows.
Definition z3_conv.cpp:251
smt_astt mk_smt_fpbv_rm(ieee_floatt::rounding_modet rm) override
Create a rounding mode to be used by floating point cast and arith ops.
Definition z3_conv.cpp:988
bool get_rational(smt_astt a, BigInt &numerator, BigInt &denominator) override
Extract the assignment to a rational/real value from the SMT solvers model.
Definition z3_conv.cpp:1361
smt_astt mk_smt_typecast_ubv_to_fpbv(smt_astt from, smt_sortt to, smt_astt rm) override
Typecast to a floating point.
Definition z3_conv.cpp:1734
smt_astt mk_smt_typecast_from_fpbv_to_ubv(smt_astt from, std::size_t width) override
Typecast from a floating point.
Definition z3_conv.cpp:1691
smt_sortt mk_fpbv_sort(const unsigned ew, const unsigned sw) override
Create a sort representing a floating-point number.
Definition z3_conv.cpp:1603
virtual void output_smt()
Definition z3_conv.cpp:1493
smt_astt mk_smt_bool(bool val) override
Create a boolean.
Definition z3_conv.cpp:1013
smt_astt tuple_fresh(const smt_sort *s, std::string name="") override
Definition z3_conv.cpp:1154
smt_astt mk_sub(smt_astt a, smt_astt b) override
Definition z3_conv.cpp:211
expr2tc get_array_elem(smt_astt array, uint64_t index, const type2tc &subtype) override
Extract an element from the model of an array, at an explicit index.
Definition z3_conv.cpp:1463
smt_astt mk_smt_fpbv_div(smt_astt lhs, smt_astt rhs, smt_astt rm) override
Convert the ieee division.
Definition z3_conv.cpp:1818
smt_astt mk_tuple_symbol(const std::string &name, smt_sortt s) override
Convert a symbol to a tuple_smt_ast.
Definition z3_conv.cpp:1219
smt_astt mk_smt_real(const std::string &str) override
Create a real in a smt_ast.
Definition z3_conv.cpp:916
void assert_ast(smt_astt a) override
Assert the truth of an ast.
Definition z3_conv.cpp:126
~z3_smt_ast() override=default
smt_astt update(smt_solver_baset *ctx, smt_astt value, unsigned int idx, const expr2tc &idx_expr) const override
Abstractly produce an "update", i.e., an array 'with' or tuple 'with'.
Definition z3_conv.cpp:1097
void dump() const override
Definition z3_conv.cpp:1486
smt_astt project(smt_solver_baset *ctx, unsigned int elem) const override
Project a member from a structure, or an field-array from a struct array.
Definition z3_conv.cpp:1114
pthread_cond_t cond
Definition cuda.h:50
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
const smt_ast * smt_astt
Definition smt_ast.h:30
smt_resultt
Result of a call to dec_solve.
Definition smt_result.h:7
const smt_sort * smt_sortt
Definition smt_sort.h:37