Expand description
Fundamental algebraic structures.
For most applications requiring an abstraction over the reals, RealField
should be sufficient.
§Algebraic properties
The goal of algebraic structures is to allow elements of sets to be combined together using one
or several operators. The number and properties of those operators characterize the algebraic
structure. Abstract operators are usually noted ∘
, +
, or ×
. The last two are preferred
when their behavior conform with the usual meaning of addition and multiplication of reals.
Let Self
be a set. Here is a list of the most common properties those operator may fulfill:
(Closure) a, b ∈ Self ⇒ a ∘ b ∈ Self,
(Divisibility) ∀ a, b ∈ Self, ∃! r, l ∈ Self such that l ∘ a = b and a ∘ r = b
(Invertibility) ∃ e ∈ Self, ∀ a ∈ Self, ∃ r, l ∈ Self such that l ∘ a = a ∘ r = e
If the right and left inverse are equal they are usually noted r = l = a⁻¹.
(Associativity) ∀ a, b, c ∈ Self, (a ∘ b) ∘ c = a ∘ (b ∘ c)
(Neutral Elt.) ∃ e ∈ Self, ∀ a ∈ Self, e ∘ a = a ∘ e = a
(Commutativity) ∀ a, b ∈ Self, a ∘ b = b ∘ a
§Identity elements
Two traits are provided that allow the definition of the additive and multiplicative identity elements:
IdentityAdditive
IdentityMultiplicative
§AbstractGroup-like structures
These structures are provided for both the addition and multiplication.
These can be derived automatically by alga_traits
attribute from alga_derive
crate.
AbstractMagma
|
_______/ \______
/ \
divisibility associativity
| |
V V
AbstractQuasigroup AbstractSemigroup
| |
identity identity
| |
V V
AbstractLoop AbstractMonoid
| |
associativity invertibility
\______ _______/
\ /
|
V
AbstractGroup
|
commutativity
|
V
AbstractGroupAbelian
The following traits are provided:
- (
Abstract
|Additive
|Multiplicative
)Magma
- (
Abstract
|Additive
|Multiplicative
)Quasigroup
- (
Abstract
|Additive
|Multiplicative
)Loop
- (
Abstract
|Additive
|Multiplicative
)Semigroup
- (
Abstract
|Additive
|Multiplicative
)Monoid
- (
Abstract
|Additive
|Multiplicative
)Group
- (
Abstract
|Additive
|Multiplicative
)GroupAbelian
§Ring-like structures
These can be derived automatically by alga_traits
attribute from alga_derive
crate.
GroupAbelian Monoid
\________ ________/
\ /
|
V
Ring
|
commutativity_of_mul
|
V
RingCommutative GroupAbelian
\_______ ___________/
\ /
|
V
Field
The following traits are provided:
Ring
RingCommutative
Field
§Module-like structures
GroupAbelian RingCommutative
\______ _____/
\ /
| |
V V
Module<Scalar> Field
\______ _____/
\ /
| |
V V
VectorSpace<Scalar>
The following traits are provided:
Module
VectorSpace
§Quickcheck properties
Functions are provided to test that algebraic properties like associativity and commutativity hold for a given set of arguments.
These tests can be automatically derived by alga_quickcheck
attribute from alga_derive
crate.
For example:
use algebra::general::SemigroupMultiplicative;
quickcheck! {
fn prop_mul_is_associative(args: (i32, i32, i32)) -> bool {
SemigroupMultiplicative::prop_mul_is_associative(args)
}
}
Structs§
- Additive
- The addition operator, commonly symbolized by
+
. - Id
- The universal identity element wrt. a given operator, usually noted
Id
with a context-dependent subscript. - Multiplicative
- The multiplication operator, commonly symbolized by
×
.
Traits§
- Abstract
Field - A field is a commutative ring, and an Abelian group under both operators.
- Abstract
Group - A group is a loop and a monoid at the same time.
- Abstract
Group Abelian - An Abelian group is a commutative group.
- Abstract
Loop - A loop is a quasigroup with an unique identity element, e.
- Abstract
Magma - A magma is an algebraic structure which consists of a set equipped with a binary operation, ∘, which must be closed.
- Abstract
Module - A module combines two sets: one with an Abelian group structure and another with a commutative ring structure.
- Abstract
Monoid - A monoid is a semigroup equipped with an identity element, e.
- Abstract
Quasigroup - A quasigroup is a magma which that has the divisibility property (or Latin square property). A set with a closed binary operation with the divisibility property.
- Abstract
Ring - A ring is the combination of an Abelian group and a multiplicative monoid structure.
- Abstract
Ring Commutative - A ring with a commutative multiplication.
- Abstract
Semigroup - A semigroup is a quasigroup that is associative.
- Additive
Group - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Group Abelian - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Loop - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Magma - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Monoid - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Quasigroup - [Alias] Algebraic structure specialized for one kind of operation.
- Additive
Semigroup - [Alias] Algebraic structure specialized for one kind of operation.
- Closed
Add - [Alias] Trait alias for
Add
andAddAssign
with result of typeSelf
. - Closed
Div - [Alias] Trait alias for
Div
andDivAssign
with result of typeSelf
. - Closed
Mul - [Alias] Trait alias for
Mul
andMulAssign
with result of typeSelf
. - Closed
Neg - [Alias] Trait alias for
Neg
with result of typeSelf
. - Closed
Sub - [Alias] Trait alias for
Sub
andSubAssign
with result of typeSelf
. - Complex
Field - Trait shared by all complex fields and its subfields (like real numbers).
- Field
- [Alias] Algebraic structure specialized for one kind of operation.
- Identity
- A type that is equipped with identity.
- Join
Semilattice - A set where every two elements have a supremum (i.e. smallest upper bound).
- Lattice
- Partially orderable sets where every two elements have a supremum and infimum.
- Meet
Semilattice - A set where every two elements have an infimum (i.e. greatest lower bound).
- Module
- A module which overloads the
*
and+
operators. - Multiplicative
Group - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Group Abelian - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Loop - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Magma - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Monoid - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Quasigroup - [Alias] Algebraic structure specialized for one kind of operation.
- Multiplicative
Semigroup - [Alias] Algebraic structure specialized for one kind of operation.
- Operator
- Trait implemented by types representing abstract operators.
- Real
Deprecated - The field of reals. This has been renamed to
RealField
. - Real
Field - Trait shared by all reals.
- Ring
- [Alias] Algebraic structure specialized for one kind of operation.
- Ring
Commutative - [Alias] Algebraic structure specialized for one kind of operation.
- Subset
Of - Nested sets and conversions between them (using an injective mapping). Useful to work with
substructures. In generic code, it is preferable to use
SupersetOf
as trait bound whenever possible instead ofSubsetOf
(because SupersetOf is automatically implemented wheneverSubsetOf
is). - Superset
Of - Nested sets and conversions between them. Useful to work with substructures. It is preferable
to implement the
SupersetOf
trait instead ofSubsetOf
whenever possible (becauseSupersetOf
is automatically implemented wheneverSubsetOf
is. - TwoSided
Inverse - Trait used to define the two_sided_inverse element relative to the given operator.