Antitone Galois connection
The galactic.algebras.connection
module.
It defines several classes for dealing with antitone Galois connection defined on powersets:
- class AbstractPolarity(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents polarities for antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- abstract __call__(*others, elements=None)
Call this instance.
- Parameters:
*others (
AbstractClosed
[TypeVar
(_S
)]) – A sequence of AbstractClosed.elements (
Iterable
[TypeVar
(_S
)] |None
, default:None
) – An optional iterable of elements.
- Returns:
The correspondence of the arguments.
- Return type:
AbstractClosed[_T]
- Raises:
- class AbstractPolarityEnumerable(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents enumerable polarities for antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- abstract __call__(*others, elements=None)
Call this instance.
- Parameters:
*others (
AbstractClosed
[TypeVar
(_S
)]) – A sequence of AbstractClosed.elements (
Iterable
[TypeVar
(_S
)] |None
, default:None
) – An optional iterable of elements.
- Returns:
The correspondence of the arguments.
- Return type:
- Raises:
- class AbstractGaloisConnection(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- abstract property polarities: tuple[AbstractPolarity[_S, _T], AbstractPolarity[_T, _S]]
Get the polarities.
- Returns:
The polarities.
- Return type:
tuple[AbstractPolarity[_S, _T], AbstractPolarity[_T, _S]]
- Raises:
- abstract property closures: tuple[AbstractClosure[_S], AbstractClosure[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_S], AbstractClosure[_T]]
- Raises:
- class AbstractGaloisConnectionLeftEnumerable(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- abstract property polarities: tuple[AbstractPolarity[_S, _T], AbstractPolarityEnumerable[_T, _S]]
Get the polarities.
- Returns:
The polarities.
- Return type:
tuple[AbstractPolarity[_S, _T], AbstractPolarityEnumerable[_T, _S]]
- Raises:
- abstract property closures: tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
- Raises:
- class AbstractGaloisConnectionRightEnumerable(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- abstract property polarities: tuple[AbstractPolarityEnumerable[_S, _T], AbstractPolarity[_T, _S]]
Get the polarities.
- Returns:
The polarities.
- Return type:
tuple[AbstractPolarityEnumerable[_S, _T], AbstractPolarity[_T, _S]]
- Raises:
- abstract property closures: tuple[AbstractClosure[_S], AbstractClosureEnumerable[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_S], AbstractClosureEnumerable[_T]]
- Raises:
- class AbstractGaloisConnectionEnumerable(*args, **kwargs)
Bases:
Protocol
[_S
,_T
]It represents antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
Examples
>>> from galactic.algebras.examples.connection 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 polarities: tuple[AbstractPolarityEnumerable[_S, _T], AbstractPolarityEnumerable[_T, _S]]
Get the polarities.
- Returns:
The polarities.
- Return type:
tuple[AbstractPolarityEnumerable[_S, _T], AbstractPolarityEnumerable[_T, _S]]
- Raises:
- abstract property closures: tuple[AbstractClosureEnumerable[_S], AbstractClosureEnumerable[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosureEnumerable[_S], AbstractClosureEnumerable[_T]]
- Raises:
- class GaloisConnectionMixin
Bases:
Generic
[_S
,_T
]It represents antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
Examples
>>> from galactic.algebras.examples.connection 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[_S], AbstractClosure[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosure[_S], AbstractClosure[_T]]
- class GaloisConnectionLeftEnumerableMixin
Bases:
GaloisConnectionMixin
[_S
,_T
],Generic
[_S
,_T
]It represents left enumerable antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- property closures: tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
- class GaloisConnectionRightEnumerableMixin
Bases:
GaloisConnectionMixin
[_S
,_T
],Generic
[_S
,_T
]It represents right enumerable antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- property closures: tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosureEnumerable[_S], AbstractClosure[_T]]
- class GaloisConnectionEnumerableMixin
Bases:
GaloisConnectionMixin
[_S
,_T
],Generic
[_S
,_T
]It represents enumerable antitone Galois connection.
the type
_S
represents the type of the elements of the left part of the Galois connection;the type
_T
represents the type of the elements of the right part of the Galois connection.
- property closures: tuple[AbstractClosureEnumerable[_S], AbstractClosureEnumerable[_T]]
Get the closures.
- Returns:
The closures.
- Return type:
tuple[AbstractClosureEnumerable[_S], AbstractClosureEnumerable[_T]]