semigroup

Semigroup

Semigroup

Mathematically a Semigroup is a set S along with an associative binary operation * such that

(∀x ∈ S)(∀y ∈ S)(∀z ∈ S) => (x*(y*z)) = ((x*y)*z)

Important

Contract: Semigroup initializer parameters must have

  • mult closed and associative on reps

class boring_math.abstract_algebra.algebras.semigroup.Semigroup

Bases: BaseSet, Generic

__init__(mult: Callable[[H, H], H], narrow: Callable[[H], H] | None = None) → None

init

param mult:

Associative function H X H -> H on reps.

param narrow:

Narrow the rep type, many-to-one function. Like choosing a representative from a coset of a group.

class boring_math.abstract_algebra.algebras.semigroup.SemigroupElement

Bases: BaseElement, Generic

__init__(rep: H, algebra: Semigroup[H]) → None

abstract base class for algebra element

param rep:

Coset element to be narrowed to a representative.

param algebra:

Algebra to which element belongs

__str__() → str

user string

Construct the string ‘SemigroupElement<rep_str>’ where rep_str = str(rep).

returns:

A string meaningful to an end user.

__mul__(right: object) → Self

mul

Multiply two elements of the same concrete algebra together.

param right:

An element within the same concrete algebra or a right action.

returns:

The product self * right otherwise NotImplemented.

raises ValueError:

If self and right are same type but different concrete algebras.

__rmul__(left: object) → Self

rmul

When left side of multiplication does not know how to multiply right side.

param left:

Left side of the multiplication.

returns:

Never returns, otherwise left.__mul__(right) would have worked.

raises TypeError:

When multiplying on left by an int.

__pow__(n: int) → Self

pow

Raising element to a positive integer power is the same as repeated multiplication.

param n:

Multiply element to itself n > 0 times.

returns:

The product of the element n times.

raises ValueError:

When n <= 0.

raises ValueError:

If algebra does not have a mult attribute.