Zulip Chat Archive
Stream: new members
Topic: make instance of decidable_eq
Patrick Thomas (Feb 27 2022 at 03:17):
How does one make a type an instance of decidable_eq
? For example, this type:
inductive term : Type
| var : string → term
| func : string → list term → term
Patrick Thomas (Feb 27 2022 at 03:17):
This does not seem to work:
@[derive decidable_eq] inductive term : Type
| var : string → term
| func : string → list term → term
Kevin Buzzard (Feb 27 2022 at 09:12):
You can look at how it's done for nat in the source code. Basically you have to write your own algorithm and prove it works
Mario Carneiro (Feb 27 2022 at 09:13):
The reason is because the derive handler for decidable_eq doesn't handle nested inductives
Kevin Buzzard (Feb 27 2022 at 09:13):
Does string
have decidable_eq? If not then that's the problem
Mario Carneiro (Feb 27 2022 at 09:13):
it does
Kevin Buzzard (Feb 27 2022 at 09:13):
Ok then what Mario says is the problem :-)
Last updated: Dec 20 2023 at 11:08 UTC