Algebraic Hierarchy & Division Algebras
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Algebraic Hierarchy and Division Algebras module serves as the foundational numerical backbone for the DeepCausality framework. It provides a structured hierarchy of algebraic traits ranging from basic Magmas to complex Real Fields, enabling uniform mathematical operations across various data structures such as Tensors, MultiVectors, and Manifolds. By establishing these traits, the project ensures that high-level causal reasoning and physics simulations maintain mathematical rigor and type safety while operating on diverse numerical types.
This module also implements specific division algebras, including Complex numbers, Quaternions, and Octonions. These implementations allow for high-precision computations—such as the 106-bit Float106—which are essential for advanced physics applications like General Relativity and Quantum Field Theory. The hierarchy is designed to support algebraic composition, allowing different mathematical domains to interoperate within a single monadic flow.
Sources: README.md:129-145, algebraic_topology.md:13-28
Algebraic Trait Hierarchy
The core of the numerical system is a strict hierarchy of traits that define mathematical properties. Each level of the hierarchy adds specific constraints or operations, building from simple binary operations to the complex properties required for field theory.
Trait Structure
The hierarchy follows standard abstract algebra definitions:
| Trait | Definition | Requirements |
|---|---|---|
| Magma | Basic binary operation | Mul or Add operation |
| Monoid | Magma with an identity element | Magma + Identity |
| Group | Monoid with an inverse element | Monoid + Inverse |
| AbelianGroup | Group with commutative operations | Group + Commutative |
| Ring | Structure with two operations (Add/Mul) | AbelianGroup + MulMonoid + Distributive |
| CommutativeRing | Ring with commutative multiplication | Ring + Commutative Mul |
| Field | Ring with multiplicative inverses | CommutativeRing + Multiplicative Inverse |
| RealField | Field with ordering and transcendentals | Field + Ordering + Transcendentals |
Sources: algebraic_topology.md:16-28
Hierarchical Relationships
This diagram illustrates the inheritance and composition of algebraic traits within the framework:
The hierarchy ensures that any type implementing a higher-level trait like Field automatically satisfies the requirements for all preceding traits, such as Ring and Group.
Sources: algebraic_topology.md:16-28
Division Algebras & Numerical Types
DeepCausality implements several division algebras that are critical for scientific computing and physics. These algebras extend the real numbers into higher dimensions while maintaining consistent algebraic properties.
Key Implementations
- Complex Numbers: Implemented for two-dimensional algebraic operations, essential for quantum amplitudes and wave functions.
- Quaternions: Used for rotations and four-dimensional spatial-temporal modeling.
- Octonions: Non-associative division algebra used in advanced particle physics theories.
- Float106: A custom 106-bit float implementation providing approximately 32 decimal digits of precision, optimized to run significantly faster than standard IEEE binary128.
Sources: README.md:124-127, README.md:144, AGENTS.md:113-114
Numerical Precision and Structure
The project utilizes a specific structure for numerical modeling within the deep_causality_num crate. Unlike other crates in the monorepo that follow a "one type, one module" rule, deep_causality_num uses a structure tailored for numerical properties to handle the specificities of Rust's trait system for numbers.
Sources: AGENTS.md:144-147
Integration with Higher-Kinded Types (HKT)
The algebraic hierarchy is integrated with the deep_causality_haft crate to provide uniform mathematics across the entire framework. This integration allows different mathematical structures to share a categorical interface (Functor, Applicative, Monad, and Comonad) via an arity-5 HKT implementation.
Categorical Mapping of Numerical Structures
| Domain | Type | Categorical Role |
|---|---|---|
| Mechanics | CausalTensor<T> | Functor (mapping over field data) |
| Algebra | CausalMultiVector<T> | Monad (chaining operations) |
| Topology | Manifold<T> | Comonad (neighborhood analysis) |
| Algebraic Support | Complex<T>, Field | Underlying scalar types for T |
Sources: README.md:129-145
Data Flow in Algebraic Composition
The following diagram represents how numerical types flow through a causal pipeline using the algebraic hierarchy:
This composition allows a physics pipeline to step from General Relativity (Tensors) through Geometric Algebra (MultiVectors) and into Topology (Manifolds) without requiring serialization or adapter code.
Sources: README.md:141-145, algebraic_topology.md:8-11
Implementation Patterns
The framework uses an "indirect" implementation strategy for applying algebraic traits to complex structures like Tensors and MultiVectors:
- Direct Methods: Implement algebraic methods (e.g.,
add,scale,neg) directly on the struct with appropriate generic bounds (e.g.,T: Field). - Standard Operators: Implement
std::opstraits (Add, Sub, Mul, Div) by calling the direct methods. - Trait Satisfaction: Implement the algebraic hierarchy traits (e.g.,
AbelianGroup,Ring) to leverage blanket implementations and ensure the type fits into the broader mathematical ecosystem.
Sources: algebraic_topology.md:30-36
Implementation Example: Chain Algebra
In algebraic topology, a Chain<T> is treated as a vector in a chain complex. If T implements AbelianGroup, the Chain can also implement AbelianGroup through formal addition of its internal weights.
Sources: algebraic_topology.md:43-55
Conclusion
The Algebraic Hierarchy and Division Algebras module provides the essential mathematical framework for DeepCausality. By defining a rigorous hierarchy of traits—from Magma to RealField—and implementing high-precision division algebras like Float106 and Quaternions, the system enables seamless composition across disparate mathematical domains. This architecture ensures that complex causal pipelines, ranging from quantum mechanics to general relativity, can be expressed as a single, type-safe monadic flow.
Sources: README.md:129-145, algebraic_topology.md:16-28