Zulip Chat Archive

Stream: general

Topic: Priority of notation


Antoine Chambert-Loir (Aug 20 2023 at 09:09):

I have defined a notation

notation:25 α " →[" M:25 "] " β:0 => EquivariantMap (@id M) α β

which conflicts with the one for MulActionHom. Because of that ambiguity, Lean stops.
I tried to insert (priority := 1000) , without success…
How can I make mine to be chosen automatically?

Eric Wieser (Aug 20 2023 at 09:11):

I think 1000 is the default priority so providing that won't do anything

Antoine Chambert-Loir (Aug 20 2023 at 09:23):

By without success, I meant that I got an error message.
Where should I insert the priority attribute? I tried notation (priority := 1000) :25…

Junyan Xu (Aug 20 2023 at 19:31):

Many examples are found by searching the repo, for example this. M:25 β:0 don't feel right to me ... Oops it's used here.

Eric Wieser (Aug 20 2023 at 19:33):

:25 is precedence not priority

Junyan Xu (Aug 20 2023 at 19:34):

What does it mean to put a precedence on a variable?

Kyle Miller (Aug 21 2023 at 02:40):

@Antoine Chambert-Loir I believe the priority goes after the :25.

Kyle Miller (Aug 21 2023 at 09:48):

Just to confirm, here is the syntax definition for notation.

Here's what that means using simplified syntax-like notation:

(docComment)? (attributes)? attrKind
"notation" (precedence)? (namedName)? (namedPrio)? notationItem* "=>" term

The attrKind is ("scoped" <|> "local")?, the namedName is "(name :=" ident ")", and the namedPrio is "(priority :=" priority ")".

Kyle Miller (Aug 21 2023 at 09:49):

The priority parser has a number of named priority levels by the way. There's default, low, mid, and high, and you can write expressions involving +, -, and parentheses.


Last updated: Dec 20 2023 at 11:08 UTC