Skip to content

Refactor string refinement constructors #1300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Aug 31, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
22b4885
Remove usage of static in the header file
Aug 25, 2017
848f2a5
Constraint gen cosmetics
Aug 25, 2017
3217fe3
constraint_generator message is a member
Aug 25, 2017
c51e35e
Use C++11 initialization for constraint generator members
Aug 25, 2017
cf950ab
Use vector instead of list for constraint_generator data
Aug 25, 2017
8043a0d
Hide index_symbols and boolean_symbols in constraint generator
Aug 25, 2017
16a0a34
constraint generator const namespace
Aug 25, 2017
51d897a
Better string_refinement constructor Act 1
Aug 26, 2017
9146575
Better string_refinement constructor Act II
Aug 26, 2017
a00b2db
String refinement - remove unused public methods, fix comments
Aug 26, 2017
30fe11b
Better string_constraint_generator constructor
Aug 26, 2017
99c815e
Make string_constraint_generatort::fresh_symbol non-static
Aug 26, 2017
abe4046
Better bv_refinement constructor
Aug 26, 2017
792a70d
Hide bv_refinement members, add override specifier
Aug 26, 2017
07f6b39
Remove unnecessary typedef
Aug 26, 2017
50173d6
Make some string_constraint_generator methods static
Aug 26, 2017
aa85392
Make more generator methods private
Aug 26, 2017
5368c8c
Private get_created_strings
Aug 26, 2017
a440da7
Group generator's member variables
Aug 26, 2017
01c6767
Rename axioms to m_axioms
Aug 26, 2017
e5c45a5
Prefix all generator member variables with "m_"
Aug 26, 2017
1282d03
Update unit tests with new constructors
Aug 29, 2017
4087187
Don't pass language_uit::uit as a pointer
Aug 29, 2017
83a29dc
Fix linter errors
Aug 29, 2017
107704a
Fix is_in_conflict with conflict override
Aug 29, 2017
fd59d47
Preprocess constexpr
Aug 29, 2017
acaad4f
Remove dead bv_refinementt::set_to
Aug 30, 2017
04fae6d
Correct comment
Aug 30, 2017
7fd2bfa
Use_counter_example assignable via constructor
Aug 30, 2017
22d699c
Move constexpr ifdef into a util header
Aug 30, 2017
8da7c30
Constraint generator doxygen
Aug 30, 2017
0838f61
Fix function declaration slicing
Aug 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/cbmc/cbmc_solvers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,14 @@ std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_string_refinement()
info.string_non_empty=options.get_bool_option("string-non-empty");
info.trace=options.get_bool_option("trace");
info.string_printable=options.get_bool_option("string-printable");

auto string_refinement=util_make_unique<string_refinementt>(info);

if(options.get_option("max-node-refinement")!="")
string_refinement->max_node_refinement=
if(options.get_bool_option("max-node-refinement"))
info.max_node_refinement=
options.get_unsigned_int_option("max-node-refinement");

string_refinement->do_array_refinement=
options.get_bool_option("refine-arrays");
string_refinement->do_arithmetic_refinement=
options.get_bool_option("refine-arithmetic");
info.refine_arrays=options.get_bool_option("refine-arrays");
info.refine_arithmetic=options.get_bool_option("refine-arithmetic");

return util_make_unique<solvert>(
std::move(string_refinement), std::move(prop));
util_make_unique<string_refinementt>(info), std::move(prop));
}

std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_smt1(
Expand Down
3 changes: 3 additions & 0 deletions src/solvers/refinement/string_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ string_refinementt::string_refinementt(const infot &info, bool):
this->set_ui(ui);
generator.max_string_length=info.string_max_length;
generator.force_printable_characters=info.string_printable;
this->max_node_refinement=info.max_node_refinement;
this->do_array_refinement=info.refine_arrays;
this->do_arithmetic_refinement=info.refine_arithmetic;
}

string_refinementt::string_refinementt(const infot &info):
Expand Down
23 changes: 13 additions & 10 deletions src/solvers/refinement/string_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Author: Alberto Griggio, [email protected]

#define MAX_NB_REFINEMENT 100

class string_refinementt: public bv_refinementt
class string_refinementt final: public bv_refinementt
{
public:
/// string_refinementt constructor arguments
Expand All @@ -41,19 +41,21 @@ class string_refinementt: public bv_refinementt
size_t string_max_length=std::numeric_limits<size_t>::max();
/// Make non deterministic character arrays have at least one character
bool string_non_empty=false;
// Should we concretize strings when the solver finished
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doxy?

bool trace=false;
/// Make non-deterministic characters printable
bool string_printable=false;
unsigned max_node_refinement=5;
bool refine_arrays=false;
bool refine_arithmetic=false;
};

explicit string_refinementt(const infot &);

void set_mode();

// Should we use counter examples at each iteration?
bool use_counter_example;

// Should we concretize strings when the solver finished
const bool do_concretizing;
const bool use_counter_example=false;

virtual std::string decision_procedure_text() const override
{
Expand All @@ -65,17 +67,18 @@ class string_refinementt: public bv_refinementt
exprt get(const exprt &expr) const override;

protected:
typedef std::set<exprt> expr_sett;
typedef std::list<exprt> exprt_listt;

decision_proceduret::resultt dec_solve() override;

bvt convert_bool_bv(const exprt &boole, const exprt &orig);

private:
const bool do_concretizing;
// Base class
typedef bv_refinementt supert;

typedef std::set<exprt> expr_sett;
typedef std::list<exprt> exprt_listt;

string_refinementt(const infot &, bool);
bvt convert_bool_bv(const exprt &boole, const exprt &orig);

unsigned initial_loop_bound;

Expand Down