Zulip Chat Archive

Stream: lean4

Topic: Elab.async changes the result of elaboration with grind


Eric Wieser (Feb 11 2026 at 05:47):

This bug seems to have returned:

structure Wrapper (α) where val : α

instance {α : Type} [NatCast α] : NatCast (Wrapper α) := sorry

def foo {α : Type} (μ : Wrapper α) (f : α  Nat) : Nat := sorry

macro:max P:term noWs "|[" s:term "]|" : term => `(
  let h : $s  List.length $P := by grind
  0)

macro:max P:term noWs "|[" term "]|" : term => `(foo $P fun x => 0)

theorem bar (a : List ) (i : Fin (a.length - 1)) : 0  a|[i.val + 1]| :=
  Nat.zero_le _

-- statement below is identical
set_option Elab.async false

/--
error: Ambiguous term
  a|[i.val + 1]|
Possible interpretations:
  foo ?m.12 fun x => 0 : Nat

  let h := ?m.21;
  0 : ?m.24
-/
#guard_msgs in
theorem bar' (a : List ) (i : Fin (a.length - 1)) : 0  a|[i.val + 1]| :=
  Nat.zero_le _

Eric Wieser (Feb 11 2026 at 05:49):

(the kernel error is no more perhaps thanks to an assert! guarding it, but the behavior change induced by Elab.async persists)

Eric Wieser (Feb 11 2026 at 06:06):

#10705 is probably relevant still

Notification Bot (Feb 11 2026 at 06:21):

3 messages were moved here from #lean4 > Kernel error in list index notation by Eric Wieser.


Last updated: Feb 28 2026 at 14:05 UTC