-
Notifications
You must be signed in to change notification settings - Fork 640
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
Can't practically improve my Hint locality in Coq 8.13.0 #13809
Comments
If this warning message does not mention which hint / database is used, then it should be updated to mention that. Ideally it should also mention which file the hint was declared in. In this case I suspect it is the |
I disagree that "the solution is to Import the module declaring the hint used by reflexivity/lia". As a user of Coq, I treat those tactics as abstractions, and I shouldn't need to know what modules they rely on. |
There is an easy backwards-compatible fix in this case, though: replace all |
I fully understand that I could make every hint Global. But, as I understand it, the point is that users are really encouraged to use #[export] rather than Global. I could remark that #[export] is quite ugly syntax, but that shouldn't matter, because in the glorious future one will simply write |
I mostly agree with you about Require Import Coq.Setoids.Setoid.
Global Set Loose Hint Behavior "Warn".
Axiom R : nat -> nat -> Prop.
Module foo.
Global Instance R_Reflexive : Reflexive R.
Admitted.
End foo.
Goal R 0 0.
reflexivity.
(* Warning: Hint used but not imported: exact foo.R_Reflexive from foo [non-imported-hint,automation] *) What should the behavior be here? |
Perhaps you are right about user-defined reflexive instances, but I'm getting warning messages that complain that I should |
Plausibly the fix to the warnings from |
CC @ppedrot @coq/doc-maintainers |
Do you have an example reproducing this warning? |
Hint used but not imported: exact Z.divide_reflexive from Z |
I'm sorry if the announcements looked aggressive. I'd say 8.15 is an optimistic schedule; we are aware it won't be easy to match, and we've already decided that we will extend the deadline if problems arise. At the same time not all users are as diligent as you are (thanks for that!). So we played the deadline card, I hope you can understand. |
Forget about Loose Hint Behaviour, just use the attributes. |
As I understand it, the purpose of "Loose Hint Behavior Warn" is to diagnose those places where one would run into difficulty when changing a Hint from (current default) Global to (future default) #[export]. If I am going to change hundreds of Hints throughout my system, I certainly do want such a diagnostic aid. The value of this aid would be improved if the Coq standard library obeyed the rules. Two examples are discussed above:
|
This is definitely true for newly written code. But there is no easy switch from global to export hints, this will require a huge refactoring for any development of a reasonable size, and it will cascade down to code that depends on a library. This is why this change of semantics was introduced via a warning. It is not reasonable to believe that big libraries will switch overnight to export semantics, but in the meantime we really, really want people to stop introducing global hints. |
We've might have done a bad job at communicating the plan but the idea is that the faster existing projects add There's a possibility though that we will anyway delay the next steps of the process for one more release so that more commands support the We do not yet have a plan to switch existing code from |
In particular, I should add that the standard library was "fixed" for this change by adding |
Yes and no. Before the introduction of the export attribute I agree it was indeed mostly useless. Now that the user can cherry-pick the scoping behaviour on a per-hint basis, it can be used as @andrew-appel did to help the incremental transition to export semantics, although it's still painful and too verbose. It should probably be extended with a table to selectively blacklist hints in order to focus on a particular set of hints being ported to export scoping, but the underlying mechanism is the same. Note that due to the way |
We discussed this issue and related ones in today's call and concluded that we should improve the warning message so that it clearly recommends two different course of actions for fixing the warning:
Also discussed was how to improve
|
There's a third option, which is to export the hints from the right files without marking them as |
Completely backward-compatible? What if you used to import only the files which defined the hints? |
Then nothing would change? To be concrete, I'm proposing that we move all hints to their own module (without changing what file they're defined in), and exporting these modules from selected files that currently only import the enclosing file/module. Since the hints are |
OK, thanks for clarifying! |
In the end, I went through all of VST and edited every Hint (adding #[export], Global, or Local as necessary) to avoid the deprecation messages. I did this without using "Set Loose Hint Behavior" because, as discussed above, that is not very useful until some adjustments are made. VST was already using Hint in a way that almost every hint was intended as #[export]; this is what made it possible to make this change without the benefit of "Set Loose Hint Behavior". |
Hopefully at some point we will make it the default, and you will be able to remove it. |
As far as I understand, we can close this issue. |
Normally when a new version of Coq comes out, I adjust my big Coq development to avoid using deprecated features. Unfortunately, Coq 8.13.0 is not mature enough for me to do this regarding the new Hint locality deprecation warning,
deprecated-hint-without-locality
. Because I believe this problem will be annoying for many users, I write this message here as a bug report, instead of just adding a reply to the Zulip topic.I want to adjust my development the "right" way, not the "quick and dirty" way. That is, I don't want to simply add Global to every Hint, I want them to have the recommended #[export] locality.
First problem: The deprecation message says, 'It is recommended to use "export" whenever possible' but gives no clue about how to use "export." I have been using Coq for many years, but never used an 'attribute' before, and it took 30 minutes of detective work in the refman before I figured out that one must write #[export] before the Hint. (Try the experiment yourself, pretending you didn't already know...). So, je vous prie, adjust the deprecation warning to say, "It is recommended to use #[export] Hint rather than just Hint, whenever possible."
Second problem: After studying all the relevant documentation, I concluded that I should write,
Global Set Loose Hint Behavior "Warn"
and then eliminate all the warning messages about "Hint used but not imported". But I find that most of those messages are caused by Coq's built-in tactics such asreflexivity
andlia
. As a user I can't solve that problem myself.Third problem: The #[export] mechanism doesn't work for Instance, as is known.
Therefore: In Coq 8.13.0 it is not possible for users to systematically and reliably adjust their developments to the new style of Hint locality, without the hassle of filtering out warning messages that come from Coq's own built-in tactics, and given the problem that Instances don't work properly. I feel that it is best to abandon the effort to adapt my development. That is, I will simply suppress the warning, via
Global Set Warnings "-deprecated-hint-without-locality"
, until a new release of Coq comes out that fixes these two issues.And therefore, the aggressive schedule by which Coq 8.15 will have different, incompatible behavior should be reconsidered until such time as an intermediate release of Coq does realistically permit users to adapt.
The text was updated successfully, but these errors were encountered: