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§
- The addition operator, commonly symbolized by
+
. - The universal identity element wrt. a given operator, usually noted
Id
with a context-dependent subscript. - The multiplication operator, commonly symbolized by
×
.
Traits§
- A field is a commutative ring, and an Abelian group under both operators.
- A group is a loop and a monoid at the same time.
- An Abelian group is a commutative group.
- A loop is a quasigroup with an unique identity element, e.
- A magma is an algebraic structure which consists of a set equipped with a binary operation, ∘, which must be closed.
- A module combines two sets: one with an Abelian group structure and another with a commutative ring structure.
- A monoid is a semigroup equipped with an identity element, e.
- 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.
- A ring is the combination of an Abelian group and a multiplicative monoid structure.
- A ring with a commutative multiplication.
- A semigroup is a quasigroup that is associative.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Trait alias for
Add
andAddAssign
with result of typeSelf
. - [Alias] Trait alias for
Div
andDivAssign
with result of typeSelf
. - [Alias] Trait alias for
Mul
andMulAssign
with result of typeSelf
. - [Alias] Trait alias for
Neg
with result of typeSelf
. - [Alias] Trait alias for
Sub
andSubAssign
with result of typeSelf
. - Trait shared by all complex fields and its subfields (like real numbers).
- [Alias] Algebraic structure specialized for one kind of operation.
- A type that is equipped with identity.
- A set where every two elements have a supremum (i.e. smallest upper bound).
- Partially orderable sets where every two elements have a supremum and infimum.
- A set where every two elements have an infimum (i.e. greatest lower bound).
- A module which overloads the
*
and+
operators. - [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- Trait implemented by types representing abstract operators.
- Real
Deprecated The field of reals. This has been renamed toRealField
. - Trait shared by all reals.
- [Alias] Algebraic structure specialized for one kind of operation.
- [Alias] Algebraic structure specialized for one kind of operation.
- 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). - 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. - Trait used to define the two_sided_inverse element relative to the given operator.