Skip to content

Commit 48c5b1e

Browse files
authored
Merge pull request #13 from HyperCogWizard/copilot/fix-12
Add comprehensive RR-RNN documentation with architecture diagrams and process flows
2 parents b9b5953 + f51dcf0 commit 48c5b1e

7 files changed

Lines changed: 2212 additions & 86 deletions

File tree

README.md

Lines changed: 216 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,232 @@
1-
# plingua
2-
The P-Lingua language for Membrane Computing
1+
# RR-PLingua: Relevance Realization Enhanced Membrane Computing
32

4-
P-Lingua is a comprehensive framework for membrane computing that provides a complete ecosystem for defining, parsing, simulating, and generating code for P-systems (membrane systems).
3+
**RR-PLingua** is an advanced membrane computing framework that integrates **Relevance Realization (RR)** dynamics with **OpenCog AtomSpace** symbolic reasoning, creating a unified platform for membrane computing with cognitive architectures.
54

6-
## 📚 Documentation
5+
## 🧠 RR-RNN: Relevance Realization with Recursive Neural Networks
6+
7+
This implementation extends the traditional P-Lingua framework with four major Next Development Directions, creating a sophisticated system for symbolic-subsymbolic integration in membrane computing environments.
8+
9+
### ✨ Key Features
10+
11+
- **🔗 Advanced PLN Integration**: Probabilistic Logic Networks with RR pattern reasoning
12+
- **💬 Enhanced Scheme Interface**: Interactive REPL for system exploration and manipulation
13+
- **💾 Persistent AtomSpace**: JSON serialization and incremental learning capabilities
14+
- **🏗️ Multi-Level Integration**: Hierarchical membrane structures with cross-level emergence
15+
16+
## 🎯 Implementation Summary
17+
18+
### 1. Advanced PLN Integration ✅
19+
**File**: `include/pln_integration.hpp`
20+
21+
- **PLN Truth Values**: Complete implementation with strength/confidence pairs
22+
- **Inference Rules**:
23+
- Deduction: A→B, A ⊢ B
24+
- Abduction: A→B, B ⊢ A (with reduced confidence)
25+
- **RR Pattern Implications**: Automatic generation of implications from high-coupling agent-arena relationships
26+
- **Full Inference Cycle**: Integrated PLN reasoning over membrane structures
727

8-
### [Comprehensive Architecture Documentation](docs/README.md)
9-
Detailed architectural insights with Mermaid diagrams covering:
10-
- **[System Architecture](docs/ARCHITECTURE.md)**: High-level design patterns and data flows
11-
- **[Component Deep Dive](docs/COMPONENTS.md)**: Internal architecture of parser, simulator, and generator
12-
- **[Usage Examples](docs/EXAMPLES.md)**: Practical demonstrations and integration guides
28+
### 2. Enhanced Scheme Interface ✅
29+
**File**: `include/scheme_interface.hpp`
1330

14-
## Dependencies
31+
- **Interactive REPL**: Full Scheme-style command evaluation
32+
- **Command Set**: 8+ commands for system exploration and manipulation
33+
- **Pattern Matching**: Query and analyze both RR and AtomSpace structures
34+
- **Real-time Updates**: Modify system state through Scheme commands
1535

16-
* Linux OS (tested on Ubuntu 16.04 and Ubuntu 18.04)
17-
* GCC 4.9.0 or higher (with support for regex)
18-
* Flex
19-
* Bison
20-
* libboost-filesystem-dev
21-
* libboost-program-options-dev
36+
### 3. Persistent AtomSpace ✅
37+
**File**: `include/persistent_atomspace.hpp`
2238

23-
sudo apt-get install build-essential flex bison libboost-filesystem-dev libboost-program-options-dev
39+
- **JSON Serialization**: Complete save/load for AtomSpace state
40+
- **RR Hypergraph Persistence**: Serialize all RR dynamics and structure
41+
- **Incremental Learning**: Merge new experiences with existing knowledge
42+
- **Memory Consolidation**: Remove low-confidence atoms to optimize storage
2443

25-
## Compiling
44+
### 4. Multi-Level Integration ✅
45+
**Distributed across**: `relevance_realization.hpp`, `atomspace_integration.hpp`, test files
2646

27-
* make grammar
28-
* make compiler
29-
* make simulator
30-
* sudo make install
47+
- **Hierarchical Structures**: Support for nested membrane architectures
48+
- **Cross-Level Emergence**: Detection of patterns spanning multiple hierarchy levels
49+
- **Temporal Reasoning**: Track relevance evolution over time
50+
- **Multi-Scale Dynamics**: Coordinated RR updates across system levels
3151

32-
## Architecture Overview
52+
## 🏛️ Architecture Overview
3353

3454
```mermaid
3555
graph TD
36-
A[P-Lingua Source] --> B[Parser]
37-
B --> C[P-System Model]
38-
C --> D[Simulator]
39-
C --> E[Code Generator]
40-
D --> F[Results]
41-
E --> G[Generated Code]
56+
subgraph "Traditional P-Lingua Core"
57+
A[P-Lingua Source] --> B[Parser]
58+
B --> C[P-System Model]
59+
C --> D[Simulator]
60+
C --> E[Code Generator]
61+
end
4262
43-
style A fill:#e3f2fd
44-
style C fill:#f3e5f5
45-
style F fill:#e8f5e8
46-
style G fill:#fff3e0
63+
subgraph "RR Enhancement Layer"
64+
F[RR Hypergraph] --> G[Relevance Dynamics]
65+
G --> H[Agent-Arena-Relation Triad]
66+
H --> I[Trialectic Co-constitution]
67+
end
68+
69+
subgraph "AtomSpace Integration"
70+
J[OpenCog AtomSpace] --> K[PLN Inference]
71+
K --> L[Pattern Recognition]
72+
L --> M[Symbolic Reasoning]
73+
end
74+
75+
subgraph "Unified Architecture"
76+
N[RR-AtomSpace Bridge]
77+
O[Scheme Interface]
78+
P[Persistent Storage]
79+
Q[Multi-Level Coordination]
80+
end
81+
82+
C --> F
83+
F --> J
84+
J --> N
85+
N --> O
86+
N --> P
87+
N --> Q
88+
89+
style F fill:#e3f2fd
90+
style J fill:#f3e5f5
91+
style N fill:#e8f5e8
92+
style O fill:#fff3e0
4793
```
4894

49-
The framework consists of three main components:
50-
- **Parser**: Transforms P-Lingua source into executable models
51-
- **Simulator**: Executes membrane computing simulations
52-
- **Generator**: Produces optimized C++ implementations
95+
## 🔄 RR Dynamics Process Flow
96+
97+
```mermaid
98+
sequenceDiagram
99+
participant Agent as Agent Membrane
100+
participant Arena as Arena Membrane
101+
participant RR as RR Engine
102+
participant AtomSpace as AtomSpace
103+
participant PLN as PLN Engine
104+
105+
Agent->>RR: Update salience
106+
Arena->>RR: Update affordances
107+
RR->>RR: Compute trialectic dynamics
108+
RR->>AtomSpace: Sync RR properties
109+
AtomSpace->>PLN: Generate implications
110+
PLN->>PLN: Perform inference cycle
111+
PLN->>AtomSpace: Update truth values
112+
AtomSpace->>RR: Feedback to RR dynamics
113+
RR->>Agent: Update relevance gradient
114+
RR->>Arena: Update coupling strength
115+
```
116+
117+
## 🚀 Quick Start
118+
119+
### Dependencies
120+
121+
```bash
122+
sudo apt-get install build-essential flex bison libboost-filesystem-dev libboost-program-options-dev libfl-dev
123+
```
124+
125+
### Build & Test
126+
127+
```bash
128+
# Build traditional P-Lingua
129+
make grammar
130+
make compiler
131+
make simulator
132+
133+
# Build RR-enhanced test programs
134+
g++ -I./include -std=c++11 -o test_rr_enhanced test_rr_enhanced.cpp
135+
g++ -I./include -std=c++11 -o test_next_directions test_next_directions.cpp
136+
g++ -I./include -std=c++11 -o demo_repl demo_repl.cpp
137+
138+
# Run comprehensive demo
139+
./test_next_directions
140+
```
141+
142+
### Interactive RR/AtomSpace REPL
143+
144+
```bash
145+
./demo_repl
146+
```
147+
148+
Available Scheme commands:
149+
```scheme
150+
(list-rr-nodes) ; List all RR nodes with properties
151+
(list-atoms) ; Show AtomSpace contents
152+
(get-system-relevance) ; Compute overall system relevance
153+
(run-pln-inference) ; Execute PLN reasoning cycle
154+
(find-patterns) ; Detect emergent patterns
155+
(get-salience node-ID) ; Query node salience
156+
(update-salience node-ID VALUE) ; Modify node properties
157+
(find-atom "NAME") ; Search atoms by name
158+
```
159+
160+
## 📊 Performance Characteristics
161+
162+
### RR Dynamics Complexity
163+
- **Trialectic Updates**: O(n) per node per timestep
164+
- **Coupling Computation**: O(n²) for agent-arena pairs
165+
- **Emergence Detection**: O(n·m) for n agents, m arenas
166+
167+
### AtomSpace Integration
168+
- **RR→Atom Conversion**: O(n) for n RR nodes
169+
- **PLN Inference**: O(r·a) for r rules, a atoms
170+
- **Pattern Matching**: O(p·log(a)) for p patterns
171+
172+
## 🔬 Research Applications
173+
174+
### Cognitive Architecture Integration
175+
- **Symbolic-Subsymbolic Bridge**: RR provides the dynamic foundation for symbolic reasoning
176+
- **Emergent Pattern Recognition**: Multi-level emergence detection across membrane hierarchies
177+
- **Adaptive Learning**: Persistent storage enables incremental knowledge accumulation
178+
179+
### Membrane Computing Enhancements
180+
- **Dynamic Rule Selection**: RR salience influences rule application priorities
181+
- **Adaptive Membrane Behavior**: Agent-arena coupling drives membrane evolution
182+
- **Hierarchical Organization**: Multi-level integration supports complex system architectures
183+
184+
## 📚 Documentation
185+
186+
### [Comprehensive RR-RNN Documentation](docs/README.md)
187+
Detailed technical documentation with diagrams covering:
188+
- **[RR-RNN Architecture](docs/ARCHITECTURE.md)**: Relevance Realization integration patterns
189+
- **[Component Deep Dive](docs/COMPONENTS.md)**: PLN, Scheme, and persistence systems
190+
- **[Usage Examples](docs/EXAMPLES.md)**: RR dynamics and AtomSpace integration demos
191+
192+
### Core Implementation Files
193+
194+
```
195+
include/
196+
├── relevance_realization.hpp # RR framework with trialectic dynamics
197+
├── atomspace_integration.hpp # RR-AtomSpace bridge
198+
├── pln_integration.hpp # PLN inference engine
199+
├── scheme_interface.hpp # Interactive Scheme REPL
200+
└── persistent_atomspace.hpp # Serialization & persistence
201+
202+
test_*.cpp # Comprehensive test suite
203+
demo_*.cpp # Interactive demonstrations
204+
```
205+
206+
## 🎯 Future Extensions
207+
208+
The implemented framework provides the foundation for:
209+
210+
1. **Advanced Cognitive Architectures**: Full symbolic-subsymbolic integration
211+
2. **Distributed RR Systems**: Multi-agent relevance realization networks
212+
3. **Learning Systems**: Persistent knowledge accumulation and refinement
213+
4. **Interactive Exploration**: Real-time system analysis and manipulation
214+
215+
## 🤝 Contributing
216+
217+
This RR-enhanced membrane computing framework represents a significant advancement toward unified cognitive architectures. Contributions are welcome in:
218+
219+
- Enhanced RR dynamics algorithms
220+
- Additional PLN inference rules
221+
- Extended Scheme command sets
222+
- Multi-level emergence patterns
223+
- Performance optimizations
224+
225+
## 📄 License
226+
227+
Licensed under the same terms as the original P-Lingua framework.
228+
229+
---
230+
231+
*RR-PLingua successfully bridges dynamic self-organization (RR) and symbolic reasoning (AtomSpace/PLN), representing a significant advancement toward unified cognitive architectures.*
53232

docs/ARCHITECTURE.md

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,71 @@
1-
# P-Lingua Architecture Documentation
1+
# RR-Enhanced P-Lingua Architecture Documentation
22

33
## Overview
44

5-
P-Lingua is a comprehensive framework for membrane computing that provides a complete ecosystem for defining, parsing, simulating, and generating code for P-systems (membrane systems). This documentation provides detailed architectural insights with visual diagrams to facilitate understanding and contribution.
5+
**RR-PLingua** is a revolutionary enhancement of the traditional P-Lingua framework that integrates **Relevance Realization (RR)** dynamics with **OpenCog AtomSpace** symbolic reasoning. This creates a sophisticated platform for cognitive membrane computing that bridges symbolic and subsymbolic processing.
6+
7+
The enhanced system provides four major architectural innovations:
8+
1. **PLN Integration** - Probabilistic Logic Networks for uncertain reasoning
9+
2. **Scheme Interface** - Interactive exploration and manipulation
10+
3. **Persistent Storage** - Knowledge accumulation and memory consolidation
11+
4. **Multi-Level Integration** - Hierarchical emergence detection
612

713
## High-Level System Architecture
814

915
```mermaid
1016
graph TD
11-
A[P-Lingua Source Files] --> B[Lexical Analyzer]
12-
B --> C[Parser]
13-
C --> D[Syntax Tree]
14-
D --> E[Semantic Analyzer]
15-
E --> F[P-System Model]
16-
F --> G[Simulator Engine]
17-
F --> H[Code Generator]
18-
G --> I[Configuration Output]
19-
H --> J[C++ Generated Code]
20-
21-
subgraph "Core Components"
22-
K[Parser Module]
23-
L[Simulator Module]
24-
M[Generator Module]
25-
N[Serialization Module]
17+
subgraph "Traditional P-Lingua Layer"
18+
A[P-Lingua Source Files] --> B[Lexical Analyzer]
19+
B --> C[Parser]
20+
C --> D[Syntax Tree]
21+
D --> E[Semantic Analyzer]
22+
E --> F[P-System Model]
23+
F --> G[Simulator Engine]
24+
F --> H[Code Generator]
25+
G --> I[Configuration Output]
26+
H --> J[C++ Generated Code]
2627
end
2728
28-
C --> K
29-
G --> L
30-
H --> M
31-
F --> N
29+
subgraph "RR Enhancement Layer"
30+
K[RR Hypergraph]
31+
L[Trialectic Dynamics]
32+
M[Agent-Arena-Relation]
33+
N[Relevance Gradients]
34+
end
3235
33-
style A fill:#e1f5fe
34-
style F fill:#f3e5f5
35-
style I fill:#e8f5e8
36-
style J fill:#fff3e0
36+
subgraph "AtomSpace Integration Layer"
37+
O[OpenCog AtomSpace]
38+
P[PLN Inference Engine]
39+
Q[Truth Value Management]
40+
R[Pattern Recognition]
41+
end
42+
43+
subgraph "Interactive & Persistence Layer"
44+
S[Scheme REPL Interface]
45+
T[JSON Serialization]
46+
U[Memory Consolidation]
47+
V[Multi-Level Coordination]
48+
end
49+
50+
F --> K
51+
K --> L
52+
L --> M
53+
M --> N
54+
55+
K --> O
56+
O --> P
57+
P --> Q
58+
Q --> R
59+
60+
O --> S
61+
O --> T
62+
T --> U
63+
K --> V
64+
65+
style K fill:#e3f2fd
66+
style O fill:#f3e5f5
67+
style S fill:#e8f5e8
68+
style V fill:#fff3e0
3769
```
3870

3971
## Core Data Structures

0 commit comments

Comments
 (0)