algebraixlib.mathobjects.set module¶
Provide the class Set
; it represents a set.
-
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
.
-
get_right_set
() → 'P( M )'[source]¶ Get the right set for this
Set
. ReturnUndef()
if not applicable.
-
is_functional
() → bool[source]¶ Return whether
self
is functional. ReturnUndef()
if not applicable.
-
is_right_functional
() → bool[source]¶ Return whether
self
is right-functional. ReturnUndef()
if not applicable.
-
is_transitive
() → bool[source]¶ Return whether
self
is transitive. ReturnUndef()
if not applicable.
-
is_equivalence_relation
() → bool[source]¶ Return whether
self
is an equivalence relation. ReturnUndef()
if not applicable.
-
__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__
(*args, **kwargs) → '( M )'[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.
-
__getitem__
(left) → 'P( M )'[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.
-
cache_is_relation
(value: bool)[source]¶ Cache whether
self
is or is not a relation. See [PropCache].
-
cache_is_clan
(value: bool)[source]¶ Cache whether
self
is or is not a clan. See [PropCache].
-
cache_is_functional
(value: bool)[source]¶ Cache whether
self
is or is not functional. See [PropCache].
-
cache_is_right_functional
(value: bool)[source]¶ Cache whether
self
is or is not a right-functional. See [PropCache].
-
cache_is_regular
(value: bool)[source]¶ Cache whether
self
is or is not regular. See [PropCache].
-
cache_is_reflexive
(value: bool)[source]¶ Cache whether
self
is or is not reflexive. See [PropCache].
-
cache_is_symmetric
(value: bool)[source]¶ Cache whether
self
is or is not symmetric. See [PropCache].
-
cache_is_transitive
(value: bool)[source]¶ Cache whether
self
is or is not transitive. See [PropCache].
- args – Zero or more unnamed arguments that are placed into the created