Class Booleans

java.lang.Object
org.episteme.core.mathematics.sets.Booleans
All Implemented Interfaces:
Iterable<Boolean>, AbelianMonoid<Boolean>, Magma<Boolean>, Monoid<Boolean>, Semiring<Boolean>, FiniteSet<Boolean>, Set<Boolean>

public final class Booleans extends Object implements Semiring<Boolean>, FiniteSet<Boolean>
The structure of Boolean values (𝔹 = {0, 1}).

This class represents the structure of Booleans.

Since:
1.0
Author:
Gemini AI (Google DeepMind)
See Also:
  • Method Details

    • getInstance

      public static Booleans getInstance()
    • operate

      public Boolean operate(Boolean a, Boolean b)
      Description copied from interface: Magma
      Performs the binary operation on two elements.

      This is the fundamental operation of a magma. The result must be an element of this magma (closure property).

      Properties: None required (not necessarily associative or commutative)

      Specified by:
      operate in interface Magma<Boolean>
      Parameters:
      a - the first operand
      b - the second operand
      Returns:
      the result of a ∗ b
      See Also:
    • add

      public Boolean add(Boolean a, Boolean b)
      Description copied from interface: AbelianMonoid
      Returns the sum of two elements (additive notation).

      Delegates to Magma.operate(Object, Object).

      Specified by:
      add in interface AbelianMonoid<Boolean>
      Parameters:
      a - the first addend
      b - the second addend
      Returns:
      a + b
    • zero

      public Boolean zero()
      Description copied from interface: AbelianMonoid
      Returns the additive identity (zero element).

      Delegates to AbelianMonoid.identity().

      Specified by:
      zero in interface AbelianMonoid<Boolean>
      Returns:
      the zero element
    • multiply

      public Boolean multiply(Boolean a, Boolean b)
      Description copied from interface: Semiring
      Returns the product of two elements.

      Multiplication must be associative and distribute over addition.

      Specified by:
      multiply in interface Semiring<Boolean>
      Parameters:
      a - the first factor
      b - the second factor
      Returns:
      a × b
    • one

      public Boolean one()
      Description copied from interface: Semiring
      Returns the multiplicative identity (one element).

      Satisfies: 1 × a = a × 1 = a for all elements a.

      Specified by:
      one in interface Semiring<Boolean>
      Returns:
      the multiplicative identity
    • isMultiplicationCommutative

      public boolean isMultiplicationCommutative()
      Description copied from interface: Semiring
      Tests whether multiplication is commutative in this semiring.
      Specified by:
      isMultiplicationCommutative in interface Semiring<Boolean>
      Returns:
      true if multiplication commutes
    • contains

      public boolean contains(Boolean element)
      Description copied from interface: Set
      Tests whether this set contains the specified element.

      This is the fundamental operation of a set - membership testing.

      Specified by:
      contains in interface Set<Boolean>
      Parameters:
      element - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also:
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Set
      Returns true if this set contains no elements.

      The empty set (∅) is a fundamental concept in set theory. It is the unique set containing no elements.

      Specified by:
      isEmpty in interface Set<Boolean>
      Returns:
      true if this set is empty
    • size

      public long size()
      Description copied from interface: FiniteSet
      Returns the number of elements in this set (its cardinality).
      Specified by:
      size in interface FiniteSet<Boolean>
      Returns:
      the cardinality of this set
    • description

      public String description()
      Description copied from interface: Set
      Returns a human-readable description of this set.

      Examples:

      • "ℝ (Real Numbers)"
      • "ℤ/12ℤ (Integers modulo 12)"
      • "{1, 2, 3, 4, 5}"

      Specified by:
      description in interface Set<Boolean>
      Returns:
      a description of this set
    • iterator

      public Iterator<Boolean> iterator()
      Description copied from interface: FiniteSet
      Returns an iterator over the elements in this set.
      Specified by:
      iterator in interface FiniteSet<Boolean>
      Specified by:
      iterator in interface Iterable<Boolean>
      Returns:
      an iterator over the elements in this set
    • stream

      public Stream<Boolean> stream()
      Description copied from interface: FiniteSet
      Returns a sequential Stream with this set as its source.
      Specified by:
      stream in interface FiniteSet<Boolean>
      Returns:
      a stream over the elements in this set
    • toString

      public String toString()
      Overrides:
      toString in class Object