Documentation

CslibFrontier.Foundations.Combinatorics.SetPartition.Basic

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 #

Main results #

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.

noncomputable def Cslib.SetPartition.blocks {α : Type u_1} (s : Setoid α) :

The number of blocks of a partition, that is, of its equivalence classes.

Blocks #

The discrete partition has one block for each element.

theorem Cslib.SetPartition.blocks_pos {α : Type u_1} [Finite α] [Nonempty α] (s : Setoid α) :
0 < blocks s

A partition of a finite nonempty type has at least one block.

theorem Cslib.SetPartition.blocks_eq_one_iff {α : Type u_1} [Nonempty α] {s : Setoid α} :
blocks s = 1 ↔ s = ⊤

A partition of a nonempty type has one block exactly when it is the one-block partition ⊤.

theorem Cslib.SetPartition.blocks_le_of_le {α : Type u_1} [Finite α] {r s : Setoid α} (h : r ≤ s) :

A coarser partition has at most as many blocks.

theorem Cslib.SetPartition.eq_of_le_of_blocks_eq {α : Type u_1} [Finite α] {r s : Setoid α} (h : r ≤ s) (hb : blocks r = blocks s) :
r = s

A partition is determined by any coarser partition with as many blocks.

theorem Cslib.SetPartition.blocks_lt_of_lt {α : Type u_1} [Finite α] {r s : Setoid α} (h : r < s) :

A strictly coarser partition of a finite type has strictly fewer blocks.

theorem Cslib.SetPartition.blocks_le_card {α : Type u_1} [Finite α] (s : Setoid α) :

A partition of a finite type has at most as many blocks as there are elements.

theorem Cslib.SetPartition.blocks_ker {α : Type u_1} {β : Type u_2} (f : α → β) :

The blocks of the kernel of f, the partition into the fibers of f, correspond to the values of f.

A lower bound on the number of partitions #

Many partitions: $j^{N-j} \le B_N$, by placing the first $j$ elements in distinct blocks and each of the others in one of these blocks (and trivially $j^0 = 1 \le B_N$ when $N \le j$).