Zulip Chat Archive
Stream: mathlib4
Topic: Fin DecidableEq diamond
Yaël Dillies (Sep 24 2023 at 16:35):
There's currently a diamond on DecidableEq (Fin n)
. One comes from Core (docs#instDecidableEqFin), the other one comes from LinearOrder (Fin n)
(docs#instDecidableEq). What should we do?
import Mathlib.Data.Fin.Basic
example (n : ℕ) : instDecidableEqFin n = instDecidableEq := rfl -- fails
Eric Rodriguez (Sep 24 2023 at 16:39):
Isn't the decidable eq on linear orders free to set for this reason?
Eric Rodriguez (Sep 24 2023 at 16:39):
@loogle LinearOrder (Fin _)
loogle (Sep 24 2023 at 16:39):
:search: Fin.instLinearOrderFin
Yaël Dillies (Sep 24 2023 at 16:40):
Yeah sure, but both decidability instances do "the same thing" by reducing x = y
for x y : Fin n
to x.val = y.val
. They just do it slightly differently.
Eric Wieser (Sep 24 2023 at 17:32):
I think the problem here is docs#LinearOrder.liftWithOrd
Eric Wieser (Sep 24 2023 at 17:33):
That should be taking DecidableEq
as an argument, probably
Eric Wieser (Sep 24 2023 at 17:34):
Though changing the core implementation to be defeq by coincidence seems pretty reasonable too
Eric Rodriguez (Sep 24 2023 at 21:35):
I would agree that liftWithOrd should be fixed
Eric Wieser (Sep 24 2023 at 22:32):
I suspect the default implementation there is going to be the right one for everything except weird instances in core
Last updated: Dec 20 2023 at 11:08 UTC