Zulip Chat Archive

Stream: mathlib4

Topic: Local notation priority


Yury G. Kudryashov (Jun 07 2023 at 15:40):

How can I make

import Mathlib.Algebra.Abs

variable {α : Type _} {n : }

set_option quotPrecheck false in
local notation "αⁿ⁺¹" => Fin (n + 1)  α

example : αⁿ⁺¹ := fun _  const

work? The local notation conflicts with

@[inherit_doc]
postfix:1000 "⁺" => PosPart.pos

from the imported file.

Yury G. Kudryashov (Jun 07 2023 at 15:40):

I tried local notation:200 and local notation:2000, neither makes it work.

Floris van Doorn (Jun 07 2023 at 16:43):

that is not the priority but the binding power. Try local notation (priority := high)

Yury G. Kudryashov (Jun 07 2023 at 16:48):

Doesn't work

Floris van Doorn (Jun 07 2023 at 19:45):

You misdiagnosed the issue. This works:

import Mathlib.Algebra.Abs

variable {α : Type _} {n : Nat}

set_option quotPrecheck false
local notation "αⁿ⁺¹" => Fin (n + 1)  α

example : αⁿ⁺¹ := sorry

Floris van Doorn (Jun 07 2023 at 19:46):

You got bitten by this trap: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Notation.20for.20inductive.20types/near/363980933


Last updated: Dec 20 2023 at 11:08 UTC