Zulip Chat Archive
Stream: lean4
Topic: Decidable equality
Pavel Shuhray (Mar 22 2022 at 12:25):
Hi
universe u
constant T : Type u
I want to say "T is a fixed type with decidable equality". How can I do it? Please, give a complete solution.
Mario Carneiro (Mar 22 2022 at 12:50):
it depends on what you mean by fixed. Usually variable (T : Type u) [DecidableEq T]
is sufficient
Marcus Rossel (Mar 22 2022 at 13:38):
Pavel Shuhray said:
I want to say "T is a fixed type with decidable equality". How can I do it? Please, give a complete solution.
I think I've tried to do the same thing before: Opaque type with interface
Adapting that approach to your case would yield:
private constant _T : Σ T : Type _, DecidableEq T := Sigma.mk Unit inferInstance
def T : Type _ := _T.fst
instance : DecidableEq T := _T.snd
(But I think you should really consider Mario's version unless you have strong reasons to use a constant.)
Pavel Shuhray (Mar 24 2022 at 10:51):
Are there "parameters" in Lean4?
Henrik Böving (Mar 24 2022 at 10:52):
You'll have to explain what you mean by that
Pavel Shuhray (Mar 24 2022 at 10:53):
In Lean3 I can write
parameter x : A
Horatiu Cheval (Mar 24 2022 at 10:55):
No, see this thread: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/parameter
Horatiu Cheval (Mar 24 2022 at 10:57):
But Sebastian also gives there a way users can implement parameter
themselves.
Last updated: Dec 20 2023 at 11:08 UTC