Zulip Chat Archive

Stream: new members

Topic: How to use let rec in proofs?


Jiatong Yang (Feb 08 2025 at 05:21):

(Lean4)
It seems that if using let rec like this, the new definition will not appear in the context.

import Mathlib

theorem t0 : True := by
  let rec f :   
  | 0 => 0
  | 1 => 1
  | n + 2 => f n + f (n + 1)
  have h : f 0 = 0 := rfl

Aaron Liu (Feb 08 2025 at 17:26):

Kyle Miller said:

It's because let rec defers creating the auxiliary definitions until everything is elaborated. It's a limitation that I don't expect to see change.


Last updated: May 02 2025 at 03:31 UTC