Zulip Chat Archive

Stream: lean4

Topic: Eq.ndrec vs Eq.rec


François G. Dorais (Sep 09 2021 at 08:13):

I just noticed that both Eq.ndrec and Eq.rec unexpand to "▸" notation:

https://github.com/leanprover/lean4/blob/474395aae486800d5ce7c7fe7e9d51a383614267/src/Init/NotationExtra.lean#L133

So it's impossible to tell them apart without disabling the "▸" notation. Is there a way to disable a single notation? Disabling all notations works but it can be hard to read very long terms that way. Is there any other way to tell Eq.ndrec from Eq.rec?

Leonardo de Moura (Sep 09 2021 at 21:36):

I added support for temporarily erasing keyed attributes. It includes appUnexpander, termElab, commandElab, tactic, etc. Example:

theorem ex {i j : Fin n} (h : i = j) : i.val = j.val :=
  h  rfl

attribute [-appUnexpander] unexpandEqNDRec

#print ex
/-
theorem ex : ∀ {n : Nat} {i j : Fin n}, i = j → i.val = j.val :=
fun {n} {i j} h => Eq.ndrec rfl h
-/

Last updated: Dec 20 2023 at 11:08 UTC