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

Deriving DecidableEq fails in implicit argument #2914

Closed
1 task done
b-mehta opened this issue Nov 19, 2023 · 1 comment · Fixed by #2918
Closed
1 task done

Deriving DecidableEq fails in implicit argument #2914

b-mehta opened this issue Nov 19, 2023 · 1 comment · Fixed by #2918
Labels
bug Something isn't working

Comments

@b-mehta
Copy link
Contributor

b-mehta commented Nov 19, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

Can't derive DecidableEq when implicit argument is used in structure

Context

structure Foo where
  a : List Nat
  ha : ∀ {i}, i ∈ a → 0 < i
deriving DecidableEq

Zulip discussion: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/deriving.20DecidableEq.20fails.20with.20implicit.20argument. The equivalent in Lean 3 succeeds. This was observed in a porting note in mathlib from February 2023 but seemingly never reported.

Steps to Reproduce

Code as above.

Expected behavior: A DecidableEq instance is generated for Foo.

Actual behavior: Fails with error:

tactic 'subst' failed, invalid equality proof, it is not of the form (x = t) or (t = x)
  _ = _
x✝¹x✝: Foo
a✝¹: List Nat
a✝b✝: ∀ {i : Nat}, i ∈ a✝¹ → 0 < i
h✝: _ = _
⊢ Decidable ({ a := a✝¹, ha := a✝ } = { a := a✝¹, ha := b✝ })

Versions

Lean (version 4.3.0-rc2)
MacOS

Additional Information

None

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@b-mehta b-mehta added the bug Something isn't working label Nov 19, 2023
@kmill
Copy link
Collaborator

kmill commented Nov 19, 2023

It's worth mentioning that when the type of ha is ∀ i, i ∈ a → 0 < i then the deriving handler succeeds.

kmill added a commit to kmill/lean4 that referenced this issue Nov 20, 2023
kmill added a commit to kmill/lean4 that referenced this issue Nov 20, 2023
kmill added a commit to kmill/lean4 that referenced this issue Nov 20, 2023
kmill added a commit to kmill/lean4 that referenced this issue Nov 20, 2023
kmill added a commit to kmill/lean4 that referenced this issue Nov 20, 2023
semorrison pushed a commit that referenced this issue Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants