@aleph-ai/tinyaleph 1.2.1 → 1.3.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/README.md +187 -2
- package/backends/bioinformatics/binding.js +503 -0
- package/backends/bioinformatics/dna-computing.js +664 -0
- package/backends/bioinformatics/encoding.js +339 -0
- package/backends/bioinformatics/folding.js +454 -0
- package/backends/bioinformatics/genetic-code.js +269 -0
- package/backends/bioinformatics/index.js +522 -0
- package/backends/bioinformatics/transcription.js +221 -0
- package/backends/bioinformatics/translation.js +264 -0
- package/backends/index.js +25 -1
- package/core/compound.js +532 -0
- package/core/hilbert.js +454 -1
- package/core/index.js +106 -12
- package/core/inference.js +605 -0
- package/core/resonance.js +245 -616
- package/core/symbols/archetypes.js +478 -0
- package/core/symbols/base.js +302 -0
- package/core/symbols/elements.js +487 -0
- package/core/symbols/hieroglyphs.js +303 -0
- package/core/symbols/iching.js +471 -0
- package/core/symbols/index.js +77 -0
- package/core/symbols/tarot.js +211 -0
- package/core/symbols.js +22 -0
- package/docs/design/BIOINFORMATICS_BACKEND_DESIGN.md +493 -0
- package/docs/guide/06-symbolic-ai.md +370 -0
- package/docs/guide/README.md +2 -1
- package/docs/reference/05-symbolic-ai.md +570 -0
- package/docs/reference/06-bioinformatics.md +546 -0
- package/docs/reference/README.md +32 -2
- package/docs/theory/11-prgraph-memory.md +559 -0
- package/docs/theory/12-resonant-attention.md +661 -0
- package/modular.js +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,13 +16,15 @@ A novel computational paradigm that encodes meaning as prime number signatures,
|
|
|
16
16
|
- **Prime Entanglement**: Graph-based tracking of prime relationships and co-occurrences
|
|
17
17
|
- **Event Streaming**: Real-time monitoring with EventEmitter pattern and async iteration
|
|
18
18
|
- **Entropy Minimization**: Reasoning as reduction of semantic uncertainty
|
|
19
|
-
- **Multiple Backends**: Semantic (NLP), Cryptographic (hashing), Scientific (quantum-inspired)
|
|
19
|
+
- **Multiple Backends**: Semantic (NLP), Cryptographic (hashing), Scientific (quantum-inspired), Bioinformatics (DNA/protein)
|
|
20
20
|
- **Formal Type System**: Typed term calculus with N(p)/A(p)/S types and ordering constraints
|
|
21
21
|
- **Reduction Semantics**: Strong normalization with prime-preserving operators
|
|
22
22
|
- **Lambda Translation**: Model-theoretic semantics via λ-calculus embedding
|
|
23
23
|
- **Enochian Vocabulary**: 21-letter angelic alphabet with prime basis and sedenion operations
|
|
24
24
|
- **ResoFormer Architecture**: Complete prime-indexed transformer with multi-head attention
|
|
25
25
|
- **Multi-Z Memory**: Hierarchical memory with fast/slow/permanent channels
|
|
26
|
+
- **Symbolic AI**: 184+ emoji symbols with cultural tags, resonance-enhanced inference
|
|
27
|
+
- **Golden Ratio Resonance**: Harmony measurement using φ ≈ 1.618 ratio detection
|
|
26
28
|
|
|
27
29
|
## Installation
|
|
28
30
|
|
|
@@ -156,6 +158,69 @@ const superposition = backend.superpose(state, 0.5, basis, 0.5);
|
|
|
156
158
|
const result = backend.measure(superposition, [basis]);
|
|
157
159
|
```
|
|
158
160
|
|
|
161
|
+
### Bioinformatics Backend
|
|
162
|
+
|
|
163
|
+
DNA computing, protein folding, and molecular biology:
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const { BioinformaticsBackend, DNACircuit, ANDGate, ORGate } = require('@aleph-ai/tinyaleph');
|
|
167
|
+
|
|
168
|
+
const backend = new BioinformaticsBackend();
|
|
169
|
+
|
|
170
|
+
// Encode DNA sequence
|
|
171
|
+
const dnaPrimes = backend.encode('ATGCGATCG');
|
|
172
|
+
|
|
173
|
+
// Transcribe DNA to RNA
|
|
174
|
+
const transcribed = backend.transcribe(dnaPrimes, { force: true });
|
|
175
|
+
console.log('mRNA primes:', transcribed.rna);
|
|
176
|
+
|
|
177
|
+
// Translate RNA to Protein
|
|
178
|
+
const translated = backend.translate(transcribed.rna);
|
|
179
|
+
console.log('Protein:', backend.decode(translated.protein));
|
|
180
|
+
|
|
181
|
+
// Full gene expression (DNA → RNA → Protein)
|
|
182
|
+
const expressed = backend.express(dnaPrimes);
|
|
183
|
+
console.log('Protein sequence:', expressed.sequence);
|
|
184
|
+
|
|
185
|
+
// Protein folding via Kuramoto oscillators
|
|
186
|
+
const proteinPrimes = backend.encode('MWLKFVIER');
|
|
187
|
+
const foldResult = backend.foldProtein(proteinPrimes);
|
|
188
|
+
console.log('Folding order parameter:', foldResult.orderParameter);
|
|
189
|
+
|
|
190
|
+
// Molecular binding affinity
|
|
191
|
+
const affinity = backend.bindingAffinity(dnaPrimes, proteinPrimes);
|
|
192
|
+
console.log('Binding affinity:', affinity.affinity);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### DNA Computing
|
|
196
|
+
|
|
197
|
+
Build logic gates and circuits using DNA strands:
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
const { DNACircuit, ANDGate, ORGate, NOTGate } = require('@aleph-ai/tinyaleph');
|
|
201
|
+
|
|
202
|
+
// Create logic gates
|
|
203
|
+
const andGate = new ANDGate({ name: 'and1' });
|
|
204
|
+
const orGate = new ORGate({ name: 'or1' });
|
|
205
|
+
const notGate = new NOTGate({ name: 'not1' });
|
|
206
|
+
|
|
207
|
+
// Evaluate gates (concentration-based)
|
|
208
|
+
console.log(andGate.evaluate(1, 1)); // { output: true, ... }
|
|
209
|
+
console.log(orGate.evaluate(0, 1)); // { output: true, ... }
|
|
210
|
+
console.log(notGate.evaluate(0)); // { output: true, ... }
|
|
211
|
+
|
|
212
|
+
// Build a circuit
|
|
213
|
+
const circuit = new DNACircuit('logic-circuit');
|
|
214
|
+
circuit.addGate('and1', new ANDGate({ name: 'and1' }));
|
|
215
|
+
circuit.addGate('not1', new NOTGate({ name: 'not1' }));
|
|
216
|
+
circuit.addGate('or1', new ORGate({ name: 'or1' }));
|
|
217
|
+
circuit.connect('and1', 'or1', 1);
|
|
218
|
+
circuit.connect('not1', 'or1', 2);
|
|
219
|
+
|
|
220
|
+
// Evaluate circuit
|
|
221
|
+
const result = circuit.evaluate();
|
|
222
|
+
```
|
|
223
|
+
|
|
159
224
|
## Physics Engine
|
|
160
225
|
|
|
161
226
|
### Oscillators
|
|
@@ -410,6 +475,89 @@ const model = new ResoFormer({
|
|
|
410
475
|
const outputs = model.forward([state1, state2]);
|
|
411
476
|
```
|
|
412
477
|
|
|
478
|
+
## Symbolic AI
|
|
479
|
+
|
|
480
|
+
### Symbol Database
|
|
481
|
+
|
|
482
|
+
184+ emoji symbols with prime assignments and cultural tags:
|
|
483
|
+
|
|
484
|
+
```javascript
|
|
485
|
+
const { getSymbol, symbolDatabase } = require('@aleph-ai/tinyaleph');
|
|
486
|
+
|
|
487
|
+
// Get a symbol
|
|
488
|
+
const hero = getSymbol('hero');
|
|
489
|
+
console.log(hero);
|
|
490
|
+
// { id: 'hero', unicode: '🦸', prime: 1013, meaning: 'Hero archetype', culturalTags: ['universal'] }
|
|
491
|
+
|
|
492
|
+
// Find Greek mythology symbols
|
|
493
|
+
const greekSymbols = symbolDatabase.getSymbolsByTag('greek');
|
|
494
|
+
|
|
495
|
+
// Encode/decode concepts to prime signatures
|
|
496
|
+
const signature = symbolDatabase.encode(['hero', 'journey', 'mountain']);
|
|
497
|
+
const symbols = symbolDatabase.decode(signature);
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Semantic Inference
|
|
501
|
+
|
|
502
|
+
Pattern matching with resonance-enhanced disambiguation:
|
|
503
|
+
|
|
504
|
+
```javascript
|
|
505
|
+
const { inferSymbol, inferWithResonance, inferMostResonant } = require('@aleph-ai/tinyaleph');
|
|
506
|
+
|
|
507
|
+
// Basic inference
|
|
508
|
+
const result = inferSymbol('brave knight');
|
|
509
|
+
// { symbol: ⚔️, method: 'regex', confidence: 0.85 }
|
|
510
|
+
|
|
511
|
+
// Resonance-enhanced inference - symbols ranked by harmony
|
|
512
|
+
const symbols = inferWithResonance('The hero fought the shadow in the temple');
|
|
513
|
+
// Symbols sorted by attention weight based on resonance scores
|
|
514
|
+
|
|
515
|
+
// Context-aware selection
|
|
516
|
+
const context = [getSymbol('warrior'), getSymbol('temple')];
|
|
517
|
+
const best = inferMostResonant('weapon', context);
|
|
518
|
+
// → 🗡️ sword (high resonance with warrior/temple context)
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Compound Symbols
|
|
522
|
+
|
|
523
|
+
Build multi-symbol concepts through prime multiplication:
|
|
524
|
+
|
|
525
|
+
```javascript
|
|
526
|
+
const { createCompound, getCompound, compoundBuilder } = require('@aleph-ai/tinyaleph');
|
|
527
|
+
|
|
528
|
+
// Pre-built compound
|
|
529
|
+
const greekWarrior = getCompound('greek_warrior');
|
|
530
|
+
// { unicode: '⚔️⛩️🦉', meaning: 'Greek Warrior: Temple guardian blessed by Athena' }
|
|
531
|
+
|
|
532
|
+
// Create custom compound
|
|
533
|
+
const fireMage = createCompound('fire_mage',
|
|
534
|
+
['magician', 'fire', 'staff'],
|
|
535
|
+
'Fire Mage - Wielder of flame magic'
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
// Calculate internal harmony
|
|
539
|
+
const harmony = compoundBuilder.calculateCompoundResonance(fireMage);
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### Golden Ratio Resonance
|
|
543
|
+
|
|
544
|
+
Primes whose ratio approaches φ ≈ 1.618 have natural harmony:
|
|
545
|
+
|
|
546
|
+
```javascript
|
|
547
|
+
const { calculateResonance, findGoldenPairs, resonanceSignature } = require('@aleph-ai/tinyaleph');
|
|
548
|
+
|
|
549
|
+
// Check resonance between primes
|
|
550
|
+
calculateResonance(3, 5); // 0.9 (Fibonacci pair!)
|
|
551
|
+
calculateResonance(7, 11); // 0.936 (close to φ)
|
|
552
|
+
|
|
553
|
+
// Find golden pairs
|
|
554
|
+
const pairs = findGoldenPairs([2, 3, 5, 7, 11, 13]);
|
|
555
|
+
|
|
556
|
+
// Get signature for symbol set
|
|
557
|
+
const sig = resonanceSignature([2, 3, 5, 7]);
|
|
558
|
+
console.log(`Mean resonance: ${sig.mean}, Golden pairs: ${sig.goldenCount}`);
|
|
559
|
+
```
|
|
560
|
+
|
|
413
561
|
## Formal Semantics
|
|
414
562
|
|
|
415
563
|
### Typed Term Calculus
|
|
@@ -541,6 +689,9 @@ console.log(CORE_VOCABULARY['ZORGE']); // "be friendly unto"
|
|
|
541
689
|
| `SemanticBackend` | Natural language processing |
|
|
542
690
|
| `CryptographicBackend` | Hashing and key derivation |
|
|
543
691
|
| `ScientificBackend` | Quantum-inspired computation |
|
|
692
|
+
| `BioinformaticsBackend` | DNA/RNA/Protein computation |
|
|
693
|
+
| `DNACircuit` | DNA logic circuit builder |
|
|
694
|
+
| `ANDGate` / `ORGate` / `NOTGate` | DNA logic gates |
|
|
544
695
|
| `Hypercomplex` | Sedenion algebra with exp/log/slerp |
|
|
545
696
|
| `Oscillator` / `OscillatorBank` | Phase-amplitude oscillators |
|
|
546
697
|
| `KuramotoModel` | Coupled oscillator synchronization |
|
|
@@ -559,6 +710,16 @@ console.log(CORE_VOCABULARY['ZORGE']); // "be friendly unto"
|
|
|
559
710
|
| `PrimeonZLadderMulti` | Multi-channel Z memory |
|
|
560
711
|
| `ResoFormer` | Prime-indexed transformer |
|
|
561
712
|
| `SparsePrimeState` | Sparse prime activations |
|
|
713
|
+
| `getSymbol(id)` | Get symbol by ID |
|
|
714
|
+
| `symbolDatabase` | Symbol database singleton |
|
|
715
|
+
| `inferSymbol(text)` | Infer symbol from text |
|
|
716
|
+
| `inferWithResonance(text)` | Resonance-ranked inference |
|
|
717
|
+
| `inferMostResonant(text, ctx)` | Context-aware selection |
|
|
718
|
+
| `createCompound(...)` | Build compound symbol |
|
|
719
|
+
| `compoundBuilder` | Compound builder instance |
|
|
720
|
+
| `calculateResonance(p1, p2)` | Prime pair resonance |
|
|
721
|
+
| `findGoldenPairs(primes)` | Find φ-ratio pairs |
|
|
722
|
+
| `resonanceSignature(primes)` | Resonance statistics |
|
|
562
723
|
| `hash(input)` | Quick semantic hash |
|
|
563
724
|
| `deriveKey(pass, salt)` | Quick key derivation |
|
|
564
725
|
|
|
@@ -633,7 +794,7 @@ Full documentation is available in the `docs/` directory:
|
|
|
633
794
|
|
|
634
795
|
- **[Guide](./docs/guide/README.md)**: Practical tutorials
|
|
635
796
|
- Quick start, semantic computing, cryptographic applications
|
|
636
|
-
- Scientific computing, LLM integration, advanced topics
|
|
797
|
+
- Scientific computing, LLM integration, symbolic AI, advanced topics
|
|
637
798
|
|
|
638
799
|
- **[Reference](./docs/reference/README.md)**: Complete API documentation
|
|
639
800
|
- Core module, physics module, backends, engine
|
|
@@ -666,6 +827,19 @@ node examples/formal-semantics/01-typed-terms.js
|
|
|
666
827
|
node examples/formal-semantics/02-reduction.js
|
|
667
828
|
node examples/formal-semantics/03-lambda-translation.js
|
|
668
829
|
node examples/formal-semantics/04-enochian-language.js
|
|
830
|
+
|
|
831
|
+
# Bioinformatics examples
|
|
832
|
+
node examples/bioinformatics/01-dna-encoding.js
|
|
833
|
+
node examples/bioinformatics/02-central-dogma.js
|
|
834
|
+
node examples/bioinformatics/03-protein-folding.js
|
|
835
|
+
node examples/bioinformatics/04-dna-computing.js
|
|
836
|
+
node examples/bioinformatics/05-molecular-binding.js
|
|
837
|
+
|
|
838
|
+
# Symbolic AI examples
|
|
839
|
+
node examples/05-symbolic-resonance.js
|
|
840
|
+
node examples/06-symbol-database.js
|
|
841
|
+
node examples/07-semantic-inference.js
|
|
842
|
+
node examples/08-compound-symbols.js
|
|
669
843
|
```
|
|
670
844
|
|
|
671
845
|
## Architecture
|
|
@@ -700,6 +874,17 @@ node examples/formal-semantics/04-enochian-language.js
|
|
|
700
874
|
│ • ⇒ implication │ • Confluence │ • Semantic domains │
|
|
701
875
|
└─────────────────┴─────────────────┴─────────────────────────────┘
|
|
702
876
|
|
|
877
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
878
|
+
│ Symbolic AI Layer │
|
|
879
|
+
├─────────────────┬─────────────────┬─────────────────────────────┤
|
|
880
|
+
│ Symbol DB │ Inference │ Resonance │
|
|
881
|
+
│ │ │ │
|
|
882
|
+
│ • 184+ emojis │ • Pattern match │ • Golden ratio φ │
|
|
883
|
+
│ • Cultural tags │ • Semantic sim │ • Prime pair harmony │
|
|
884
|
+
│ • Prime index │ • ResoFormer │ • Cluster detection │
|
|
885
|
+
│ • Categories │ • Context-aware │ • Compound scoring │
|
|
886
|
+
└─────────────────┴─────────────────┴─────────────────────────────┘
|
|
887
|
+
|
|
703
888
|
┌─────────────────────────────────────────────────────────────────┐
|
|
704
889
|
│ Enochian Language Module │
|
|
705
890
|
├─────────────────────────────────────────────────────────────────┤
|