leanprover / leanprover/fp-lean

minus function in GettingToKnow/DatatypesPatterns.lean doesn't work

Open Beginner friendly
#301 0 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

In the Getting to Know Lean chapter, section 1.5 Datatypes, there's a mistake on line 372 in the definition of the minus function.
The current version reads:

def minus (n : Nat) (k : Nat) : Nat := 
  match k with 
  | Nat.zero => n 
  | Nat.succ k' => pred (minus n k') 

It should read:

def minus (n : Nat) (k : Nat) : Nat :=
  match k with
  | Nat.zero => n
  | Nat.succ k' => Nat.pred (minus n k')

https://github.com/leanprover/fp-lean/blob/0abeea545d560a324e2561f7210fbd6ed154fa02/book/FPLean/GettingToKnow/DatatypesPatterns.lean#L368

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

Open book/FPLean/GettingToKnow/DatatypesPatterns.lean around line 368 and compare the minus definition with the issue's corrected version. Verify that the definition uses Nat.pred, then check the surrounding chapter content or Lean validation to confirm the example works.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.