-
Notifications
You must be signed in to change notification settings - Fork 753
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Prerequisites
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Put the following function into a file
def foo (pat : ByteArray) (stackPos : Nat) (hst : stackPos < pat.size) : { n : Nat // n ≤ stackPos } :=
if h : stackPos = 0 then
⟨0, by simp⟩
else
go (stackPos - 1) (by omega)
where
go (guess : Nat) (hg : guess < stackPos) : { n : Nat // n ≤ stackPos } :=
if pat[guess] = pat[stackPos] then
⟨guess + 1, by omega⟩
else if h : guess = 0 then
⟨0, by simp⟩
else
have : (foo pat (guess - 1) (by omega)) < guess := by
have := (foo pat (guess - 1) (by omega)).property
omega
go (foo pat (guess - 1) (by omega)) (by omega)Running the file in VS Code (or live.lean-lang.org) or building it via lake build will cause Lean to indefinitely use a CPU core while continuously eating memory.
This seems to be related to termination checking, since turning the function into a partial function makes it go through instantly.
Expected behavior: Function definition is accepted or rejected
Actual behavior: Hang
Versions
4.27.0 and nightly-2026-02-09
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working