after From elpi Require Import elpi.
, I see many occurrences of lib.foo
becoming a syntax error.
Worse, stepping back and forth fixes the error in the coqidetop — I guess that's clearly a bug? This is with coq-elpi.1.16.0
BTW.
I guess that's about the lib :
syntax shadowing lib.
but maybe failing to left-factor?
term: LEVEL "0"
[ [ "lib"; ":"; id = qualified_name -> { ...
| "lib"; ":"; "@"; id = qualified_name -> { ...
but I've only reverse-engineered Coq notations, and I know .mlg
s can have more tricks under their sleeves...
minimized:
Module a.
Module lib.
Definition a := 0.
End lib.
End a.
Import a.
Check a.lib.a.
Check lib.a.
From elpi Require elpi.
(* Step over the above, and do NOT step back *)
Check a.lib.a. (* works. *)
(* Check lib.a. (* Fails *) *)
Module lib. (* Fails. *)
Definition a := 0.
End lib.
Hum, I see, it is expected but maybe a bad choice. In practice it turns "lib" into a keyword
Years after that addition, I believe it is not very useful. But purging it would require some work.
In the early days writing {{ foo }}
would not resolve foo
to a Coq name once and forall, so "coqlib" was better. Today names in term quotations are resolved statically, so the feature serves no purpose IMO.
could you make lib:
a keyword instead? I'm assuming the lexer has better backtracking...
Yes, but then forall (lib : nat)
and foralll (lib: nat)
would be different, and that would be confusing
It wouldn't be the first time, and that example is a bit easier to workaround compared to Import lib.foo. where lib. is external
Anyway, thank you for the prompt response; I'll file a bug on this.
What about backtracking + syntax extension, and the fact this happens on require? Those seem both odd, and potentially the same oddity...
Last updated: Oct 13 2024 at 01:02 UTC