leanprover / leanprover/fp-lean

3.5.3: question about `1 + x` in `(fun (x : Nat) => 1 + x) = (Nat.succ ·)`

Open
#260 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

I'm not sure if this is incorrect, but just feel it questionable.

https://github.com/leanprover/fp-lean/blob/c30ec0985b695c6470f2ba104819e974e150c2f3/book/FPLean/TypeClasses/StandardClasses.lean#L144-L145

The statement (fun (x : Nat) => 1 + x) = (Nat.succ ·) is a perfectly reasonable statement. From the perspective of mathematics, two functions are equal if they map equal inputs to equal outputs, so this statement is even true, though it requires a one-line proof to convince Lean of this fact.

I think the one-line proof here is funext; apply Nat.add_comm. Is this what is intended?
The proof of the following statement seems easier:

(fun (x : Nat) => x + 1) = (Nat.succ ·)

example : (fun (x : Nat) => 1 + x) = (Nat.succ ·) := by
  funext
  apply Nat.add_comm

example : (fun (x : Nat) => x + 1) = (Nat.succ ·) := by
  rfl

Anyway, thanks for the great book!

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/TypeClasses/StandardClasses.lean around lines 144–145 and compare the two function-equality examples in the issue. Check whether the text should explain the one-line proof or use the definitionally equal form; done means the book’s statement and accompanying explanation accurately reflect the intended Lean proof.

Written by the indexing model from the issue text.

Assessment

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.