@aleph-ai/tinyaleph 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +278 -0
- package/backends/cryptographic/index.js +196 -0
- package/backends/index.js +15 -0
- package/backends/interface.js +89 -0
- package/backends/scientific/index.js +272 -0
- package/backends/semantic/index.js +527 -0
- package/backends/semantic/surface.js +393 -0
- package/backends/semantic/two-layer.js +375 -0
- package/core/fano.js +127 -0
- package/core/hilbert.js +564 -0
- package/core/hypercomplex.js +141 -0
- package/core/index.js +133 -0
- package/core/llm.js +132 -0
- package/core/prime.js +184 -0
- package/core/resonance.js +695 -0
- package/core/rformer-tf.js +1086 -0
- package/core/rformer.js +806 -0
- package/core/sieve.js +350 -0
- package/data.json +8163 -0
- package/docs/EXAMPLES_PLAN.md +293 -0
- package/docs/README.md +159 -0
- package/docs/design/ALEPH_CHAT_ARCHITECTURE.md +499 -0
- package/docs/guide/01-quickstart.md +298 -0
- package/docs/guide/02-semantic-computing.md +409 -0
- package/docs/guide/03-cryptographic.md +420 -0
- package/docs/guide/04-scientific.md +494 -0
- package/docs/guide/05-llm-integration.md +568 -0
- package/docs/guide/06-advanced.md +996 -0
- package/docs/guide/README.md +188 -0
- package/docs/reference/01-core.md +695 -0
- package/docs/reference/02-physics.md +601 -0
- package/docs/reference/03-backends.md +892 -0
- package/docs/reference/04-engine.md +632 -0
- package/docs/reference/README.md +252 -0
- package/docs/theory/01-prime-semantics.md +327 -0
- package/docs/theory/02-hypercomplex-algebra.md +421 -0
- package/docs/theory/03-phase-synchronization.md +364 -0
- package/docs/theory/04-entropy-reasoning.md +348 -0
- package/docs/theory/05-non-commutativity.md +402 -0
- package/docs/theory/06-two-layer-meaning.md +414 -0
- package/docs/theory/07-resonant-field-interface.md +419 -0
- package/docs/theory/08-semantic-sieve.md +520 -0
- package/docs/theory/09-temporal-emergence.md +298 -0
- package/docs/theory/10-quaternionic-memory.md +415 -0
- package/docs/theory/README.md +162 -0
- package/engine/aleph.js +418 -0
- package/engine/index.js +7 -0
- package/index.js +23 -0
- package/modular.js +254 -0
- package/package.json +99 -0
- package/physics/collapse.js +95 -0
- package/physics/entropy.js +88 -0
- package/physics/index.js +65 -0
- package/physics/kuramoto.js +91 -0
- package/physics/lyapunov.js +80 -0
- package/physics/oscillator.js +95 -0
- package/types/index.d.ts +575 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Temporal Emergence and PRSC
|
|
2
|
+
|
|
3
|
+
This document covers Prime-Resonant Symbolic Computation (PRSC), a foundational framework that redefines time as an emergent property of symbolic phase alignment.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Traditional computational architectures rely on a global clock to synchronize discrete state transitions, treating time as a linear, externally imposed scalar. PRSC takes a radically different approach: **time emerges from the alignment of prime-indexed oscillators**.
|
|
8
|
+
|
|
9
|
+
The key insight: even in classical systems, the clock is a periodic oscillator—an underlying resonance mechanism that indexes state propagation. Time is an artifact of periodic phase thresholds, not a fundamental flow.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## The PRSC Formalism
|
|
14
|
+
|
|
15
|
+
### Symbolic Phase Space
|
|
16
|
+
|
|
17
|
+
In PRSC, symbolic states are represented as phase oscillators indexed by prime numbers. Each prime pᵢ drives an oscillator with frequency:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
fᵢ ∝ 1/pᵢ
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This ensures **incommensurate periods** and a non-repeating temporal field. Incommensurate frequencies can never perfectly synchronize, creating a rich dynamical landscape.
|
|
24
|
+
|
|
25
|
+
The global phase state is a vector:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Φ(t) = (Φ₁(t), Φ₂(t), ..., Φₙ(t))
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
where Φᵢ(t) is the phase of the i-th symbolic subspace.
|
|
32
|
+
|
|
33
|
+
### The Coherence Function
|
|
34
|
+
|
|
35
|
+
The coherence function C(t) measures phase alignment across all oscillators:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
C(t) = Σᵢ,ⱼ wᵢⱼ · cos(Φᵢ(t) - Φⱼ(t))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
where wᵢⱼ are weights reflecting symbolic proximity.
|
|
42
|
+
|
|
43
|
+
**A temporal event occurs when:**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
C(t) ≥ C_threshold
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This event defines a "tick" of emergent time, replacing the global clock with a dynamic, symbolic convergence process.
|
|
50
|
+
|
|
51
|
+
### Visualization
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
t →
|
|
55
|
+
╭──────────────────────────────────────────╮
|
|
56
|
+
Φ₁₃(t) │ ∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿∿ │
|
|
57
|
+
Φ₁₇(t) │ ∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼∼ │
|
|
58
|
+
Φ₁₉(t) │ ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈ │
|
|
59
|
+
╰──────────────────────────────────────────╯
|
|
60
|
+
↑ ↑
|
|
61
|
+
Event 1 Event 2
|
|
62
|
+
(C > C_th) (C > C_th)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Entropy and State Collapse
|
|
68
|
+
|
|
69
|
+
System evolution is governed by an entropy operator combining Hamiltonian dynamics with dissipation:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
d/dt |ψ(t)⟩ = Ĥ|ψ(t)⟩ - λ(R̂ - τ_stable)|ψ(t)⟩
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
where:
|
|
76
|
+
- Ĥ is the Hamiltonian (energy operator)
|
|
77
|
+
- λ controls entropy dissipation
|
|
78
|
+
- R̂ is the resonance operator
|
|
79
|
+
- τ_stable is the stability threshold
|
|
80
|
+
|
|
81
|
+
### Collapse Probability
|
|
82
|
+
|
|
83
|
+
The probability of state collapse follows:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
P_collapse = 1 - e^(-∫ Ŝ(t) dt)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
where:
|
|
90
|
+
```
|
|
91
|
+
Ŝ(t) = S₀ e^(-λt)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This means computation occurs **only when symbolic states achieve sufficient coherence**, mimicking quantum-like collapse in a classical system.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quaternionic Resonance
|
|
99
|
+
|
|
100
|
+
For primes p ≡ 1 (mod 12), symbolic states are encoded using Gaussian and Eisenstein factorizations embedded in quaternions:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
φₖ = c + ki + jℓ + dk, where k = j·i
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### The Quaternionic Resonance Field
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
ψ_q(x, t) = N⁻¹ ψ̄_q(x) · exp(iφ(x, t))
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
A projection operator maps this to a Bloch vector:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
Ĉ_q : H_q → ℝ⁴
|
|
116
|
+
Ĉ_q|ψ_q⟩ = (1/‖ψ_q‖²)⟨ψ_q, ξ', ξ'⟩
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Quaternionic Synchronization
|
|
120
|
+
|
|
121
|
+
Nodes in a distributed system synchronize through phase-locking:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
125
|
+
│ Node 1 │ │ Node 2 │
|
|
126
|
+
│ ψ_q^(1) │◄────────────►│ ψ_q^(2) │
|
|
127
|
+
│ q=a+bi+cj+dk │ Phase-lock │ q'=a'+b'i+c'j+d'k│
|
|
128
|
+
└─────────────────┘ Δψ_q∈[0,π] └─────────────────┘
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Collapse occurs when:
|
|
132
|
+
1. Ŝ(y) < 0.3 (low entropy)
|
|
133
|
+
2. The twist angle is properly aligned
|
|
134
|
+
|
|
135
|
+
This enhances non-local communication by stabilizing states against noise.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Distributed Holographic Memory
|
|
140
|
+
|
|
141
|
+
### Local Memory Fields
|
|
142
|
+
|
|
143
|
+
Each node in a distributed PRSC system maintains a local holographic memory field:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
(M)ᵣ = Σ_p∈set F_r α_p^(r) e^(-S_r(x,y)) e^(ipθ_r)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Global Memory State
|
|
150
|
+
|
|
151
|
+
The global memory emerges from weighted combination:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
(M) = Σᵣ wᵣ(M)ᵣ
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Retrieval Process
|
|
158
|
+
|
|
159
|
+
1. **Local Resonance**: Apply R̂ᵣ(n) to reconstruct |ψᵣ⟩
|
|
160
|
+
2. **Global Coherence**: Synchronize via:
|
|
161
|
+
```
|
|
162
|
+
C_global(t) = Σᵢ,ᵣ Σ_p∈set Fᵣ cos(φ_p^(r) - φᵢ^(r)) · α_p^(r) α_i^(r)
|
|
163
|
+
```
|
|
164
|
+
3. **Quaternionic Synchronization**: Exchange ψ_q^(r) with phase-locking
|
|
165
|
+
|
|
166
|
+
Successful retrieval occurs when C_global(t) ≥ γ_global.
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
170
|
+
│ Node 1 │ │ Node 2 │ │ Node 3 │
|
|
171
|
+
│ (M)₁ │ │ (M)₂ │ │ (M)₃ │
|
|
172
|
+
└────┬─────┘ └────┬─────┘ └────┬─────┘
|
|
173
|
+
│ │ │
|
|
174
|
+
└────────────────┼────────────────┘
|
|
175
|
+
│
|
|
176
|
+
▼
|
|
177
|
+
┌──────────┐
|
|
178
|
+
│ Global │
|
|
179
|
+
│ (M) │
|
|
180
|
+
└──────────┘
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Resonant Instruction Selection
|
|
186
|
+
|
|
187
|
+
The resonant instruction selection operator projects the symbolic state onto instruction attractors at each temporal event:
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Π̂_res : H_M → H_I
|
|
191
|
+
|
|
192
|
+
I_k = arg max_{I∈H_I} |⟨ψ(t)|I⟩|² subject to C(t) ≥ τ
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This triggers execution based on resonance, enabling:
|
|
196
|
+
- Parallel computation
|
|
197
|
+
- Adaptive instruction selection
|
|
198
|
+
- Content-dependent execution paths
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## RISA: Resonant Instruction Set Architecture
|
|
203
|
+
|
|
204
|
+
PRSC is implemented through RISA, which includes:
|
|
205
|
+
|
|
206
|
+
### Core Instructions
|
|
207
|
+
|
|
208
|
+
| Instruction | Description |
|
|
209
|
+
|-------------|-------------|
|
|
210
|
+
| `RES p, a, φ` | Initialize prime oscillator with amplitude and phase |
|
|
211
|
+
| `COHERE threshold` | Set coherence threshold for temporal events |
|
|
212
|
+
| `PROJ state` | Project state onto instruction space |
|
|
213
|
+
| `COLLAPSE` | Force state collapse |
|
|
214
|
+
|
|
215
|
+
### Distributed Operations
|
|
216
|
+
|
|
217
|
+
| Instruction | Description |
|
|
218
|
+
|-------------|-------------|
|
|
219
|
+
| `SEND_QUAT q, node` | Transmit quaternionic state to node |
|
|
220
|
+
| `RECV_QUAT q, node` | Integrate received quaternionic state |
|
|
221
|
+
| `SYNC_GLOBAL p1, p2, node` | Align phases across nodes |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ResoLang
|
|
226
|
+
|
|
227
|
+
ResoLang is a programming language for PRSC implementation:
|
|
228
|
+
|
|
229
|
+
```resolang
|
|
230
|
+
% Define oscillators
|
|
231
|
+
primelet p13 = oscillator(prime=13, amplitude=0.7, phase=1.0);
|
|
232
|
+
primelet p17 = oscillator(prime=17, amplitude=0.5, phase=1.3);
|
|
233
|
+
|
|
234
|
+
% Quaternionic state
|
|
235
|
+
quatstate q = quaternion(p13, gaussian=(1,2), eisenstein=(3,4));
|
|
236
|
+
|
|
237
|
+
% Symbolic state
|
|
238
|
+
state s = {p13:0.7, p17:0.5};
|
|
239
|
+
|
|
240
|
+
% Store and retrieve via resonance
|
|
241
|
+
resonant (threshold=0.8) {
|
|
242
|
+
store s in memory;
|
|
243
|
+
retrieve s from global_memory;
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Applications
|
|
250
|
+
|
|
251
|
+
### Symbolic AI
|
|
252
|
+
Context-aware, non-linear reasoning that respects semantic relationships.
|
|
253
|
+
|
|
254
|
+
### Quantum-like Search
|
|
255
|
+
Probabilistic efficiency through resonance-based exploration.
|
|
256
|
+
|
|
257
|
+
### Decentralized Identity
|
|
258
|
+
Non-local identity management through quaternionic synchronization.
|
|
259
|
+
|
|
260
|
+
### Quantum Computing
|
|
261
|
+
Classical analogs for quantum algorithm design and testing.
|
|
262
|
+
|
|
263
|
+
### Cognitive Modeling
|
|
264
|
+
Modeling attention, time perception, and memory retrieval.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Experimental Predictions
|
|
269
|
+
|
|
270
|
+
PRSC makes testable predictions:
|
|
271
|
+
|
|
272
|
+
1. **Non-uniform execution delay**: Increases with symbolic complexity
|
|
273
|
+
2. **Temporal compression**: Dense firing during alignment
|
|
274
|
+
3. **Resonance interference patterns**: Observable in memory fields
|
|
275
|
+
4. **Time symmetry breaking**: Near bifurcation points in phase space
|
|
276
|
+
|
|
277
|
+
These can be validated via simulations or physical resonator arrays.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Implementation in Aleph
|
|
282
|
+
|
|
283
|
+
Aleph implements PRSC concepts through:
|
|
284
|
+
|
|
285
|
+
- **Prime-indexed oscillators** → `physics/oscillator.js`, `physics/kuramoto.js`
|
|
286
|
+
- **Coherence functions** → `physics/entropy.js`
|
|
287
|
+
- **State collapse** → `physics/collapse.js`
|
|
288
|
+
- **Temporal events** → `engine/aleph.js` (transform application on entropy threshold)
|
|
289
|
+
- **Quaternionic states** → `core/hypercomplex.js` (sedenions generalize quaternions)
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Related Documents
|
|
294
|
+
|
|
295
|
+
- [Prime Semantics →](./01-prime-semantics.md)
|
|
296
|
+
- [Phase Synchronization →](./03-phase-synchronization.md)
|
|
297
|
+
- [Entropy and Reasoning →](./04-entropy-reasoning.md)
|
|
298
|
+
- [Quaternionic Memory Field →](./10-quaternionic-memory.md)
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# Quaternionic Memory Field
|
|
2
|
+
|
|
3
|
+
This document covers the Quaternionic Memory Field (QMF), a formalism for encoding semantic information as dynamic unit quaternions within a high-dimensional Hilbert space.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Quaternionic Memory Field extends standard complex phase vectors into 4-dimensional hypercomplex space. This enables:
|
|
8
|
+
|
|
9
|
+
- **Rotational semantics**: Meaning encoded as orientations in 4D space
|
|
10
|
+
- **Non-commutative composition**: Order of operations affects outcome
|
|
11
|
+
- **Smooth interpolation**: Continuous transitions between semantic states
|
|
12
|
+
- **Active memory**: Memory as a resonant field, not static storage
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Mathematical Foundation
|
|
17
|
+
|
|
18
|
+
### Quaternion Definition
|
|
19
|
+
|
|
20
|
+
The fundamental unit of semantic orientation is the quaternion q ∈ ℍ:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
q = w + xi + yj + zk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The basis elements satisfy the Hamilton relations:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
i² = j² = k² = ijk = -1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
From these, the multiplication rules follow:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
ij = k, jk = i, ki = j
|
|
36
|
+
ji = -k, kj = -i, ik = -j
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Unit Quaternion Constraint
|
|
40
|
+
|
|
41
|
+
All semantic states are normalized (unit quaternions):
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
|q| = √(w² + x² + y² + z²) = 1
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This ensures semantic operations represent **pure rotations** in 4D space, preserving structural integrity. Unit quaternions form a 3-sphere (S³) embedded in 4D space.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
z(k)
|
|
51
|
+
│
|
|
52
|
+
│
|
|
53
|
+
│
|
|
54
|
+
─────┼───── y(j)
|
|
55
|
+
╱│
|
|
56
|
+
╱ │
|
|
57
|
+
╱ │
|
|
58
|
+
x(i)
|
|
59
|
+
|
|
60
|
+
Unit hypersphere: w² + x² + y² + z² = 1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## The Extended Field Space
|
|
66
|
+
|
|
67
|
+
### Prime-Quaternionic Hilbert Space
|
|
68
|
+
|
|
69
|
+
Standard holographic memory uses a Prime Hilbert Space (H_prime) with orthogonal basis vectors indexed by primes. The quaternionic extension tensor-products this with the quaternion space:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
H_Q = H_prime ⊗ ℍ
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
A state vector |Ψ⟩ in this field is a superposition of prime modes, where each mode carries a quaternion coefficient:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|Ψ⟩ = Σᵢ qᵢ|pᵢ⟩
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
where:
|
|
82
|
+
- |pᵢ⟩ is the basis vector for the i-th prime
|
|
83
|
+
- qᵢ is the quaternion encoding the semantic orientation of that mode
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## The Four Semantic Axes
|
|
88
|
+
|
|
89
|
+
Unlike standard Euclidean coordinates, quaternion components represent **functional properties** of memory:
|
|
90
|
+
|
|
91
|
+
| Component | Name | Semantic Role |
|
|
92
|
+
|-----------|------|---------------|
|
|
93
|
+
| **w** (scalar) | Coherence | Stability, "truth" alignment, presence strength |
|
|
94
|
+
| **x** (i-axis) | Security | Boundary integrity, encapsulation, safety |
|
|
95
|
+
| **y** (j-axis) | Performance | Efficiency, speed, optimization |
|
|
96
|
+
| **z** (k-axis) | Usability | Accessibility, interface quality, UX |
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
w: Coherence
|
|
100
|
+
│
|
|
101
|
+
│
|
|
102
|
+
│
|
|
103
|
+
─────────┼────────── y: Performance
|
|
104
|
+
╱│
|
|
105
|
+
╱ │
|
|
106
|
+
╱ │
|
|
107
|
+
x: Security z: Usability
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This semantic interpretation means:
|
|
111
|
+
- High w → stable, grounded memory
|
|
112
|
+
- High x → well-protected information
|
|
113
|
+
- High y → efficiently retrievable
|
|
114
|
+
- High z → easily understood
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Text-to-Field Encoding
|
|
119
|
+
|
|
120
|
+
Information is encoded into the field by modulating the quaternion axes using prime-based harmonics:
|
|
121
|
+
|
|
122
|
+
### Scalar Component (w)
|
|
123
|
+
```
|
|
124
|
+
w = Σₖ cos(2πfₖ · charₖ)
|
|
125
|
+
```
|
|
126
|
+
Modulated by cosine functions to establish base coherence.
|
|
127
|
+
|
|
128
|
+
### Vector Components (x, y, z)
|
|
129
|
+
```
|
|
130
|
+
x = Σₖ sin(2πfₖ · charₖ) · weight_security
|
|
131
|
+
y = Σₖ sin(2πfₖ · charₖ) · weight_performance
|
|
132
|
+
z = Σₖ sin(2πfₖ · charₖ) · weight_usability
|
|
133
|
+
```
|
|
134
|
+
Modulated by mixed sine/cosine functions to distribute semantic weight.
|
|
135
|
+
|
|
136
|
+
The result is a unique "rotational signature" for any text.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Non-Commutative Composition
|
|
141
|
+
|
|
142
|
+
The composition of two memory states uses the **Hamilton Product**:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
q₁ × q₂ = (w₁w₂ - v₁·v₂, w₁v₂ + w₂v₁ + v₁×v₂)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
where v₁ = (x₁, y₁, z₁) and v₂ = (x₂, y₂, z₂).
|
|
149
|
+
|
|
150
|
+
### The Critical Property
|
|
151
|
+
|
|
152
|
+
**Order matters**. In general:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
q₁ × q₂ ≠ q₂ × q₁
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The **Commutator** measures this divergence:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
[q₁, q₂] = q₁q₂ - q₂q₁
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
If ‖[q₁, q₂]‖ > ε, the sequence is **order-dependent**.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
q₁ ────────► q₁ × q₂
|
|
168
|
+
╲
|
|
169
|
+
╲
|
|
170
|
+
╲
|
|
171
|
+
q₂ ─────╲──► q₂ × q₁
|
|
172
|
+
╲
|
|
173
|
+
Different results! (Non-commutative)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Semantic Implication
|
|
177
|
+
|
|
178
|
+
This allows the field to distinguish:
|
|
179
|
+
- "Action A then Action B"
|
|
180
|
+
- vs. "Action B then Action A"
|
|
181
|
+
|
|
182
|
+
For example:
|
|
183
|
+
- "encrypt then send" ≠ "send then encrypt"
|
|
184
|
+
- "read then write" ≠ "write then read"
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Field Operations
|
|
189
|
+
|
|
190
|
+
### Holographic Superposition
|
|
191
|
+
|
|
192
|
+
Memories are superposed into the global field via element-wise complex multiplication combined with quaternionic rotation:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Ψ_total = Σᵢ (Φ_keyᵢ ⊛ Φ_dataᵢ) × qᵢ
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
where:
|
|
199
|
+
- Φ = Complex phase vectors (content)
|
|
200
|
+
- q = Quaternion encoding (semantic orientation)
|
|
201
|
+
- ⊛ = Element-wise interaction
|
|
202
|
+
|
|
203
|
+
When a new pattern is superposed, it **rotates** the existing quaternion field at that prime index.
|
|
204
|
+
|
|
205
|
+
### Resonance and Retrieval
|
|
206
|
+
|
|
207
|
+
Retrieval is a resonance operation. The **Resonance Score** combines structural and semantic alignment:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
R = α · Jaccard(Σ_query, Σ_pattern) + β · |q_query · q_pattern|
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
1. **Prime Signature Similarity (Jaccard)**: Do query and memory share prime factors?
|
|
214
|
+
2. **Semantic Alignment (Dot Product)**: Do they point in the same 4D direction?
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Entanglement Mechanics
|
|
219
|
+
|
|
220
|
+
Two memories become **entangled** when their shared structure exceeds a threshold.
|
|
221
|
+
|
|
222
|
+
### Entanglement Strength
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
E(A, B) = ½ · (|Σ_A ∩ Σ_B| / max(|Σ_A|, |Σ_B|) + |q_A · q_B|)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If E ≥ 0.3 (typical threshold), an explicit link forms.
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
┌──────────────┐ ┌──────────────┐
|
|
232
|
+
│ Memory A │◄───────────────────│ Memory B │
|
|
233
|
+
│ │ Entanglement │ │
|
|
234
|
+
│ q_A │ E(A,B) ≥ 0.3 │ q_B │
|
|
235
|
+
└──────────────┘ └──────────────┘
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Teleportation
|
|
239
|
+
|
|
240
|
+
Entanglement enables **teleportation**: accessing Memory B instantaneously when interacting with Memory A. This creates a navigable graph within the field.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Field Stability Metrics
|
|
245
|
+
|
|
246
|
+
Three metrics ensure the memory field remains useful:
|
|
247
|
+
|
|
248
|
+
### Entropy (S)
|
|
249
|
+
|
|
250
|
+
Measures information dispersion across prime modes:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
S = -Σ pᵢ log₂(pᵢ) / log₂(N)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
| Entropy | Meaning |
|
|
257
|
+
|---------|---------|
|
|
258
|
+
| Low (≈0) | Concentrated, sharp memory |
|
|
259
|
+
| High (≈1) | Diffuse, noisy |
|
|
260
|
+
|
|
261
|
+
### Coherence (C)
|
|
262
|
+
|
|
263
|
+
Measures phase alignment:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
C = |Σ e^(iθⱼ)| / N
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
| Coherence | Meaning |
|
|
270
|
+
|-----------|---------|
|
|
271
|
+
| ≈1.0 | Perfectly phase-locked, high confidence |
|
|
272
|
+
| ≈0.0 | Random phases, confusion |
|
|
273
|
+
|
|
274
|
+
### Lyapunov Stability (λ)
|
|
275
|
+
|
|
276
|
+
Measures divergence of trajectories over time:
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
λ = lim_{n→∞} (1/n) Σ ln(|dS_{i+1}/dS_i|)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
| λ | Meaning |
|
|
283
|
+
|---|---------|
|
|
284
|
+
| < 0 | Stable, converging to truth |
|
|
285
|
+
| > 0 | Unstable, risk of hallucination |
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Interpolation: SLERP
|
|
290
|
+
|
|
291
|
+
Linear interpolation fails for rotations. To transition smoothly between semantic states q₁ and q₂, use **Spherical Linear Interpolation** (SLERP):
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
Slerp(q₁, q₂, t) = sin((1-t)Ω)/sin(Ω) · q₁ + sin(tΩ)/sin(Ω) · q₂
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
where:
|
|
298
|
+
```
|
|
299
|
+
cos(Ω) = q₁ · q₂
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
╭─────────────────╮
|
|
304
|
+
╱ ╲
|
|
305
|
+
╱ SLERP path ╲
|
|
306
|
+
q₁ ──────────────────── q₂
|
|
307
|
+
╲ ╱
|
|
308
|
+
╲ Linear path ╱
|
|
309
|
+
╰─────────────────╯
|
|
310
|
+
|
|
311
|
+
(SLERP traces the shortest path on S³)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This enables smooth "thought transitions" between distinct concepts.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Visualization
|
|
319
|
+
|
|
320
|
+
To visualize the 4D memory field, use a two-step projection:
|
|
321
|
+
|
|
322
|
+
### Step 1: Stereographic Projection (4D → 3D)
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
(x, y, z)_3D = (x, y, z)_4D / (1 - w)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Projects the quaternion onto a 3D hyperplane.
|
|
329
|
+
|
|
330
|
+
### Step 2: Perspective Projection (3D → 2D)
|
|
331
|
+
|
|
332
|
+
Standard perspective projection using depth (z) to scale node size, representing semantic "closeness" to the observer.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Key Invariants
|
|
337
|
+
|
|
338
|
+
For logical consistency, preserve these invariants:
|
|
339
|
+
|
|
340
|
+
| Invariant | Requirement |
|
|
341
|
+
|-----------|-------------|
|
|
342
|
+
| **Unit Norm** | All quaternions satisfy \|q\| = 1 |
|
|
343
|
+
| **Prime Uniqueness** | Each memory has unique prime signature |
|
|
344
|
+
| **Entropy Bounds** | 0 ≤ S ≤ 1 |
|
|
345
|
+
| **Symmetric Entanglement** | E(A,B) = E(B,A) |
|
|
346
|
+
| **Commutator Sensitivity** | Non-commutative operations respected |
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Implementation in Aleph
|
|
351
|
+
|
|
352
|
+
Aleph implements QMF concepts through:
|
|
353
|
+
|
|
354
|
+
### Hypercomplex States
|
|
355
|
+
The `SedenionState` class generalizes quaternions to 16 dimensions (sedenions contain quaternions as a subspace):
|
|
356
|
+
|
|
357
|
+
```javascript
|
|
358
|
+
const { SedenionState } = require('./core/hypercomplex');
|
|
359
|
+
|
|
360
|
+
// Create quaternion-like state (first 4 components)
|
|
361
|
+
const q = new SedenionState([w, x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Non-Commutative Multiplication
|
|
365
|
+
The `multiply()` method respects non-commutativity:
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
const q1q2 = q1.multiply(q2);
|
|
369
|
+
const q2q1 = q2.multiply(q1);
|
|
370
|
+
// q1q2 ≠ q2q1 in general
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Field Metrics
|
|
374
|
+
Physics module provides entropy and stability:
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
const { computeEntropy } = require('./physics/entropy');
|
|
378
|
+
const { lyapunov } = require('./physics/lyapunov');
|
|
379
|
+
|
|
380
|
+
const entropy = computeEntropy(state);
|
|
381
|
+
const stability = lyapunov(entropyTrajectory);
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Semantic Encoding
|
|
385
|
+
Backend encodes text to quaternionic field:
|
|
386
|
+
|
|
387
|
+
```javascript
|
|
388
|
+
const backend = new SemanticBackend(config);
|
|
389
|
+
const state = backend.textToOrderedState('secure fast usable');
|
|
390
|
+
// State encodes security, performance, usability orientations
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Relation to Other Frameworks
|
|
396
|
+
|
|
397
|
+
| QMF Concept | Aleph Implementation |
|
|
398
|
+
|-------------|---------------------|
|
|
399
|
+
| Quaternion q | SedenionState (generalized) |
|
|
400
|
+
| Unit norm | `state.normalize()` |
|
|
401
|
+
| Hamilton product | `state.multiply()` |
|
|
402
|
+
| Prime Hilbert space | Prime-indexed oscillators |
|
|
403
|
+
| Coherence C | `state.coherence()` |
|
|
404
|
+
| Entropy S | `computeEntropy()` |
|
|
405
|
+
| Entanglement | Zero-divisor detection |
|
|
406
|
+
| SLERP | Interpolation via progressive collapse |
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Related Documents
|
|
411
|
+
|
|
412
|
+
- [Hypercomplex Algebra →](./02-hypercomplex-algebra.md)
|
|
413
|
+
- [Non-Commutativity →](./05-non-commutativity.md)
|
|
414
|
+
- [Entropy and Reasoning →](./04-entropy-reasoning.md)
|
|
415
|
+
- [Temporal Emergence →](./09-temporal-emergence.md)
|