Skip to content

rename post_process to finish_eager_conversion #6551

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 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions src/solvers/flattening/arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class arrayst:public equalityt
message_handlert &message_handler,
bool get_array_constraints = false);

void post_process() override
void finish_eager_conversion() override
{
post_process_arrays();
SUB::post_process();
finish_eager_conversion_arrays();
SUB::finish_eager_conversion();
if(get_array_constraints)
display_array_constraint_count();
}
Expand All @@ -55,7 +55,7 @@ class arrayst:public equalityt
messaget log;
message_handlert &message_handler;

virtual void post_process_arrays()
virtual void finish_eager_conversion_arrays()
{
add_array_constraints();
}
Expand Down
10 changes: 5 additions & 5 deletions src/solvers/flattening/boolbv.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class boolbvt:public arrayst
bv_cache.clear();
}

void post_process() override
void finish_eager_conversion() override
{
post_process_quantifiers();
functions.post_process();
SUB::post_process();
finish_eager_conversion_quantifiers();
functions.finish_eager_conversion();
SUB::finish_eager_conversion();
}

enum class unbounded_arrayt { U_NONE, U_ALL, U_AUTO };
Expand Down Expand Up @@ -266,7 +266,7 @@ class boolbvt:public arrayst
typedef std::list<quantifiert> quantifier_listt;
quantifier_listt quantifier_list;

void post_process_quantifiers();
void finish_eager_conversion_quantifiers();

typedef std::vector<std::size_t> offset_mapt;
offset_mapt build_offset_map(const struct_typet &src);
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/boolbv_quantifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ literalt boolbvt::convert_quantifier(const quantifier_exprt &src)
return quantifier_list.back().l;
}

void boolbvt::post_process_quantifiers()
void boolbvt::finish_eager_conversion_quantifiers()
{
if(quantifier_list.empty())
return;
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/flattening/bv_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,10 +976,10 @@ void bv_pointerst::do_postponed(
UNREACHABLE;
}

void bv_pointerst::post_process()
void bv_pointerst::finish_eager_conversion()
{
// post-processing arrays may yield further objects, do this first
SUB::post_process();
SUB::finish_eager_conversion();

for(postponed_listt::const_iterator
it=postponed_list.begin();
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/flattening/bv_pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class bv_pointerst:public boolbvt
message_handlert &message_handler,
bool get_array_constraints = false);

void post_process() override;
void finish_eager_conversion() override;

std::size_t boolbv_width(const typet &type) const override
{
Expand Down
8 changes: 6 additions & 2 deletions src/solvers/flattening/equality.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class equalityt:public prop_conv_solvert

virtual literalt equality(const exprt &e1, const exprt &e2);

void post_process() override
using SUB = prop_conv_solvert;

void finish_eager_conversion() override
{
add_equality_constraints();
prop_conv_solvert::post_process();
SUB::finish_eager_conversion();
typemap.clear(); // if called incrementally, don't do it twice
}

Expand All @@ -50,6 +52,8 @@ class equalityt:public prop_conv_solvert
typemapt typemap;

virtual literalt equality2(const exprt &e1, const exprt &e2);

// an eager conversion of the transitivity constraints
virtual void add_equality_constraints();
virtual void add_equality_constraints(const typestructt &typestruct);
};
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/lowering/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class functionst

void record(const function_application_exprt &function_application);

virtual void post_process()
virtual void finish_eager_conversion()
{
add_function_constraints();
}
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/prop/prop_conv_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void prop_conv_solvert::ignoring(const exprt &expr)
log.warning() << "warning: ignoring " << expr.pretty() << messaget::eom;
}

void prop_conv_solvert::post_process()
void prop_conv_solvert::finish_eager_conversion()
{
}

Expand All @@ -441,7 +441,7 @@ decision_proceduret::resultt prop_conv_solvert::dec_solve()
const auto post_process_start = std::chrono::steady_clock::now();

log.statistics() << "Post-processing" << messaget::eom;
post_process();
finish_eager_conversion();
post_processing_done = true;

const auto post_process_stop = std::chrono::steady_clock::now();
Expand Down
5 changes: 3 additions & 2 deletions src/solvers/prop/prop_conv_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class prop_conv_solvert : public conflict_providert,

virtual ~prop_conv_solvert() = default;

// non-iterative eager conversion
virtual void finish_eager_conversion();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious: this used to be protected. Why is making it public the right thing to do?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I am thinking about the use of this for an eager conversion, say to Dimacs, or something else.
Right now, we trigger the "finishing" by calling dec_solve, which then doesn't actually do solving, but returns an error, which we then ignore. It would be clearer to feed the constraints to the decision procedure, and then call finish_eager_conversion, and then be done.


// overloading from decision_proceduret
decision_proceduret::resultt dec_solve() override;
void print_assignment(std::ostream &out) const override;
Expand Down Expand Up @@ -99,8 +102,6 @@ class prop_conv_solvert : public conflict_providert,
void enable_hardness_collection() override;

protected:
virtual void post_process();

bool post_processing_done = false;

/// Get a _boolean_ value from the model if the formula is satisfiable.
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/refinement/bv_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class bv_refinementt:public bv_pointerst
protected:

// Refine array
void post_process_arrays() override;
void finish_eager_conversion_arrays() override;

// Refine arithmetic
bvt convert_mult(const mult_exprt &expr) override;
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/refinement/bv_refinement_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ decision_proceduret::resultt bv_refinementt::dec_solve()
{
// do the usual post-processing
log.status() << "BV-Refinement: post-processing" << messaget::eom;
post_process();
finish_eager_conversion();

log.debug() << "Solving with " << prop.solver_text() << messaget::eom;

Expand Down
2 changes: 1 addition & 1 deletion src/solvers/refinement/refine_arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Author: Daniel Kroening, [email protected]
#include <solvers/sat/satcheck.h>

/// generate array constraints
void bv_refinementt::post_process_arrays()
void bv_refinementt::finish_eager_conversion_arrays()
{
collect_indices();
// at this point all indices should in the index set
Expand Down