algebra.ring

package algebra.ring

Members list

Concise view

Type members

Classlikes

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
Self type

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
Self type

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
Self type
trait AdditiveGroup[A] extends AdditiveMonoid[A]

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
Self type

Attributes

Source:
Additive.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AdditiveGroup.type
object BoolRng.type
object CommutativeRng.type
trait RingFunctions[R]
object BoolRing.type
object CommutativeRing.type
object DivisionRing.type
object EuclideanRing.type
object Field.type
object GCDRing.type
object Ring.type
object Rng.type
trait AdditiveMonoid[A] extends AdditiveSemigroup[A]

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
Self type

Attributes

Source:
Additive.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AdditiveGroup.type
object BoolRng.type
object CommutativeRng.type
trait RingFunctions[R]
object BoolRing.type
object CommutativeRing.type
object DivisionRing.type
object EuclideanRing.type
object Field.type
object GCDRing.type
object Ring.type
object Rng.type
object AdditiveMonoid.type
object CommutativeRig.type
object Rig.type
object Semifield.type
object Semiring.type

Attributes

Companion:
object
Source:
Additive.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Additive.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source:
Additive.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AdditiveGroup.type
object BoolRng.type
object CommutativeRng.type
trait RingFunctions[R]
object BoolRing.type
object CommutativeRing.type
object DivisionRing.type
object EuclideanRing.type
object Field.type
object GCDRing.type
object Ring.type
object Rng.type
object AdditiveMonoid.type
object CommutativeRig.type
object Rig.type
object Semifield.type
object Semiring.type
object AdditiveSemigroup.type
trait BoolRing[A] extends BoolRng[A] with CommutativeRing[A]

A Boolean ring is a ring whose multiplication is idempotent, that is a⋅a = a for all elements ''a''. This property also implies a+a = 0 for all ''a'', and a⋅b = b⋅a (commutativity of multiplication).

A Boolean ring is a ring whose multiplication is idempotent, that is a⋅a = a for all elements ''a''. This property also implies a+a = 0 for all ''a'', and a⋅b = b⋅a (commutativity of multiplication).

Every Boolean ring is equivalent to a Boolean algebra. See algebra.lattice.BoolFromBoolRing for details.

Attributes

Companion:
object
Source:
BoolRing.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
BoolRing.scala
Graph
Supertypes
Self type
trait BoolRng[A] extends CommutativeRng[A]

A Boolean rng is a rng whose multiplication is idempotent, that is a⋅a = a for all elements ''a''. This property also implies a+a = 0 for all ''a'', and a⋅b = b⋅a (commutativity of multiplication).

A Boolean rng is a rng whose multiplication is idempotent, that is a⋅a = a for all elements ''a''. This property also implies a+a = 0 for all ''a'', and a⋅b = b⋅a (commutativity of multiplication).

Every BoolRng is equivalent to algebra.lattice.GenBool. See algebra.lattice.GenBoolFromBoolRng for details.

Attributes

Companion:
object
Source:
BoolRng.scala
Graph
Supertypes
Known subtypes
class SetBoolRng[A]
trait BoolRing[A]
Self type

Attributes

Companion:
trait
Source:
BoolRng.scala
Graph
Supertypes
Self type
BoolRng.type

CommutativeRig is a Rig that is commutative under multiplication.

CommutativeRig is a Rig that is commutative under multiplication.

Attributes

Companion:
object
Source:
CommutativeRig.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
CommutativeRig.scala
Graph
Supertypes
Self type
trait CommutativeRing[A] extends Ring[A] with CommutativeRig[A] with CommutativeRng[A]

CommutativeRing is a Ring that is commutative under multiplication.

CommutativeRing is a Ring that is commutative under multiplication.

Attributes

Companion:
object
Source:
CommutativeRing.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
CommutativeRing.scala
Graph
Supertypes
Self type
trait CommutativeRng[A] extends Rng[A] with CommutativeSemiring[A]

CommutativeRng is a Rng that is commutative under multiplication.

CommutativeRng is a Rng that is commutative under multiplication.

Attributes

Companion:
object
Source:
CommutativeRng.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
CommutativeRng.scala
Graph
Supertypes
Self type

CommutativeSemifield is a Semifield that is commutative under multiplication.

CommutativeSemifield is a Semifield that is commutative under multiplication.

Attributes

Companion:
object
Source:
CommutativeSemifield.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
CommutativeSemifield.scala
Graph
Supertypes
Self type

CommutativeSemiring is a Semiring that is commutative under multiplication.

CommutativeSemiring is a Semiring that is commutative under multiplication.

Attributes

Companion:
object
Source:
CommutativeSemiring.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
CommutativeSemiring.scala
Graph
Supertypes
Self type
trait DivisionRing[A] extends Ring[A] with Semifield[A]

Attributes

Companion:
object
Source:
DivisionRing.scala
Graph
Supertypes
Known subtypes
Self type

Attributes

Companion:
trait
Source:
DivisionRing.scala
Graph
Supertypes
Self type

Attributes

Source:
DivisionRing.scala
Graph
Supertypes
Known subtypes
object DivisionRing.type
trait EuclideanRing[A] extends GCDRing[A]

EuclideanRing implements a Euclidean domain.

EuclideanRing implements a Euclidean domain.

The formal definition says that every euclidean domain A has (at least one) euclidean function f: A -> N (the natural numbers) where:

(for every x and non-zero y) x = yq + r, and r = 0 or f(r) < f(y).

This generalizes the Euclidean division of integers, where f represents a measure of length (or absolute value), and the previous equation represents finding the quotient and remainder of x and y. So:

quot(x, y) = q mod(x, y) = r

Attributes

Companion:
object
Source:
EuclideanRing.scala
Graph
Supertypes
Known subtypes
Self type

Attributes

Companion:
trait
Source:
EuclideanRing.scala
Graph
Supertypes
Self type

Attributes

Source:
EuclideanRing.scala
Graph
Supertypes
Known subtypes
object EuclideanRing.type
object Field.type
trait Field[A] extends EuclideanRing[A] with DivisionRing[A] with CommutativeSemifield[A]

Attributes

Companion:
object
Source:
Field.scala
Graph
Supertypes
Known subtypes
Self type
object Field extends FieldFunctions[Field]

Attributes

Companion:
trait
Source:
Field.scala
Graph
Supertypes
Self type
Field.type

Attributes

Source:
Field.scala
Graph
Supertypes
Known subtypes
object Field.type
trait GCDRing[A] extends CommutativeRing[A]

GCDRing implements a GCD ring.

GCDRing implements a GCD ring.

For two elements x and y in a GCD ring, we can choose two elements d and m such that:

d = gcd(x, y) m = lcm(x, y)

d * m = x * y

Additionally, we require:

gcd(0, 0) = 0 lcm(x, 0) = lcm(0, x) = 0

and commutativity:

gcd(x, y) = gcd(y, x) lcm(x, y) = lcm(y, x)

Attributes

Companion:
object
Source:
GCDRing.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
GCDRing.scala
Graph
Supertypes
Self type
GCDRing.type
trait GCDRingFunctions[R <: (GCDRing)] extends RingFunctions[R]

Attributes

Source:
GCDRing.scala
Graph
Supertypes
Known subtypes
object EuclideanRing.type
object Field.type
object GCDRing.type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Source:
Multiplicative.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object DivisionRing.type
object Field.type
object Semifield.type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Source:
Multiplicative.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CommutativeRig.type
object DivisionRing.type
object Field.type
object Semifield.type
object Rig.type
trait RingFunctions[R]
object BoolRing.type
object CommutativeRing.type
object EuclideanRing.type
object GCDRing.type
object Ring.type

Attributes

Companion:
object
Source:
Multiplicative.scala
Graph
Supertypes
class Any
Known subtypes

Attributes

Companion:
trait
Source:
Multiplicative.scala
Graph
Supertypes
Self type

Attributes

Source:
Multiplicative.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object BoolRng.type
object CommutativeRng.type
object CommutativeRig.type
object DivisionRing.type
object Field.type
object Semifield.type
object Rig.type
trait RingFunctions[R]
object BoolRing.type
object CommutativeRing.type
object EuclideanRing.type
object GCDRing.type
object Ring.type
object Rng.type
object Semiring.type
trait Rig[A] extends Semiring[A] with MultiplicativeMonoid[A]

Rig consists of:

Rig consists of:

  • a commutative monoid for addition (+)
  • a monoid for multiplication (*)

Alternately, a Rig can be thought of as a ring without multiplicative or additive inverses (or as a semiring with a multiplicative identity).

Mnemonic: "Rig is a Ring without 'N'egation."

Attributes

Companion:
object
Source:
Rig.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Rig.scala
Graph
Supertypes
Self type
Rig.type
trait Ring[A] extends Rig[A] with Rng[A]

Ring consists of:

Ring consists of:

  • a commutative group for addition (+)
  • a monoid for multiplication (*)

Additionally, multiplication must distribute over addition.

Ring implements some methods (for example fromInt) in terms of other more fundamental methods (zero, one and plus). Where possible, these methods should be overridden by more efficient implementations.

Attributes

Companion:
object
Source:
Ring.scala
Graph
Supertypes
Known subtypes
object Ring extends RingFunctions[Ring]

Attributes

Companion:
trait
Source:
Ring.scala
Graph
Supertypes
Self type
Ring.type

Attributes

Source:
Ring.scala
Graph
Supertypes
Known subtypes
object BoolRing.type
object CommutativeRing.type
object DivisionRing.type
object EuclideanRing.type
object Field.type
object GCDRing.type
object Ring.type
trait Rng[A] extends Semiring[A] with AdditiveCommutativeGroup[A]

Rng (pronounced "Rung") consists of:

Rng (pronounced "Rung") consists of:

  • a commutative group for addition (+)
  • a semigroup for multiplication (*)

Alternately, a Rng can be thought of as a ring without a multiplicative identity (or as a semiring with an additive inverse).

Mnemonic: "Rng is a Ring without multiplicative 'I'dentity."

Attributes

Companion:
object
Source:
Rng.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Rng.scala
Graph
Supertypes
Self type
Rng.type
trait Semifield[A] extends Rig[A] with MultiplicativeGroup[A]

Semifield consists of:

Semifield consists of:

  • a commutative monoid for addition (+)
  • a group for multiplication (*)

Alternately, a Semifield can be thought of as a DivisionRing without an additive inverse.

Attributes

Companion:
object
Source:
Semifield.scala
Graph
Supertypes
Known subtypes

Attributes

Companion:
trait
Source:
Semifield.scala
Graph
Supertypes
Self type

Semiring consists of:

Semiring consists of:

  • a commutative monoid for addition (+)
  • a semigroup for multiplication (*)

Alternately, a Semiring can be thought of as a ring without a multiplicative identity or an additive inverse.

A Semiring with an additive inverse (-) is a Rng. A Semiring with a multiplicative identity (1) is a Rig. A Semiring with both of those is a Ring.

Attributes

Companion:
object
Source:
Semiring.scala
Graph
Supertypes
Known subtypes
class MapSemiring[K, V]
class SetSemiring[A]
trait BoolRing[A]
trait GCDRing[A]
trait EuclideanRing[A]
trait Field[A]
trait BoolRng[A]
class SetBoolRng[A]
trait Rig[A]
trait Ring[A]
trait DivisionRing[A]
trait Semifield[A]
trait Rng[A]

Attributes

Companion:
trait
Source:
Semiring.scala
Graph
Supertypes
Self type
trait Signed[A]

A trait that expresses the existence of signs and absolute values on linearly ordered additive commutative monoids (i.e. types with addition and a zero).

A trait that expresses the existence of signs and absolute values on linearly ordered additive commutative monoids (i.e. types with addition and a zero).

The following laws holds:

(1) if a <= b then a + c <= b + c (linear order), (2) signum(x) = -1 if x < 0, signum(x) = 1 if x > 0, signum(x) = 0 otherwise,

Negative elements only appear when the scalar is taken from a additive abelian group. Then:

(3) abs(x) = -x if x < 0, or x otherwise,

Laws (1) and (2) lead to the triange inequality:

(4) abs(a + b) <= abs(a) + abs(b)

Signed should never be extended in implementations, rather the Signed.forAdditiveCommutativeMonoid and subtraits.

It's better to have the Signed hierarchy separate from the Ring/Order hierarchy, so that we do not end up with duplicate implicits.

Attributes

Companion:
object
Source:
Signed.scala
Graph
Supertypes
class Any
Known subtypes
object Signed extends SignedFunctions[Signed]

Attributes

Companion:
trait
Source:
Signed.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Signed.type

Attributes

Source:
Signed.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Signed.type
object TruncatedDivision.type
trait TruncatedDivision[A] extends Signed[A]

Division and modulus for computer scientists taken from https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf

Division and modulus for computer scientists taken from https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf

For two numbers x (dividend) and y (divisor) on an ordered ring with y != 0, there exists a pair of numbers q (quotient) and r (remainder) such that these laws are satisfied:

(1) q is an integer (2) x = y * q + r (division rule) (3) |r| < |y|, (4t) r = 0 or sign(r) = sign(x), (4f) r = 0 or sign(r) = sign(y).

where sign is the sign function, and the absolute value function |x| is defined as |x| = x if x >=0, and |x| = -x otherwise.

We define functions tmod and tquot such that: q = tquot(x, y) and r = tmod(x, y) obey rule (4t), (which truncates effectively towards zero) and functions fmod and fquot such that: q = fquot(x, y) and r = fmod(x, y) obey rule (4f) (which floors the quotient and effectively rounds towards negative infinity).

Law (4t) corresponds to ISO C99 and Haskell's quot/rem. Law (4f) is described by Knuth and used by Haskell, and fmod corresponds to the REM function of the IEEE floating-point standard.

Attributes

Companion:
object
Source:
TruncatedDivision.scala
Graph
Supertypes
trait Signed[A]
class Any
Known subtypes

Attributes

Companion:
trait
Source:
TruncatedDivision.scala
Graph
Supertypes
Self type

Attributes

Source:
TruncatedDivision.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object TruncatedDivision.type