ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
yices_conv.h
Go to the documentation of this file.
1#ifndef _ESBMC_SOLVERS_YICES_YICES_CONV_H_
2#define _ESBMC_SOLVERS_YICES_YICES_CONV_H_
3
5#include <yices.h>
6
7class yices_smt_ast : public solver_smt_ast<term_t>
8{
9public:
10 yices_smt_ast(smt_solver_baset *ctx, term_t _t, const smt_sort *_s)
11 : solver_smt_ast<term_t>(ctx, _t, _s)
12 {
13 // Detect term errors
14 if (a == NULL_TERM)
15 {
16 yices_print_error(stderr);
17 log_error("Error creating yices term");
18 abort();
19 }
20 }
21 ~yices_smt_ast() override = default;
22
23 // Provide assign semantics for arrays. While yices will swallow array
24 // equalities, it appears to silently not honor them? From observation.
25 void assign(smt_solver_baset *ctx, smt_astt sym) const override;
26
27 smt_astt project(smt_solver_baset *ctx, unsigned int elem) const override;
28
32 unsigned int idx,
33 const expr2tc &idx_expr = expr2tc()) const override;
34
35 void dump() const override;
36
37 std::string symname;
38};
39
41 public array_iface,
42 public tuple_iface,
43 public fp_convt
44{
45public:
47 ~yices_convt() override;
48
49 smt_resultt dec_solve() override;
50 smt_resultt dec_solve_assuming(const ast_vec &assumptions) override;
51 bool supports_assumptions() const override
52 {
53 return true;
54 }
55 const std::string solver_text() override;
56
57 void assert_ast(smt_astt a) override;
58
59 smt_astt mk_add(smt_astt a, smt_astt b) override;
60 smt_astt mk_bvadd(smt_astt a, smt_astt b) override;
61 smt_astt mk_sub(smt_astt a, smt_astt b) override;
62 smt_astt mk_bvsub(smt_astt a, smt_astt b) override;
63 smt_astt mk_mul(smt_astt a, smt_astt b) override;
64 smt_astt mk_bvmul(smt_astt a, smt_astt b) override;
65 smt_astt mk_mod(smt_astt a, smt_astt b) override;
66 smt_astt mk_bvsmod(smt_astt a, smt_astt b) override;
67 smt_astt mk_bvumod(smt_astt a, smt_astt b) override;
68 smt_astt mk_div(smt_astt a, smt_astt b) override;
69 smt_astt mk_bvsdiv(smt_astt a, smt_astt b) override;
70 smt_astt mk_bvudiv(smt_astt a, smt_astt b) override;
71 smt_astt mk_shl(smt_astt a, smt_astt b) override;
72 smt_astt mk_bvshl(smt_astt a, smt_astt b) override;
73 smt_astt mk_bvashr(smt_astt a, smt_astt b) override;
74 smt_astt mk_bvlshr(smt_astt a, smt_astt b) override;
75 smt_astt mk_neg(smt_astt a) override;
76 smt_astt mk_bvneg(smt_astt a) override;
77 smt_astt mk_bvnot(smt_astt a) override;
78 smt_astt mk_bvxor(smt_astt a, smt_astt b) override;
79 smt_astt mk_bvor(smt_astt a, smt_astt b) override;
80 smt_astt mk_bvand(smt_astt a, smt_astt b) override;
81 smt_astt mk_implies(smt_astt a, smt_astt b) override;
82 smt_astt mk_xor(smt_astt a, smt_astt b) override;
83 smt_astt mk_or(smt_astt a, smt_astt b) override;
84 smt_astt mk_and(smt_astt a, smt_astt b) override;
85 smt_astt mk_not(smt_astt a) override;
86 smt_astt mk_lt(smt_astt a, smt_astt b) override;
87 smt_astt mk_bvult(smt_astt a, smt_astt b) override;
88 smt_astt mk_bvslt(smt_astt a, smt_astt b) override;
89 smt_astt mk_gt(smt_astt a, smt_astt b) override;
90 smt_astt mk_bvugt(smt_astt a, smt_astt b) override;
91 smt_astt mk_bvsgt(smt_astt a, smt_astt b) override;
92 smt_astt mk_le(smt_astt a, smt_astt b) override;
93 smt_astt mk_bvule(smt_astt a, smt_astt b) override;
94 smt_astt mk_bvsle(smt_astt a, smt_astt b) override;
95 smt_astt mk_ge(smt_astt a, smt_astt b) override;
96 smt_astt mk_bvuge(smt_astt a, smt_astt b) override;
97 smt_astt mk_bvsge(smt_astt a, smt_astt b) override;
98 smt_astt mk_eq(smt_astt a, smt_astt b) override;
99 smt_astt mk_neq(smt_astt a, smt_astt b) override;
100 smt_astt mk_store(smt_astt a, smt_astt b, smt_astt c) override;
101 smt_astt mk_select(smt_astt a, smt_astt b) override;
102 smt_astt mk_isint(smt_astt a) override;
103
104 smt_sortt mk_bool_sort() override;
105 smt_sortt mk_real_sort() override;
106 smt_sortt mk_int_sort() override;
107 smt_sortt mk_bv_sort(std::size_t width) override;
109 smt_sortt mk_fbv_sort(std::size_t width) override;
110 smt_sortt mk_bvfp_sort(std::size_t width, std::size_t swidth) override;
111 smt_sortt mk_bvfp_rm_sort() override;
112
113 smt_astt mk_smt_int(const BigInt &theint) override;
114 smt_astt mk_smt_real(const std::string &str) override;
115 smt_astt mk_smt_bv(const BigInt &theint, smt_sortt s) override;
116 smt_astt mk_smt_bool(bool val) override;
117 smt_astt mk_smt_symbol(const std::string &name, const smt_sort *s) override;
119 const std::string &name,
120 const std::vector<smt_astt> &args,
121 smt_sortt rangesort) override;
123 const std::string &name,
124 const smt_sort *s,
125 smt_sortt array_subtype) override;
126 smt_astt mk_extract(smt_astt a, unsigned int high, unsigned int low) override;
127 smt_astt mk_sign_ext(smt_astt a, unsigned int topwidth) override;
128 smt_astt mk_zero_ext(smt_astt a, unsigned int topwidth) override;
129 smt_astt mk_concat(smt_astt a, smt_astt b) override;
131
132 void push_ctx() override;
133 void pop_ctx() override;
134
136 convert_array_of(smt_astt init_val, unsigned long domain_width) override;
137
138 smt_sortt mk_struct_sort(const type2tc &type) override;
139 smt_astt tuple_create(const expr2tc &structdef) override;
140 smt_astt tuple_fresh(smt_sortt s, std::string name = "") override;
142 const type2tc &array_type,
143 smt_astt *inputargs,
144 bool const_array,
145 smt_sortt domain) override;
146 smt_astt tuple_array_of(const expr2tc &init_value, unsigned long domain_width)
147 override;
148 smt_astt mk_tuple_symbol(const std::string &name, smt_sortt s) override;
149 smt_astt mk_tuple_array_symbol(const expr2tc &expr) override;
150 expr2tc tuple_get(const expr2tc &expr) override;
151 expr2tc tuple_get(const type2tc &type, smt_astt a) override;
152
155 uint64_t index,
156 const type2tc &subtype) override;
157
158 tvt get_bool(smt_astt a) override;
159 BigInt get_bv(smt_astt a, bool is_signed) override;
160 expr2tc get_array_elem(smt_astt array, uint64_t index, const type2tc &subtype)
161 override;
162
163 void print_model() override;
164
165 context_t *yices_ctx;
166};
167
168#endif /* _ESBMC_SOLVERS_YICES_YICES_CONV_H_ */
Definition bigint.hh:58
array_iface(bool _b, bool inf)
Definition smt_array.h:14
Definition toml.hpp:6607
fp_convt(smt_solver_baset *_ctx)
Definition fp_conv.cpp:26
Definition namespace.h:10
Definition options.h:11
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
Definition smt_sort.h:40
solver_smt_ast(smt_solver_baset *ctx, term_t _a, smt_sortt s)
Definition smt_ast.h:103
solver_ast_type a
Definition smt_ast.h:109
Definition smt_tuple.h:27
Definition threeval.h:10
Definition toml.hpp:1531
void print_model() override
Method to print the SMT model.
Definition yices_conv.cpp:1152
smt_astt mk_bvsmod(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:225
smt_astt mk_bvule(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:515
smt_astt mk_tuple_array_symbol(const expr2tc &expr) override
Like mk_tuple_symbol, but for arrays.
Definition yices_conv.cpp:1063
smt_astt tuple_create(const expr2tc &structdef) override
Create a new tuple from a struct definition.
Definition yices_conv.cpp:964
smt_sortt mk_bvfp_rm_sort() override
Create a floating-point rounding mode sort, using bitvectors.
Definition yices_conv.cpp:1199
smt_astt mk_neg(smt_astt a) override
Definition yices_conv.cpp:333
smt_astt mk_bvlshr(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:321
smt_astt mk_mul(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:188
smt_astt mk_isint(smt_astt a) override
Definition yices_conv.cpp:649
smt_astt mk_smt_int(const BigInt &theint) override
Create an integer smt_ast.
Definition yices_conv.cpp:657
smt_astt mk_zero_ext(smt_astt a, unsigned int topwidth) override
Identical to mk_sign_ext, but extends AST with zeros.
Definition yices_conv.cpp:786
smt_astt mk_bvxor(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:351
smt_astt mk_bvadd(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:152
smt_astt mk_bvshl(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:297
smt_astt mk_array_symbol(const std::string &name, const smt_sort *s, smt_sortt array_subtype) override
Definition yices_conv.cpp:756
smt_astt mk_bvmul(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:200
smt_astt mk_bvneg(smt_astt a) override
Definition yices_conv.cpp:339
smt_astt mk_div(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:249
smt_astt mk_tuple_symbol(const std::string &name, smt_sortt s) override
Convert a symbol to a tuple_smt_ast.
Definition yices_conv.cpp:1058
smt_astt mk_bvnot(smt_astt a) override
Definition yices_conv.cpp:345
smt_sortt mk_bv_sort(std::size_t width) override
Create a bv sort.
Definition yices_conv.cpp:1172
smt_astt mk_implies(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:387
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 yices_conv.cpp:778
smt_sortt mk_bool_sort() override
Create a bool sort.
Definition yices_conv.cpp:1157
smt_astt mk_smt_bool(bool val) override
Create a boolean.
Definition yices_conv.cpp:695
smt_astt convert_array_of(smt_astt init_val, unsigned long domain_width) override
Create an array with a single initializer.
Definition yices_conv.cpp:820
smt_astt mk_bvor(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:363
smt_astt mk_bvult(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:445
expr2tc tuple_get_array_elem(smt_astt array, uint64_t index, const type2tc &subtype) override
Definition yices_conv.cpp:886
smt_astt mk_store(smt_astt a, smt_astt b, smt_astt c) override
Definition yices_conv.cpp:622
smt_astt mk_gt(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:469
smt_astt mk_not(smt_astt a) override
Definition yices_conv.cpp:427
smt_astt mk_mod(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:212
void assert_ast(smt_astt a) override
Assert the truth of an ast.
Definition yices_conv.cpp:134
smt_sortt mk_bvfp_sort(std::size_t width, std::size_t swidth) override
Create a floating-point sort, using bitvectors.
Definition yices_conv.cpp:1193
smt_astt mk_bvuge(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:550
const std::string solver_text() override
Solver name fetcher.
Definition yices_conv.cpp:127
smt_astt mk_bvsdiv(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:261
smt_astt mk_concat(smt_astt a, smt_astt b) override
Concatenate two smt expressions.
Definition yices_conv.cpp:794
smt_astt mk_bvsub(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:176
smt_astt mk_smt_real(const std::string &str) override
Create a real in a smt_ast.
Definition yices_conv.cpp:670
bool supports_assumptions() const override
Definition yices_conv.h:51
smt_astt mk_bvsgt(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:492
smt_astt mk_bvand(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:375
context_t * yices_ctx
Definition yices_conv.h:165
smt_astt mk_shl(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:285
BigInt get_bv(smt_astt a, bool is_signed) override
Extract the assignment to a bitvector from the SMT solver's model.
Definition yices_conv.cpp:838
smt_astt mk_bvsge(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:562
smt_astt mk_extract(smt_astt a, unsigned int high, unsigned int low) override
Create an 'extract' func app.
Definition yices_conv.cpp:770
smt_astt mk_eq(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:574
smt_astt mk_and(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:417
smt_resultt dec_solve_assuming(const ast_vec &assumptions) override
Solve with each boolean ast in assumptions held true for this query only.
Definition yices_conv.cpp:110
smt_astt mk_lt(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:434
smt_astt mk_bvashr(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:309
smt_resultt dec_solve() override
Solve the formula given to the solver.
Definition yices_conv.cpp:96
smt_astt mk_smt_bv(const BigInt &theint, smt_sortt s) override
Create a bitvector.
Definition yices_conv.cpp:677
smt_astt tuple_array_create(const type2tc &array_type, smt_astt *inputargs, bool const_array, smt_sortt domain) override
Definition yices_conv.cpp:988
smt_astt tuple_fresh(smt_sortt s, std::string name="") override
Create a fresh tuple, with freely valued fields.
Definition yices_conv.cpp:981
smt_sortt mk_real_sort() override
Create a real sort.
Definition yices_conv.cpp:1162
smt_astt mk_ite(smt_astt cond, smt_astt t, smt_astt f) override
Create an ite operation.
Definition yices_conv.cpp:806
smt_astt mk_select(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:639
smt_astt mk_bvumod(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:237
smt_astt mk_bvsle(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:527
smt_astt mk_or(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:407
~yices_convt() override
Definition yices_conv.cpp:64
smt_astt mk_sub(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:164
smt_sortt mk_int_sort() override
Create a int sort.
Definition yices_conv.cpp:1167
void push_ctx() override
Push one context on the SMT assertion stack.
Definition yices_conv.cpp:69
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 yices_conv.cpp:863
smt_astt mk_bvudiv(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:273
smt_astt mk_bvslt(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:457
smt_sortt mk_array_sort(smt_sortt domain, smt_sortt range) override
Create an array sort.
Definition yices_conv.cpp:1183
smt_astt mk_le(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:504
smt_astt mk_bvugt(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:480
tvt get_bool(smt_astt a) override
Extract the assignment to a boolean variable from the SMT solver's model.
Definition yices_conv.cpp:825
expr2tc tuple_get(const expr2tc &expr) override
Extract the assignment to a tuple-typed symbol from the SMT solvers model.
Definition yices_conv.cpp:1111
smt_astt mk_smt_symbol(const std::string &name, const smt_sort *s) override
Definition yices_conv.cpp:704
smt_astt mk_add(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:140
smt_astt mk_xor(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:397
smt_astt tuple_array_of(const expr2tc &init_value, unsigned long domain_width) override
Create a potentially /large/ array of tuples.
Definition yices_conv.cpp:1025
smt_sortt mk_struct_sort(const type2tc &type) override
Create a sort representing a struct.
Definition yices_conv.cpp:938
yices_convt(const namespacet &ns, const optionst &options)
Definition yices_conv.cpp:45
void pop_ctx() override
Pop one context on the SMT assertion stack.
Definition yices_conv.cpp:82
smt_sortt mk_fbv_sort(std::size_t width) override
Create a fixed-point sort.
Definition yices_conv.cpp:1177
smt_astt mk_neq(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:598
smt_astt mk_ge(smt_astt a, smt_astt b) override
Definition yices_conv.cpp:539
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 yices_conv.cpp:721
void dump() const override
Definition yices_conv.cpp:1204
void assign(smt_solver_baset *ctx, smt_astt sym) const override
Abstractly produce an assign.
Definition yices_conv.cpp:894
std::string symname
Definition yices_conv.h:37
smt_astt update(smt_solver_baset *ctx, smt_astt value, unsigned int idx, const expr2tc &idx_expr=expr2tc()) const override
Abstractly produce an "update", i.e., an array 'with' or tuple 'with'.
Definition yices_conv.cpp:920
yices_smt_ast(smt_solver_baset *ctx, term_t _t, const smt_sort *_s)
Definition yices_conv.h:10
~yices_smt_ast() override=default
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 yices_conv.cpp:912
pthread_cond_t cond
Definition cuda.h:50
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
#define log_error(fmt,...)
Definition message.h:83
Definition range.py:1
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
FILE * stderr
void abort(void)
Definition stdlib.c:77