Adding large-step encoding for CHCs in CProver (no [required] changes to the solver)#8465
Adding large-step encoding for CHCs in CProver (no [required] changes to the solver)#8465yvizel wants to merge 22 commits intodiffblue:developfrom
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.
tautschnig
left a comment
There was a problem hiding this comment.
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.
I'd suggest that used_relations just return a std::vector<symbol_exprt> (which is cheap with copy elision).
tautschnig
left a comment
There was a problem hiding this comment.
clang-formatfixes 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.
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.
src/cprover/chc_db.cpp
Outdated
| 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.
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.
src/cprover/chc_db.cpp
Outdated
| std::vector<symbol_exprt> use; | ||
| r.used_relations(*this, use); |
There was a problem hiding this comment.
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.
| 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); | |
| } |
src/cprover/chc_db.h
Outdated
| forall_exprt m_chc; | ||
|
|
||
| public: | ||
| horn_clauset(forall_exprt f) : m_chc(f) {} |
There was a problem hiding this comment.
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.
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.
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.
Why is the explicit deconstruction required?
| container_encoding_targett container2; | ||
| std::vector<horn_clauset> all2; |
There was a problem hiding this comment.
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.
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.) |