Zulip Chat Archive
Stream: new members
Topic: Lifting instances from other types
Fingy Soupy (May 09 2022 at 18:34):
I am defining a small wrapper type around another type and I would like my new type to "inherit" all of the instances of the other type
For example,
structure nat_plus :=
(v : nat)
instance : has_lift nat nat_plus := ⟨nat_plus.mk⟩
instance : linear_order nat_plus := ↑nat.linear_order -- Does not work
Here I have wrapped the nat type and would like my new type to use nat's linear_order. Is there a way to do this using coe/lift and without having to wrap each individual field in every instance I would like to copy over?
Eric Wieser (May 09 2022 at 19:00):
There are helpers like docs#function.injective.add_comm_monoid
Eric Wieser (May 09 2022 at 19:01):
Fingy Soupy (May 09 2022 at 19:32):
This is perfect thanks,
Is there a reason there is no complete_lattice.lift?
Rémy Degenne (May 09 2022 at 19:46):
There is docs#function.injective.complete_lattice
Fingy Soupy (May 09 2022 at 19:50):
Thanks! :) I guess I was looking in the wrong place
Eric Wieser (May 09 2022 at 20:31):
There's an open issue about standardizing the names
Last updated: Dec 20 2023 at 11:08 UTC