Band

A Band is an algebraic structure consisting of a semigroup in which all elements possess the property of idempotency. Idempotency means that the result of an operation on any element with itself yields the same element, that is, for any \(a \in S\), \(a \cdot a = a\) holds.

Thus, a band is a semigroup in which every element is "self-contained" in the sense that multiplying it by itself does not change it.

Why are bands needed?

Bands play an important role in various fields of mathematics and applied sciences. Here are several reasons:

Examples of bands

Formal Definition

Band is a semigroup that is also idempotent, i.e., adding a value to itself yields the same value.

Band must satisfy the following laws:

Code

trait Band[A] extends Semigroup[A]:
  override def combineN(a: A, n: Int): Either[String, A] =
    if n <= 0 then
      Left("Repeated combining for semigroups must have n > 0")
    else Right(a) // combine(a, a) == a

Laws

Diagram

classDiagram
    class Semigroup~A~{
        +combine(x: A, y: A) A
    }
    class IdempotentSemigroup~A~
    Semigroup <|-- IdempotentSemigroup    

References: