Zulip Chat Archive
Stream: lean4
Topic: let rec expression must be named with induction on field
Jakub Nowak (Dec 22 2025 at 13:24):
I think that worked before, but maybe not?
structure Foo where
n : Nat
/-- error: 'let rec' expressions must be named -/
#guard_msgs in
example (foo : Foo) := by
induction foo.n where
| zero => sorry
| succ n => sorry
Jakub Nowak (Dec 22 2025 at 14:57):
Oh, wait, it should be with, not where...
We should definitely fix that error message.
Kevin Buzzard (Dec 22 2025 at 19:30):
Slightly tangential but there's a code action which writes the correct syntax for you:
Screenshot from 2025-12-22 19-29-55.png
Jakub Nowak (Dec 22 2025 at 20:05):
Hm, there's something weird with it though. It doesn't work on https://live.lean-lang.org nor in neovim.
Jakub Nowak (Dec 22 2025 at 20:31):
I've just checked and it also doesn't work for me in vscode. Is this feature from nightly?
Jakub Nowak (Dec 22 2025 at 20:35):
Ahh, you need import Mathlibimport Batteries for it to work.
Last updated: Feb 28 2026 at 14:05 UTC