leanprover / leanprover/lean4

"bad" simp lemmas can lead to `acyclic` tactic failure with `simp` recursion limit

Open
#3,907 2 comments 0 reactions 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
  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.
Description

I assume acyclic should now use omega instead of simp_arith

Context
Steps to Reproduce
import Mathlib.Algebra.Order.Monoid.Lemmas
import Mathlib.Data.Nat.Basic

@[simp] theorem succ_le_iff_lt: n + 1 ≤ k ↔ n < k := sorry

inductive Foo 
| mk (x y: Foo)

set_option trace.Meta.Tactic.acyclic true in
example {x y: Foo} (h: x = Foo.mk y x): False := nomatch h

Expected behavior: acyclic can handle such a goal

Actual behavior: acyclic tactic produces an error message:

[Meta.Tactic.acyclic] failed with
    tactic 'simp' failed, nested error:
    maximum recursion depth has been reached (use `set_option maxRecDepth <num>` to increase limit) 
Versions

4.7.0-rc2

Additional Information
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

Reproduce the example using the listed Mathlib imports and set_option trace.Meta.Tactic.acyclic true. Start by tracing where acyclic invokes simp or simp_arith, then investigate the reported assumption that it should use omega; done means the example succeeds without increasing maxRecDepth and the recursion error no longer occurs.

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
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.