Zulip Chat Archive
Stream: new members
Topic: Docs for how to prove termination of recursive function?
aron (Mar 02 2025 at 19:58):
I haven't been able to find any documentation for how to prove that a recursive function terminates when Lean can't figure it out automatically. Are there any docs for this?
I don't even know how it works syntactically. Does the termination_by
clause go in a specific place or can it go anywhere in the function body?
Ruben Van de Velde (Mar 02 2025 at 20:00):
It goes after the function body
Markus Himmel (Mar 02 2025 at 20:00):
You can have a look at the reference manual, which contains some examples.
Ruben Van de Velde (Mar 02 2025 at 20:01):
And if that doesn't help, you can search in mathlib
Joachim Breitner (Mar 02 2025 at 20:42):
https://lean-lang.org/blog/2024-1-11-recursive-definitions-in-lean/ is also worth looking at
Last updated: May 02 2025 at 03:31 UTC