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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Basic arithmetic traits and operations.
//!
//! This module provides fundamental arithmetic traits that are used throughout the algebra crate.
//! It re-exports standard arithmetic operations from [`std::ops`] and numeric traits from
//! [`num_traits`].
//!
//! # Examples
//!
//! ```
//! use cova_algebra::arithmetic::{Additive, Multiplicative};
//!
//! // Types implementing Additive can be added and assigned
//! fn add<T: Additive>(a: T, b: T) -> T { a + b }
//!
//! // Types implementing Multiplicative can be multiplied and assigned
//! fn multiply<T: Multiplicative>(a: T, b: T) -> T { a * b }
//! ```
use *;
/// A trait for types that support addition (and comparison) operations.
///
/// This trait combines the basic requirements for types that can be added together:
/// - Addition operation with [`Add`] trait
/// - Addition assignment with [`AddAssign`] trait
/// - Equality comparison with [`PartialEq`]
///
/// # Examples
/// - All primitive numeric types implement this trait
/// - [`Boolean`](crate::algebras::boolean::Boolean) type implements this trait using bitwise
/// [`std::ops::BitXor`]
/// - Using the [`modular!`] macro, you can define a modular arithmetic type and it will implement
/// this trait.
/// - Using the [`prime_field!`] macro, you can define a prime field type and it will implement this
/// trait.
/// A trait for types that support multiplication operations.
///
/// This trait combines the basic requirements for types that can be multiplied (and compared)
/// together:
/// - Multiplication operation with [`Mul`] trait
/// - Multiplication assignment with [`MulAssign`] trait
/// - Equality comparison with [`PartialEq`]
///
/// # Examples
/// - All primitive numeric types implement this trait
/// - [`Boolean`](crate::algebras::boolean::Boolean) type implements this trait using bitwise
/// [`std::ops::BitAnd`]
/// - Using the [`modular!`] macro, you can define a modular arithmetic type and it will implement
/// this trait.
/// - Using the [`prime_field!`] macro, you can define a prime field type and it will implement this
/// trait.
/// Trait for types that have a concept of positive infinity.