Skip to content

Adding large-step encoding for CHCs in CProver (no [required] changes to the solver)#8465

Open
yvizel wants to merge 1 commit into
diffblue:developfrom
yvizel:develop
Open

Adding large-step encoding for CHCs in CProver (no [required] changes to the solver)#8465
yvizel wants to merge 1 commit into
diffblue:developfrom
yvizel:develop

Conversation

@yvizel
Copy link
Copy Markdown

@yvizel 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.

Copy link
Copy Markdown
Collaborator

@tautschnig tautschnig left a 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.

Comment thread src/cprover/cprover_parse_options.h Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/cutpoint_graph.h Outdated
Comment thread src/cprover/cutpoint_graph.h Outdated
Comment thread src/cprover/cutpoint_graph.h Outdated
@qinheping qinheping self-assigned this Oct 28, 2024
@yvizel yvizel requested a review from tautschnig October 29, 2024 12:01
Copy link
Copy Markdown
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

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

  1. clang-format fixes are strictly required.
  2. 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
Copy link
Copy Markdown
Collaborator

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.

Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.cpp Outdated
Comment thread src/cprover/chc_db.h Outdated
forall_exprt m_chc;

public:
horn_clauset(forall_exprt f) : m_chc(f) {}
Copy link
Copy Markdown
Collaborator

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");
Copy link
Copy Markdown
Collaborator

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).

Comment thread src/cprover/cutpoint_graph.cpp Outdated
Comment on lines +8 to +9
#include <iostream>
#include <fstream>
Copy link
Copy Markdown
Collaborator

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?

Comment thread src/cprover/cutpoint_graph.cpp Outdated
Comment on lines +11 to +15
cutpoint_grapht::~cutpoint_grapht() {
m_edges.clear();
m_cps.clear();
m_insts.clear();
}
Copy link
Copy Markdown
Collaborator

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?

Comment on lines +1280 to +1281
container_encoding_targett container2;
std::vector<horn_clauset> all2;
Copy link
Copy Markdown
Collaborator

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?

Comment thread src/cprover/state_encoding.cpp Outdated
Comment on lines +1243 to +1248
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);
Copy link
Copy Markdown
Collaborator

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.

@tautschnig
Copy link
Copy Markdown
Collaborator

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.)

@tautschnig tautschnig assigned yvizel and unassigned tautschnig and qinheping Jan 8, 2025
Copilot AI review requested due to automatic review settings March 12, 2026 13:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 300 out of 541 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.24%. Comparing base (59d2211) to head (f731f13).
⚠️ Report is 94 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8465      +/-   ##
===========================================
- Coverage    80.41%   80.24%   -0.17%     
===========================================
  Files         1703     1707       +4     
  Lines       188398   188797     +399     
  Branches        73       73              
===========================================
  Hits        151502   151502              
- Misses       36896    37295     +399     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yvizel yvizel force-pushed the develop branch 2 times, most recently from cd2b757 to 0d6cdac Compare March 24, 2026 15:48
@yvizel yvizel requested review from a team and martin-cs as code owners March 24, 2026 15:48
Introduce a resolution-based large-step encoding for Constrained Horn
Clauses (CHCs) in CProver. The encoding is opt-in via a new
`--large-step` command-line flag and does not require any changes to
the underlying solver.

New components added under src/cprover/:
- chc_db: data structures for storing and indexing CHCs
- chc_large_step: the large-step transformation built on top of chc_db
- chc_wto: weak topological ordering of CHC predicates
- cutpoint_graph: cutpoint graph used to drive the large-step encoding

Hooks the new option through cprover_parse_options and extends
state_encoding to emit the transformed clauses when the flag is set.

Adds regression tests under regression/cprover/large_step/ covering
arrays, pointers, structs, loops, function calls, and trace generation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants