Skip to content
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

[CONTRACTS] Refactor quantified symbol detection for loop contracts #8299

Merged
merged 1 commit into from
May 23, 2024

Conversation

qinheping
Copy link
Collaborator

Resolves: #8298

In loop contracts, we replace quantified variables with a tmp variable and add the tmp variable to the symbol map. However, the detection of the quantified variables is not complete now---it does not include equal expression.
This PR add equal expressions

  • 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

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.32%. Comparing base (c320360) to head (a7383d9).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8299      +/-   ##
===========================================
- Coverage    78.35%   78.32%   -0.04%     
===========================================
  Files         1721     1721              
  Lines       188278   188338      +60     
  Branches     18460    18452       -8     
===========================================
- Hits        147523   147511      -12     
- Misses       40755    40827      +72     

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

Copy link
Collaborator

@remi-delmas-3000 remi-delmas-3000 left a comment

Choose a reason for hiding this comment

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

We don't seem to have tests for all the possible operators matched in add_quantified_variable (ternary op?)

@@ -376,7 +376,9 @@ void add_quantified_variable(
auto &unary_expression = to_unary_expr(expression);
add_quantified_variable(symbol_table, unary_expression.op(), mode);
}
if(expression.id() == ID_notequal || expression.id() == ID_implies)
if(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to transform forall and exists nodes without having to explicitly match on other irep_ids ? Maybe using exprt::visit_post or exprt::visit_pre ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rewrote the whole function with visit_pre.

@qinheping qinheping force-pushed the issues/8298 branch 2 times, most recently from 657328c to 08d8491 Compare May 22, 2024 20:37
@qinheping qinheping changed the title [CONTRACTS] Add equal expressions in quantified symbol detection for loop contracts [CONTRACTS] Refactor quantified symbol detection for loop contracts May 23, 2024
@qinheping qinheping merged commit 9a0d532 into diffblue:develop May 23, 2024
38 of 40 checks passed
@qinheping qinheping deleted the issues/8298 branch May 23, 2024 05:08
@feliperodri feliperodri added the Code Contracts Function and loop contracts label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-high Code Contracts Function and loop contracts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CBMC 5.95.1 crashes on proof of simple array equality function
3 participants