algebraixlib.partition module

Operations for partitioning sets and multisets.

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

Return set_ partitioned according to class_invariant_func.

Parameters:
  • set – The set that is to be partitioned.
  • class_invariant_func

    A function from elements of set_ to MathObjects. It defines an equivalence relation on set_ such that

    \[x, y \in set\_ : x \equiv y \iff class\_invariant\_func(x) = class\_invariant\_func(y)\]
Returns:

A set with structure \(P(set\_.ground\_set)\) that defines a partition on set_, imposed by the equivalence relation defined by the function class_invariant_func.

algebraixlib.partition.make_labeled_partition(set_, class_invariant_func)[source]

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

Parameters:
  • set – The set that is to be partitioned.
  • class_invariant_func

    A function from elements of set_ to MathObjects. It defines an equivalence relation on set_ such that

    \[x, y \in set\_ : x \equiv y \iff class\_invariant\_func(x) = class\_invariant\_func(y)\]
Returns:

A function with structure \(P(range(class\_invariant\_func) \times P(set\_.ground\_set))\) that maps the range of class_invariant_func when applied to set_ to sets of elements of set_ that belong to the given equivalence class.