leanprover / leanprover/lean4

`simp_all` deleting hypotheses

Open
#11,291 2 comments 2 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

Prerequisites

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

Description

The simp_all tactic does not behave as expected when it is both unfolding a definition and simplifying an implication. This can cause important hypotheses to disappear from the context, potentially making the theorem unprovable.

Context

I personally use simp_all a lot, usually via aesop. This bug happens pretty frequently after, say, an induction step. The induction hypothesis will then have the form of an implication and can get deleted by this bug.

As a workaround, one can use simp_all only [def]; simp_all.

See discussion #lean4 > simp_all behavior.

Steps to Reproduce
  1. Define a predicate which unfolds to another predicate, e.g.
opaque p (n : Nat) : Prop 
def P (n : Nat) : Prop := p n
  1. Run simp_all on a goal which contains an implication of type P n → P m and P n.
example (h : P 0 → P 1) (h0 : P 0) : Target := by simp_all [P] 

See mwe.

Expected behavior: After simp_all [P], goal is h : p 1, h0 : p 0 ⊢ Target

Actual behavior: After simp_all [P], goal is h0 : p 0 ⊢ Target

Versions

4.25.0
4.27.0-nightly-2025-11-20

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

Begin with the minimal self-contained reproduction in the issue and inspect the simp_all tactic behavior when unfolding P and simplifying an implication. Compare the resulting context with the expected h : p 1 and h0 : p 0, using the simp_all only [P]; simp_all workaround as a reference for completion.

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
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.