Elements

This module defines essential type for representing lattice elements.

class galactic.algebras.lattice.elements.Joinable

Bases: galactic.algebras.poset.elements.PartiallyOrdered

The Joinable type sets for each pair of elements a, b an unique supremum c = a | b (also called a least upper bound or join).

A class implementing the Joinable abstract class must be declared by inheriting from Joinable with itself as a parameter and must implement the methods:

Example

Let the integers ordered by the relation \(a \leq b\): is \(a\) a divisor of \(b\)?

implemented by the Integer class:

>>> from galactic.examples.arithmetic.algebras import Integer
>>> Integer(24) | Integer(36)
Integer(72)
>>> Integer(24).union(Integer(36), Integer(10))
Integer(360)
abstract __or__(other)

Return the join of this element and the other.

Parameters

other – the other element

Returns

the join of this element and the other

Return type

Joinable

union(*args) → galactic.algebras.lattice.elements.Joinable

Returns the union of this element and the others.

Parameters

*args (Joinable) – the others elements

Returns

the join of this element and the others

Return type

Joinable

Raises

TypeError – if one of the other elements is not an instance of this element class.

class galactic.algebras.lattice.elements.Meetable

Bases: galactic.algebras.poset.elements.PartiallyOrdered

The Meetable type sets for each pair of elements a, b an unique infimum c = a & b (also called a greatest lower bound or meet).

A class implementing the Meetable abstract class must be declared by inheriting from Meetable with itself as a parameter and must implement the methods:

Example

Let the integers ordered by the relation \(a \leq b\): is \(a\) a divisor of \(b\)?

implemented by the Integer class:

>>> from galactic.examples.arithmetic.algebras import Integer
>>> Integer(24) & Integer(36)
Integer(12)
>>> Integer(24).intersection(Integer(36), Integer(10))
Integer(2)
abstract __and__(other)

Return the meet of this element and the other.

Parameters

other – the other element

Returns

the meet of this element and the other

Return type

Meetable

intersection(*args) → galactic.algebras.lattice.elements.Meetable

Returns the intersection of this element and the others.

Parameters

*args (Meetable) – the others elements

Returns

the meet of this element and the others

Return type

Meetable

Raises

TypeError – if one of the other elements is not an instance of this element class.

class galactic.algebras.lattice.elements.Element

Bases: galactic.algebras.lattice.elements.Meetable, galactic.algebras.lattice.elements.Joinable

The Element class describes elements that can be member of a lattice.

galactic.algebras.lattice.elements.infimum(iterable: Iterable[galactic.algebras.lattice.elements.Meetable] = None, default=None) → galactic.algebras.lattice.elements.Meetable

Computes the infimum of meetable elements.

Keyword Arguments
  • iterable (Iterable[Meetable]) – An iterable collection of meetable elements.

  • default – The default value when the iterable is empty.

Returns

Return type

The intersection of all elements from the iterable collection.

galactic.algebras.lattice.elements.supremum(iterable: Iterable[galactic.algebras.lattice.elements.Joinable] = None, default=None) → galactic.algebras.lattice.elements.Joinable

Computes the supremum of joinable elements.

Keyword Arguments
  • iterable (Iterable[joinable]) – An iterable collection of joinable elements.

  • default – The default value when the iterable is empty.

Returns

Return type

The union of all elements from the iterable collection.

galactic.algebras.lattice.elements.supremum_generators(iterable: Iterable[galactic.algebras.lattice.elements.Joinable] = None) → Iterator[galactic.algebras.lattice.elements.Joinable]

The supremum_generators() function produces the supremum generators from an iterable of joinable elements.

Keyword Arguments

iterable (Iterable[Joinable]) – The iterable collection of elements.

Returns

An iterator over the supremum generators.

Return type

Iterator[Joinable]

galactic.algebras.lattice.elements.infimum_generators(iterable: Iterable[galactic.algebras.lattice.elements.Meetable] = None) → Iterator[galactic.algebras.lattice.elements.Meetable]

The infimum_generators() function produces the infimum generators from an iterable of meetable elements.

Keyword Arguments

iterable (Iterable[Meetable]) – The iterable collection of elements.

Returns

An iterator over the infimum generators.

Return type

Iterator[Meetable]