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