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:
objectProvide 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()ifclanis not a clan.
-
static
compose()[source]¶ Return the composition of
clan1withclan2.Returns: The binary extension of composition from the algebra of relations to the algebra of clans, applied to clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
cross_union()[source]¶ Return the cross-union of
clan1andclan2.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 clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
cross_functional_union()[source]¶ Return the cross-functional union of
clan1andclan2.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 clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
lhs_cross_functional_union()[source]¶ Return the lhs-cross-functional union (‘left join’) of
lhsandrhs.This operation results in a clan that contains every relation of a cross-functional union, but also contains all relations in
lhsthat 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()iflhsorrhsare not clans.
-
static
cross_right_functional_union()[source]¶ Return the cross-right-functional union of
clan1andclan2.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 clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
cross_intersect()[source]¶ Return the cross-intersection of
clan1andclan2.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 clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
substrict()[source]¶ Return the substriction of
clan1andclan2.The substriction of two clans is a clan that contains all relations from
clan1that 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 clan1andclan2, orUndef()ifclan1orclan2are not clans.
-
static
superstrict()[source]¶ Return the superstriction of
clan1andclan2.The superstriction of two clans is a clan that contains all relations from
clan1that 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 clan1andclan2, orUndef()ifclan1orclan2are 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
objis a member of the ground set of this algebra.return: Trueifobjis a clan,Falseif 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
objis either a member of the ground set of this algebra - or
Undef.
Returns: Trueifobjis either a relation orUndef,Falseif not.- Return whether
-
algebraixlib.algebras.clans.is_absolute_member(obj: algebraixlib.mathobjects.mathobject.MathObject) → bool[source]¶ Return whether
objis a member of the absolute ground set of this algebra.return: Trueifobjis an absolute clan,Falseif 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 clanorUndef()ifclanis 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 clanorUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_functional(clan, _checked=True) → bool[source]¶ Return whether
clanis functional.Returns: Trueif every relation inclanis functional (is a function),Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_right_functional(clan, _checked=True) → bool[source]¶ Return whether
clanis right-functional.Returns: Trueif every relation inclanis right-functional,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_regular(clan, _checked=True) → bool[source]¶ Return whether
clanis (left-)regular.Returns: Trueifclanis regular,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_right_regular(clan, _checked=True) → bool[source]¶ Return whether
clanis right-regular.Returns: Trueifclanis right-regular,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_reflexive(clan, _checked=True) → bool[source]¶ Return whether
clanis reflexive.Returns: Trueif every relation inclanis reflexive,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_symmetric(clan, _checked=True) → bool[source]¶ Return whether
clanis symmetric.Returns: Trueif every relation inclanis symmetric,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.is_transitive(clan, _checked=True) → bool[source]¶ Return whether
clanis transitive.Returns: Trueif every relation inclanis transitive,Falseif not, orUndef()ifclanis not a clan.
-
algebraixlib.algebras.clans.project()[source]¶ Return a clan that contains only the couplets with lefts from
clanthat 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()ifclanis 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
leftand 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 *.)