Zulip Chat Archive

Stream: Is there code for X?

Topic: Splitting a finite list as sublists


Antoine Chambert-Loir (Oct 27 2022 at 20:01):

Is there a code for taking a set with at least n elements, a partition of n and obtaining a list of lists with the correct sizes and no duplicate, such as

lemma list.exists_pw_disjoint_with_card {c : list } (hc : c.sum  fintype.card α) :
   (o : list (list α)),
  (list.map (list.length) o = c)  ( s  o, list.nodup s)  list.pairwise list.disjoint o :=
sorry

(In fact, I proved that, but maybe I shouldn't have…)
This allowed me to characterize all cycle types of permutations on a set of given cardinality:

lemma equiv.perm_with_cycle_type_nonempty_iff {m : multiset } :
  (m.sum  fintype.card α  ( a  m, 2  a))  (equiv.perm_with_cycle_type α m).nonempty :=
sorry

Martin Dvořák (Oct 27 2022 at 20:42):

Is (∀ s ∈ o, list.nodup s) ∧ list.pairwise list.disjoint o the same as list.nodup o.join or I got it wrong?

Patrick Johnson (Oct 27 2022 at 20:53):

docs#list.nodup_join

Antoine Chambert-Loir (Oct 28 2022 at 13:54):

That allows to simplify the statement, thanks for the link!


Last updated: Dec 20 2023 at 11:08 UTC