Skip to main content

Ring

Trait Ring 

Source
pub trait Ring:
    AbelianGroup
    + MulMonoid
    + Distributive { }
Expand description

Represents a Ring in abstract algebra.

A ring is an algebraic structure with two binary operations, addition and multiplication, that is more general than a Field because it does not require multiplicative inverses for all non-zero elements.

§Mathematical Definition

A set R is a ring if it satisfies the following laws:

  1. Under Addition: R forms an AbelianGroup.

    • Addition is associative: (a + b) + c = a + (b + c)
    • Addition is commutative: a + b = b + a
    • There is an additive identity 0: a + 0 = a
    • Every element a has an additive inverse -a: a + (-a) = 0
  2. Under Multiplication: R forms a MulMonoid.

    • Multiplication is associative: (a * b) * c = a * (b * c)
    • There is a multiplicative identity 1: a * 1 = a
  3. Distributivity: Multiplication distributes over addition.

    • a * (b + c) = (a * b) + (a * c) (Left distributivity)
    • (a + b) * c = (a * c) + (b * c) (Right distributivity)

This trait combines AbelianGroup and MulMonoid to enforce these properties. The distributivity law is implicitly assumed to be upheld by the Add and Mul implementations.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Ring for T