algebraixlib.mathobjects.set module¶
Provide the class Set
; it represents a set.
-
algebraixlib.mathobjects.set.
make_set_unchecked
(*args)[source]¶ Factory wrapper to create a
Set
(unchecked version).
-
class
algebraixlib.mathobjects.set.
Set
(*args, direct_load=False)[source]¶ Bases:
algebraixlib.mathobjects.mathobject.MathObject
A set containing zero or more different
MathObject
instances.Parameters: - args – Zero or more unnamed arguments that are placed into the created
Set
. If you want to pass in an iterable, you need to prefix it with an asterisk*
. If no argument is given or the given iterable is empty, an empty set is created. (A Python string of typestr
is an iterable, but it is considered a single, non-iterable argument.) - direct_load – (Optional) Set to
True
if you know that all arguments (or all elements of the iterable) are instances ofMathObject
.
-
data
¶ Read-only; return the elements of this instance as a
frozenset
ofMathObject
instances.
-
has_element
(elem: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
elem
is an element of this set.elem
must be aMathObject
.For a more relaxed version (that auto-converts non-
MathObject
arguments into instances ofAtom
) see__contains__
and the constructelem in Set
.
-
get_ground_set
() → algebraixlib.structure.Structure[source]¶ Return the ground set of the lowest-level algebra of this
Set
.
-
__ne__
(other)[source]¶ Implement value-based inequality. Return
True
if type or set elements don’t match.
-
__contains__
(item)[source]¶ Return
True
ifitem
is a member of this set. Ifitem
is not aMathObject
, it is converted into anAtom
.This allows Boolean expressions of the form
element in Set
.
-
__call__
()[source]¶ With the syntax
mo(left)
, return the right associated withleft
.Parameters: Returns: If
self
is a function, return the right component of the couplet that has as left the single argument if one exists; returnUndef()
if no couplet with the given left exists. Also returnUndef()
ifself
is not a function.
-
__le__
(other, NotImplemented=NotImplemented)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
-
__getitem__
()[source]¶ With the syntax
mo[left]
, return a set of rights associated withleft
.Parameters: left – The left component of the couplet(s) of which the right component(s) are returned. Returns: If self
is a relation, return a set that contains the right(s) of the couplet(s) that have a left component that matchesleft
. Ifself
is a clan, return a set that contains the right(s) of all couplets in all relations that have a left component that matchesleft
. (The returned set may be empty if no couplet with the given left exists.) ReturnUndef()
ifself
is neither a relation nor a clan.
- args – Zero or more unnamed arguments that are placed into the created