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
withmultiset2
.Returns: The multiset union of multiset1
andmultiset2
orUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
intersect
()[source]¶ Return the multiset intersection of
multiset1
withmultiset2
.Returns: The multiset intersection of multiset1
andmultiset2
orUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
minus
()[source]¶ Return the multiset difference of
multiset1
andmultiset2
.Returns: The multiset difference of multiset1
andmultiset2
orUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
add
()[source]¶ Return the multiset addition of
multiset1
andmultiset2
.Returns: The multiset addition of multiset1
andmultiset2
orUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
substrict
()[source]¶ Return
multiset1
ifmultiset1
is a subset ofmultiset2
orUndef()
if not.Returns: The substriction of multiset1
andmultiset2
(may returnUndef()
). Also returnUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
superstrict
()[source]¶ Return
multiset1
ifmultiset1
is a superset ofmultiset2
orUndef()
if not.Returns: The superstriction of multiset1
andmultiset2
(may returnUndef()
). Also returnUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
is_subset_of
()[source]¶ Return whether
multiset1
is a submultiset ofmultiset2
.Returns: True
ifmultiset1
is a submultiset ofmultiset2
,False
if not. ReturnUndef()
ifmultiset1
ormultiset2
are not instances ofMultiset
.
-
static
is_superset_of
()[source]¶ Return whether
multiset1
is a supermultiset ofmultiset2
.Returns: True
ifmultiset1
is a supermultiset ofmultiset2
,False
if not. ReturnUndef()
ifmultiset1
ormultiset2
are 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
obj
is a member of the ground set of this algebra.Returns: True
ifobj
is a multiset (an instance ofMultiset
),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
ifobj
is either a relation orUndef
,False
if not.- Return whether
-
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
ifobj
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
orUndef()
ifset_of_multisets
is not aSet
or 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_multisets
orUndef()
ifset_of_multisets
is not aSet
or 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()
ifmset
has 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()
ifmset
is 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
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 ofmset
that is returned.