omega-strange-loops
Self-referential cognitive structures inspired by Hofstadter's "I Am a Strange Loop."
Part of the ExoGenesis-Omega cognitive architecture.
Overview
omega-strange-loops implements the computational structures that enable self-awareness and consciousness-like properties through self-reference. Inspired by Douglas Hofstadter's work on strange loops and Gödel's incompleteness theorems.
Key concepts:
- Strange Loops: Self-referential feedback systems that cross hierarchical levels
- Self-Models: Internal representations that represent the system itself
- Meta-Cognition: Thinking about thinking at multiple levels
- Tangled Hierarchies: Levels that loop back on themselves
- Mirror Structures: Representations that can represent themselves
Features
- Strange Loop Engine: Create and traverse self-referential loops
- Self-Model Construction: Build and update internal self-representations
- Meta-Cognitive Levels: Multiple levels of self-reflection
- Recursive Mirrors: Infinite regress with bounded computation
- Paradox Detection: Identify and handle self-referential paradoxes
- Tangled Hierarchies: Model level-crossing references
Installation
Add this to your Cargo.toml:
[]
= "1.0.0"
Quick Start
use ;
Core Concepts
What is a Strange Loop?
A strange loop occurs when moving through levels of a hierarchical system, you unexpectedly find yourself back at the starting level. In consciousness, this manifests as:
- The "I" that thinks about itself
- Awareness of being aware
- The observer observing the observer
Level N: "I am thinking about..."
↓
Level N-1: "...the thought that..."
↓
Level N-2: "...I am thinking about..."
↓
... (loops back to Level N)
Strange Loops
use ;
// Create a strange loop
let mut loop_struct = new; // 5 levels
// Add level-crossing reference (the "strange" part)
loop_struct.add_crossing?;
// Traverse the loop
let mut current = new;
for step in 0..10
Tangled Hierarchies
let mut hierarchy = new;
// Normal hierarchical levels
for i in 0..6
// Add tangles (level violations)
hierarchy.add_tangle?; // High level influences low level
hierarchy.add_tangle?; // Top loops to bottom
// Check if hierarchy is tangled
println!;
println!;
Self-Models
The system maintains an internal model of itself:
use ;
let mut self_model = new; // 32-dimensional state
// Update self-model based on observations
let observation = vec!;
self_model.observe;
// Get current self-state
let state = self_model.current_state;
println!;
println!;
println!;
// Predict own future state
let prediction = self_model.predict?; // 10 steps ahead
println!;
// Compare prediction with reality (self-awareness)
let reality = self_model.current_state.vector;
let error = self_model.prediction_error;
println!;
Self-Model Updates
// Apply update to self-model
let update = SelfModelUpdate ;
self_model.apply_update?;
// Self-model learns from discrepancies
self_model.learn_from_error?; // Learning rate 0.01
Meta-Cognition
Thinking about thinking at multiple levels:
use ;
let mut meta = new; // 5 meta-levels
// Level 0: Base cognition (thinking about the world)
let base_thought = vec!;
// Level 1: Meta-cognition (thinking about thoughts)
let meta1 = meta.reflect?;
println!;
// Level 2: Meta-meta-cognition (thinking about meta-cognition)
let meta2 = meta.reflect?;
println!;
// Higher levels
for level in 3..5
// Check current meta-level
println!;
println!;
Thought About Thought
let thought = ThoughtAboutThought ;
println!;
Recursive Mirrors
Representations that can represent themselves:
use ;
let mut mirror = new; // Max 3 reflections
// First reflection
let input = vec!;
let r1 = mirror.reflect?;
println!;
// Reflection of reflection
let r2 = mirror.reflect?;
println!;
// Each reflection adds distortion (bounded infinite regress)
let r3 = mirror.reflect?;
println!;
// Beyond max depth, returns fixed point
let r4 = mirror.reflect?;
println!;
Mirror Properties
// Self-similarity across reflections
let similarity = mirror.self_similarity;
println!;
// Information preserved
let info_preserved = mirror.information_preservation;
println!;
Self-Referential Symbols
Symbols that can reference themselves:
use SelfReferentialSymbol;
// Create symbol
let mut symbol = new;
// Add self-reference
symbol.add_reference;
println!;
// Add references to other symbols
symbol.add_reference;
symbol.add_reference;
println!;
Paradox Detection
Handle self-referential paradoxes:
use ;
let config = StrangeLoopConfig ;
let mut engine = new;
// This might create a paradox
let result = engine.process;
match result
Configuration
use StrangeLoopConfig;
let config = StrangeLoopConfig ;
let engine = new;
Use Cases
1. Self-Aware AI
// AI that knows it's an AI
let mut ai = new;
// Process external input
let perception = perceive_world;
// Self-reflective processing
let output = ai.process?;
// "I am processing this input"
let meta_awareness = ai.meta_cognition.reflect?;
// "I am aware that I am processing this input"
let meta_meta = ai.meta_cognition.reflect?;
2. Introspection
// Examine own internal states
let internal_state = engine.self_model.current_state;
// Compare with expected state
let expected = engine.self_model.expected_state;
let discrepancy = engine.self_model.compare;
if discrepancy > 0.3
3. Recursive Self-Improvement
// Model of how I learn
let learning_model = engine.self_model.learning_model;
// Model of how I model my learning
let meta_learning = engine.meta_cognition.reflect?;
// Use meta-learning to improve learning
let improved_learning = engine.improve_from_meta?;
engine.update_learning_model?;
Integration with Omega
omega-brain (Unified Integration)
└── omega-strange-loops (This crate)
├── Strange loops
├── Self-models
├── Meta-cognition
├── Mirrors
└── Paradox handling
Enables:
├── Self-awareness in omega-brain
├── Meta-cognitive control
└── Introspective capabilities
Related Crates
- omega-brain - Unified cognitive architecture
- omega-consciousness - Consciousness models
- omega-attention - What enters self-awareness
- omega-hippocampus - Autobiographical memory
References
- Hofstadter, D. R. (2007). "I Am a Strange Loop"
- Hofstadter, D. R. (1979). "Gödel, Escher, Bach: An Eternal Golden Braid"
- Metzinger, T. (2003). "Being No One: The Self-Model Theory of Subjectivity"
- Dennett, D. C. (1991). "Consciousness Explained"
- Gödel, K. (1931). "On Formally Undecidable Propositions"
License
Licensed under the MIT License. See LICENSE for details.