There are many (older) Coq developments floating around that have Require Import ssreflect.
, but will not immediately work with the ssreflect bundled with Coq (although ssr
has all they require). My goto solution has been to define a file with:
From Coq Require Export ssreflect.
Global Set SsrOldRewriteGoalsOrder.
Global Set Asymmetric Patterns.
Global Set Bullet Behavior "None".
... to get the old behavior. However, I have to duplicate this file in all projects. Is there any alternative to the duplication? Should something like this file live in Coq stdlib?
I'm afraid the only alternative is From mathcomp Require Import ssreflect
(which contains these lines IIRC).
right, but then suddenly your project depends on coq-mathcomp-ssreflect
. This is what I think should no longer be necessary, unless you actually use stuff outside of ssr
(which many projects don't)
@Enrico Tassi so I take it you don't think adding something like theories/ssr/compat.v
with that content would be welcome among devs?
I just don't see the usecase. If you were using ssr before the integration in Coq, you were already depending on coq-mathcomp-ssreflect. So adding a From mathcomp
to your files does not seem a big change (and also using From seems to be the recommended way of importing these days).
Is there a scenario I don't see?
There are many projects out there that only use the ssreflect proof language and nothing else from ssreflect. And they started using the proof language before the ssr
integration in Coq, so they rely on the mathcomp
behavior of the proof language. Now, why would those projects want to depend on coq-mathcomp-ssreflect
? That's one more dependency in opam or Nix that you have to state and have users download every time. The only thing these projects get from coq-mathcomp-ssreflect
is the above behavior automatically. One whole dependency is a quite a lot to pay for four lines of Vernac.
I agree, I was just saying that this dependency was already there... I think you can propose the extra file, and see what others think. I don't see a big problem with such a file being there, maybe under a name that is more precise, eg ssreflect_v1_4 (I don't recall in which version it was merged, I would put there the one before) so that you can Require Import ssreflect_v1_4.
rather than Require Import ssr.compat.
I'd definitely recommend against Global Set
and in favor of project-wide option setting through -set
and coq_flags
in Dune or -arg
in coq_makefile / _CoqProject
.
Théo Zimmermann said:
I'd definitely recommend against
Global Set
and in favor of project-wide option setting through-set
andcoq_flags
in Dune or-arg
in coq_makefile /_CoqProject
.
But then it should be done this way in MathComp too: https://github.com/math-comp/math-comp/blob/master/mathcomp/ssreflect/ssreflect.v#L4 --- meaning every project using MathComp has to change its _CoqProject
/Makefile?
Sure! But this will be a breaking change (although a welcome one) for projects depending upon math-comp.
and I guess this only works in 8.12?
No, it is already supported at least in 8.11
meaning it can only be done in like... 8.15
Actually, it is supported since 8.10!
https://coq.inria.fr/refman/changes.html#other-changes-in-8-10-beta1
Passing -arg
is better w.r.t. "virality" but does not solve the original problem which is "not to have these options set in each and every project".
Sure, but at least, it is less invasive since you don't have to create a Coq file that you import everywhere.
right, it is an improvement for sure for projects that don't need Coq 8.9 or earlier
I let @Karl Palmskog say what he prefers, to me it is less invasive to put one file in Coq, than 2 lines in each project using Coq
(I've already proposed the solution I prefer, which is a dependency on the ssr package from MC)
FTR with respect to the removal of Global Set
from math-comp, there's also Export Set
that is available since 8.8 and allows to reproduce the same behavior (from the point of view of reverse deps).
Note that instead of Global Set you can also go for Export Set, which is more modular.
Nice, what is it's scope?
You get the options if you Import
directly the file that sets them.
We want the option to be global WRT mathcomp, but not necessarily reach its users
In fact, it might be time to deprecate Global Set
in Coq.
Global Set can be used for nice hacks though
the fact it is highly non-recommended doesn't necessarily mean we should remove it
OK maybe
(I think a warning would be nice though)
Anyway, FWIW here is the documentation of locality attributes of Set
/ Unset
: https://coq.github.io/doc/master/refman/language/core/basic.html#locality-attributes-supported-by-set-and-unset
The warning that the manual contains could indeed become a warning that is raised when using the command with the Global
/ global
attribute.
for my use case, I guess -arg
is enough, but I will have to test
looks like the SsrOldRewriteGoalsOrder option is only available when a certain plugin is loaded:
let () =
Goptions.(declare_bool_option
{ optkey = ["SsrOldRewriteGoalsOrder"];
(in plugins/ssr/ssrequality.ml
)
So the -set
approach seemingly can't accomplish the same as Global Set
here.
Good point. The argument approach allows one to load a plugin though (see -rfrom
/ -rifrom
flags and also the 8.12 changes related to the interleaving of command-line flags, second bullet at https://coq.github.io/doc/master/refman/changes.html#tools).
Last updated: Oct 13 2024 at 01:02 UTC