Zulip Chat Archive

Stream: Is there code for X?

Topic: finset of functions


Bolton Bailey (Mar 19 2022 at 19:13):

Given a fintype A and s : finset B, how does one get the finset of all functions from A to B with image in s?

Kyle Miller (Mar 19 2022 at 19:21):

docs#fintype.pi_finset I believe

import data.fintype.basic

open_locale classical

noncomputable
example (A B : Type*) [fintype A] (s : finset B) : finset (A  B) := fintype.pi_finset (λ a, s)

Kyle Miller (Mar 19 2022 at 19:22):

Then docs#fintype.mem_pi_finset gives you the membership property

Yaël Dillies (Mar 19 2022 at 20:57):

You probably rather want docs#finset.pi, except that the return type is a bit offputting. Guess who got confused again


Last updated: Dec 20 2023 at 11:08 UTC