leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
3.88k stars 329 forks source link

Stack overflow in `refine'` #4144

Closed eric-wieser closed 2 weeks ago

eric-wieser commented 2 weeks ago

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

The following code crashes the lean server:

example : False := by
  refine' absurd (congrArg (·.1) sorry) _

Context

Zulip thread

Steps to Reproduce

  1. Run the code above

Expected behavior: Lean server doesn't crash, some error is probably emitted on the tactic

Actual behavior: Lean server does crash

Versions

v4.8.0rc1

Impact

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

eric-wieser commented 2 weeks ago

The cause seems to be infinite recursion in instantiateExprMVars, which cannot call withIncRecDepth because: