Skip to content
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

Polynomial : notation conflict concerning [[ and ]] #47

Open
letouzey opened this issue Oct 22, 2024 · 0 comments
Open

Polynomial : notation conflict concerning [[ and ]] #47

letouzey opened this issue Oct 22, 2024 · 0 comments

Comments

@letouzey
Copy link

As already mentioned in #46 I'm an happy user of QuantumLib, thanks a lot for this lib. Nonetheless there's a little detail that I find quite annoying. In QuantumLib.Polynomial, there is the following notation:

Notation "P [[ x ]]" := (Peval P x) (at level 0) : poly_scope.

The issue is that it currently breaks any nested use of other notations involving [ ].
For instance:

From Coq Require Import List.
From QuantumLib Require Import Polynomial.
Import ListNotations.
Check [ [O] ]. (* list (list nat) as expected, but only thanks to the spaces added between the square brackets *)
Check [[O]]. (* syntax error *)

Same (and more annoying actually) for nested patterns such as [[U|V]|W], also a syntax error as soon as Polynomial is Require'd, unless artificial blanks are added between consecutive square brackets.

Closing the poly_scope scope does not help (btw, could you please avoid this global open of poly_scope in Polynomial ?).

I suggest enclosing the notation for Peval in a little inner module, say PolyNotations (just like ListNotations ) to avoid forcing anyone to "benefit" unconditionally from this notation. Or find an alternative not based on square bracket maybe ?

Best regards
Pierre Letouzey, IRIF lab, Université Paris Cité

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant