Skip to content

cprover: state-encoding for uninterpreted functions and member/index lvalues#9069

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:strata/cprover-state-encoding
Open

cprover: state-encoding for uninterpreted functions and member/index lvalues#9069
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:strata/cprover-state-encoding

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

Leave mathematical-function (uninterpreted function) symbols unencoded as state variables, and follow member/index chains to the addressable base expression when state-encoding lvalues.

  • 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 tautschnig self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates state encoding to better handle uninterpreted (mathematical) function symbols and lvalue member/index chains, and adjusts SMT2 conversion behavior.

Changes:

  • Enable datatype support in the SMT2 state-encoding target.
  • Avoid state-encoding pure mathematical-function symbols; refine member/index handling to only use address-based evaluation when the base is addressable.
  • Avoid splitting struct-tag assignments when RHS is a computed full-struct value (function application / if-then-else).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/cprover/state_encoding_targets.h Enables SMT2 datatypes in the state-encoding converter.
src/cprover/state_encoding_targets.cpp Changes pointer-related size conversion to fall back when size_of_expr fails.
src/cprover/state_encoding.cpp Adjusts expression evaluation and struct assignment splitting to accommodate uninterpreted functions / computed structs.

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

Comment on lines 82 to +87
auto size_opt = size_of_expr(
to_pointer_type(to_binary_expr(expr).op1().type()).base_type(), ns);
CHECK_RETURN(size_opt.has_value());
convert_expr(*size_opt);
if(size_opt.has_value())
convert_expr(*size_opt);
else
convert_expr(from_integer(1, size_type()));
{
use_array_of_bool = true;
use_as_const = true;
use_datatypes = true;
Comment on lines +249 to +251
const exprt *base = &what.operands()[0];
while(base->id() == ID_member || base->id() == ID_index)
base = &base->operands()[0];
Comment thread src/cprover/state_encoding.cpp Outdated
Comment on lines +536 to +538
if(
lhs.type().id() == ID_struct_tag &&
rhs.id() != ID_function_application && rhs.id() != ID_if)
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.68%. Comparing base (321ba11) to head (6dcb7fe).

Files with missing lines Patch % Lines
src/cprover/state_encoding.cpp 62.50% 6 Missing ⚠️
src/cprover/state_encoding_targets.cpp 0.00% 3 Missing ⚠️
src/cprover/state_encoding_targets.h 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9069      +/-   ##
===========================================
- Coverage    80.68%   80.68%   -0.01%     
===========================================
  Files         1714     1714              
  Lines       189501   189515      +14     
  Branches        73       73              
===========================================
+ Hits        152902   152908       +6     
- Misses       36599    36607       +8     

☔ View full report in Codecov by Harness.
📢 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.

…lvalues

Leave mathematical-function (uninterpreted function) symbols unencoded as
state variables, and follow member/index chains to the addressable base
expression when state-encoding lvalues.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig force-pushed the strata/cprover-state-encoding branch from 78c4acf to 6dcb7fe Compare June 19, 2026 08:16
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.

2 participants