-
Notifications
You must be signed in to change notification settings - Fork 41
Introducing some structure for model method bodies #3571
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
Introducing some structure for model method bodies #3571
Conversation
restricted to ifs and intermediate variables
and spotlessing
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3571 +/- ##
=========================================
Coverage 47.21% 47.21%
Complexity 15834 15834
=========================================
Files 1675 1675
Lines 96307 96307
Branches 15413 15413
=========================================
+ Hits 45470 45472 +2
+ Misses 45658 45657 -1
+ Partials 5179 5178 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
My questions would also be:
Maybe we should add a |
Because thus jml model method bodies can remain purely logical expressions and their definition can be directly expanded into the sequent. That is a fundamental asset of model methods as they are implemented in KeY (like related constructs in other verification frameworks). Dealing with loops in particular would make this impossible. This was driven by trying to relax notation while keeping the verification-system power of the type definitions. How does the JavaDL-definition axiom or taclet for model methods look like in jmlparser?
I think actually, it does. In KeY, however, the expansion mechanism for non-model methods, is conservative and uses [] box-semantics to be on the safe side.
I would refrain from putting jml model methods into modalities, It's their power to define functions directly. I would be happy to intrdoduce ghost methods that can use any code. They do not even need to be pure. |
key.core/src/main/java/de/uka/ilkd/key/speclang/njml/Translator.java
Outdated
Show resolved
Hide resolved
8ff2ffe to
2b160d3
Compare
as otherwise namespaces would complain about double insertion.
08bb0c0 to
92806e4
Compare
|
The implementation renders the local variables into "let expressions" which are Is it bad that subst makes it to the surface here? Could also be easily avoided by expanding them during translation. ... On the other hand: It renders the user-defined structure into the logic. There are fully automatic (OSS-)taclets in place that expand the substitutions. |
No. Trust the sound rules in KeY. IMHO, it is strange that you do not use updates here instead of substitutions. |
Well observed. The reason behind this that updates operate only on global program variables whereas substitutions operate on logical variables which are not part of a global namespace. It would not be advisable to clutter the program varoable namespace with symbols needed for temporary local value assignment. |
|
The feature has been mentioned in the keydocs (although they are not very structured) The Boyer Moore example has been adapted to the new syntax capabilities. |
# Conflicts: # key.ui/examples/heap/BoyerMoore/BM(BM__bm((I)).JML normal_behavior operation contract.0.proof

Intended Change
This is a new feature request by users that wanted to use model methods.
The PR introduces method bodies that allow some statements. It is limited to
This is still rather limited but allows you to structure your code already quite a bit.
The restrictions are:
var(due to a restriction in the lexer/parser)The only thing that needs to be done is then to interpret these structures into a term.
My running example is the following which explains itself:
Plan
Type of pull request
Ensuring quality
Additional information and contact(s)
The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.