Skip to content

dsimp simplifies too much #5755

@hargoniX

Description

@hargoniX

Prerequisites

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

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
    sorry

At "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumWe may work on this issue if we find the timebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions