-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#eval
on let rec
causes error in kernel
#2374
Comments
kmill
added a commit
to kmill/lean4
that referenced
this issue
Oct 9, 2024
Makes `#eval` use the `elabMutualDef` machinery to process all the `let rec`s that might appear in the expression. This now works: ```lean #eval let rec fact (n : Nat) : Nat := match n with | 0 => 1 | n' + 1 => n * fact n' fact 5 ``` Closes leanprover#2374
kmill
added a commit
to kmill/lean4
that referenced
this issue
Oct 9, 2024
Makes `#eval` use the `elabMutualDef` machinery to process all the `let rec`s that might appear in the expression. This now works: ```lean let rec fact (n : Nat) : Nat := match n with | 0 => 1 | n' + 1 => n * fact n' fact 5 ``` Closes leanprover#2374
kmill
added a commit
to kmill/lean4
that referenced
this issue
Oct 11, 2024
Makes `#eval` use the `elabMutualDef` machinery to process all the `let rec`s that might appear in the expression. This now works: ```lean let rec fact (n : Nat) : Nat := match n with | 0 => 1 | n' + 1 => n * fact n' fact 5 ``` Closes leanprover#2374
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Description
Running
#eval
on an expression that contains alet rec
cause the kernel to report an error: "(kernel) declaration has metavariables". I understand the(kernel)
in this message indicates a bug where the evaluator sends an incorrect term to the kernel. Ideally evaluation would succeed for these expressions, or failing that, at least the evaluator would report an error instead of the kernel.It seems the presence of
let rec
itself is the cause, not actual recursion or even using thelet
-introduced binding. When the same expression is instead used in the body as adef
and then thedef
is given to#eval
, evaluation succeeds. Similarly, when thelet rec
becomes a simplelet
, everything works.Original Zulip thread.
I found a similar but seemingly distinct issue #2071.
Steps to Reproduce
Minimized reproduction:
Expected behavior: Both
#eval
s should return 37. Or the error in the kernel reported by the second#eval
should become an error in the elaborator.Actual behavior: Error in the kernel.
Reproduces how often: Always: all occurrences of
let rec
in#eval
I could think of caused this error. Removing therec
keyword causes#eval
to succeed.Versions
The text was updated successfully, but these errors were encountered: