exo_exotic/
lib.rs

1//! # EXO-Exotic: Cutting-Edge Cognitive Experiments
2//!
3//! This crate implements 10 exotic cognitive experiments pushing the boundaries
4//! of artificial consciousness and intelligence research.
5//!
6//! ## Experiments
7//!
8//! 1. **Strange Loops** - Hofstadter-style self-referential cognition
9//! 2. **Artificial Dreams** - Offline replay and creative recombination
10//! 3. **Predictive Processing** - Friston's Free Energy Principle
11//! 4. **Morphogenetic Cognition** - Self-organizing pattern formation
12//! 5. **Collective Consciousness** - Distributed Φ across substrates
13//! 6. **Temporal Qualia** - Subjective time dilation/compression
14//! 7. **Multiple Selves** - Partitioned consciousness dynamics
15//! 8. **Cognitive Thermodynamics** - Landauer principle in thought
16//! 9. **Emergence Detection** - Detecting novel emergent properties
17//! 10. **Cognitive Black Holes** - Attractor states in thought space
18//!
19//! ## Performance Optimizations
20//!
21//! - SIMD-accelerated computations where applicable
22//! - Lock-free concurrent data structures
23//! - Cache-friendly memory layouts
24//! - Early termination heuristics
25
26pub mod strange_loops;
27pub mod dreams;
28pub mod free_energy;
29pub mod morphogenesis;
30pub mod collective;
31pub mod temporal_qualia;
32pub mod multiple_selves;
33pub mod thermodynamics;
34pub mod emergence;
35pub mod black_holes;
36
37// Re-exports for convenience
38pub use strange_loops::{StrangeLoop, SelfReference, TangledHierarchy};
39pub use dreams::{DreamEngine, DreamState, DreamReport};
40pub use free_energy::{FreeEnergyMinimizer, PredictiveModel, ActiveInference};
41pub use morphogenesis::{MorphogeneticField, TuringPattern, CognitiveEmbryogenesis};
42pub use collective::{CollectiveConsciousness, HiveMind, DistributedPhi};
43pub use temporal_qualia::{TemporalQualia, SubjectiveTime, TimeCrystal};
44pub use multiple_selves::{MultipleSelvesSystem, SubPersonality, SelfCoherence};
45pub use thermodynamics::{CognitiveThermodynamics, ThoughtEntropy, MaxwellDemon};
46pub use emergence::{EmergenceDetector, CausalEmergence, PhaseTransition};
47pub use black_holes::{CognitiveBlackHole, AttractorState, EscapeDynamics};
48
49/// Unified experiment runner for all exotic modules
50pub struct ExoticExperiments {
51    pub strange_loops: StrangeLoop,
52    pub dreams: DreamEngine,
53    pub free_energy: FreeEnergyMinimizer,
54    pub morphogenesis: MorphogeneticField,
55    pub collective: CollectiveConsciousness,
56    pub temporal: TemporalQualia,
57    pub selves: MultipleSelvesSystem,
58    pub thermodynamics: CognitiveThermodynamics,
59    pub emergence: EmergenceDetector,
60    pub black_holes: CognitiveBlackHole,
61}
62
63impl ExoticExperiments {
64    /// Create a new suite of exotic experiments with default parameters
65    pub fn new() -> Self {
66        Self {
67            strange_loops: StrangeLoop::new(5),
68            dreams: DreamEngine::new(),
69            free_energy: FreeEnergyMinimizer::new(0.1),
70            morphogenesis: MorphogeneticField::new(32, 32),
71            collective: CollectiveConsciousness::new(),
72            temporal: TemporalQualia::new(),
73            selves: MultipleSelvesSystem::new(),
74            thermodynamics: CognitiveThermodynamics::new(300.0), // Room temperature
75            emergence: EmergenceDetector::new(),
76            black_holes: CognitiveBlackHole::new(),
77        }
78    }
79
80    /// Run all experiments and collect results
81    pub fn run_all(&mut self) -> ExperimentResults {
82        ExperimentResults {
83            strange_loop_depth: self.strange_loops.measure_depth(),
84            dream_creativity: self.dreams.measure_creativity(),
85            free_energy: self.free_energy.compute_free_energy(),
86            morphogenetic_complexity: self.morphogenesis.measure_complexity(),
87            collective_phi: self.collective.compute_global_phi(),
88            temporal_dilation: self.temporal.measure_dilation(),
89            self_coherence: self.selves.measure_coherence(),
90            cognitive_temperature: self.thermodynamics.measure_temperature(),
91            emergence_score: self.emergence.detect_emergence(),
92            attractor_strength: self.black_holes.measure_attraction(),
93        }
94    }
95}
96
97impl Default for ExoticExperiments {
98    fn default() -> Self {
99        Self::new()
100    }
101}
102
103/// Results from running all exotic experiments
104#[derive(Debug, Clone)]
105pub struct ExperimentResults {
106    pub strange_loop_depth: usize,
107    pub dream_creativity: f64,
108    pub free_energy: f64,
109    pub morphogenetic_complexity: f64,
110    pub collective_phi: f64,
111    pub temporal_dilation: f64,
112    pub self_coherence: f64,
113    pub cognitive_temperature: f64,
114    pub emergence_score: f64,
115    pub attractor_strength: f64,
116}
117
118impl ExperimentResults {
119    /// Overall exotic cognition score (normalized 0-1)
120    pub fn overall_score(&self) -> f64 {
121        let scores = [
122            (self.strange_loop_depth as f64 / 10.0).min(1.0),
123            self.dream_creativity,
124            1.0 - self.free_energy.min(1.0), // Lower free energy = better
125            self.morphogenetic_complexity,
126            self.collective_phi,
127            self.temporal_dilation.abs().min(1.0),
128            self.self_coherence,
129            1.0 / (1.0 + self.cognitive_temperature / 1000.0), // Normalize temp
130            self.emergence_score,
131            1.0 - self.attractor_strength.min(1.0), // Lower = less trapped
132        ];
133        scores.iter().sum::<f64>() / scores.len() as f64
134    }
135}
136
137#[cfg(test)]
138mod tests {
139    use super::*;
140
141    #[test]
142    fn test_experiment_suite_creation() {
143        let experiments = ExoticExperiments::new();
144        assert!(experiments.strange_loops.measure_depth() >= 0);
145    }
146
147    #[test]
148    fn test_run_all_experiments() {
149        let mut experiments = ExoticExperiments::new();
150        let results = experiments.run_all();
151        assert!(results.overall_score() >= 0.0);
152        assert!(results.overall_score() <= 1.0);
153    }
154}