Zulip Chat Archive
Stream: general
Topic: style: indenting termination_by and decreasing_by
Johan Commelin (Nov 27 2024 at 14:16):
Should termination_by
and decreasing_by
be indented or not?
Mathlib seems to have both styles occurring quite a bit.
Damiano Testa (Nov 27 2024 at 14:29):
I don't have a strong opinion, though maybe have a slight preference for no indentation.
Johan Commelin (Nov 27 2024 at 14:41):
Same here
Julian Berman (Nov 27 2024 at 15:19):
I followed https://github.com/leanprover/vscode-lean4/pull/329/files in lean.nvim which had proposed indenting for them (but of course am happy to change). I think I didn't even find any examples of multi-line termination_by, but I found lots of examples for decreasing_by and at least in core I think they were all indented.
Joachim Breitner (Nov 27 2024 at 17:25):
Purely personal preference, but I find I don’t indent them. They are not part of the typically indented body of the function. Likewise, I also don’t indent where
.
The lean core repo also has both styles:
~/build/lean/lean4 $ git grep ^\ \ termination_by|wc -l
130
~/build/lean/lean4 $ git grep ^termination_by|wc -l
433
~/build/lean/lean4 $ git grep ^\ \ \ \ termination_by|wc -l
34
(Although that could be misleading, as the “don’t indent” rule would indent it if is part of a where
or letrec
defined function).
Last updated: May 02 2025 at 03:31 UTC