Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Printing JML for quantifiers with multiple variables #119

Open
samysweb opened this issue May 24, 2024 · 1 comment
Open

Printing JML for quantifiers with multiple variables #119

samysweb opened this issue May 24, 2024 · 1 comment

Comments

@samysweb
Copy link

This is either a parsing bug in KeY or a printing bug in JML Parser.
Given the file

public class PolishFlagSort {
    /*@
      @ public normal_behavior
      @    ensures (\forall int I, J; 0 <= I && I < J && J < ar.length; ar[I] <= ar[J]);
      @*/
    public static void sort ( int[] ar ) {
	return;
    }
}

reprinting via JML Parser produces:

public class PolishFlagSort {
    /*@  normal_behavior
        ensures (\forall int I, int J;0 <= I && I < J && J < ar.length; ar[I] <= ar[J]);
        */
    public static void sort(int[] ar) {
        return;
    }
}

Note the , int J vs , J.

This is not blocking our project so no hurry, but I wanted to persist this observation.
From a superficial glance this does not seem to be fixable quickly.

@WolframPfeifer
Copy link

I looked it up in the grammar (https://github.com/KeYProject/key/blob/51f368c9ee0da2d2e053933de19e202ef7f36af4/key.core/src/main/antlr4/JmlParser.g4#L387): The JML parser of KeY allows the declaration of multiple variables with a single quantifier. However, these variables all must be of the same type, so the printed contract is not valid KeY-JML.

Btw., I noticed that the visibility modifier public is missing from the printed contract ...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants