Zulip Chat Archive
Stream: lean4
Topic: instBEqNat = instBEq := rfl --fails
Johan Commelin (Jan 11 2023 at 07:00):
src4#instBEq src4#instBEqNat are both in Init/Prelude
and don't seem to be defeq. Is that intentional, or should it be fixed?
example : instBEqNat = instBEq := rfl --fails
Sebastian Ullrich (Jan 11 2023 at 08:50):
It does look intentional: https://github.com/leanprover/lean4/commit/da55789c26d7e6030927eb0815796f93c8fa8f50
Johan Commelin (Jan 11 2023 at 08:56):
Hmm, so do you have a recommendation for the issue I linked to?
Johan Commelin (Jan 11 2023 at 08:57):
Should we just pass the instance around explicitly, in cases like this?
Sebastian Ullrich (Jan 11 2023 at 09:35):
I'm not sure. Note that with instBEq
you lose the accelerated kernel reduction, which I think is the whole reason for this particular setup
Sebastian Ullrich (Jan 11 2023 at 09:37):
Why do the used lemmas demand instBEq
? It would be nicer if they merely demanded LawfulBEq
.
Johan Commelin (Jan 11 2023 at 09:40):
I guess it's just the instance that TC found...
Gabriel Ebner (Jan 11 2023 at 19:36):
We've been talking about making Decidable
extend BEq
in core, which would fix this diamond.
Gabriel Ebner (Jan 11 2023 at 19:38):
I wanted to wait with this change until after the port, because I expect some (easily fixable) breakage in mathlib. (For example, cases h
with h : Decidable p
would no longer be the moral equivalent of by_cases p
).
Yury G. Kudryashov (Jan 15 2023 at 06:47):
Do you mean something like this (not tested)?
class Decidable (p : Prop) :=
(decide : Bool)
(decide_iff : decide ↔ p)
With this definition, will we still need BEq
?
Chris Hughes (Jan 15 2023 at 06:58):
The difficulty is that Lean is supposed to be a programming language to also be used by people who have no interest in proof and those people probably never want to see Prop
at all.
Mario Carneiro (Jan 15 2023 at 07:05):
Importantly, Decidable
can't replace BEq
because a BEq
is not necessarily lawful. Gabriel's proposal can eliminate LawfulBEq
however, making it equivalent to DecidableEq
.
Yury G. Kudryashov (Jan 15 2023 at 07:07):
With this definition we can have
class DecidableEq (α : Type*) extends BEq α :=
(beq_iff_eq : ∀ x y : α, x == y ↔ x = y)
instance [DecidableEq α] {x y : α} : Decidable (x = y) where
decide := x == y
decide_iff := DecidableEq.beq_iff_eq x y
Mario Carneiro (Jan 15 2023 at 07:08):
right
Mario Carneiro (Jan 15 2023 at 07:08):
that's what Gabriel's PR lean4#2038 implements
Kevin Buzzard (Jul 20 2023 at 10:07):
Someone else just independently discovered this issue (and mentioned it to me on the Discord). The idea was to wait until after the port -- is that now?
Last updated: Dec 20 2023 at 11:08 UTC