@aleph-ai/tinyaleph 1.0.2 → 1.1.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.
@@ -346,6 +346,201 @@ This captures how the field **responds to input** rather than just its final sta
346
346
 
347
347
  ---
348
348
 
349
+ ## Extended Synchronization Models
350
+
351
+ Beyond the basic Kuramoto model, TinyAleph provides five advanced synchronization models for complex dynamics:
352
+
353
+ ### NetworkKuramoto - Topology-Aware Coupling
354
+
355
+ Instead of all-to-all coupling, uses an adjacency matrix A:
356
+
357
+ ```
358
+ dθᵢ/dt = ωᵢ + K Σⱼ Aᵢⱼ sin(θⱼ - θᵢ)
359
+ ```
360
+
361
+ This enables **modular synchronization** that respects semantic neighborhoods:
362
+
363
+ ```javascript
364
+ const { NetworkKuramoto } = require('@aleph-ai/tinyaleph');
365
+
366
+ // Create with custom adjacency
367
+ const network = new NetworkKuramoto(frequencies, adjacency, 0.5);
368
+
369
+ // Or build from entanglement graph
370
+ network.setFromEntanglementGraph(entanglementGraph, primeList);
371
+
372
+ // Find synchronized clusters
373
+ const clusters = network.findClusters(0.5);
374
+ console.log('Found', clusters.length, 'clusters');
375
+
376
+ // Network metrics
377
+ console.log('Clustering coefficient:', network.averageClustering());
378
+ ```
379
+
380
+ **Semantic Use**: Respects concept neighborhoods from the EntanglementLayer.
381
+
382
+ ---
383
+
384
+ ### AdaptiveKuramoto - Hebbian Plasticity
385
+
386
+ Coupling strengths evolve based on synchronization:
387
+
388
+ ```
389
+ dθᵢ/dt = ωᵢ + (1/N) Σⱼ Kᵢⱼ sin(θⱼ - θᵢ)
390
+ dKᵢⱼ/dt = ε(cos(θⱼ - θᵢ) - Kᵢⱼ)
391
+ ```
392
+
393
+ **"Concepts that sync together link together"**
394
+
395
+ ```javascript
396
+ const { AdaptiveKuramoto } = require('@aleph-ai/tinyaleph');
397
+
398
+ // Create with learning rate
399
+ const adaptive = new AdaptiveKuramoto(frequencies, 0.3, 0.02);
400
+
401
+ // Evolve - coupling strengths change!
402
+ for (let i = 0; i < 1000; i++) {
403
+ adaptive.tick(0.05);
404
+ }
405
+
406
+ // Check evolved coupling
407
+ console.log('Total coupling:', adaptive.totalCoupling());
408
+ console.log('K(0,1):', adaptive.adjacency[0][1]); // Strong if synced
409
+ console.log('K(0,7):', adaptive.adjacency[0][7]); // Weak if not synced
410
+ ```
411
+
412
+ **Semantic Use**: Self-organizing semantic memory that learns relationships.
413
+
414
+ ---
415
+
416
+ ### SakaguchiKuramoto - Phase Frustration
417
+
418
+ Adds a phase lag parameter α that introduces frustration:
419
+
420
+ ```
421
+ dθᵢ/dt = ωᵢ + (K/N) Σⱼ sin(θⱼ - θᵢ - α)
422
+ ```
423
+
424
+ Creates **chimera states**—where some oscillators synchronize while others don't:
425
+
426
+ ```javascript
427
+ const { SakaguchiKuramoto } = require('@aleph-ai/tinyaleph');
428
+
429
+ // Create with phase lag
430
+ const sakaguchi = new SakaguchiKuramoto(frequencies, 0.5, Math.PI/4);
431
+
432
+ // Evolve
433
+ for (let i = 0; i < 500; i++) {
434
+ sakaguchi.tick(0.05);
435
+ }
436
+
437
+ // Classify state
438
+ console.log('State:', sakaguchi.classifyState());
439
+ // 'synchronized' | 'chimera' | 'partial' | 'incoherent'
440
+
441
+ // Chimera ratio (fraction synchronized)
442
+ console.log('Chimera ratio:', sakaguchi.chimeraRatio());
443
+
444
+ // Critical phase lag for chimera formation
445
+ console.log('Critical α:', SakaguchiKuramoto.criticalPhaseLag(0.5));
446
+ ```
447
+
448
+ **Semantic Use**: Models cognitive dissonance, competing interpretations, or partial understanding.
449
+
450
+ ---
451
+
452
+ ### SmallWorldKuramoto - Watts-Strogatz Topology
453
+
454
+ Creates small-world networks with:
455
+ - **High clustering** (local neighborhoods connected)
456
+ - **Short path length** (random long-range shortcuts)
457
+
458
+ ```javascript
459
+ const { SmallWorldKuramoto } = require('@aleph-ai/tinyaleph');
460
+
461
+ // k = neighbors per side, p = rewiring probability
462
+ // p=0: ring lattice, p=1: random graph
463
+ const smallWorld = new SmallWorldKuramoto(frequencies, 4, 0.1, 0.5);
464
+
465
+ // Network metrics
466
+ console.log('Clustering:', smallWorld.averageClustering());
467
+ console.log('Avg path length:', smallWorld.averagePathLength());
468
+ console.log('Small-world σ:', smallWorld.smallWorldCoefficient());
469
+ // σ > 1 indicates small-world properties
470
+
471
+ // Regenerate with new parameters
472
+ smallWorld.regenerate(6, 0.2);
473
+ ```
474
+
475
+ | Rewiring p | Clustering | Path Length | Character |
476
+ |------------|------------|-------------|-----------|
477
+ | 0.0 | High | Long | Regular lattice |
478
+ | 0.1 | High | Short | **Small-world** |
479
+ | 1.0 | Low | Short | Random |
480
+
481
+ **Semantic Use**: Balance between local semantic clusters and global conceptual reach.
482
+
483
+ ---
484
+
485
+ ### MultiSystemCoupling - Cross-System Synchronization
486
+
487
+ Couples multiple Kuramoto systems via their mean fields:
488
+
489
+ ```
490
+ dθᵢ^(a)/dt = [internal coupling] + Σ_b G_ab r^(b) sin(ψ^(b) - θᵢ^(a))
491
+ ```
492
+
493
+ Models multi-agent alignment or hierarchical organization:
494
+
495
+ ```javascript
496
+ const {
497
+ KuramotoModel,
498
+ MultiSystemCoupling,
499
+ createHierarchicalCoupling,
500
+ createPeerCoupling
501
+ } = require('@aleph-ai/tinyaleph');
502
+
503
+ // Manual creation
504
+ const system1 = new KuramotoModel(frequencies, 0.4);
505
+ const system2 = new KuramotoModel(frequencies, 0.4);
506
+ const multi = new MultiSystemCoupling([system1, system2]);
507
+
508
+ // Or use factories
509
+ const hierarchy = createHierarchicalCoupling(frequencies, 3, 16);
510
+ const peers = createPeerCoupling(frequencies, 4, 0.15);
511
+
512
+ // Evolve
513
+ for (let i = 0; i < 800; i++) {
514
+ multi.tick(0.05);
515
+ }
516
+
517
+ // Analyze
518
+ const state = multi.getState();
519
+ console.log('Global order:', state.globalOrder);
520
+ console.log('Inter-system coherence:', state.interSystemCoherence);
521
+ // Matrix showing phase alignment between systems
522
+ ```
523
+
524
+ **Semantic Use**:
525
+ - Hierarchical: context/domain layers driving content layers
526
+ - Peer: multiple agents reaching consensus
527
+ - Cross-domain: knowledge transfer between fields
528
+
529
+ ---
530
+
531
+ ## Model Selection Guide
532
+
533
+ | Scenario | Model | Why |
534
+ |----------|-------|-----|
535
+ | Semantic neighborhood structure | NetworkKuramoto | Respects topology |
536
+ | Learning relationships | AdaptiveKuramoto | Self-organizing |
537
+ | Conflicting interpretations | SakaguchiKuramoto | Chimera states |
538
+ | Balance local/global | SmallWorldKuramoto | Optimal connectivity |
539
+ | Multi-agent consensus | MultiSystemCoupling | Cross-system |
540
+ | Hierarchical context | MultiSystemCoupling | Bottom-up flow |
541
+
542
+ ---
543
+
349
544
  ## Summary
350
545
 
351
546
  Phase synchronization provides:
@@ -356,6 +551,7 @@ Phase synchronization provides:
356
551
  4. **Transient capture** of input-specific responses
357
552
  5. **Adaptive coupling** for stability control
358
553
  6. **Field-based computation** where answers emerge from dynamics
554
+ 7. **Extended models** for topology, plasticity, frustration, and multi-system dynamics
359
555
 
360
556
  The oscillator model is the heartbeat of semantic computation.
361
557
 
@@ -14,6 +14,10 @@ This section provides a deep exploration of the mathematical and conceptual foun
14
14
  8. [The Semantic Sieve](./08-semantic-sieve.md) - Ensuring prime uniqueness
15
15
  9. [Temporal Emergence](./09-temporal-emergence.md) - Time as emergent from prime-resonant symbolic computation
16
16
  10. [Quaternionic Memory Field](./10-quaternionic-memory.md) - 4D rotational semantics and non-commutative memory
17
+ 11. [Formal Type System](./11-formal-types.md) - Typed term calculus N(p)/A(p)/S
18
+ 12. [Reduction Semantics](./12-reduction-semantics.md) - Strong normalization and confluence
19
+ 13. [Lambda Translation](./13-lambda-translation.md) - Model-theoretic semantics via λ-calculus
20
+ 14. [Enochian Language](./14-enochian-language.md) - The 21-letter angelic alphabet
17
21
 
18
22
  ---
19
23
 
@@ -157,6 +161,49 @@ This two-layer architecture explains:
157
161
 
158
162
  ---
159
163
 
164
+ ## New: Formal Semantics Layer
165
+
166
+ Recent additions to Aleph include a rigorous formal semantics layer implementing model-theoretic foundations:
167
+
168
+ ### Typed Term Calculus
169
+
170
+ The library now supports a formal type system with three primitive types:
171
+
172
+ | Type | Notation | Interpretation |
173
+ |------|----------|----------------|
174
+ | Noun | N(p) | Prime p as referent: ⟦N(p)⟧ = p |
175
+ | Adjective | A(p) | Partial function f_p with domain constraint p < q |
176
+ | Sentence | S | Discourse state as sequence in D* |
177
+
178
+ Key features:
179
+ - **Ordering Constraint**: A(p) can only apply to N(q) when p < q
180
+ - **Triadic Fusion**: FUSE(p,q,r) where p+q+r must be prime
181
+ - **Sentence Composition**: Sequential (◦) and implication (⇒) operators
182
+
183
+ ### Reduction Semantics
184
+
185
+ The reduction system provides:
186
+ - **Small-step reduction**: e → e' via prime-preserving operators ⊕
187
+ - **Strong normalization**: Termination guaranteed by strictly decreasing measure
188
+ - **Confluence**: Via Newman's Lemma on local confluence
189
+
190
+ ### Lambda Translation
191
+
192
+ Model-theoretic semantics via translation function τ:
193
+ - τ(N(p)) = constant representing p
194
+ - τ(A(p)N(q)) = application (f_p q)
195
+ - τ(FUSE(p,q,r)) = sum constant
196
+
197
+ ### Enochian Language Module
198
+
199
+ The 21-letter angelic alphabet with mathematical structure:
200
+ - **Prime Basis**: PE = {7, 11, 13, 17, 19, 23, 29}
201
+ - **Twist Angles**: κ(p) = 360/p degrees
202
+ - **Sedenion Operations**: 16-dimensional hypercomplex multiplication
203
+ - **Core Vocabulary**: 35+ traditional Enochian words
204
+
205
+ ---
206
+
160
207
  ## Continue Reading
161
208
 
162
209
  - [Prime Semantics →](./01-prime-semantics.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-ai/tinyaleph",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Prime-resonant semantic computing framework - hypercomplex algebra, oscillator dynamics, and entropy-minimizing reasoning",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "dependencies": {
96
96
  "@noble/curves": "^1.9.7",
97
- "@sschepis/resolang": "^0.1.2",
97
+ "@sschepis/resolang": "^0.4.1",
98
98
  "@tensorflow/tfjs-node": "^4.22.0"
99
99
  }
100
100
  }
package/physics/index.js CHANGED
@@ -4,26 +4,26 @@
4
4
 
5
5
  const { Oscillator, OscillatorBank } = require('./oscillator');
6
6
  const { KuramotoModel } = require('./kuramoto');
7
- const {
8
- shannonEntropy,
9
- stateEntropy,
10
- coherence,
7
+ const {
8
+ shannonEntropy,
9
+ stateEntropy,
10
+ coherence,
11
11
  mutualInformation,
12
12
  relativeEntropy,
13
13
  jointEntropy,
14
14
  oscillatorEntropy
15
15
  } = require('./entropy');
16
- const {
17
- estimateLyapunov,
18
- classifyStability,
16
+ const {
17
+ estimateLyapunov,
18
+ classifyStability,
19
19
  adaptiveCoupling,
20
20
  localLyapunov,
21
21
  delayEmbedding,
22
22
  stabilityMargin
23
23
  } = require('./lyapunov');
24
- const {
25
- collapseProbability,
26
- shouldCollapse,
24
+ const {
25
+ collapseProbability,
26
+ shouldCollapse,
27
27
  measureState,
28
28
  collapseToIndex,
29
29
  bornMeasurement,
@@ -31,12 +31,32 @@ const {
31
31
  applyDecoherence
32
32
  } = require('./collapse');
33
33
 
34
+ // Extended synchronization models
35
+ const {
36
+ NetworkKuramoto,
37
+ AdaptiveKuramoto,
38
+ SakaguchiKuramoto,
39
+ SmallWorldKuramoto,
40
+ MultiSystemCoupling,
41
+ createHierarchicalCoupling,
42
+ createPeerCoupling
43
+ } = require('./sync-models');
44
+
34
45
  module.exports = {
35
46
  // Oscillators
36
47
  Oscillator,
37
48
  OscillatorBank,
38
49
  KuramotoModel,
39
50
 
51
+ // Extended synchronization models
52
+ NetworkKuramoto,
53
+ AdaptiveKuramoto,
54
+ SakaguchiKuramoto,
55
+ SmallWorldKuramoto,
56
+ MultiSystemCoupling,
57
+ createHierarchicalCoupling,
58
+ createPeerCoupling,
59
+
40
60
  // Entropy & Information
41
61
  shannonEntropy,
42
62
  stateEntropy,