Zulip Chat Archive

Stream: general

Topic: Forward and backwards recursion


Zahir Bingen (Aug 09 2023 at 12:04):

Hello everyone,
I have a simple question about LEAN3. All the recursive functions I have made are recursing backwards. Is this actually a requirement, to guarantee termination of the function? Or is it also possible to do forwards recursion with a proof that the function will terminate?

Trebor Huang (Aug 09 2023 at 12:33):

Forwards recursion is also possible. See termination_by for providing termination proofs in this case.


Last updated: Dec 20 2023 at 11:08 UTC