Zulip Chat Archive
Stream: Is there code for X?
Topic: nonempty_of_nonempty_subtype
Yaël Dillies (Oct 02 2021 at 20:52):
Does this exist? And is there a problem with making it an instance?
instance nonempty_of_nonempty_subtype {α : Type*} {p : α → Prop} [h : nonempty (subtype p)] :
nonempty α :=
h.elim (λ x, ⟨x.val⟩)
Eric Wieser (Oct 03 2021 at 08:20):
I think that's nonempty.map subtype.val
?
Gabriel Ebner (Oct 03 2021 at 15:47):
And is there a problem with making it an instance?
Yes, it will cause type class search to go through nonempty nat
, nonempty (subtype ?m_1)
, nonempty (subtype ?m_2)
, ...
Last updated: Dec 20 2023 at 11:08 UTC