leanprover / leanprover/fp-lean

Section 1.5: Datatypes and Patterns - Termination discussion

Open
#145 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lean
Stars
192
Forks
73
PR merge metrics
No merged PRs in 30d

Description

Thanks a lot for the book. I've really enjoyed working through it so far and the quality is great.

I had a couple of things that slightly confused me, maybe this is useful to clarify in the text:

Unlike many languages, Lean ensures by default that every recursive function will eventually reach a base case. From a programming perspective, this rules out accidental infinite loops.

A consequence of this is that Lean will not accept a version of even that attempts to invoke itself recursively on the original number.

It was not clear to me immediately what this means. I assumed that Lean will somehow by default refuse to run a recursive function that is not proven to terminate. I tested this (VSCode), and it crashed the Lean language process, so it appears it did just run the function. I think it would help here to clarify what the purpose is of the termination checks (eg something about the value of the diagnostics, but that it does not prevent the function from running).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Section 1.5, “Datatypes and Patterns,” and review the quoted discussion of recursive termination alongside the reported VSCode behavior. Clarify what termination checks and their diagnostics mean, including whether they prevent a function from running, and verify the revised explanation in VSCode.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.