[−][src]Module alga::general
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 |
Multiplicative | The multiplication operator, commonly symbolized by |
Traits
AbstractField | A field is a commutative ring, and an Abelian group under both operators. |
AbstractGroup | A group is a loop and a monoid at the same time. |
AbstractGroupAbelian | An Abelian group is a commutative group. |
AbstractLoop | A loop is a quasigroup with an unique identity element, e. |
AbstractMagma | A magma is an algebraic structure which consists of a set equipped with a binary operation, ∘, which must be closed. |
AbstractModule | A module combines two sets: one with an Abelian group structure and another with a commutative ring structure. |
AbstractMonoid | A monoid is a semigroup equipped with an identity element, e. |
AbstractQuasigroup | 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. |
AbstractRing | A ring is the combination of an Abelian group and a multiplicative monoid structure. |
AbstractRingCommutative | A ring with a commutative multiplication. |
AbstractSemigroup | A semigroup is a quasigroup that is associative. |
AdditiveGroup | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveGroupAbelian | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveLoop | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveMagma | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveMonoid | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveQuasigroup | [Alias] Algebraic structure specialized for one kind of operation. |
AdditiveSemigroup | [Alias] Algebraic structure specialized for one kind of operation. |
ClosedAdd | [Alias] Trait alias for |
ClosedDiv | [Alias] Trait alias for |
ClosedMul | [Alias] Trait alias for |
ClosedNeg | [Alias] Trait alias for |
ClosedSub | [Alias] Trait alias for |
ComplexField | 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. |
JoinSemilattice | 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. |
MeetSemilattice | A set where every two elements have an infimum (i.e. greatest lower bound). |
Module | A module which overloads the |
MultiplicativeGroup | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeGroupAbelian | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeLoop | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeMagma | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeMonoid | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeQuasigroup | [Alias] Algebraic structure specialized for one kind of operation. |
MultiplicativeSemigroup | [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 | Trait shared by all reals. |
Ring | [Alias] Algebraic structure specialized for one kind of operation. |
RingCommutative | [Alias] Algebraic structure specialized for one kind of operation. |
SubsetOf | Nested sets and conversions between them (using an injective mapping). Useful to work with
substructures. In generic code, it is preferable to use |
SupersetOf | Nested sets and conversions between them. Useful to work with substructures. It is preferable
to implement the |
TwoSidedInverse | Trait used to define the two_sided_inverse element relative to the given operator. |