atlas_embeddings/foundations/
mod.rs

1//! # Chapter 0: Foundations
2//!
3//! This chapter builds all mathematical prerequisites from first principles,
4//! assuming no prior knowledge beyond elementary set theory.
5//!
6//! ## Purpose
7//!
8//! The Atlas of Resonance Classes and its embedding into E₈ is a deep mathematical
9//! structure. To understand it rigorously, we must establish foundations carefully.
10//!
11//! This chapter provides:
12//! - **Basic definitions**: Graphs, groups, vector spaces
13//! - **Exact arithmetic**: Rational numbers, no floating point
14//! - **Action principles**: Variational calculus and stationary configurations
15//! - **Resonance classes**: The 96 equivalence classes forming Atlas vertices
16//! - **Category theory**: The language for describing Atlas initiality (future section)
17//!
18//! ## Reading Guide
19//!
20//! **For mathematicians**: This chapter is elementary but establishes notation and
21//! conventions. Skim §0.1-0.2, focus on §0.3 (resonance classes) and §0.4 (categories).
22//!
23//! **For physicists**: The action functional in §0.2 will be familiar. The 12,288-cell
24//! complex may be new—it's a discrete analog of field theory configuration spaces.
25//!
26//! **For computer scientists**: Note the emphasis on exact arithmetic (§0.1.2) and
27//! discrete optimization (§0.2.4). The code serves as executable definitions.
28//!
29//! ## Chapter Organization
30//!
31//! - **[§0.1 Primitive Concepts](primitives)**: Graphs, arithmetic, groups, vectors
32//! - **[§0.2 Action Functionals](action)**: Variational calculus, the 12,288-cell complex
33//! - **[§0.3 Resonance Classes](resonance)**: The 96 equivalence classes, label system
34//! - **[§0.4 Categorical Preliminaries](categories)**: Categories, functors, initial objects
35//!
36//! ## Main Results
37//!
38//! This chapter establishes:
39//!
40//! 1. **Exact arithmetic framework** (§0.1.2): All computations use rationals, no floats
41//! 2. **Action functional** (§0.2.3): Defined on 12,288-cell boundary complex
42//! 3. **96 resonance classes** (§0.3.2): Stationary configuration partitions into exactly 96 classes
43//! 4. **Label system** (§0.3.3): Each class labeled by 6-tuple (e₁,e₂,e₃,d₄₅,e₆,e₇)
44//! 5. **8D extension** (§0.3.4): Labels extend uniquely to E₈ coordinates
45//!
46//! These results are **computational discoveries**, not assumptions. The number 96
47//! emerges from optimization, not by design.
48//!
49//! ## Connection to Main Theorem
50//!
51//! The Atlas initiality theorem (proved in later chapters) states:
52//!
53//! > The Atlas is the initial object in the category of resonance graphs,
54//! > from which all exceptional Lie groups emerge through categorical operations.
55//!
56//! This chapter provides:
57//! - The **Atlas** itself (96 resonance classes from §0.3)
58//! - The **categorical language** to state initiality (§0.4)
59//! - The **first-principles approach** ensuring no circular reasoning
60//!
61//! ## Historical Context
62//!
63//! The Atlas emerged from research by the UOR Foundation into invariant properties
64//! of software systems under the Universal Object Reference (UOR) framework. The
65//! discovery that fundamental mathematical structures arise from informational
66//! action principles was unexpected.
67//!
68//! This chapter reconstructs the discovery path: starting only with an action
69//! functional, we derive the 96-vertex structure without assuming Lie theory.
70//!
71//! ---
72//!
73//! **Navigation**:
74//! - Next: [§0.1 Primitive Concepts](primitives)
75//! - Up: [Main Page](crate)
76
77// Public submodules
78pub mod action;
79pub mod categories;
80pub mod primitives;
81pub mod resgraph;
82pub mod resonance;
83
84// Re-export key types for convenience
85pub use action::{ActionFunctional, Complex12288, Configuration};
86pub use categories::{Functor, Morphism, Product, Quotient, ResonanceGraph};
87pub use primitives::{KleinElement, SimpleGraph};
88pub use resgraph::{ResGraphMorphism, ResGraphObject};
89pub use resonance::{extend_to_8d, generate_all_labels, AtlasLabel, ResonanceClass};
90
91#[cfg(test)]
92mod tests {
93    use super::*;
94
95    #[test]
96    fn test_foundations_module_structure() {
97        // Verify we can create instances of key types
98        let _ = SimpleGraph::new();
99        let _ = KleinElement::Identity;
100        let _ = Complex12288::new();
101        let _ = AtlasLabel::new(0, 0, 0, 0, 0, 0);
102
103        // Verify category theory types
104        let _ = Product::new("A".to_string(), "B".to_string(), None);
105        let _ = Quotient::new("G".to_string(), 48, None);
106        let _ = ResonanceGraph::new(96, vec![], std::collections::HashMap::new());
107    }
108
109    #[test]
110    fn test_96_labels_generation() {
111        let labels = generate_all_labels();
112        assert_eq!(labels.len(), 96);
113
114        // All should be valid
115        assert!(labels.iter().all(AtlasLabel::is_valid));
116    }
117
118    #[test]
119    fn test_all_labels_extend_to_8d() {
120        let labels = generate_all_labels();
121
122        for label in &labels {
123            let extended = extend_to_8d(label);
124
125            // Verify extension has 8 coordinates
126            assert_eq!(extended.len(), 8);
127
128            // Verify first 3 match
129            assert_eq!(extended[0], label.e1);
130            assert_eq!(extended[1], label.e2);
131            assert_eq!(extended[2], label.e3);
132
133            // Verify d45 constraint: e4 - e5 = d45
134            assert_eq!(extended[3] - extended[4], label.d45);
135
136            // Verify last 2 match
137            assert_eq!(extended[5], label.e6);
138            assert_eq!(extended[6], label.e7);
139
140            // Verify parity: sum is even
141            let sum: i8 = extended.iter().sum();
142            assert_eq!(sum % 2, 0);
143        }
144    }
145}