Zulip Chat Archive

Stream: Is there code for X?

Topic: set to finset equiv


Yakov Pechersky (May 04 2021 at 22:32):

Something akin to

noncomputable def classicize {α : Type*} [decidable_eq α] [fintype α] : set α  finset α := sorry

Eric Rodriguez (May 04 2021 at 22:43):

doesn't seem too hard to prove using set.to_finset if it's not around

Eric Rodriguez (May 04 2021 at 22:44):

although funnily enough my computer won't find an instance of fintype ↥s from fintype α

Eric Wieser (May 04 2021 at 22:45):

You need decidability for that, Eric

Eric Rodriguez (May 04 2021 at 22:45):

decidable_pred s?

Eric Wieser (May 04 2021 at 22:46):

decidable_pred (\mem s)

Eric Rodriguez (May 04 2021 at 22:47):

@[simp] lemma finset.to_finset_coe {α : Type*} (s : finset α) : set.to_finset (s : set α) = s :=
by rw set.to_finset; ext; simp

noncomputable def classicize {α : Type*} [decidable_eq α] [fintype α] : set α  finset α :=
{ to_fun := λ s, by {classical; exact set.to_finset s},
  inv_fun := λ s, s,
  left_inv := λ x, by simp,
  right_inv := λ x, by { dsimp only, convert finset.to_finset_coe x } }

Eric Rodriguez (May 04 2021 at 22:47):

terrible code but it will work

Eric Wieser (May 04 2021 at 22:47):

Do we have docs#set.to_finset_coe?

Eric Rodriguez (May 04 2021 at 22:47):

we have the set = set version, finset = finset isn't there

Eric Wieser (May 04 2021 at 22:48):

What's that one called?

Eric Rodriguez (May 04 2021 at 22:49):

docs#set.coe_to_finset

Eric Rodriguez (May 04 2021 at 22:57):

edited to something slightly less terrible, but it's not quite as clean as it should be due to different fintype instances, same thing as earlier today lol

Eric Rodriguez (May 04 2021 at 22:57):

maybe that's why it's not been put in yet

Kevin Buzzard (May 05 2021 at 06:28):

There should be a map from set to finset sending infinite sets to zero


Last updated: Dec 20 2023 at 11:08 UTC