algebraixlib.mathobjects.set module¶
A math object that represents a set.
-
class
algebraixlib.mathobjects.set.
Set
(*args, direct_load=False)[source]¶ Bases:
algebraixlib.mathobjects.mathobject.MathObject
A set consisting of zero or more different
MathObject
instances.- Construct a
Set
from a singleMathObject
or value or an iterable collection of - such.
Parameters: - args – Zero or more unnamed arguments that are placed into the created set.
- direct_load – Flag they allows bypassing the normal auto-converting of elements.
The elements must all be instances of
MathObject
.
If no argument is given or the given iterable is empty, an empty set is created.
Note
A string is an iterable, so an explicit conversion to an
Atom
(or wrapping it into brackets or braces) is required for multi-character strings.-
data
¶ Read-only; return the elements of this instance as a
frozenset
ofMathObject
instances.
-
cardinality
¶ Read-only; return the number of elements in the set.
-
is_empty
¶ Return
True
if this set is empty.
-
has_element
(elem: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return
True
ifelem
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
.
-
is_left_regular
() → bool[source]¶ Return
True
if thisSet
is left-regular. ReturnUndef
if not applicable.
-
is_left_functional
() → bool[source]¶ Return
True
if thisSet
is left-functional. ReturnUndef
if not applicable.
-
is_right_functional
() → bool[source]¶ Return
True
if thisSet
is right-functional. ReturnUndef
if not applicable.
-
is_bijection
() → bool[source]¶ Return
True
if thisSet
is both left and right-functional. ReturnUndef
if not applicable.
-
is_reflexive
() → bool[source]¶ Return
True
if thisSet
is reflexive. ReturnUndef
if not applicable.
-
is_symmetric
() → bool[source]¶ Return
True
if thisSet
is symmetric. ReturnUndef
if not applicable.
-
is_transitive
() → bool[source]¶ Return
True
if thisSet
is transitive. ReturnUndef
if not applicable.
-
is_equivalence_relation
() → bool[source]¶ Return
True
if thisSet
is reflexive, symmetric, and transitive. 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
.
- Construct a