Zulip Chat Archive

Stream: lean4

Topic: bug with spacing


Kenny Lau (Oct 18 2025 at 17:17):

theorem foo (L : List Nat) : True := by
  induction L with
  | nil => trivial -- start here
  1. delete the comment -- start here
  2. add a newline
  3. type | cons => trivial
  4. observe that lean complains that cons hasn't been provided
  5. add a space before | cons and then delete the space
  6. it's now magically fixed

Kenny Lau (Oct 18 2025 at 17:17):

image.png

Kenny Lau (Oct 18 2025 at 17:17):

(tested on live lean)

Aaron Liu (Oct 18 2025 at 17:30):

I had the same problem which sometimes I encounter it and sometimes it's fine, didn't think it was serious enough to report

Kim Morrison (Oct 20 2025 at 02:29):

@Kenny Lau, can you please open an issue?

Kenny Lau (Oct 20 2025 at 07:27):

Kim Morrison said:

Kenny Lau, can you please open an issue?

lean4#10847

Robin Arnez (Oct 20 2025 at 07:31):

That was lean4#10679, wasn't it?

Kenny Lau (Oct 20 2025 at 07:32):

but i tested it against a version after that date

Kenny Lau (Oct 20 2025 at 07:33):

the description is different, the one you linked is saying that the error message stays after removing the alternative, mine says that the error message appears after adding the alternative

Kenny Lau (Oct 20 2025 at 07:33):

which, if you think about it, how can there be an error message in the first place if there is an "offending alternative"?? that's my bug i think

Robin Arnez (Oct 20 2025 at 07:38):

I've had this problem before but I can't seem to reproduce it with your steps. You're probably right that this is still a problem but maybe there is a better way to reproduce it?

Kenny Lau (Oct 20 2025 at 07:39):

did you delete the comment?

Sebastian Ullrich (Oct 20 2025 at 07:44):

I have a reproducer

Robin Arnez (Oct 20 2025 at 07:46):

Maybe I misunderstood something but:

  1. open in Lean 4 playground
  2. put | cons => trivial into the clipboard
  3. select -- start here
  4. backspace
  5. enter
  6. paste

causes no error to occur. I think a better repro is:

theorem foo (L : List Nat) : True := by
  induction L with
  | nil => trivial
  1. Type a single | at the end of the last line.
  2. Wait until the error appears.
  3. Write cons => trivial => The error is still there
  4. Add a space before the | => The error disappears

Sebastian Ullrich (Oct 20 2025 at 07:47):

lean#10848, a partial oversight from lean#10679


Last updated: Dec 20 2025 at 21:32 UTC