algebraixlib.algebras.clans module¶
This module contains the algebra of clans and related functionality.
A clan is also a set (of relations), and inherits all operations
of the algebra of sets. These are provided in sets
.
-
class
algebraixlib.algebras.clans.
Algebra
[source]¶ Bases:
object
Provide the operations and relations that are members of the algebra of clans.
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 clans. All member functions are also available at the enclosing module scope.
-
static
transpose
()[source]¶ Return a clan where all relations have their left and right components swapped.
Returns: The unary extension of transposition from the algebra of relations to the algebra of clans, applied to clan
, orUndef()
ifclan
is not a clan.
-
static
compose
()[source]¶ Return the composition of
clan1
withclan2
.Returns: The binary extension of composition from the algebra of relations to the algebra of clans, applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
cross_union
()[source]¶ Return the cross-union of
clan1
andclan2
.The cross-union of two clans is a clan that contains the result of unioning every relation from one clan with every relation from the other clan.
Returns: The binary extension of union from the algebra of relations (which inherits it from the algebra of sets) to the algebra of clans applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
cross_functional_union
()[source]¶ Return the cross-functional union of
clan1
andclan2
.The cross-functional union of two clans is the cross-union of these clans, but removing all resulting relations that are not functions.
Returns: The binary extension of the functional union from the algebra of relations to the algebra of clans, applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
lhs_cross_functional_union
()[source]¶ Return the lhs-cross-functional union (‘left join’) of
lhs
andrhs
.This operation results in a clan that contains every relation of a cross-functional union, but also contains all relations in
lhs
that are not already part of one of the resulting relations.Parameters: lhs – All relations in this clan are guaranteed to be represented in the result. Returns: The resulting clan or Undef()
iflhs
orrhs
are not clans.
-
static
cross_right_functional_union
()[source]¶ Return the cross-right-functional union of
clan1
andclan2
.The cross-right-functional union of two clans is the cross-union of these clans, but removing all resulting relations that are not right-functional.
Returns: The binary extension of the right-functional union from the algebra of relations to the algebra of clans, applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
cross_intersect
()[source]¶ Return the cross-intersection of
clan1
andclan2
.The cross-intersection of two clans is a clan that contains the result of intersecting every relation from one clan with every relation from the other clan.
Returns: The binary extension of intersection from the algebra of relations (which inherits it from the algebra of sets) to the algebra of clans applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
substrict
()[source]¶ Return the substriction of
clan1
andclan2
.The substriction of two clans is a clan that contains all relations from
clan1
that are a subset of a relation fromclan2
.Returns: The binary extension of substriction from the algebra of sets to the algebra of clans applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
superstrict
()[source]¶ Return the superstriction of
clan1
andclan2
.The superstriction of two clans is a clan that contains all relations from
clan1
that are a superset of a relation fromclan2
.Returns: The binary extension of superstriction from the algebra of sets to the algebra of clans applied to clan1
andclan2
, orUndef()
ifclan1
orclan2
are not clans.
-
static
-
algebraixlib.algebras.clans.
transpose
()¶ Convenience redirection to
Algebra.transpose
.
-
algebraixlib.algebras.clans.
compose
()¶ Convenience redirection to
Algebra.compose
.
-
algebraixlib.algebras.clans.
cross_union
()¶ Convenience redirection to
Algebra.cross_union
.
-
algebraixlib.algebras.clans.
cross_functional_union
()¶ Convenience redirection to
Algebra.cross_functional_union
.
-
algebraixlib.algebras.clans.
lhs_cross_functional_union
()¶ Convenience redirection to
Algebra.lhs_cross_functional_union
.
-
algebraixlib.algebras.clans.
cross_right_functional_union
()¶ Convenience redirection to
Algebra.cross_right_functional_union
.
-
algebraixlib.algebras.clans.
cross_intersect
()¶ Convenience redirection to
Algebra.cross_intersect
.
-
algebraixlib.algebras.clans.
substrict
()¶ Convenience redirection to
Algebra.substrict
.
-
algebraixlib.algebras.clans.
superstrict
()¶ Convenience redirection to
Algebra.superstrict
.
-
algebraixlib.algebras.clans.
get_name
() → str[source]¶ Return the name and ground set of this algebra in string form.
-
algebraixlib.algebras.clans.
get_ground_set
() → algebraixlib.structure.Structure[source]¶ Return the ground set of this algebra.
-
algebraixlib.algebras.clans.
get_absolute_ground_set
() → algebraixlib.structure.Structure[source]¶ Return the absolute ground set of this algebra.
-
algebraixlib.algebras.clans.
is_member
(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
obj
is a member of the ground set of this algebra.return: True
ifobj
is a clan,False
if not.Note
This function may call
get_ground_set()
onobj
. The result of this operation is cached.
-
algebraixlib.algebras.clans.
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.clans.
is_absolute_member
(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
obj
is a member of the absolute ground set of this algebra.return: True
ifobj
is an absolute clan,False
if not.Note
This function may call
get_ground_set()
onobj
. The result of this operation is cached.
-
algebraixlib.algebras.clans.
get_lefts
()[source]¶ Return the set of the left components of all couplets in all relations in
clan
.Returns: The union of the left sets of all relations in clan
orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
get_rights
()[source]¶ Return the set of the right components of all couplets in all relations in
clan
.Returns: The union of the right sets of all relations in clan
orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_functional
(clan, _checked=True) → bool[source]¶ Return whether
clan
is functional.Returns: True
if every relation inclan
is functional (is a function),False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_right_functional
(clan, _checked=True) → bool[source]¶ Return whether
clan
is right-functional.Returns: True
if every relation inclan
is right-functional,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_regular
(clan, _checked=True) → bool[source]¶ Return whether
clan
is (left-)regular.Returns: True
ifclan
is regular,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_right_regular
(clan, _checked=True) → bool[source]¶ Return whether
clan
is right-regular.Returns: True
ifclan
is right-regular,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_reflexive
(clan, _checked=True) → bool[source]¶ Return whether
clan
is reflexive.Returns: True
if every relation inclan
is reflexive,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_symmetric
(clan, _checked=True) → bool[source]¶ Return whether
clan
is symmetric.Returns: True
if every relation inclan
is symmetric,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
is_transitive
(clan, _checked=True) → bool[source]¶ Return whether
clan
is transitive.Returns: True
if every relation inclan
is transitive,False
if not, orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
project
()[source]¶ Return a clan that contains only the couplets with lefts from
clan
that matchlefts
.Parameters: - clan – The source data. Must be a clan.
- lefts – The names of the left components to match. (If you want to pass in an
iterable, you need to prefix it with an asterisk
*
.)
Returns: The projection of
clan
(a clan that contains only couplets with left components as indicated bylefts
), orUndef()
ifclan
is not a clan.
-
algebraixlib.algebras.clans.
from_set
()[source]¶ Return a clan where all relations contain a single couplet with the same left component.
Parameters: - left – The left component of all couplets in the returned clan.
- values – The right components of the couplets in the returned clan. (If you want
to pass in an iterable, you need to prefix it with an asterisk
*
.)
Returns: A clan where every relation consists of a single couplet with a left component of
left
and a right component fromvalues
.
-
algebraixlib.algebras.clans.
from_dict
()[source]¶ Return a clan with a single relation where the couplets are the elements of
dict1
.
-
algebraixlib.algebras.clans.
diag
()[source]¶ Return a clan diagonal of the arguments.
Parameters: args – Pass in the elements from which the clan diagonal is formed. (If you want to pass in an iterable, you need to prefix it with an asterisk *
.)