@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,188 @@
|
|
|
1
|
+
# Part II: Practical Guide
|
|
2
|
+
|
|
3
|
+
This section provides hands-on guidance for using Aleph in your projects. Whether you're building semantic applications, implementing cryptographic operations, or simulating quantum systems, this guide will get you started.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
1. [Quick Start](./01-quickstart.md) - Get running in 5 minutes
|
|
8
|
+
2. [Semantic Computing](./02-semantic-computing.md) - Natural language understanding
|
|
9
|
+
3. [Cryptographic Applications](./03-cryptographic.md) - Hashing and key derivation
|
|
10
|
+
4. [Scientific Computing](./04-scientific.md) - Quantum simulation
|
|
11
|
+
5. [LLM Integration](./05-llm-integration.md) - Coupling with language models
|
|
12
|
+
6. [Advanced Techniques](./06-advanced.md) - Power user guide
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Clone the repository
|
|
20
|
+
git clone https://github.com/your-repo/tinyaleph.git
|
|
21
|
+
cd tinyaleph
|
|
22
|
+
|
|
23
|
+
# Install dependencies
|
|
24
|
+
npm install
|
|
25
|
+
|
|
26
|
+
# Verify installation
|
|
27
|
+
node -e "require('./modular'); console.log('✓ Aleph loaded')"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick Example
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
const { createEngine } = require('./modular');
|
|
36
|
+
|
|
37
|
+
// Load semantic configuration
|
|
38
|
+
const config = require('./data.json');
|
|
39
|
+
|
|
40
|
+
// Create an engine
|
|
41
|
+
const engine = createEngine('semantic', config);
|
|
42
|
+
|
|
43
|
+
// Process a query
|
|
44
|
+
const result = engine.run('What is the nature of wisdom?');
|
|
45
|
+
|
|
46
|
+
console.log({
|
|
47
|
+
output: result.output,
|
|
48
|
+
entropy: result.entropy.toFixed(3),
|
|
49
|
+
coherence: result.coherence.toFixed(3)
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Choosing a Backend
|
|
56
|
+
|
|
57
|
+
Aleph supports three specialized backends:
|
|
58
|
+
|
|
59
|
+
| Backend | Use Case | Typical Applications |
|
|
60
|
+
|---------|----------|---------------------|
|
|
61
|
+
| **Semantic** | Natural language | Chatbots, concept mapping, reasoning |
|
|
62
|
+
| **Cryptographic** | Security | Hashing, key derivation, encryption |
|
|
63
|
+
| **Scientific** | Simulation | Quantum computing, particle physics |
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
// Semantic backend
|
|
67
|
+
const semantic = createEngine('semantic', semanticConfig);
|
|
68
|
+
|
|
69
|
+
// Cryptographic backend
|
|
70
|
+
const crypto = createEngine('cryptographic', { dimension: 32 });
|
|
71
|
+
|
|
72
|
+
// Scientific backend
|
|
73
|
+
const science = createEngine('scientific', { dimension: 16 });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## The Engine Interface
|
|
79
|
+
|
|
80
|
+
All backends share a common engine interface:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
// Process input
|
|
84
|
+
const result = engine.run(input);
|
|
85
|
+
|
|
86
|
+
// Get physics state
|
|
87
|
+
const physics = engine.getPhysicsState();
|
|
88
|
+
|
|
89
|
+
// Evolve without input
|
|
90
|
+
const states = engine.evolve(10);
|
|
91
|
+
|
|
92
|
+
// Switch backends at runtime
|
|
93
|
+
engine.setBackend(newBackend);
|
|
94
|
+
|
|
95
|
+
// Reset state
|
|
96
|
+
engine.reset();
|
|
97
|
+
|
|
98
|
+
// Get history
|
|
99
|
+
const history = engine.getHistory(10);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Result Object
|
|
105
|
+
|
|
106
|
+
Every `engine.run()` returns a result object:
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
{
|
|
110
|
+
input: "original input",
|
|
111
|
+
inputPrimes: [2, 3, 5, 7],
|
|
112
|
+
resultPrimes: [2, 3, 7],
|
|
113
|
+
output: "decoded output",
|
|
114
|
+
entropy: 2.31,
|
|
115
|
+
coherence: 0.76,
|
|
116
|
+
lyapunov: -0.05,
|
|
117
|
+
stability: 'STABLE',
|
|
118
|
+
collapsed: false,
|
|
119
|
+
steps: [...],
|
|
120
|
+
evolutionSteps: 42,
|
|
121
|
+
framesCollected: 8,
|
|
122
|
+
fieldBased: true,
|
|
123
|
+
orderParameter: 0.82
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Field | Type | Description |
|
|
128
|
+
|-------|------|-------------|
|
|
129
|
+
| `input` | any | Original input |
|
|
130
|
+
| `inputPrimes` | number[] | Encoded prime representation |
|
|
131
|
+
| `resultPrimes` | number[] | Processed prime representation |
|
|
132
|
+
| `output` | any | Decoded output |
|
|
133
|
+
| `entropy` | number | Shannon entropy of final state |
|
|
134
|
+
| `coherence` | number | Phase coherence measure |
|
|
135
|
+
| `lyapunov` | number | Lyapunov exponent (stability) |
|
|
136
|
+
| `stability` | string | 'STABLE', 'MARGINAL', or 'CHAOTIC' |
|
|
137
|
+
| `collapsed` | boolean | Whether state collapsed |
|
|
138
|
+
| `steps` | object[] | Transform steps taken |
|
|
139
|
+
| `fieldBased` | boolean | Whether answer came from field dynamics |
|
|
140
|
+
| `orderParameter` | number | Kuramoto order parameter |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Configuration
|
|
145
|
+
|
|
146
|
+
Each backend accepts configuration options:
|
|
147
|
+
|
|
148
|
+
### Semantic Backend
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
const config = {
|
|
152
|
+
dimension: 16, // Hypercomplex dimension
|
|
153
|
+
vocabulary: {...}, // Word → primes mapping
|
|
154
|
+
ontology: {...}, // Prime → meaning mapping
|
|
155
|
+
transforms: [...], // Semantic transforms
|
|
156
|
+
axes: {...}, // Semantic axes
|
|
157
|
+
corePrimes: [2,3,5...], // Protected primes
|
|
158
|
+
stopWords: ['a','the'...] // Filtered words
|
|
159
|
+
};
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Engine Options
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
const engineOptions = {
|
|
166
|
+
dampingRate: 0.02, // Oscillator damping
|
|
167
|
+
baseCoupling: 0.3, // Kuramoto coupling strength
|
|
168
|
+
collapseCoherence: 0.7, // Collapse coherence threshold
|
|
169
|
+
collapseEntropy: 1.8, // Collapse entropy threshold
|
|
170
|
+
maxTransformSteps: 5, // Max reasoning steps
|
|
171
|
+
entropyThreshold: 0.5, // Target entropy
|
|
172
|
+
maxEvolutionSteps: 100, // Max physics steps
|
|
173
|
+
dt: 0.016 // Time step
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const engine = createEngine('semantic', {
|
|
177
|
+
...config,
|
|
178
|
+
engineOptions
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Next Steps
|
|
185
|
+
|
|
186
|
+
- [Quick Start →](./01-quickstart.md) - Get running in 5 minutes
|
|
187
|
+
- [Theory →](../theory/README.md) - Understand the foundations
|
|
188
|
+
- [Reference →](../reference/README.md) - Complete API documentation
|