Zulip Chat Archive

Stream: lean4

Topic: deriving DecidableEq fails with implicit argument


Bhavik Mehta (Nov 19 2023 at 18:35):

Here's my example:

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

This 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
ab:  {i : Nat}, i  a✝¹  0 < i
h: _ = _
 Decidable ({ a := a✝¹, ha := a } = { a := a✝¹, ha := b })

Is this already known? The equivalent works in Lean 3, and is mentioned in (at least) one porting note in mathlib.

Kyle Miller (Nov 19 2023 at 18:43):

I don't see anything in the issue tracker -- want to create an issue?

It seems it's just the implicit argument. This works:

structure Foo where
  a : List Nat
  ha :  i, i  a  0 < i
deriving DecidableEq

Bhavik Mehta (Nov 19 2023 at 18:44):

Will do.

Bhavik Mehta (Nov 19 2023 at 18:49):

Reported here: https://github.com/leanprover/lean4/issues/2914

Scott Morrison (Nov 20 2023 at 03:18):

@Arthur Adjedj or others who've played with these derive handlers --- any ideas what's happening here? I'd be happy to merge a fix.

Kyle Miller (Nov 20 2023 at 04:07):

lean4#2918

Scott Morrison (Nov 20 2023 at 04:22):

Looks great. I'll merge once the test is moved.


Last updated: Dec 20 2023 at 11:08 UTC