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

Assignable free #3188

Merged
merged 12 commits into from
Jul 17, 2023
Merged

Assignable free #3188

merged 12 commits into from
Jul 17, 2023

Conversation

flo2702
Copy link
Member

@flo2702 flo2702 commented Jun 28, 2023

This branch implements assignable_free clauses, which akin to ensures_free allow you to specify frame conditions that the caller can assume but the callee does not have to prove. See #3185.

assignable_free clauses are implemented for functional method contracts, functional block/loop contracts, and loop invariants.

Semantics

Consider the following example.

/*@ public normal_behavior
  @ ensures field == 21; */
void foo() {
  field = 21;
  bar();
}

/*@ public normal_behavior
  @ ensures true; 
  @ assignable \nothing;
  @ assignable_free field; */
void bar() {
  field = 42;
}

Both contracts are provable: The proof obligation for bar() must show that only field is modified, but then when bar() is called from foo(), foo() assumes that bar() modifies \nothing.

In general, the caller assumes that the callee only modifies the locations mentioned in its assignable clause(s), while the callee must prove that it only modifies the locations in the union of its assignable and assignable_free clauses.

@flo2702 flo2702 added Feature New feature or request JML (Semantics) labels Jun 28, 2023
@flo2702 flo2702 added this to the v2.12.0 milestone Jun 28, 2023
@github-actions
Copy link

github-actions bot commented Jun 28, 2023

Thank you for your contribution.

The test artifacts are available on Artiweb.
The newest artifact is here.

@flo2702 flo2702 marked this pull request as ready for review July 7, 2023 16:25
@flo2702 flo2702 requested a review from mattulbrich July 7, 2023 16:27
@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Merging #3188 (91abedd) into main (c482269) will increase coverage by 0.01%.
The diff coverage is 45.81%.

@@             Coverage Diff              @@
##               main    #3188      +/-   ##
============================================
+ Coverage     37.59%   37.61%   +0.01%     
- Complexity    16684    16709      +25     
============================================
  Files          2043     2043              
  Lines        125713   125902     +189     
  Branches      21106    21138      +32     
============================================
+ Hits          47257    47353      +96     
- Misses        72693    72770      +77     
- Partials       5763     5779      +16     
Impacted Files Coverage Δ
...ilkd/key/proof/init/FunctionalBlockContractPO.java 0.00% <0.00%> (ø)
.../ilkd/key/proof/init/FunctionalLoopContractPO.java 0.00% <0.00%> (ø)
...e/uka/ilkd/key/rule/AbstractLoopInvariantRule.java 5.11% <0.00%> (-0.25%) ⬇️
...de/uka/ilkd/key/rule/LoopContractInternalRule.java 9.47% <0.00%> (-0.21%) ⬇️
...va/de/uka/ilkd/key/speclang/AuxiliaryContract.java 45.73% <ø> (ø)
...ava/de/uka/ilkd/key/speclang/LoopContractImpl.java 0.00% <0.00%> (ø)
...lkd/key/speclang/dl/translation/DLSpecFactory.java 0.00% <ø> (ø)
...va/de/uka/ilkd/key/speclang/BlockContractImpl.java 28.88% <29.41%> (-2.07%) ⬇️
.../key/proof/init/FunctionalOperationContractPO.java 54.76% <30.00%> (-3.23%) ⬇️
.../key/speclang/FunctionalOperationContractImpl.java 42.54% <36.36%> (-0.04%) ⬇️
... and 14 more

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@flo2702 flo2702 self-assigned this Jul 10, 2023
key.core/src/main/antlr4/JmlLexer.g4 Outdated Show resolved Hide resolved
@mattulbrich
Copy link
Member

Rather a large addition to the code. Thanks for your efforts.

@flo2702 flo2702 enabled auto-merge July 17, 2023 10:59
@flo2702 flo2702 added this pull request to the merge queue Jul 17, 2023
Merged via the queue into KeYProject:main with commit 54191be Jul 17, 2023
16 checks passed
@flo2702 flo2702 deleted the assignableFree branch July 17, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request JML (Semantics)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants