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

Generate easier POs for non-trivial diverges clauses #3430

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Drodt
Copy link
Member

@Drodt Drodt commented Feb 22, 2024

Related Issue

This pull request fixes #29.

Intended Change

A non-trivial (i.e, neither true nor false) diverges clause results in two contracts to be verified. Previously, there was one where the value of the clause (here div) is not true and the method therefore terminates, and one where the method does not terminate.

E.g., the two POs would look like pre & !div -> <m()>post and pre -> [m()] post. This resulted in more complex proofs, because the case where div is false had to be considered as well for the second PO.

This PR changes the POs to

  1. pre & !div -> <m()>post and
  2. pre & div -> [m()] post

Hence, we have a proper cut.

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (behaviour should not change or only minimally change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • There are changes to the (Java) code
  • There are changes to the taclet rule base
  • There are changes to the deployment/CI infrastructure (gradle, github, ...)
  • Other:

Ensuring quality

  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I made sure that new/changed end-user features are well documented (https://github.com/KeYProject/key-docs).
  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: ...
  • I have checked that runtime performance has not deteriorated.

Additional information and contact(s)

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.77%. Comparing base (1fb0c10) to head (7472e4a).
Report is 114 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3430   +/-   ##
=========================================
  Coverage     37.77%   37.77%           
+ Complexity    17031    17030    -1     
=========================================
  Files          2076     2076           
  Lines        126950   126953    +3     
  Branches      21381    21381           
=========================================
+ Hits          47952    47954    +2     
  Misses        73092    73092           
- Partials       5906     5907    +1     

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

@@ -926,10 +926,13 @@ public ImmutableSet<Contract> createFunctionalOperationContracts(String name, IP
result = result.add(contract);
} else {
// create two contracts for each diamond and box modality
Map<LocationVariable, Term> boxPres = new LinkedHashMap<>(pres);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a copy of clauses.requires? Previously that map was used when constructing the FunctionalOperationContract.

@wadoon wadoon added this to the v2.14.0 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-trivial diverges clauses make you prove things twice.
3 participants