Hello
I am currently trying to test some functions on persistent arrays from PArray
.
I already used notations of form [| true; true | false|]
, but it is seems to not behave well with others modules that I import. My question is where can I find informations about the [| ... | ... |]
notation. I don't find it anywhere in the documentation.
it's part of the basic term syntax https://coq.github.io/doc/master/refman/language/core/basic.html#grammar-token-term0
it seems not documented other than that (?)
Quentin Canu said:
it is seems to not behave well with others modules that I import
Could you be more precise? that might be a bug.
In my case, it is BigQ
from the bignums
library
@Quentin Canu I mean: would you have an example where "it does not behave well". If it's a bug in either PArray or bignums, I'd like to fix it.
Require Import PArray Uint63.
Check [|true; true | false|].
From Bignums Require Import BigQ.
Check [|true; true | false|].
The last line fails in my case
That indeed looks like a bug in bignums, thanks
So, I fixed the bug in bignums master branch by changing the problematic [_]
notation to `[_]
but I'm still wondering what is the best strategy to publish the fix (I'm leaning toward publishing a coq-bignums.8.17.1, as well as 8.13.1,...,8.16.1 but that might break a few packages and OPAM files may have to be adjusted).
isn't it a coq bug? I get an error with
Require Import List.
Import ListNotations.
Check [| true; true | false |].
too (Error: Syntax error: [term level 200] expected after '[' (in [term]).
)
We could consider that a Coq bug too but I don't know how to fix it then. (and ListNotations
is well known to be troublesome, that's why it is in a module in the first place I guess)
OTOH if some code doesn't work with ListNotations it could as well not exist for many users...
okay, so [| true; true | false |]
is undocumented primitive syntax which isn't even notation for something else? I can't get Set Printing All
to desugar it...
yes
honestly, I'd still consider dropping it, and requiring replacements to be opt-in and compatible with ListNotations
.
Of course, that violates normal compatibility policies and might be impractical; it just seems a problem that this was merged in the first place.
I don't think we realised that it's incompatible
sure, I was not suggesting you were torturers. More constructively, "any new syntax must be tested together with _all_ stdlib notation modules" might belong in the MR review checklist
It's not exactly undocumented as noted by Gaëtan in the second message of this thread but it's indeed a primitive syntax.
I've read that message, and I'm choosing "undocumented" as more accurate than "documented"
I might have unreasonable expectations here, but I'd like at least to not blame ListNotations
for this.
More concretely, I'm not sure BigNums
deserves blame either but I'm not familiar with it.
I'd consider BigNums
as to blame here (I'm saying that as a maintainer ;) )
(and to be clear I have nothing against PArray _users_)
Besides, the doc for ListNotations (see the comment just above the Module
opening) reads "Standard notations for lists. In a special module to avoid conflicts."
I understand that as some acknowledgment that this notation can be problematic, hence it's isolation in a module, that's not loaded by default.
that's a good question, and I might be biased because stdpp exports ListNotations
by default, but it seems almost any Coq notation can be problematic (that's fundamental to LL(1) parsing), and some other stdlib modules follow the same convention
OTOH to be perfectly honest I should admit that, contrary to what I expected,mathcomp/ssreflect/seq.v
keeps building even when plugging Require Import PArray.
in.
See https://github.com/coq/coq/commit/d068a422173a55eda92996aa46ec1094be614520 for the history
Paolo Giarrusso said:
OTOH to be perfectly honest I should admit that, contrary to what I expected,
mathcomp/ssreflect/seq.v
keeps building even when pluggingRequire Import PArray.
in.
Yes, mathcomp has its own list notation with an additional ::
(i.e., [:: 1; 2; 3]
instead of [1; 2. 3]
) probably for good reasons.
Paolo Giarrusso said:
OTOH to be perfectly honest I should admit that, contrary to what I expected,
mathcomp/ssreflect/seq.v
keeps building even when pluggingRequire Import PArray.
in.
why wouldn't it? even if it used []
notations instead of [::]
Pierre Roux said:
See https://github.com/coq/coq/commit/d068a422173a55eda92996aa46ec1094be614520 for the history
BTW that commit says "bug 2463" but it seems to actually be https://github.com/coq/coq/issues/2438
FYI, regarding bignums, we discussed the matter with @Erik Martin-Dorel (comaintainer) and came up with the following path of actions: https://github.com/coq-community/bignums/pull/73#issuecomment-1468302491
Thank you, I'll have a look on it
@Quentin Canu there is a discussion about the update of the Docker images, could you express your opinion i any there: https://github.com/coq/opam-coq-archive/pull/2505
@Quentin Canu so if you use OPAM you should now be able to opam update
then opam install coq-bignums.9.0.0+coq8.16
to get the fixed bignums without the conflicting notation.
BTW, if you happen to develop a refinement with arrays, please consider submiting a pull request on CoqEAL, this is definitely something missing there.
Last updated: Oct 04 2023 at 22:01 UTC