# algebraixlib.partition module¶

Operations for partitioning sets and multisets.

algebraixlib.partition.partition(set_or_mset, class_invariant_func)[source]

Return set_or_mset partitioned according to class_invariant_func.

Parameters: set_or_mset – The set or multiset that is to be partitioned. class_invariant_func – A function from elements of set_or_mset to MathObjects. It defines an equivalence relation on set_or_mset such that $x, y \in set\_or\_mset : x \equiv y \iff class\_invariant\_func(x) = class\_invariant\_func(y)$ A set with structure $$P(set\_or\_mset.ground\_set)$$ that defines a partition on set_or_mset, imposed by the equivalence relation defined by the function class_invariant_func.
algebraixlib.partition.make_labeled_partition(set_or_mset, class_invariant_func)[source]

Return a ‘labeled’ partition of set_or_mset, partitioned according to class_invariant_func.

Parameters: set_or_mset – The set or multiset that is to be partitioned. class_invariant_func – A function from elements of set_or_mset to MathObjects. It defines an equivalence relation on set_or_mset such that $x, y \in set\_or\_mset : x \equiv y \iff class\_invariant\_func(x) = class\_invariant\_func(y)$ A function with structure $$P(range(class\_invariant\_func) \times P(set\_or\_mset.ground\_set))$$ that maps the range of class_invariant_func when applied to set_or_mset to sets of elements of set_or_mset that belong to the given equivalence class.