Zulip Chat Archive

Stream: general

Topic: decidable_eq to decidable_pred


Quanwen Chen (Jul 26 2022 at 10:19):

If I have a type Q (Q : Type), and its equality is decidable, i.e., [decQ : decidable_eq Q], how can I say a function, λ q : Q, q = q is a decidable_pred?

Eric Wieser (Jul 26 2022 at 10:28):

Are you looking for λ q, deqQ q q?

Quanwen Chen (Jul 26 2022 at 10:30):

Thank you so much!

Anne Baanen (Jul 26 2022 at 10:54):

The typeclass system should be smart enough to figure this out as well, so you could write something like (by apply_instance : decidable_pred (@eq Q)).

Eric Wieser (Jul 26 2022 at 11:38):

That's not the instance being asked for here

Eric Wieser (Jul 26 2022 at 11:38):

That's defeq to deqQ in a reducible way

Eric Wieser (Jul 26 2022 at 11:39):

Admittedly needing decidability of x = x is a rather strange request, as it's just true!

Quanwen Chen (Jul 26 2022 at 13:55):

Thanks for all the help. I am trying to figure out how to use decidable_eq and decidable_pred within decidable type class, so I asked the trivial question.


Last updated: Dec 20 2023 at 11:08 UTC