[ssreflect] Use rw instead of rewrite to avoid conflicts with legacy tactic#21478
[ssreflect] Use rw instead of rewrite to avoid conflicts with legacy tactic#21478proux01 wants to merge 3 commits intorocq-prover:masterfrom
Conversation
According to rocq-prover#21425 (comment)
Since this was the major cause of conflict with legacy tactics, ssreflect can now be loaded in the Prelude. For backward compatibility From Corelib Require Import ssreflect. still loads a 'rewrite' wrapper to 'rw'.
andres-erbsen
left a comment
There was a problem hiding this comment.
Finally realizing the true extent of the change here, I am deeply skeptical of where this is going. Over years, ssreflect code has earned a reputation of being dense and essentially incomprehensible to outsiders and brittle outside the narrow niche of coding style used in mathcomp. While there are certainly valuable bits to be adopted from there, the way towards it would be targeted feature-by-feature design review with user-experience considerations under special focus.
Even adding a global 2-letter shorthand for ssreflect's rewrite seems premature given that unifall did not land, and I ran into serious issues within the first hour of trying ssr rewrite out in a relatively undemanding proof. I am still in favor of resolving the naming collision, but ssrewrite or something similarly evocative of the use case of the tactic would be more appropriate.
| Require Export Corelib.Init.Tactics. | ||
| Require Export Corelib.Init.Tauto. | ||
| Require Export Corelib.Init.Sumbool. | ||
| Require Export ssreflect_rw. |
There was a problem hiding this comment.
The referenced file defines a number of global notations, Ltacs, definitions, lemmas, and hints, not just ssreflect rewrite. We should not force these upon all corelib users without much more extensive review, even if we can get CI to pass with them.
|
I guess the point here is to provide the ability to load at the same time ssreflect and libraries which did not load it, and in order to do that, at least the grammar from ssreflect must be taken into account in order not to create conflicts during a late |
|
Let me take a step back: I think indeed this is not a regular PR but a strategic one. Let's start with some facts.
Stuff that have been tried before and are not a good thing IMO.
In my opinion, we should integrate ssreflect as such to resolve compatibility issues right now, with minimal impact to users: I do not think here is the time and place to change its syntax or semantics as an answer to tastes and distastes of the participants to this discussion (this is a more general and valid question, but solves a distinct issue). The fact that this PR does not pass CI and calls for overlay reflects the Require time conflicts, so that we can solve them here once and for all, for everyone wanting to mix mathcomp or other ssreflect based developments with almost anything. |
|
I agree that the split of the ecosystem is not ideal and we ought to do something about it. I would be happy to discuss strategy if one was proposed. I am not sure what you mean by Require-time conflicts -- are there any? I've been able to Require and wrap ssreflect in coqutil, for example, without needing the overlays here. The change I highlighted above adds controversial ssreflect constructs to by-default-Imported prelude. This does not seem necessary for fixing the compatibility issues, but is interesting as an experiment for investigating what the incompatibilities are -- or is that what you meant by "strategic PR"? I would like to improve compatibility, but the path towards that must take into account desires and constraints of all users, mathcomp and otherwise. Obviously porting large swaths of code is costly, and shipping barely-tested constructs is not right. But I don't think we'd make any friends by forcing ssreflect as-is upon the supermajority of users who have not chosen it -- at the very least we should leave them the option whether to Import it or not. At a higher level, my preferred path would be to
|
|
I globally agree with you @andres-erbsen. By the way I think I got mistaken when I said As for ssreflect evaluation, I fully agree that it should be tested on non ssr contexts to see what might be missing and improved in a backward compatible way. I'm sorry to see your issues with ssr rewrite taking an awful amount of time (I usually have the exact opposite experience so I was surprised) and I am eager to know where this slowdown comes from. However I do think ssreflect syntax should not be "evaluated" but that there should be a second one, less perl-ish available to all, and that ideally it should resemble current syntax e.g. |
|
PS:
What I would like to reach is the point where |
Since this was the major cause of conflict with legacy tactics, ssreflect can now be loaded in the Prelude. For backward compatibility
still loads a
rewritewrapper torw.The
theories/Corelib/ssrdir still contains:ssrfun.vandssrbool.vthat should go back in mathcomp (in a further PR)ssreflect.vwithrewritetactic as alias torw(to be removed in a few releases)if ... then ... elsenotations: in the long run we should maybe deprecate the specificif ... then ... elsefor inductives with two constructors (that is error prone, since it depends from the order of the constructors) with a quickfix toward the newif g is first_constructor then ... elsevariant and restrictif ... then ... elseto booleans (or anything coercible to bool)Depends on: #21609 , #21611
Documented any new / changed user messages.make doc_gram_rsts.Overlays (to be merged before the current PR)
Most overlays are handling the new
ofandiskeywords and are only a couple lines long.