Zulip Chat Archive

Stream: Is there code for X?

Topic: Image of function as finset


Adam Topaz (May 27 2021 at 17:59):

Given a type X with [fintype X] and a function f : X \to Y, what's the best way to construct the image of f as a finset Y?

Eric Wieser (May 27 2021 at 18:02):

I guess docs#finset.image doesn't help?

Eric Wieser (May 27 2021 at 18:03):

(finset.univ : finset X).image f looks like it should work

Eric Wieser (May 27 2021 at 18:03):

I don't think there's a finset.range to match set.range

Adam Topaz (May 27 2021 at 18:04):

Yeah the finest.univ trick should do the trick

Bhavik Mehta (May 27 2021 at 18:55):

Adam Topaz said:

Yeah the finest.univ trick should do the trick

Yup this is what I usually use to express this

Eric Wieser (May 27 2021 at 19:22):

It's probably quite reasonable to introduce a finset.range though, since definitionally that might avoids \mem univ here and there

Eric Wieser (May 27 2021 at 19:23):

It would match docs#set.range and docs#monoid_hom.range etc

Eric Rodriguez (May 27 2021 at 19:25):

if it's an embedding, docs#finset.map is really solid too; has good cardinality results and such liek


Last updated: Dec 20 2023 at 11:08 UTC