Zulip Chat Archive
Stream: Is there code for X?
Topic: Disjoint union of finsets
Yaël Dillies (Jan 10 2022 at 11:36):
I have two finsets s and t that I know to be disjoint. How can I make their union without bothering the end user with decidability assumptions?
Yaël Dillies (Jan 10 2022 at 11:38):
In my case, it's actually making a finset (α ⊕ β) from s : finset α and t : finset β.
Anne Baanen (Jan 10 2022 at 11:44):
Probably best to directly use the constructor, i.e. finset.mk (s + t : multiset α) sorry, where sorry is something like docs#multiset.nodup_add_of_nodup
Yaël Dillies (Jan 10 2022 at 11:45):
I'll define finset.sum then.
Yaël Dillies (Jan 10 2022 at 12:10):
Urgh, finset.sum is obviously already a thing.
Anne Baanen (Jan 10 2022 at 12:15):
Semi-serious option: finset.add to generalize + on multisets?
Yaël Dillies (Jan 10 2022 at 12:16):
But what about the α ⊕ β-specific operation? I'm thinking of finset.disj_sum
Yaël Dillies (Jan 10 2022 at 12:17):
Actually, my original idea doesn't work because disjoint on finsets requires decidable_eq because it goes through the semilattice_inf instance.
Yaël Dillies (Jan 10 2022 at 12:18):
Back when we had finset.disjoint, this wouldn't have been a problem.
Yaël Dillies (Jan 11 2022 at 10:26):
Actually, docs#finset.disj_union is already a thing
Last updated: May 02 2025 at 03:31 UTC