leanprover / leanprover/lean4

Cases on mvar leading to crash/stackoverflow

Open
#13,820 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
Description

example : ∃ c, c = true := by
refine ⟨?c, ?_⟩
cases ?c with
| true => sorry
| false => sorry

The following program seems to stackoverflow/crash both locally trying multiple versions of lean/lean lsp and the lean live on nightly.

(For example it might stall for a very long time, report "Lean server printed an error: Stack overflow detected. Aborting.", or "Server process for file:///.../test_rbtree_typecheck_timeout.lean crashed, likely due to a stack overflow or a bug. Code: -32902"

Context

[Broader context that the issue occurred in. If there was any prior discussion on the Lean Zulip, link it here as well.]

Steps to Reproduce
  1. Try to run the above minimized lean program.

Expected behavior: [Clear and concise description of what you expect to happen]

Make forward progress.

Actual behavior: [Clear and concise description of what actually happens]

Lean seems to crash/become non-responsive.

Versions

[Output of #version or #eval Lean.versionString]
[OS version, if not using live.lean-lang.org.]

https://live.lean-lang.org/#project=lean-nightly&codez=ATCmA8EMFsAcBtTAFzEMBEwDGAaLwC8wALgE4CuSyhARgJ4BQIIJoAZgJYB2SgF%2BQD8OYHwD6gS%2FJGTTJADOoaUMzAA7uyIALCSAA%2BxcknwA%2BYNID2JEgybAdrSPFkEjp87SA

Additional Information

I think the closest issues I found were https://github.com/leanprover/lean4/issues/2504, https://github.com/leanprover/lean4/issues/4219, https://github.com/leanprover/lean4/issues/2506 though I would not say any of these directly apply.

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimized Lean program from the issue against the Lean nightly release or the linked live.lean-lang.org example, confirming the stack overflow or crash when cases is applied to the metavariable. Trace the elaboration path involved and add a regression test for this program; done means it makes forward progress without crashing or becoming non-responsive.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.