Zulip Chat Archive
Stream: Is there code for X?
Topic: Construct finset from set
Marcus Rossel (Jul 14 2021 at 16:28):
Is there a way of directly constructing a finset
from a set
and a proof that this set is finite?
Something like:
def f : finset nat := {
s := some_set
proof := begin ... end -- some_set.finite
}
Rémy Degenne (Jul 14 2021 at 16:29):
Marcus Rossel (Jul 14 2021 at 16:30):
That's what I'm using at the moment, but that isn't quite what I want, because then I have to split the definition into a lemma and a definition:
lemma proof : some_set.finite := begin ... end
def f : finset nat := proof.to_finset
Eric Wieser (Jul 14 2021 at 16:39):
You can combine those in a single definition with have
Marcus Rossel (Jul 14 2021 at 16:41):
@Eric Wieser
How?
Eric Wieser (Jul 14 2021 at 16:45):
def f : finset nat :=
have proof : some_set.finite := begin ... end,
proof.to_finset
Last updated: Dec 20 2023 at 11:08 UTC