ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
boolector_conv.h
Go to the documentation of this file.
1#ifndef _ESBMC_SOLVERS_BOOLECTOR_BOOLECTOR_CONV_H_
2#define _ESBMC_SOLVERS_BOOLECTOR_BOOLECTOR_CONV_H_
3
4#include <cstdio>
6#include <irep2/irep2.h>
8
9extern "C"
10{
11#include <boolector/boolector.h>
12}
13
14class btor_smt_ast : public solver_smt_ast<BoolectorNode *>
15{
16public:
17 using solver_smt_ast<BoolectorNode *>::solver_smt_ast;
18 ~btor_smt_ast() override = default;
19
20 void dump() const override;
21};
22
24 public array_iface,
25 public fp_convt
26{
27public:
29 ~boolector_convt() override;
30
31 void push_ctx() override;
32 void pop_ctx() override;
33 smt_resultt dec_solve() override;
34 smt_resultt dec_solve_assuming(const ast_vec &assumptions) override;
35 bool supports_assumptions() const override
36 {
37 return true;
38 }
39 const std::string solver_text() override;
40
41 void assert_ast(smt_astt a) override;
42
43 smt_astt mk_bvadd(smt_astt a, smt_astt b) override;
44 smt_astt mk_bvsub(smt_astt a, smt_astt b) override;
45 smt_astt mk_bvmul(smt_astt a, smt_astt b) override;
46 smt_astt mk_bvsmod(smt_astt a, smt_astt b) override;
47 smt_astt mk_bvumod(smt_astt a, smt_astt b) override;
48 smt_astt mk_bvsdiv(smt_astt a, smt_astt b) override;
49 smt_astt mk_bvudiv(smt_astt a, smt_astt b) override;
50 smt_astt mk_bvshl(smt_astt a, smt_astt b) override;
51 smt_astt mk_bvashr(smt_astt a, smt_astt b) override;
52 smt_astt mk_bvlshr(smt_astt a, smt_astt b) override;
53 smt_astt mk_bvneg(smt_astt a) override;
54 smt_astt mk_bvnot(smt_astt a) override;
55 smt_astt mk_bvxor(smt_astt a, smt_astt b) override;
56 smt_astt mk_bvor(smt_astt a, smt_astt b) override;
57 smt_astt mk_bvand(smt_astt a, smt_astt b) override;
58 smt_astt mk_implies(smt_astt a, smt_astt b) override;
59 smt_astt mk_xor(smt_astt a, smt_astt b) override;
60 smt_astt mk_or(smt_astt a, smt_astt b) override;
61 smt_astt mk_and(smt_astt a, smt_astt b) override;
62 smt_astt mk_not(smt_astt a) override;
63 smt_astt mk_bvult(smt_astt a, smt_astt b) override;
64 smt_astt mk_bvslt(smt_astt a, smt_astt b) override;
65 smt_astt mk_bvugt(smt_astt a, smt_astt b) override;
66 smt_astt mk_bvsgt(smt_astt a, smt_astt b) override;
67 smt_astt mk_bvule(smt_astt a, smt_astt b) override;
68 smt_astt mk_bvsle(smt_astt a, smt_astt b) override;
69 smt_astt mk_bvuge(smt_astt a, smt_astt b) override;
70 smt_astt mk_bvsge(smt_astt a, smt_astt b) override;
71 smt_astt mk_eq(smt_astt a, smt_astt b) override;
72 smt_astt mk_neq(smt_astt a, smt_astt b) override;
73 smt_astt mk_store(smt_astt a, smt_astt b, smt_astt c) override;
74 smt_astt mk_select(smt_astt a, smt_astt b) override;
75
76 smt_sortt mk_bool_sort() override;
77 smt_sortt mk_bv_sort(std::size_t width) override;
79 smt_sortt mk_fbv_sort(std::size_t width) override;
80 smt_sortt mk_bvfp_sort(std::size_t width, std::size_t swidth) override;
81 smt_sortt mk_bvfp_rm_sort() override;
82
83 smt_astt mk_smt_int(const BigInt &theint) override;
84 smt_astt mk_smt_real(const std::string &str) override;
85 smt_astt mk_smt_bv(const BigInt &theint, smt_sortt s) override;
86 smt_astt mk_smt_bool(bool val) override;
87 smt_astt mk_smt_symbol(const std::string &name, const smt_sort *s) override;
89 const std::string &name,
90 const std::vector<smt_astt> &args,
91 smt_sortt rangesort) override;
93 const std::string &name,
94 const smt_sort *s,
95 smt_sortt array_subtype) override;
96 smt_astt mk_extract(smt_astt a, unsigned int high, unsigned int low) override;
97 smt_astt mk_sign_ext(smt_astt a, unsigned int topwidth) override;
98 smt_astt mk_zero_ext(smt_astt a, unsigned int topwidth) override;
99 smt_astt mk_concat(smt_astt a, smt_astt b) override;
101
103 convert_array_of(smt_astt init_val, unsigned long domain_width) override;
104
105 tvt get_bool(smt_astt a) override;
106 BigInt get_bv(smt_astt a, bool is_signed) override;
107 expr2tc get_array_elem(smt_astt array, uint64_t index, const type2tc &subtype)
108 override;
109
110 smt_astt overflow_arith(const expr2tc &expr) override;
111
112 std::string dump_smt() override;
113 void print_model() override;
114
116 bool is_forall,
117 std::vector<smt_astt> lhs,
118 smt_astt rhs) override;
119
120 // Members
121 Btor *btor;
122
124
129 std::unordered_map<std::string, BoolectorNode *> uf_decls;
130};
131
132#endif /* _ESBMC_SOLVERS_BOOLECTOR_BOOLECTOR_CONV_H_ */
Definition bigint.hh:58
array_iface(bool _b, bool inf)
Definition smt_array.h:14
Definition toml.hpp:6607
smt_astt mk_bvudiv(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:186
smt_astt mk_store(smt_astt a, smt_astt b, smt_astt c) override
Definition boolector_conv.cpp:468
smt_astt mk_bvmul(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:134
smt_astt mk_bvsub(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:121
smt_astt mk_or(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:313
smt_astt mk_smt_real(const std::string &str) override
Create a real in a smt_ast.
Definition boolector_conv.cpp:501
smt_astt mk_bvxor(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:252
smt_astt mk_bvugt(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:368
smt_astt mk_and(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:324
smt_astt mk_extract(smt_astt a, unsigned int high, unsigned int low) override
Create an 'extract' func app.
Definition boolector_conv.cpp:615
smt_astt mk_bvule(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:394
void push_ctx() override
Push one context on the SMT assertion stack.
Definition boolector_conv.cpp:51
void pop_ctx() override
Pop one context on the SMT assertion stack.
Definition boolector_conv.cpp:57
smt_astt mk_xor(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:302
smt_sortt mk_bvfp_sort(std::size_t width, std::size_t swidth) override
Create a floating-point sort, using bitvectors.
Definition boolector_conv.cpp:882
smt_astt mk_quantifier(bool is_forall, std::vector< smt_astt > lhs, smt_astt rhs) override
Definition boolector_conv.cpp:897
smt_astt mk_not(smt_astt a) override
Definition boolector_conv.cpp:335
smt_sortt mk_bvfp_rm_sort() override
Create a floating-point rounding mode sort, using bitvectors.
Definition boolector_conv.cpp:891
smt_astt mk_smt_bv(const BigInt &theint, smt_sortt s) override
Create a bitvector.
Definition boolector_conv.cpp:507
bool supports_assumptions() const override
Definition boolector_conv.h:35
smt_astt mk_bvlshr(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:225
smt_resultt dec_solve_assuming(const ast_vec &assumptions) override
Solve with each boolean ast in assumptions held true for this query only.
Definition boolector_conv.cpp:81
void print_model() override
Method to print the SMT model.
Definition boolector_conv.cpp:849
smt_astt mk_bvadd(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:108
BigInt get_bv(smt_astt a, bool is_signed) override
Extract the assignment to a bitvector from the SMT solver's model.
Definition boolector_conv.cpp:692
smt_astt mk_ite(smt_astt cond, smt_astt t, smt_astt f) override
Create an ite operation.
Definition boolector_conv.cpp:652
smt_sortt mk_bool_sort() override
Create a bool sort.
Definition boolector_conv.cpp:854
smt_astt mk_concat(smt_astt a, smt_astt b) override
Concatenate two smt expressions.
Definition boolector_conv.cpp:639
smt_astt mk_bvuge(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:420
smt_astt mk_bvult(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:342
smt_astt overflow_arith(const expr2tc &expr) override
Detect integer arithmetic overflows.
Definition boolector_conv.cpp:739
std::string dump_smt() override
Method to dump the SMT formula.
Definition boolector_conv.cpp:812
smt_astt mk_bvumod(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:160
Btor * btor
Definition boolector_conv.h:121
smt_astt mk_bvnot(smt_astt a) override
Definition boolector_conv.cpp:245
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 boolector_conv.cpp:703
const std::string solver_text() override
Solver name fetcher.
Definition boolector_conv.cpp:96
smt_astt mk_bvor(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:265
tvt get_bool(smt_astt a) override
Extract the assignment to a boolean variable from the SMT solver's model.
Definition boolector_conv.cpp:666
boolector_convt(const namespacet &ns, const optionst &options)
Definition boolector_conv.cpp:25
smt_astt mk_bvsge(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:433
smt_astt convert_array_of(smt_astt init_val, unsigned long domain_width) override
Create an array with a single initializer.
Definition boolector_conv.cpp:799
smt_sortt mk_bv_sort(std::size_t width) override
Create a bv sort.
Definition boolector_conv.cpp:860
smt_astt mk_bvsdiv(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:173
smt_astt mk_bvand(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:278
smt_astt mk_zero_ext(smt_astt a, unsigned int topwidth) override
Identical to mk_sign_ext, but extends AST with zeros.
Definition boolector_conv.cpp:631
smt_astt mk_smt_bool(bool val) override
Create a boolean.
Definition boolector_conv.cpp:514
smt_astt mk_array_symbol(const std::string &name, const smt_sort *s, smt_sortt array_subtype) override
Definition boolector_conv.cpp:521
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 boolector_conv.cpp:623
smt_astt mk_smt_symbol(const std::string &name, const smt_sort *s) override
Definition boolector_conv.cpp:530
smt_sortt mk_fbv_sort(std::size_t width) override
Create a fixed-point sort.
Definition boolector_conv.cpp:866
smt_astt mk_select(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:483
void assert_ast(smt_astt a) override
Assert the truth of an ast.
Definition boolector_conv.cpp:103
symtabt symtable
Definition boolector_conv.h:123
smt_astt mk_bvashr(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:212
smt_astt mk_bvsmod(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:147
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 boolector_conv.cpp:569
std::unordered_map< std::string, BoolectorNode * > uf_decls
Uninterpreted-function declarations, keyed by name.
Definition boolector_conv.h:129
smt_astt mk_bvslt(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:355
smt_astt mk_neq(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:457
smt_sortt mk_array_sort(smt_sortt domain, smt_sortt range) override
Create an array sort.
Definition boolector_conv.cpp:872
smt_resultt dec_solve() override
Solve the formula given to the solver.
Definition boolector_conv.cpp:66
smt_astt mk_implies(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:291
smt_astt mk_bvshl(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:199
~boolector_convt() override
Definition boolector_conv.cpp:45
smt_astt mk_smt_int(const BigInt &theint) override
Create an integer smt_ast.
Definition boolector_conv.cpp:495
smt_astt mk_bvsgt(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:381
smt_astt mk_bvneg(smt_astt a) override
Definition boolector_conv.cpp:238
smt_astt mk_bvsle(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:407
smt_astt mk_eq(smt_astt a, smt_astt b) override
Definition boolector_conv.cpp:446
Definition boolector_conv.h:15
~btor_smt_ast() override=default
void dump() const override
Definition boolector_conv.cpp:843
fp_convt(smt_solver_baset *_ctx)
Definition fp_conv.cpp:26
Definition namespace.h:10
Definition options.h:11
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, BoolectorNode *_a, smt_sortt s)
Definition smt_ast.h:103
Definition threeval.h:10
pthread_cond_t cond
Definition cuda.h:50
Classes and definitions for non-stringy internal representation.
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
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
boost::multi_index_container< symtab_entryt, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< BOOST_MULTI_INDEX_MEMBER(symtab_entryt, std::string, val)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(symtab_entryt, unsigned int, level), std::greater< unsigned int > > > > symtabt
Definition smt_solver.h:1299
const smt_sort * smt_sortt
Definition smt_sort.h:37