galactic.algebras.connection.core#
galactic.algebras.connection.core module
Defines classes for working with antitone Galois connections on power sets:
- class Polarity(*args, **kwargs)#
Bases:
Protocol,Generic[_S,_T]Represents polarities for antitone Galois connections.
the type _S represents the element type of the left part of the antitone Galois connection
the type _T represents the element type of the right part of the antitone Galois connection
- abstractmethod __call__(*elements)#
Compute the correspondence for the given elements.
- Parameters:
*elements (
Iterable[TypeVar(_S)]) β An optional iterable of elements- Returns:
The corresponding closed set
- Return type:
Closed[_T]
- Raises:
NotImplementedError β If the method is not implemented
- class GaloisConnection#
Bases:
Protocol,Generic[_S,_T]Represents antitone Galois connections.
the type _S is the element type of the left side of the antitone Galois connection
the type _T is the element type of the right side of the antitone Galois connection
Examples
>>> from galactic.algebras.connection.examples.numerical.core import ( ... IntegerConnection, ... ) >>> connection = IntegerConnection( ... [2, 3, 4, 5, 6], ... [10, 12, 18, 24, 36, 48, 30, 60], ... ) >>> polarities = connection.polarities >>> polarities (<...MultiplePolarity...>, <...DivisorPolarity...>) >>> list(polarities[0]([2, 3, 4])) [12, 24, 36, 48, 60] >>> list(polarities[1](polarities[0]([2, 3, 4]))) [2, 3, 4, 6] >>> list(polarities[1]([30])) [2, 3, 5, 6] >>> list(polarities[0](polarities[1]([30]))) [30, 60] >>> list(polarities[1]([10])) [2, 5] >>> list(polarities[0](polarities[1]([10]))) [10, 30, 60] >>> closures = connection.closures >>> list(closures[0]([2, 3])) [2, 3, 6] >>> list(closures[1]([30])) [30, 60]
- abstract property polarities: tuple[Polarity[_S, _T], Polarity[_T, _S]]#
Get the polarities of the Galois connection.
- Returns:
The pair of polarities
- Return type:
- Raises:
NotImplementedError β If the method is not implemented