-
Notifications
You must be signed in to change notification settings - Fork 808
dsimp simplifies too much #5755
Copy link
Copy link
Closed
Labels
P-mediumWe may work on this issue if we find the timeWe may work on this issue if we find the timebugSomething isn't workingSomething isn't working
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
Consider:
inductive C : Type where
| C1 (b : Bool) : C
| C2 (c1 c2 : C) : C
deriving Inhabited
open C
def id1 (b : Bool) : C := C1 b
def id2 (c : C) : C :=
match c with
| C1 b => id1 b
| C2 c1 c2 => C2 (id2 c1) (id2 c2)
theorem id2_is_idempotent : id2 (id2 c) ≠ id2 c :=
match c with
| C1 b => by
dsimp only [id2]
-- HERE , which implies that id2 (id1 b) --> id1 b happened at some point
sorry
| C2 _ _ => by
sorryAt "HERE" the goal is id1 b ≠ id1 b so dsimp did a id2 (id1 b) --> id1 b rewrite at some
point (as confirmed by trace.Meta.Tactic.simp.rewrite), this happens despite dsimp only
being instructed to unfold id2, not id1.
Expected behavior: id2 (id1 b) should not be rewritten to id1, this breaks abstraction without the user intending so.
Actual behavior: id2 (id1 b) get's rewritten to id1 b
Versions
"4.12.0-nightly-2024-10-17"
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P-mediumWe may work on this issue if we find the timeWe may work on this issue if we find the timebugSomething isn't workingSomething isn't working