-
Notifications
You must be signed in to change notification settings - Fork 715
Description
Prerequisites
Please put an X between the brackets as you perform the following steps:
- Check that your issue is not already filed:
https://github.com/leanprover/lean4/issues - Reduce the issue to a minimal, self-contained, reproducible test case.
Avoid dependencies to Mathlib or Batteries. - Test your test case against the latest nightly release, for example on
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
In some situations, simp? creates a simp only call wrongly unfolding let variables.
Context
Zulip discussion at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/simp.3F.20adding.20let.20reduction/near/493985664
Steps to Reproduce
Run the following snippet:
theorem foo {α : Type} (c : α → α) (x : α) : c x = x := by
let d := c
let e := d
change e x = x
simp? [e]
sorryExpected behavior:
simp? [e] should suggest simp only [e]
Actual behavior:
simp? [e] suggests simp only [e, d], pulling in d while this is not used in the simp call
Another example of misbehavior (probably due to the same bug) is
theorem foo {α : Type} (c : α → α) (x : α) : c x = x := by
let d := c
change d x = x
-- simp [d]
have : x = x := by
simp?
sorrywhere the simp? call unfolds to simp only, unless you uncomment simp [d] two lines above: then simp? unfolds to simp only [d].
Versions
Lean 4.16.0-nightly-2025-01-15
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.