leanprover / leanprover/lean4

exact? and apply? throw "maximum recursion depth has been reached" when large Nat constants are involved

Open
#5,613 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Consider the MWE (link to playground)

/-
[reduction] unfolded declarations (max: 283, num: 7): ▼
  [] LE.le ↦ 283 
  [] Nat.rec ↦ 131 
  [] Nat.pred ↦ 125 
  [] Nat.sub ↦ 125 
  [] Not ↦ 78 
  [] LT.lt ↦ 78 
  [] Nat.lt ↦ 78 
-/
set_option diagnostics true
def help (x : Nat) : x ≤ 125 := by
  apply? -- maximum recursion depth exceeded.
  exact?

It's not clear what the right behaviour ought to be, I suppose that Lean is trying to unfold the definition of Nat.le.

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

Reproduce the linked playground MWE with diagnostics enabled, focusing on apply? and exact? for the large Nat constant. Read the reported unfolding trace for Nat.le, Nat.rec, Nat.pred, and Nat.sub; the issue is done only when the expected recursion behavior is agreed and the maximum-depth failure is addressed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.