-
Notifications
You must be signed in to change notification settings - Fork 60
Variants #1622
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
Variants #1622
Conversation
6f86486
to
88cb570
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
All in all, I think that most of this is OK, but the way variant assertion are inserted need to be improved:
-
For loops, it should really rely on the WTO, and therefore I think that this should really be done by the backend. In particular, I'm not sure that we should store sets of variants to check at "continue" blocks. Instead, when entering a WTO component whose head has a variant, create a new handler for the head of the loop that will check the variant decrease, and make all the jumps from inside the component point to this new handler.
-
For recursive calls in program code, I would really prefer not translating operands to terms. This would be yet another translation from places to XXX, and I'm afraid of subtle semantic differences betwen the versions. Instead, please use a method similar to the one for loop I propose above: create a new sub-handler for recursive calls, and make it check that the variant decreases before performing the actual recursive call.
7f93023
to
3d9bc4e
Compare
63f7676
to
b54e227
Compare
(I'm in the process of reviewing this.) |
7203c3b
to
df20c42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great work. I have a few comments here and there, and two other concerns:
-
the definition of well foundedness is broken (see my comment)
-
it would be great to demonstrate this new features on some of the already existing examples : PA and union find, of course, and perhaps binary search or other examples. This should not be so difficult, all the needed ingredients are already there.
df20c42
to
6424814
Compare
6424814
to
77b5f24
Compare
The variant in `PreContract` stays here: I interpreted this type as a "creusot" contract, so it can contain a variant.
77b5f24
to
afba3ba
Compare
afba3ba
to
5b09fa7
Compare
If you feel this is ready to merge, then please press the button ;) |
This allow variants in various places:
Together with a rework of the
WellFounded
trait, to allow variants on custom types.Fixes #561, #754.