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
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
/// Implements various algebraic traits for `Octonion<T>`.
///
/// | Type | `Distributive` | `Associative` | `Commutative` | Trait |
/// | :--- | :---: | :---: | :---: | :--- |
/// | **Octonion** | ✅ | ❌ | ❌ | `DivisionAlgebra` |
///
/// This file is responsible for binding the `Octonion` type to the algebraic
/// hierarchy defined in the `deep_causality_num/src/algebra/` module.
/// It explicitly states the algebraic properties of octonions, such as being
/// a distributive and abelian group, and a division algebra, while correctly
/// identifying their non-associative and non-commutative nature.
use crate::;
// Marker Traits
/// Implements the `Distributive` marker trait for `Octonion`.
///
/// This signifies that multiplication of `Octonion`s distributes over addition,
/// i.e., `a * (b + c) = (a * b) + (a * c)`. This property holds for octonions.
// DO NOT IMPLEMENT `Associative` as octonion multiplication is non-associative.
// DO NOT IMPLEMENT `Commutative` as octonion multiplication is non-commutative.
// Octonion addition is component-wise and commutative.
/// Implements the `AbelianGroup` trait for `Octonion`.
///
/// This signifies that `Octonion`s form an abelian (commutative) group under addition.
/// Addition is component-wise, ensuring commutativity and associativity.
// Octonions are a Division Algebra, but NOT associative.
// The blanket impl for `Algebra<T>` will apply, since we can satisfy its
// bounds: `Module<T> + Mul<...> + MulAssign + One + Distributive`.
/// Implements the `DivisionAlgebra` trait for `Octonion`.
///
/// Octonions form a non-associative division algebra over the real numbers.
/// This trait provides methods for `conjugate`, `norm_sqr`, and `inverse`,
/// which are fundamental to division algebras.
// Octonions do not form a multiplicative group because multiplication is not associative.
// However, non-zero octonions do have multiplicative inverses.
// The `MulGroup` trait requires associativity, so it is not implemented.