Zulip Chat Archive

Stream: lean4

Topic: Elaboration failure with let mut whose RHS is a do notation


Siddharth Bhat (Oct 03 2024 at 15:34):

Consider the MWE:

def fails : MetaM Unit := do
  let mut val : Bool  do
      pure true
  -- unknown identifier val
  val := Bool.not val -- FAILS!
  return ()

def succeeds : MetaM Unit := do
  let val : Bool  do
      pure true
  let mut val := val
  val := Bool.not val
  return ()

Does someone know what I'm doing wrong here?

Mario Carneiro (Oct 03 2024 at 15:47):

this is a bug in the do notation

Siddharth Bhat (Oct 03 2024 at 15:51):

OK, let me file a bug.

Siddharth Bhat (Oct 03 2024 at 15:52):

Filed: https://github.com/leanprover/lean4/issues/5607


Last updated: May 02 2025 at 03:31 UTC