-
Notifications
You must be signed in to change notification settings - Fork 452
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
simp only [Option.some_bind] -> maximum recursion depth has been reached #5935
Comments
Brief inspection: seems to be a complex isDefEq after application of the simp theorem
|
Thank you for investigating. Let me know if I can help in some way to get this resolved. |
Fallout from #5479 maybe? Maybe that defeq check needs to run at reduced transparency? (But this being in the simplifier isn't the transparency already reduced?) |
We get the same error in #5724, where this is due to the kernel trying to reduce a |
We see kernel timeouts about 300 times, which is around 10% of our test cases, so getting kernel issues fixed would help us to get these down, which indeed would be super helpful. |
Ok, not due to #5479 likely, and maybe just a duplicate of #5724: The following avoids the problem: def Option.some_bind' := (fun () => @Option.some_bind) ()
theorem extracted_1 (e : Option (BitVec 32)) :
none =
Option.bind e fun x =>
if x ≥ 32 then none
else
(some ((BitVec.ofInt 32 (-33)).sshiftRight x.toNat)).bind fun y =>
if y = 0#32 then none else some 0#32 := by
simp only [Option.some_bind'] This redefinition of the lemma makes it a non-rfl lemma, so we effectively get the effect of Leo’s #4595 and the kernel is happy. |
It’s still somewhat surprising that this is an elab-time timeout, and not (just) a kernel-time timeout, so more debugging to be done. We’ll probably going to merge #4595 (off by default) so that in these cases you can at least set a flag and hopefully make progress in your work, and maybe it can be on by default eventually. |
Merging #4595 would be incredibly useful. This would also allow us to gather data at a bit wider scale, which can then potentially inform a more complete solution. |
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Context
I checked with @hargoniX and this seems to be a bug.
Steps to Reproduce
Expected behavior: No error recursion error
Actual behavior: Either simp successfully terminating or reporting that it could not find a simp-lemma to apply
Versions
Lean 4.14.0-nightly-2024-11-03
Target: x86_64-unknown-linux-gnu
Further information
On our dataset, this (or a similar) simp error fires 82 times.
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: