-
Notifications
You must be signed in to change notification settings - Fork 17
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
[RFC] Add polymorphism of smt v3 in smt v2.6 #53
Conversation
If I understand correctly, this is a compatible extension of smtlib v2.6, correct ?
Finally, note that I recently added error messages to smtlib, though it seems I didn't correctly set up testing to fail on syntax change, I'll fix that in master (and then you'll have the fun of writing the error messages for the new cases (and potentially fixing some of the already existing ones)). |
Actually, the test works fine (just run |
I haven't checked if the SMTLIB V3 use the same choices than @OcamlPro-Coquera and others. All the proposition of extension choosed the In fact I would propose to go full v3 even if things are not yet settled and very incomplete, we just need to have the understanding that it is completely experimental. So:
Doing in this way will avoid one gigantic branch, allows to test part of v3 and makes a playground for the smtlib v3 proposal. I can do the simple first part, add |
Hi, |
@bobot would the psmt2 format work for you (until smtlib3 is released) ? |
It should work. But I must admit I don't know what is the difference with the current PR, except adding a specific version psmt. @OCamlPro-Coquera is there a difference? Do you have time to check with your benchmarks? There is also a corresponding why3 branch which adds |
If everyone can be happy with it, I think the best thing to do would be to add a new version of smtlib2 that contains the required extensions for polymorphism, probably called |
It should work with me, I just don't know what are the next steps and who does them. |
I'll start on that, and ping you once you can try it out. |
So, I just pushed on the repo a branch From now on, I'd suggest you do the following:
And then we should be good to go, :) |
Thank you for the fixes and the |
Great ! (Though just to be clear,rather than setting the target of your PR to the |
ece580b
to
a418973
Compare
Ok I fixed the misunderstanding by resetting |
a418973
to
e05bf1a
Compare
@Gbury I think that all the remaining points are done. FWIW:
|
What is the version of |
The latest release ( |
@ACoquereau There is a difference between smtv3 and psmt2 at least when trying the benchmark: In
In smtv3 and what is implemented would be:
The smtv3 is more regular since |
f1e1a58
to
0fc6b50
Compare
I have a compilation error with |
I've just posted on the issue to describe how and why dolmen generates dune files. |
I'll take a look, ^^ |
I know, however, it seems to be by design of menhir (see https://gitlab.inria.fr/fpottier/menhir/-/issues/14 for more information) |
0fc6b50
to
00e0629
Compare
Okay, so lsp actually broke the API compatibility between |
I'm not sure the polymorphic notation we introduced back then (for veriT) needs to be retained. Pretty sure that smt3 notation will be adopted. |
Indeed For the Why3 MR: https://gitlab.inria.fr/why3/why3/-/merge_requests/112 . @Gbury the MR also updates for the new menhir version, and The trigger with |
Can you send me the problematic file ? |
Ok, so the problem you encounter with "as" is the following: there is a So, basically, according to a strict interpretation of the smtlib standard, |
Ok, I will try that. But in the long run, we could have other attributes that express something else than terms, so |
I'm not quite sure what you'd want, so let me resume how attributes are defined by smtlib2 and handled by dolmen. In smtlib2, attributes have the form For typing, the typechecker does try and type all attributes that are attached to each term (the "try" here means that by default an error in parsing an attribute will only result in a warning and not an error). Since there are close to no attributes defined in the tff typechecker, the typing of an attribute (and its optional payload), will almost always then be routed to the typing builtin function. That allows for each language to define its own typing of attributes. In the case of smtlib2, you can see the attributes defined there : Lines 129 to 142 in dfbd7ff
The first two cases define the typing of Lines 83 to 90 in dfbd7ff
And finally, we have the following case which enables the typechecker to parse s-expressions as terms: Lines 144 to 151 in dfbd7ff
As such, parsing attributes works for all attributes (that's pretty much the only solution), and typing of these is very easily extensible and adaptable to each language. However, note that currently, attributes are meant to be non-crucial information attached to terms, or said differently, the presence or absence of an attribute should not change whether a term type-checks; attributes are used as meta-data and/or hints for the consumer, which is why the current use of attributes are for triggers and naming things for later model output. information that is required to succesfuly type or prevent the typing of terms should not be in attributes but as normal nodes of the AST. This is the case for So now that the usage of attributes in dolmen is a bit clearer, we can talk about how to handle uses of |
Basically, I'd say smtlib2 (and extension's authors) should decide whether attribute payloads are terms or s-expressions (or both, given an adequate syntax rule to distinguish the two cases), and stop trying to say different things depending on the situation. |
I agree fully with your last comment. And that's why I think it would be simpler if dolmen could parse the |
It would be a solution, but that's not really possible with menhir as far as I know, ^^ (plus it would be a hack in the sens that other attributes could not really do the same, except if the mechanism was somehow extensible at runtime, which would be .. complicated ; that's one of the reasons dolmen is likely never going to parse the Coq language). By the way, I submitted a topic about that in the SMTLIB google group (it's pending for authorization currently). |
Sorry for not merging sooner, I'll try and merge asap. However, concerning the second one (about the timeouts), I'm not really sure about its usefulness. I'll need to add it in comments and in the docs, but there is already a way to disable the timer part of the limits, by using a timeout of 0 (see the documentation for Unix.itimer). For the size computation limits, is there a real and measurable cost to the Gc alarm (as in a test case where you can measure/observe the overhead of the alarm when setting the memory limit to infinity) ? And actually, what is the motivation behind the change ? Does it try and solve a concrete problem or is it more for code cleanliness ? |
There is still the problem with the pattern. I have a problem with the namespace it is different for terms and type it seems. I haven't looked at it since just after the discussion. I just didn't know what was the value for removing the limitations ;). (e.g the example Option module uses (About |
I Have a plan to take care of the patterns properly, i'll try and work on it soon (probably next week). |
58dc3ed
to
f835115
Compare
I removed the little fixes from this branch and I will put them to a new MR. The |
f835115
to
7ff80c2
Compare
I rebased on master |
Merged, thanks a lot for the work ! |
Over the year adding polymorphism to the smt language have been proposed a lot of time. It will become standard in v3 as already discussed in #48. But for COLIBRI I needed to be able to parse polymorphism (since it knows little above ground term any encoding is problematic). Finally the addition is quite small since dolmen already handles it internally.
Currently the modificatio is as simple as possible:
In order to solve that, and if you are interested, what is the right way since v3 should be mainly backward compatible with 2.6:
I don't plan to add a v3 parser now, first because v3 is still not formalised and because I believe it is be better to do it step by step.