Zulip Chat Archive

Stream: Is there code for X?

Topic: relabeling Fin n


Alex Kontorovich (Apr 19 2023 at 20:41):

Suppose I have a map f : Fin n → X, and a subset S of Fin n of cardinality m = S.card; I'd like to create a map g : Fin m → Xby restricting f to the elements of S. Is there a clean way to do this? Thanks!

Adam Topaz (Apr 19 2023 at 20:47):

docs#fintype.equiv_fin composed with f, I suppose?

Adam Topaz (Apr 19 2023 at 20:48):

you may need to cast to get the right m in the fin m as well, but that should be straightforward.

Eric Wieser (Apr 19 2023 at 20:59):

Can you write out the full mwe?

Eric Wieser (Apr 19 2023 at 21:00):

This sounds like something that can be done computably if the details are what I think they are

Eric Wieser (Apr 19 2023 at 21:11):

(concretely, I think the statement I think we should have is [FinEnum X] (s : Finset X) : FinEnum s)

Alex Kontorovich (Apr 19 2023 at 21:19):

That's great, thanks! I'll try to play with that in my application...


Last updated: Dec 20 2023 at 11:08 UTC