[declare] Allow custom typing flags when declaring constants. - #12586
Conversation
ec6fa01 to
cabb2a5
Compare
3af36b3 to
5ee6fd9
Compare
5ee6fd9 to
fe9ef42
Compare
|
Not sure I'm happy with the current setup, but requesting review. |
|
For your complete information, the following job in allow failure mode has failed: test-suite:4.12+trunk+dune |
d946646 to
3870d45
Compare
|
For your complete information, the following job in allow failure mode has failed: test-suite:4.12+trunk+dune |
3870d45 to
6724742
Compare
SkySkimmer
left a comment
There was a problem hiding this comment.
This isn't hooked up to anything.
@SkySkimmer indeed I provide here the core API and defer to #12539 and #9004 the implementation using attributes + the test cases. Do you think it is a bad idea? How should @lthms proceed? |
|
I think having an unused API is a bad idea, we should just merge this PR and its first user. |
|
Ok , @lthms , please include this PR in your branch then. |
|
Ack. I will try to give it a try later this week. |
6724742 to
ca93ab8
Compare
|
I did some progress, but still the parsing is broken. |
|
Am I correct to guess your three last commits implements what I tried to do in my PR, @ejgallego? (it’s fine by me, I just want to be sure I understood correctly) |
They are just a try, I didn't finish them; feel free to ignore them / update them. |
Given all the valid (as in correct in English) options, I'd say we pick the ones we like the most and find less confusing for a user. I can sum up all the proposals given here, as well as all the preferences, if you like. |
If there were many ways to pass the termination check, I'd probably like |
We use the new `Declare.Info` structure to uniformly add properties to the handling of constants. In this case, per-constant typing flags. The internal code may want to see some further refactoring, including pushing the flags down to `Safe_typing.add_constant` , but the changes in the interface should be definitive. This will allow rocq-prover#12539 and rocq-prover#9004 using attributes.
This is just an experiment, but makes the uses of the API easier as we don't mess with the global state anymore.
The syntax is the one of boolean attributes, that is to say
`#[typing($flag={yes,no}]` where `$flag` is one of `guarded`,
`universes`, `positive`.
We had to instrument the pretyper in a few places, it is interesting
that it is doing so many checks.
Most cases should be accounted in proof code, however be wary of paths where `Global.env ()` is used.
Co-authored-by: <Théo Zimmermann <theo.zimmermann@inria.fr>
|
Updated to |
|
Actually after looking a bit more to the global |
|
As far as I'm concerned, both |
As discussed in the Coq meeting.
|
The the sea of comments, there were these two, by myself and @mattam82:
|
|
@gares: This was answered:
|
|
I like |
fair enough, but I'm not so sure the deprecation plan makes sense. I mean, if we agree that termination is better than guarded, maybe we can deprecate it right now, and provide the new name as an attribute from the start. (in another PR) |
|
Agreed. Making the change in a separate (but 8.13) PR is also a good idea to make the process more efficient. |
|
@herbelin this seems all good to me. If you see no other problems, the sooner its merged the better |
|
So, if I understand correctly, the current proposal is: Are the plans clear regarding Concretely, my question is whether there is a risk of having to backtrack if I merge now? |
I think we could refine more; my point is indeed what @Zimmi48 said, IMHO we should keep the attributes and the |
The plan is indeed to change the |
|
OK, you then think that enough feedback has been given and we could now safely merge? If so, will do around 8PM Paris time. |
|
Yes, because this was discussed during the Coq Call and it corresponds more or less to the conclusion. |
|
@coqbot: merge now |
|
Thanks to all! |
|
Though the train has left the station, |
There is still time until the final release. I still like just Set Positivity Checking.
#[check(positivity=no)] Inductive foo := ...
#[skip_check(positivity=yes] Inductive foo := ...
#[bypass_check(positivity=no)] ...I don't like the double negation in the last example. That alone, should be a reason to go with |
|
I've not followed the details of the PR. I don't care for the double negative in the last example, either.
On the other hand, No wording is perfect and no code lasts forever. We can change this relatively easily if we come up with a better idea in the future. We may come up with better ideas as more attributes are created over time. |
We use the new
Declare.Infostructure to uniformly add properties tothe handling of constants. In this case, per-constant typing flags.
The internal code may want to see some further refactoring, including
pushing the flags down to
Safe_typing.add_constant, but the changesin the interface should be definitive.
By request, we also implement attributes to specify the typing flags, they have the form
#[typing($ATT=$ENABLE)]where:ATTis one ofguarded,universes,positiveENABLEis one ofon/offThis replaces #12539 and finishes #9004 .