Antitone Galois connection

The galactic.algebras.connection module.

It defines several classes for dealing with antitone Galois connection defined on powersets:

class AbstractLeftPolarity(connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR])

AbstractLeftPolarity is the left component of a Galois connection.

  • the type _TL represents the type of the elements of the left part of the Galois connection;

  • the type _CL represents the type of the closed sets of the left part of the Galois connection;

  • the type _TR represents the type of the elements of the right part of the Galois connection;

  • the type _CR represents the type of the closed sets of the right part of the Galois connection.

abstract __call__(*closed: _CL, elements: Iterable[_TL] | None = None) _CR

Compute the correspondence of elements.

Keyword Arguments:
  • *closed (_CL) – A sequence of finite closed sets.

  • elements (Iterable[_TL], optional) – The elements whose correspondence is requested.

Returns:

The correspondence of elements.

Return type:

_CR

__init__(connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR]) None

Initialise a polarity.

Parameters:

connection ("AbstractGaloisConnection[_TL, _CL, _TR, _CR]) – The antitone Galois connection.

property connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR]

Get the connection.

Returns:

The correspondence of elements.

Return type:

AbstractGaloisConnection[_TL, _CL, _TR, _CR]

class AbstractRightPolarity(connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR])

AbstractLeftPolarity is the right component of a Galois connection.

  • the type _TL represents the type of the elements of the left part of the Galois connection;

  • the type _CL represents the type of the closed sets of the left part of the Galois connection;

  • the type _TR represents the type of the elements of the right part of the Galois connection;

  • the type _CR represents the type of the closed sets of the right part of the Galois connection.

abstract __call__(*closed: _CR, elements: Iterable[_TR] | None = None) _CL

Compute the correspondence of elements.

Keyword Arguments:
  • *closed (_CR) – A sequence of finite closed sets.

  • elements (Iterable[_TR], optional) – The elements whose correspondence is requested.

Returns:

The correspondence of elements.

Return type:

_CL

__init__(connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR]) None

Initialise a polarity.

Parameters:

connection ("AbstractGaloisConnection[_TL, _CL, _TR, _CR]) – The antitone Galois connection.

property connection: AbstractGaloisConnection[_TL, _CL, _TR, _CR]

Get the connection.

Returns:

The correspondence of elements.

Return type:

AbstractGaloisConnection[_TL, _CL, _TR, _CR]

class AbstractGaloisConnection

AbstractGaloisConnection represents antitone Galois connection.

  • the type _TL represents the type of the elements of the left part of the Galois connection;

  • the type _CL represents the type of the closed sets of the left part of the Galois connection;

  • the type _TR represents the type of the elements of the right part of the Galois connection;

  • the type _CR represents the type of the closed sets 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]
__init__() None

Initialise an antitone Galois connection.

property closures: Tuple[AbstractClosure[_TL, _CL], AbstractClosure[_TR, _CR]]

Get the closures.

Returns:

The closures.

Return type:

Tuple[AbstractClosure[_TL, _CL], AbstractClosure[_TR, _CR]]

abstract property polarities: Tuple[AbstractLeftPolarity[_TL, _CL, _TR, _CR], AbstractRightPolarity[_TL, _CL, _TR, _CR]]

Get the polarities.

Returns:

The polarities.

Return type:

Tuple[AbstractPolarity[_TL, _TR], AbstractPolarity[_TR, _TL]]