For a Set , the set of all partitions of is a Preorder (in fact a Partial Order) ordered by fineness: is finer than (; is coarser than ) if for every part there is a part with . Viewing partitions as surjections, is finer than iff there is a function with .
Sources: 7 Sketches §1.1 (Eq. 1.5), Example 1.52, 1.68, Exercises 1.6, 1.42, 1.53, 1.77, 1.103–1.106; §1.4.2.
- The coarsest partition has one part and corresponds to ; the finest has singleton parts and corresponds to (7S Exercise 1.53).
- The Join is the transitive closure of the union of the two relations — the “join of systems” from §1.1. The Meet has parts the nonempty intersections .
- has 15 elements (7S Exercise 1.6); has 5, with 12 pairs (7S Exercise 1.42).
- Any Function induces a Galois Connection (Pushforward and Pullback of Partitions); for surjective the right adjoint is just precomposition (Example 1.68).
- The connectivity observation is monotone (7S Exercise 1.77) but does not preserve joins.
Docs: FinSets · Vignette: partitions
# partitions of {1..n} as surjections; fineness = existence of h with f⋅h == g
using Catlab
f = FinFunction([1,1,2,3], 3) # (12)(3)(4)
g = FinFunction([1,1,1,2], 2) # (123)(4)
function finer(f::FinFunction, g::FinFunction)
# f ≤ g iff g is constant on the fibres of f
all(g(i) == g(j) for i in dom(f), j in dom(f) if f(i) == f(j))
end
finer(f, g) # true-- Mathlib: `Setoid α` is a complete lattice; `r ≤ s` iff r is finer than s
example {α : Type} : CompleteLattice (Setoid α) := inferInstance
#check @Setoid.le_def -- r ≤ s ↔ ∀ a b, r a b → s a bimport Data.List (nub, sort)
-- a partition of a finite list as a list of blocks
type Partition a = [[a]]
finer :: Eq a => Partition a -> Partition a -> Bool
finer p q = all (\blk -> any (\blk' -> all (`elem` blk') blk) q) p