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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// TODO: Redo these docs.
//! Module theory abstractions and implementations.
//!
//! This module provides traits and implementations for module theory concepts,
//! which generalize vector spaces by allowing the scalars to lie in a ring rather than a field.
//!
//! Semimodule abstractions and implementations.
//!
//! A semimodule is a generalization of vector spaces and modules where the scalars form a semiring
//! rather than a ring or field. Like modules, semimodules support scalar multiplication and
//! addition, but the scalars only need to form a semiring structure.
//!
//! # Key Concepts
//!
//! - **Semimodule**: A set with an additive structure and scalar multiplication by elements of a
//! semiring
//! - **Semiring**: A ring-like structure but without the requirement of additive inverses
//! - **Scalar Multiplication**: Compatible multiplication between semiring elements and semimodule
//! elements
//!
//! # Examples
//!
//! The tropical algebra (implemented in the `tropical` module) is a classic example of a
//! semimodule, where addition is replaced by maximum and multiplication by regular addition.
//!
//! # Module Structure
//!
//! - [`trivial`]: Trivial semimodule
//! - [`tropical`]: Semimodule over the tropical semiring
use PhantomData;
use *;
use crate::;
/// A left semimodule over a semiring.
///
/// A set with commutative addition and left scalar multiplication satisfying:
/// - Distributivity: s * (x + y) = s * x + s * y
/// - Compatibility: (s + t) * x = s * x + t * x
/// - Associativity: (s * t) * x = s * (t * x)
/// - Identity: 1 * x = x
/// - Zero: 0 * x = 0
/// A right semimodule over a semiring.
///
/// A set with commutative addition and right scalar multiplication satisfying:
/// - Distributivity: (x + y) * s = x * s + y * s
/// - Compatibility: x * (s + t) = x * s + x * t
/// - Associativity: x * (s * t) = (x * s) * t
/// - Identity: x * 1 = x
/// - Zero: x * 0 = 0
/// A two-sided semimodule over a semiring.
///
/// - **Semimodule**: A vector space generalization where scalars are elements of a semiring
/// - **Left/Right Semimodule**: Defines scalar multiplication from left/right respectively
/// - **Two-Sided Semimodule**: Both left and right semimodule over the same semiring
///
/// Combines left and right semimodule properties over the same semiring.
/// Note: For commutative semirings, left and right actions typically coincide.
/// A trait representing a left module over a ring.
///
/// A left module is a generalization of a vector space, where the scalars lie in a ring
/// rather than a field. This trait combines the requirements for an Abelian group
/// with scalar multiplication by elements of the ring on the left.
/// A trait representing a right module over a ring.
///
/// A right module is a generalization of a vector space, where the scalars lie in a ring
/// rather than a field. This trait combines the requirements for an Abelian group
/// with scalar multiplication by elements of the ring on the right.
/// A trait representing a two-sided module over a ring.
///
/// A two-sided module is a generalization of a vector space, where the scalars lie in a ring
/// rather than a field. This trait combines the requirements for an Abelian group
/// with scalar multiplication by elements of the ring on both the left and right.
/// A trait representing a vector space over a field.
///
/// A vector space is a module over a field, meaning it has both addition and
/// scalar multiplication operations, with the scalars coming from a field.