Zulip Chat Archive
Stream: mathlib4
Topic: convert tactic hangs
Eric Wieser (Oct 03 2024 at 21:58):
The following code results in a hang that maxHeartbeats
seems unable to stop:
import Mathlib.Tactic.Convert
def Nat.choose : Nat → Nat → Nat
| _, 0 => 1
| 0, _ + 1 => 0
| n + 1, k + 1 => choose n k + choose n (k + 1)
structure Foo (n : Nat)
set_option maxHeartbeats 200 -- be quick please
def foo (x : Foo (Nat.choose 2000 1500)) : Foo (Nat.choose 2000 500) := by
convert x using 1 -- hangs forever
if you add and remove a space after the 1
, then you get a new hanging lean background process each time
Johan Commelin (Oct 04 2024 at 03:31):
I guess this is a bug in convert
, right? Or do you think it is lower-level than that?
Jireh Loreaux (Oct 04 2024 at 04:01):
isn't this exactly caused by lean4#5565 ?
Johan Commelin (Oct 04 2024 at 04:09):
Sounds likely, yes! @Eric Wieser do you agree this is probably the cause?
Jireh Loreaux (Oct 04 2024 at 04:13):
@Kim Morrison I think you asked if there was a reason to cut a bugfix release about lean4#5565. This might be it.
Eric Wieser (Oct 04 2024 at 08:45):
I think this might also be a lower level issue caused by using MVarId.assign
, which would pass a huge Nat to the kernel where no further timeout checks are made
Eric Wieser (Oct 04 2024 at 08:50):
Jireh Loreaux said:
Kim Morrison I think you asked if there was a reason to cut a bugfix release about lean4#5565. This might be it.
Even if we don't do a 4.12.0 bug fix release, it would be good to get the lean4#5566 patch into a 4.13.0rc2
Yaël Dillies (Oct 04 2024 at 08:53):
You mean 4.13.0-rc3 ?
Eric Wieser (Oct 04 2024 at 09:12):
Nope, looks like I mean rc4
Kyle Miller (Oct 06 2024 at 01:34):
I don't think this is a convert
issue, given that rfl
hangs too:
def foo : Foo (Nat.choose 2000 1500) = Foo (Nat.choose 2000 500) := by
rfl
Eric Wieser (Oct 06 2024 at 06:49):
Huh, I was sure I tried that when minimizing!
Johan Commelin (Oct 07 2024 at 14:51):
@Kyle Miller Is this a known issue? Or should we report it at core?
Eric Wieser (Oct 07 2024 at 14:54):
Maybe this message is relevant?
Kyle Miller (Oct 07 2024 at 16:11):
Seems like a good idea to report it. I don't immediately see any related issues.
Johan Commelin (Oct 09 2024 at 06:16):
Is this the same issue as https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.E2.9C.94.20.60rfl.60.20regression.3F ?
Kyle Miller (Oct 09 2024 at 06:29):
One difference is that this example never triggers a timeout, which on its own is worth figuring out. The other thread at least gets a "max recursion depth".
Johan Commelin (Oct 09 2024 at 06:30):
That's a good point
Last updated: May 02 2025 at 03:31 UTC