-
Notifications
You must be signed in to change notification settings - Fork 269
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
Adding large-step encoding for CHCs in CProver (no [required] changes to the solver) #8465
base: develop
Are you sure you want to change the base?
Conversation
yvizel
commented
Sep 22, 2024
- Each commit message has a non-empty body, explaining why the change was made.
- Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- White-space or formatting changes outside the feature-related changed lines are in commits of their own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of comments that each apply in several more places. More generally, however, it would be great to have comments. At bare minimum there should be high-level design comments in some place that explain how the various pieces fit together. Also, we need tests that demonstrate the new feature.
src/cprover/chc_db.cpp
Outdated
m_head_idx[func].insert(&r); | ||
|
||
std::vector<symbol_exprt> use; | ||
r.used_relations(*this,std::back_inserter(use)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest that used_relations
just return a std::vector<symbol_exprt>
(which is cheap with copy elision).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format
fixes are strictly required.- A bunch of suggestions below. Would be great to see them addressed, but we can do this in parallel with reviewing/working on the solver changes.
@@ -0,0 +1,9 @@ | |||
KNOWNBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applies to this one as well as all other KNOWNBUG
tests that you added: could you please add at the bottom:
--
Brief explanation as to what the bug is.
That is, add another --
and then an explanatory text.
chc_dbt::chc_sett chc_dbt::m_empty_set; | ||
std::unordered_set<exprt, irep_hash> chc_grapht::m_expr_empty_set; | ||
|
||
void horn_clauset::used_relations(chc_dbt &db, std::vector<symbol_exprt> & out) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to run clang-format
(or, rather, git-clang-format
) to ensure all use of whitespace is in line with the repository rules.
std::vector<symbol_exprt> use; | ||
r.used_relations(*this, use); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the signature of used_relations
such that this becomes std::vector<symbol_exprt> use = r.used_relations(*this);
. That is, return by value.
if (can_cast_expr<function_application_exprt>(expr)) | ||
{ | ||
const function_application_exprt & f = to_function_application_expr(expr); | ||
funcs.insert(f); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (can_cast_expr<function_application_exprt>(expr)) | |
{ | |
const function_application_exprt & f = to_function_application_expr(expr); | |
funcs.insert(f); | |
} | |
if (auto f = expr_try_dynamic_cast<function_application_exprt>(expr)) | |
{ | |
funcs.insert(*f); | |
} |
forall_exprt m_chc; | ||
|
||
public: | ||
horn_clauset(forall_exprt f) : m_chc(f) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Qualify this with explicit
@@ -277,6 +277,7 @@ int cprover_parse_optionst::main() | |||
|
|||
solver_options.trace = cmdline.isset("trace"); | |||
solver_options.verbose = cmdline.isset("verbose"); | |||
solver_options.large_step = cmdline.isset("large-step"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a help
entry (in cprover_parse_optionst::help
at the bottom of this file).
#include <iostream> | ||
#include <fstream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are either of those really required?
cutpoint_grapht::~cutpoint_grapht() { | ||
m_edges.clear(); | ||
m_cps.clear(); | ||
m_insts.clear(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the explicit deconstruction required?
container_encoding_targett container2; | ||
std::vector<horn_clauset> all2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are those good for?
if (!can_cast_expr<forall_exprt>(clause)) | ||
{ | ||
throw incorrect_goto_program_exceptiont("Not forall"); | ||
} | ||
const forall_exprt& forall = to_forall_expr(clause); | ||
db.add_clause(forall); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rewrite this using expr_try_dynamic_cast
instead of can_cast_expr
.
Also, once done with the changes, please rebase/combine all commits into a single one. (Or perhaps one for the source changes and one for the tests.) |