mathru/algebra/abstr/
loop_.rs

1//! Loop
2
3use super::{
4    identity::Identity,
5    operator::{Addition, Multiplication, Operator},
6    quasigroup::Quasigroup,
7};
8
9/// A quasigroup with an unique identity element.
10///
11/// $\exists e \in \mathbb{Q}, \forall a \in \mathbb{Q}, \exists r, l \in
12/// \mathbb{Q}$ such that $l ∘ a = a ∘ r = e $ The left inverse $r$ and
13/// right inverse $l$ are not required to be equal. The following property is
14/// added to the quasigroup structure:
15///
16/// This property follows from
17///
18/// $\forall a \in \mathbb{Q}, \exists e \in \mathbb{Q}$, such that $e ∘ a =
19/// a ∘ e = a$.
20pub trait Loop<O: Operator>: Quasigroup<O> + Identity<O> {}
21
22macro_rules! impl_loop(
23    ($T:ty, $($S:ty),*) =>
24    {
25        $(
26        impl Loop<$T> for $S
27        {
28        }
29        )*
30    }
31);
32
33impl_loop!(Addition, i8, i16, i32, i64, i128, f32, f64);
34impl_loop!(Multiplication, f32, f64);