Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: dsimp does not close reflexive equality goals if they are wrapped in metadata #2514

Closed
1 task done
kmill opened this issue Sep 5, 2023 · 0 comments · Fixed by #2776
Closed
1 task done

bug: dsimp does not close reflexive equality goals if they are wrapped in metadata #2514

kmill opened this issue Sep 5, 2023 · 0 comments · Fixed by #2776

Comments

@kmill
Copy link
Collaborator

kmill commented Sep 5, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

dsimp has a feature where it can close goals that can be solved by Eq.refl if the goal is obviously an equality and the LHS and RHS are defeq (up to reducible transparency). For example

example : ∀ (x : α × α), x = id x := by
  intro p
  -- `⊢ (x, y) = id (x, y)`
  dsimp
  -- closed goal

However, sometimes tactics can insert metadata around this equality and then dsimp no longer tries to use Eq.refl.

example : ∀ (x : α × α), x = id x := by
  intro (x, y)
  -- `⊢ (x, y) = id (x, y)`
  dsimp
  -- not done yet, goal `⊢ (x, y) = (x, y)`
  rfl

One can see the metadata (noImplicitLambda) by setting set_option pp.raw true.

(This was reported by Heather Macbeth on Zulip)

Here is another test that demonstrates the issue. Removing the have line removes the need for the rfl. The have line can also be replaced by refine no_implicit_lambda% ?_ to more explicitly introduce metadata.

example {α : Type _} (n : α) : n = n := by
  have := 0
  dsimp
  rfl

In Lean.Meta.dsimpGoal one can see that there is targetNew.eq? instead of targetNew.consumeMData.eq?, which is likely the cause. Other pattern matches in that function refer to targetNew.consumeMData rather than targetNew.

Versions

leanprover/lean4:v4.0.0-rc4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant