Set partitions and their blocks #
Partitions of a type α are equivalence relations Setoid α, ordered by refinement: r ≤ s when
every block of r lies in a block of s. The discrete partition is ⊥ and the partition with one
block is ⊤. Mathlib's complete lattice on Setoid α provides the join and meet.
The number of blocks of s is blocks s, defined as Nat.card (Quotient s). Coarsening a
partition can only decrease its number of blocks, and a partition is determined by any coarser
partition with as many blocks; so on a finite type the number of blocks is strictly antitone in the
refinement order.
Mathlib declares no finiteness instance on Setoid α. This file adds Finite (Setoid α) for
finite α and no Fintype instance: statements that sum over the partitions assume
[Fintype (Setoid α)], which Fintype.ofFinite provides, and counts are stated with Nat.card.
Main definitions #
Cslib.SetPartition.instFiniteSetoid: a finite type has finitely many partitions.Cslib.SetPartition.blocks: the number of blocks of a partition.
Main results #
Cslib.SetPartition.blocks_eq_one_iff: on a nonempty type,⊤is the only partition with one block.Cslib.SetPartition.blocks_le_of_le: a coarser partition has at most as many blocks.Cslib.SetPartition.eq_of_le_of_blocks_eq: a partition equals any coarser partition with as many blocks.Cslib.SetPartition.blocks_lt_of_lt: on a finite type, a strictly coarser partition has strictly fewer blocks.Cslib.SetPartition.blocks_le_card: a partition has at most as many blocks as elements.Cslib.SetPartition.blocks_ker: the fibers offare as many as the values off.Cslib.SetPartition.pow_le_card_setoid: $j^{N-j} \le B_N$, where $B_N$ is the number of partitions of $N$ elements.
There are finitely many partitions of a finite type. Where a Fintype (Setoid α) instance is
needed, any will do, for example the noncomputable Fintype.ofFinite.
The number of blocks of a partition, that is, of its equivalence classes.
Blocks #
The blocks of the kernel of f, the partition into the fibers of f, correspond to the
values of f.