algebraixlib.algebras.multisets module¶
This module contains the algebra of multisets and related functionality.
-
class
algebraixlib.algebras.multisets.Algebra[source]¶ Bases:
objectProvide 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
multiset1withmultiset2.Returns: The multiset union of multiset1andmultiset2orUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
intersect()[source]¶ Return the multiset intersection of
multiset1withmultiset2.Returns: The multiset intersection of multiset1andmultiset2orUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
minus()[source]¶ Return the multiset difference of
multiset1andmultiset2.Returns: The multiset difference of multiset1andmultiset2orUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
add()[source]¶ Return the multiset addition of
multiset1andmultiset2.Returns: The multiset addition of multiset1andmultiset2orUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
substrict()[source]¶ Return
multiset1ifmultiset1is a subset ofmultiset2orUndef()if not.Returns: The substriction of multiset1andmultiset2(may returnUndef()). Also returnUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
superstrict()[source]¶ Return
multiset1ifmultiset1is a superset ofmultiset2orUndef()if not.Returns: The superstriction of multiset1andmultiset2(may returnUndef()). Also returnUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
is_subset_of()[source]¶ Return whether
multiset1is a submultiset ofmultiset2.Returns: Trueifmultiset1is a submultiset ofmultiset2,Falseif not. ReturnUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
is_superset_of()[source]¶ Return whether
multiset1is a supermultiset ofmultiset2.Returns: Trueifmultiset1is a supermultiset ofmultiset2,Falseif not. ReturnUndef()ifmultiset1ormultiset2are not instances ofMultiset.
-
static
-
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
objis a member of the ground set of this algebra.Returns: Trueifobjis a multiset (an instance ofMultiset),Falseif not.
-
algebraixlib.algebras.multisets.is_member_or_undef(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ - Return whether
objis either a member of the ground set of this algebra - or
Undef.
Returns: Trueifobjis either a relation orUndef,Falseif not.- Return whether
-
algebraixlib.algebras.multisets.is_absolute_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
objis a member of the absolute ground set of this algebra.Returns: Trueifobjis an absolute multiset,Falseif not.
-
algebraixlib.algebras.multisets.demultify()[source]¶ Return a set based on
multisetthat 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_multisetsorUndef()ifset_of_multisetsis not aSetor any of its members are not instances ofMultiset.
-
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_multisetsorUndef()ifset_of_multisetsis not aSetor any of its members are not instances ofMultiset.
-
algebraixlib.algebras.multisets.single(mset: algebraixlib.mathobjects.multiset.Multiset)[source]¶ Return the single element of
mset.Returns: Return the single element of mset, orUndef()ifmsethas not exactly one element with a multiplicity of 1 or is not a multiset (that is, an instance ofMultiset).
-
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, orUndef()ifmsetis empty or is not a multiset (that is, an instance ofMultiset).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
msetthat 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
msetis retrieved, because the expressions that consume that value will be invariant with respect to the exact element ofmsetthat is returned.