Zulip Chat Archive

Stream: new members

Topic: Problem deriving LawfulBEq


aron (Mar 08 2025 at 21:26):

I have this type defined:

structure UnificationVar where
  index : Nat
  deriving BEq, Hashable, LawfulBEq

but there's an error for LawfulBEq: default handlers have not been implemented yet, class: 'LawfulBEq' types: [UnificationVar]

What does this error mean and how can I fix it?

Aaron Liu (Mar 08 2025 at 21:36):

If you just do deriving DecidableEq then both BEq and LawfulBEq are available by typeclass synthesis.

aron (Mar 08 2025 at 22:05):

ah nice, that worked! thanks!

aron (Mar 08 2025 at 22:06):

but could you still help me understand what the original error means?

Aaron Liu (Mar 08 2025 at 22:07):

default handlers have not been implemented yet probably means no one has told Lean what to do when it encounters deriving LawfulBEq.

Kyle Miller (Mar 08 2025 at 22:45):

BEq tends to be misleading to new users. I can't think of any reason you wouldn't want DecidableEq instead of BEq + LawfulBEq. There are some tricky problems you can get into too if you have all three defined.


Last updated: May 02 2025 at 03:31 UTC