algebraixlib.algebras.multisets module

This module contains the algebra of multisets and related functionality.

class algebraixlib.algebras.multisets.Algebra[source]

Bases: object

Provide the operations and relations that are members of the algebra of multisets.

This class contains only static member functions. Its main purpose is to provide a namespace for and highlight the operations and relations that belong to the algebra of multisets. All member functions are also available at the enclosing module scope.

static union()[source]

Return the multiset union of multiset1 with multiset2.

Returns:The multiset union of multiset1 and multiset2 or Undef() if multiset1 or multiset2 are not instances of Multiset.
static intersect()[source]

Return the multiset intersection of multiset1 with multiset2.

Returns:The multiset intersection of multiset1 and multiset2 or Undef() if multiset1 or multiset2 are not instances of Multiset.
static minus()[source]

Return the multiset difference of multiset1 and multiset2.

Returns:The multiset difference of multiset1 and multiset2 or Undef() if multiset1 or multiset2 are not instances of Multiset.
static add()[source]

Return the multiset addition of multiset1 and multiset2.

Returns:The multiset addition of multiset1 and multiset2 or Undef() if multiset1 or multiset2 are not instances of Multiset.
static substrict()[source]

Return multiset1 if multiset1 is a subset of multiset2 or Undef() if not.

Returns:The substriction of multiset1 and multiset2 (may return Undef()). Also return Undef() if multiset1 or multiset2 are not instances of Multiset.
static superstrict()[source]

Return multiset1 if multiset1 is a superset of multiset2 or Undef() if not.

Returns:The superstriction of multiset1 and multiset2 (may return Undef()). Also return Undef() if multiset1 or multiset2 are not instances of Multiset.
static is_subset_of()[source]

Return whether multiset1 is a submultiset of multiset2.

Returns:True if multiset1 is a submultiset of multiset2, False if not. Return Undef() if multiset1 or multiset2 are not instances of Multiset.
static is_superset_of()[source]

Return whether multiset1 is a supermultiset of multiset2.

Returns:True if multiset1 is a supermultiset of multiset2, False if not. Return Undef() if multiset1 or multiset2 are not instances of Multiset.
algebraixlib.algebras.multisets.union()

Convenience redirection to Algebra.union.

algebraixlib.algebras.multisets.intersect()

Convenience redirection to Algebra.intersect.

algebraixlib.algebras.multisets.minus()

Convenience redirection to Algebra.minus.

algebraixlib.algebras.multisets.add()

Convenience redirection to Algebra.add.

algebraixlib.algebras.multisets.substrict()

Convenience redirection to Algebra.substrict.

algebraixlib.algebras.multisets.superstrict()

Convenience redirection to Algebra.superstrict.

algebraixlib.algebras.multisets.is_subset_of()

Convenience redirection to Algebra.is_subset_of.

algebraixlib.algebras.multisets.is_superset_of()

Convenience redirection to Algebra.is_superset_of.

algebraixlib.algebras.multisets.get_name() → str[source]

Return the name and ground set of this algebra in string form.

algebraixlib.algebras.multisets.get_ground_set() → algebraixlib.structure.Structure[source]

Return the ground set of this algebra.

algebraixlib.algebras.multisets.get_absolute_ground_set() → algebraixlib.structure.Structure[source]

Return the absolute ground set of this algebra.

algebraixlib.algebras.multisets.is_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]

Return whether obj is a member of the ground set of this algebra.

Returns:True if obj is a multiset (an instance of Multiset), False if not.
algebraixlib.algebras.multisets.is_member_or_undef(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]
Return whether obj is either a member of the ground set of this algebra
or Undef.
Returns:True if obj is either a relation or Undef, False if not.
algebraixlib.algebras.multisets.is_absolute_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]

Return whether obj is a member of the absolute ground set of this algebra.

Returns:True if obj is an absolute multiset, False if not.
algebraixlib.algebras.multisets.demultify()[source]

Return a set based on multiset that contains all elements without multiples.

algebraixlib.algebras.multisets.big_union()[source]

Return the set_of_multisets union of all members of set_of_multisets.

Returns:The multiset union of all members of set_of_multisets or Undef() if set_of_multisets is not a Set or any of its members are not instances of Multiset.
algebraixlib.algebras.multisets.big_intersect()[source]

Return the multiset intersection of all members of multiset.

Returns:The multiset intersection of all members of set_of_multisets or Undef() if set_of_multisets is not a Set or any of its members are not instances of Multiset.
algebraixlib.algebras.multisets.single(mset: algebraixlib.mathobjects.multiset.Multiset)[source]

Return the single element of mset.

Returns:Return the single element of mset, or Undef() if mset has not exactly one element with a multiplicity of 1 or is not a multiset (that is, an instance of Multiset).
algebraixlib.algebras.multisets.some(mset: algebraixlib.mathobjects.multiset.Multiset)[source]

Return ‘some’ element of mset. Use with caution - may be non-deterministic.

Returns:Some element of mset, or Undef() if mset is empty or is not a multiset (that is, an instance of Multiset).

Note

This function should only be used in contexts where the way the return value will be utilized by the calling function is invariant of the particular element returned; the element of mset that is returned is non-deterministic.

This function is only intended to be used in (mostly implementation) scenarios where it does not matter which element of mset is retrieved, because the expressions that consume that value will be invariant with respect to the exact element of mset that is returned.