Zulip Chat Archive
Stream: lean4
Topic: local notation in variable
Floris van Doorn (Nov 24 2023 at 12:56):
In the following example, my local notation doesn't work when used in a variable.
variable {n : Nat}
set_option quotPrecheck false
local notation "Fₙ" => {k : Nat // k < n}
example {a : Fₙ} : 0 ≤ a.1 := by apply Nat.zero_le _ -- works
variable {a : Fₙ}
example : 0 ≤ a.1 := by apply Nat.zero_le -- uses `sorry`, since the type of `a` contains `sorry`.
Is this a known issue? Is there a way to work around this?
Patrick Massot (Nov 24 2023 at 14:01):
It is known. I'm on mobile so I can't search, sorry.
Floris van Doorn (Nov 24 2023 at 14:02):
After searching slightly more, I indeed found this previous thread: https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Notation.20introduces.20sorry
Floris van Doorn (Nov 24 2023 at 14:07):
So in summary: a workaround is to use set_option hygiene false
.
Sebastien Gouezel (Nov 24 2023 at 15:22):
Would notation3
work here?
Floris van Doorn (Nov 24 2023 at 15:37):
notation3
has the same behavior
Damiano Testa (Nov 24 2023 at 16:49):
By the way Floris, I learned this solution from someone also called Floris. :upside_down:
Last updated: Dec 20 2023 at 11:08 UTC