🔌 Antitone Galois connection#
Classes and functions#
galactic.algebras.connection.core
module
It defines several classes for dealing with antitone Galois connection defined on powersets:
- class AbstractPolarity(*args, **kwargs)#
Bases:
Protocol
[_C
,_S
,_D
]It represents polarities for antitone Galois connections.
the type
_C
represents the type of the closed of the left part of the antitone Galois connection;the type
_S
represents the type of the elements of the left part of the antitone Galois connection;the type
_D
represents the type of the closed of the right part of the antitone Galois connection;
- abstractmethod __call__(*others, elements=None)#
Call this instance.
- Parameters:
- Returns:
The correspondence of the arguments.
- Return type:
_D
- Raises:
- class AbstractGaloisConnection(*args, **kwargs)#
Bases:
Protocol
[_C
,_S
,_D
,_T
]It represents antitone Galois connections.
the type
_C
represents the type of the closed of the left part of the antitone Galois connection;the type
_S
represents the type of the elements of the left part of the antitone Galois connection;the type
_D
represents the type of the closed of the right part of the antitone Galois connection;the type
_T
represents the type of the elements of the right part of the antitone Galois connection.
Examples
>>> from galactic.algebras.connection.examples.numerical import IntegerConnection >>> connection = IntegerConnection( ... [2, 3, 4, 5, 6], ... [10, 12, 18, 24, 36, 48, 30, 60], ... ) >>> polarities = connection.polarities >>> list(polarities[0](elements=[2, 3, 4])) [12, 24, 36, 48, 60] >>> list(polarities[1](polarities[0](elements=[2, 3, 4]))) [2, 3, 4, 6] >>> list(polarities[1]([30])) [2, 3, 5, 6] >>> list(polarities[0](polarities[1](elements=[30]))) [30, 60] >>> list(polarities[1]([10])) [2, 5] >>> list(polarities[0](polarities[1](elements=[10]))) [10, 30, 60] >>> closures = connection.closures >>> list(closures[0](elements=[2, 3])) [2, 3, 6] >>> list(closures[1](elements=[30])) [30, 60]
- abstract property closures: tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]#
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]
- Raises:
- abstract property polarities: tuple[AbstractPolarity[_C, _S, _D], AbstractPolarity[_D, _T, _C]]#
Get the polarities.
- Returns:
The polarities.
- Return type:
tuple[AbstractPolarity[_C, _S, _D], AbstractPolarity[_D, _T, _S]]
- Raises:
- class GaloisConnectionMixin#
Bases:
Generic
[_C
,_S
,_D
,_T
]It represents antitone Galois connections.
the type
_C
represents the type of the closed of the left part of the antitone Galois connection;the type
_S
represents the type of the elements of the left part of the antitone Galois connection;the type
_D
represents the type of the closed of the right part of the antitone Galois connection;the type
_T
represents the type of the elements of the right part of the antitone Galois connection.
Examples
>>> from galactic.algebras.connection.examples.numerical import IntegerConnection >>> connection = IntegerConnection( ... [2, 3, 4, 5, 6], ... [10, 12, 18, 24, 36, 48, 30, 60], ... ) >>> polarities = connection.polarities >>> list(polarities[0](elements=[2, 3, 4])) [12, 24, 36, 48, 60] >>> list(polarities[1](polarities[0](elements=[2, 3, 4]))) [2, 3, 4, 6] >>> list(polarities[1]([30])) [2, 3, 5, 6] >>> list(polarities[0](polarities[1](elements=[30]))) [30, 60] >>> list(polarities[1]([10])) [2, 5] >>> list(polarities[0](polarities[1](elements=[10]))) [10, 30, 60] >>> closures = connection.closures >>> list(closures[0](elements=[2, 3])) [2, 3, 6] >>> list(closures[1](elements=[30])) [30, 60]
- property closures: tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]#
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]
Examples#
galactic.algebras.connection.examples.numerical
module
It defines example classes for dealing with antitone finite Galois connection:
- class IntegerConnection(domain, co_domain)#
Bases:
GaloisConnectionMixin
[Divisors
,int
,Multiple
,int
]It represents an antitone Galois connection.
- Parameters:
- property closures: tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]#
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_C, _S], AbstractClosure[_D, _T]]
- property co_domain: FrozenFIFOSet[int]#
Get the co-domain.
- Returns:
The co-domain.
- Return type:
FrozenFIFOSet[int]
- property domain: FrozenFIFOSet[int]#
Get the domain.
- Returns:
The domain.
- Return type:
FrozenFIFOSet[int]
- property polarities: tuple[MultiplePolarity, DivisorPolarity]#
Get the polarities.
- Returns:
The couple of polarities.
- Return type:
- class MultiplePolarity(connection)#
Bases:
object
It represents the polarity of multiple.
- Parameters:
connection (
IntegerConnection
) – The antitone Galois connection
- class Divisors(connection, elements=None)#
Bases:
ClosedEnumerableMixin
[int
],Element
It represents the divisors of some integers.
- Parameters:
connection (
IntegerConnection
) – An antitone Galois connection.elements (
Iterable
[int
] |None
, default:None
) – An iterable of int.
- Raises:
ValueError – If an element is not in the co-domain.
- property closure: AbstractClosure[Divisors, int]#
Get the closure operator.
- Returns:
The closure operator.
- Return type:
- equivalence(element)#
Compute equivalences of the element.
- Parameters:
element (
TypeVar
(_T
)) – The element whose equivalences are requested- Returns:
An iterator over the equivalence elements of element
- Return type:
Iterator[_T]
- join(*others)#
Return the supremum of this element and the others.
- Parameters:
*others (
Self
) – The others elements- Returns:
The join of this element and the others
- Return type:
Self
- join_level(generators)#
Compute the level of an element considering an iterable of generators.
- join_priority(generators)#
Compute the priority of an element considering an iterable of generators.
- meet(*others)#
Return the infimum of this element and the others.
- Parameters:
*others (
Self
) – The others elements- Returns:
The meet of this element and the others
- Return type:
Self
- meet_level(generators)#
Compute the level of an element considering an iterable of generators.
- meet_priority(generators)#
Compute the priority of an element considering an iterable of generators.
- subsumption(element)#
Compute subsumed elements of the element.
- Parameters:
element (
TypeVar
(_T
)) – The element whose subsumed elements are requested- Returns:
An iterator over the subsumed elements of element
- Return type:
Iterator[_T]
- supsumption(element)#
Compute supsumed elements of the element.
Notes
supsumption is a neologism to designate the inverse relation of subsumption.
- Parameters:
element (
TypeVar
(_T
)) – The element whose supsumed elements are requested- Returns:
An iterator over the supsumed elements of element
- Return type:
Iterator[_T]
- class Multiple(connection, elements=None)#
Bases:
ClosedEnumerableMixin
[int
],Element
It represents the multiple of some integers.
- Parameters:
connection (
IntegerConnection
) – The Galois connectionelements (
Iterable
[int
] |None
, default:None
) – An optional iterable of int.
- Raises:
ValueError – If an element is not in the domain.
- property closure: AbstractClosure[Multiple, int]#
Get the closure operator.
- Returns:
The closure operator.
- Return type:
- equivalence(element)#
Compute equivalences of the element.
- Parameters:
element (
TypeVar
(_T
)) – The element whose equivalences are requested- Returns:
An iterator over the equivalence elements of element
- Return type:
Iterator[_T]
- join(*others)#
Return the supremum of this element and the others.
- Parameters:
*others (
Self
) – The others elements- Returns:
The join of this element and the others
- Return type:
Self
- join_level(generators)#
Compute the level of an element considering an iterable of generators.
- join_priority(generators)#
Compute the priority of an element considering an iterable of generators.
- meet(*others)#
Return the infimum of this element and the others.
- Parameters:
*others (
Self
) – The others elements- Returns:
The meet of this element and the others
- Return type:
Self
- meet_level(generators)#
Compute the level of an element considering an iterable of generators.
- meet_priority(generators)#
Compute the priority of an element considering an iterable of generators.
- subsumption(element)#
Compute subsumed elements of the element.
- Parameters:
element (
TypeVar
(_T
)) – The element whose subsumed elements are requested- Returns:
An iterator over the subsumed elements of element
- Return type:
Iterator[_T]
- supsumption(element)#
Compute supsumed elements of the element.
Notes
supsumption is a neologism to designate the inverse relation of subsumption.
- Parameters:
element (
TypeVar
(_T
)) – The element whose supsumed elements are requested- Returns:
An iterator over the supsumed elements of element
- Return type:
Iterator[_T]