rei-lang 0.5.2 → 0.5.4
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 +170 -361
- package/dist/index.d.mts +365 -2
- package/dist/index.d.ts +365 -2
- package/dist/index.js +3066 -263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3048 -264
- package/dist/index.mjs.map +1 -1
- package/package.json +88 -80
package/README.md
CHANGED
|
@@ -1,70 +1,67 @@
|
|
|
1
|
-
# Rei (0₀式) —
|
|
1
|
+
# Rei (0₀式) — Values That Know Themselves
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/rei-lang)
|
|
4
4
|
[](./LICENSE)
|
|
5
|
-
[]()
|
|
6
|
+
[](./PEACE_USE_CLAUSE.md)
|
|
6
7
|
|
|
7
|
-
**Rei**
|
|
8
|
+
**Rei** is a computation language where every value carries six attributes — field, flow, memory, layer, relation, and will — as language primitives. Where other languages lose context at every step, Rei values know where they are, where they came from, and what they're connected to.
|
|
8
9
|
|
|
9
|
-
**Author:** Nobuki Fujimoto
|
|
10
|
+
**Author:** Nobuki Fujimoto (藤本 伸樹)
|
|
10
11
|
|
|
11
12
|
---
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## Why Rei?
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
- **Hidden Single 検出** — 制約グループ内で唯一の候補位置を自動確定
|
|
17
|
-
- **Pointing Pair 検出** — Box-Line Reduction による高度候補消去
|
|
18
|
-
- **推論層追跡 (ReasoningTrace)** — 各確定/消去ステップの推論層を記録
|
|
19
|
-
- **難易度分析 (DifficultyAnalysis)** — easy/medium/hard/expert の自動判定(スコア0-100)
|
|
20
|
-
- 新パイプ: `agent_difficulty` / `自律難易度`, `agent_trace` / `自律追跡`
|
|
21
|
-
|
|
22
|
-
### Phase 4c: ゲーム推論深化
|
|
23
|
-
- **行動パターン分化** — reactive(防御的)/ proactive(攻撃的)/ contemplative(MC評価)/ competitive(minimax)
|
|
24
|
-
- **戦術パターン知覚** — threat, opportunity, fork, block, center, corner の自動検出
|
|
25
|
-
- **対局分析 (MatchAnalysis)** — プレイヤー別の手数・戦術パターン集計・サマリー生成
|
|
26
|
-
- 新パイプ: `agent_analyze` / `自律分析`
|
|
16
|
+
In conventional languages, spatial structure, history, and relationships are things you build on top. In Rei, they're built in.
|
|
27
17
|
|
|
28
18
|
```rei
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
19
|
+
// A value with spatial context: center 5, neighbors [1, 2, 3]
|
|
20
|
+
let mut x = 𝕄{5; 1, 2, 3}
|
|
21
|
+
|
|
22
|
+
// One pipe gives you the full picture — no manual tracking needed
|
|
23
|
+
x |> sigma
|
|
24
|
+
// → { field: { center: 5, neighbors: [1,2,3], dim: 3 },
|
|
25
|
+
// flow: { velocity: 0, phase: "rest" },
|
|
26
|
+
// memory: { entries: [...], trajectory: [...] },
|
|
27
|
+
// layer: { depth: 1, structure: "flat" },
|
|
28
|
+
// relation: { refs: [], isolated: true },
|
|
29
|
+
// will: { tendency: "rest", strength: 0 } }
|
|
36
30
|
```
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
**Puzzles and games are the same abstraction.** AgentSpace unifies puzzle-solving and game-playing on the v0.5 agent runtime:
|
|
32
|
+
This isn't a library feature. It's **what values are** in Rei.
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
- **Games** = competitive multi-agent systems (players have opposing objectives)
|
|
44
|
-
|
|
45
|
-
The only difference is agent `behavior` and mediator `strategy`.
|
|
34
|
+
### What this enables
|
|
46
35
|
|
|
36
|
+
**Dependency tracing without instrumentation:**
|
|
47
37
|
```rei
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
sudoku(grid) |> as_agent_space |> 調停σ // Same σ for both
|
|
58
|
-
game("tictactoe") |> as_agent_space |> 調停σ
|
|
38
|
+
let mut a = 𝕄{5; 1, 2, 3}
|
|
39
|
+
let mut b = 𝕄{10; 4, 5, 6}
|
|
40
|
+
let mut c = 𝕄{7; 8, 9}
|
|
41
|
+
a |> bind("b", "mirror")
|
|
42
|
+
b |> bind("c", "mirror")
|
|
43
|
+
|
|
44
|
+
a |> trace
|
|
45
|
+
// → { root: "a", chains: [["a","b","c"]], maxDepth: 2 }
|
|
46
|
+
// a knows its entire dependency graph — automatically
|
|
59
47
|
```
|
|
60
48
|
|
|
61
|
-
|
|
49
|
+
**Influence scoring between connected values:**
|
|
50
|
+
```rei
|
|
51
|
+
a |> influence("c")
|
|
52
|
+
// → { from: "a", to: "c", score: 1, path: ["a","b","c"], hops: 2 }
|
|
53
|
+
```
|
|
62
54
|
|
|
63
|
-
|
|
55
|
+
**Values that evolve their own intentions:**
|
|
56
|
+
```rei
|
|
57
|
+
let mut w = 𝕄{5; 1, 2, 3}
|
|
58
|
+
w |> intend("maximize")
|
|
59
|
+
w |> will_evolve
|
|
60
|
+
// → { previous: {tendency:"rest"}, evolved: {tendency:"rest", strength:0.3},
|
|
61
|
+
// reason: "弱い意志 → 内在傾向に回帰", autonomous: true }
|
|
62
|
+
```
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
- **Entity Agent** — Six-attribute autonomous agents (perceive → decide → act cycle)
|
|
67
|
-
- **Mediator** — Concurrent execution engine with conflict detection and resolution strategies
|
|
64
|
+
In Python, every one of these features requires a framework, manual state tracking, and hundreds of lines of boilerplate. In Rei, they're one pipe away.
|
|
68
65
|
|
|
69
66
|
---
|
|
70
67
|
|
|
@@ -74,31 +71,27 @@ v0.5 introduced a **self-organizing agent runtime** — entities perceive, decid
|
|
|
74
71
|
npm install rei-lang
|
|
75
72
|
```
|
|
76
73
|
|
|
77
|
-
## Quick Start
|
|
74
|
+
## Quick Start (5 minutes)
|
|
78
75
|
|
|
79
76
|
### As a Library
|
|
80
77
|
|
|
81
78
|
```typescript
|
|
82
79
|
import { rei } from 'rei-lang';
|
|
83
80
|
|
|
84
|
-
// Multi-dimensional
|
|
81
|
+
// Multi-dimensional numbers: center-periphery computation
|
|
85
82
|
rei('let field = 𝕄{5; 1, 2, 3, 4}');
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
//
|
|
90
|
-
rei('compress
|
|
91
|
-
rei('
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
rei('
|
|
96
|
-
|
|
97
|
-
rei(
|
|
98
|
-
console.log(rei('g.state')); // "line"
|
|
99
|
-
|
|
100
|
-
// Reset state between sessions
|
|
101
|
-
rei.reset();
|
|
83
|
+
rei('field |> compute :weighted'); // → 7.5
|
|
84
|
+
rei('field |> compute :harmonic'); // → harmonic aggregation
|
|
85
|
+
|
|
86
|
+
// Functions compress complexity
|
|
87
|
+
rei('compress distance(x, y) = sqrt(x * x + y * y)');
|
|
88
|
+
rei('distance(3, 4)'); // → 5
|
|
89
|
+
|
|
90
|
+
// Pipes flow naturally
|
|
91
|
+
rei('-25 |> abs |> sqrt'); // → 5
|
|
92
|
+
rei('[5, 3, 8, 1] |> sort |> reverse'); // → [8, 5, 3, 1]
|
|
93
|
+
|
|
94
|
+
rei.reset(); // clear state between sessions
|
|
102
95
|
```
|
|
103
96
|
|
|
104
97
|
### Interactive REPL
|
|
@@ -109,33 +102,24 @@ npx rei
|
|
|
109
102
|
|
|
110
103
|
```
|
|
111
104
|
╔══════════════════════════════════════════╗
|
|
112
|
-
║ Rei (0₀式) REPL v0.5.
|
|
105
|
+
║ Rei (0₀式) REPL v0.5.2 ║
|
|
113
106
|
║ D-FUMT Computational Language ║
|
|
114
107
|
╚══════════════════════════════════════════╝
|
|
115
108
|
|
|
116
109
|
零 > 𝕄{5; 1, 2, 3, 4} |> compute :weighted
|
|
117
110
|
7.5
|
|
118
111
|
|
|
119
|
-
零 >
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
零 > karma(0.8, 0.9, 0.7)
|
|
123
|
-
0.504
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Execute a File
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
npx rei program.rei
|
|
112
|
+
零 > 𝕄{5; 1, 2, 3} |> sigma
|
|
113
|
+
{ field: { center: 5, ... }, flow: { ... }, memory: { ... }, ... }
|
|
130
114
|
```
|
|
131
115
|
|
|
132
116
|
---
|
|
133
117
|
|
|
134
|
-
##
|
|
118
|
+
## Core Concepts
|
|
135
119
|
|
|
136
|
-
### Multi-Dimensional Numbers
|
|
120
|
+
### 𝕄 — Multi-Dimensional Numbers
|
|
137
121
|
|
|
138
|
-
The
|
|
122
|
+
The fundamental data type. A center value surrounded by neighbors, computed in four modes:
|
|
139
123
|
|
|
140
124
|
```rei
|
|
141
125
|
let m = 𝕄{5; 1, 2, 3, 4}
|
|
@@ -146,354 +130,179 @@ m |> compute :harmonic // center + n / Σ(1/|nᵢ|)
|
|
|
146
130
|
m |> compute :exponential // center × avg(e^nᵢ)
|
|
147
131
|
```
|
|
148
132
|
|
|
149
|
-
|
|
133
|
+
This isn't an array with an index. It's a value with spatial awareness — the center knows its periphery.
|
|
150
134
|
|
|
151
|
-
|
|
135
|
+
### σ (Sigma) — Six Attributes
|
|
152
136
|
|
|
153
|
-
|
|
154
|
-
let a = 0ooo // 3rd-order extension of zero
|
|
155
|
-
a >> :x >> :x // extend: order 3 → 5
|
|
156
|
-
a << // reduce: order 3 → 2
|
|
157
|
-
a |> valStar // numeric projection: 0.001
|
|
137
|
+
Every value in Rei carries six attributes, accessible via `|> sigma`:
|
|
158
138
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
139
|
+
| Attribute | 日本語 | What it tracks |
|
|
140
|
+
|-----------|--------|---------------|
|
|
141
|
+
| **field** | 場 | Spatial context: center, neighbors, dimension |
|
|
142
|
+
| **flow** | 流れ | Temporal state: velocity, acceleration, phase |
|
|
143
|
+
| **memory** | 記憶 | History: past operations, trajectory, causes |
|
|
144
|
+
| **layer** | 層 | Structural depth: nesting, components |
|
|
145
|
+
| **relation** | 関係 | Connections: bindings, dependencies, entanglements |
|
|
146
|
+
| **will** | 意志 | Intention: tendency, strength, prediction |
|
|
162
147
|
|
|
163
|
-
###
|
|
148
|
+
### Relation Deep — 縁起的追跡
|
|
164
149
|
|
|
165
|
-
|
|
150
|
+
Track how values depend on each other:
|
|
166
151
|
|
|
167
152
|
```rei
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
153
|
+
let mut a = 𝕄{5; 1, 2}
|
|
154
|
+
let mut b = 𝕄{10; 3, 4}
|
|
155
|
+
a |> bind("b", "mirror") // create a relation
|
|
156
|
+
|
|
157
|
+
a |> trace // dependency chain (BFS, cycle-safe)
|
|
158
|
+
a |> influence("b") // influence score between values
|
|
159
|
+
a |> entangle("b") // deep bidirectional entanglement
|
|
160
|
+
// also: 追跡, 影響("b"), 縁起("b") — full Japanese support
|
|
173
161
|
```
|
|
174
162
|
|
|
175
|
-
###
|
|
163
|
+
### Will Deep — 意志の自律性
|
|
176
164
|
|
|
177
|
-
|
|
165
|
+
Values can carry and evolve intentions:
|
|
178
166
|
|
|
179
167
|
```rei
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
168
|
+
let mut x = 𝕄{5; 1, 2, 3}
|
|
169
|
+
x |> intend("maximize") // set intention
|
|
170
|
+
x |> will_evolve // autonomous evolution based on history
|
|
171
|
+
|
|
172
|
+
let mut y = 𝕄{10; 4, 5}
|
|
173
|
+
y |> intend("minimize")
|
|
174
|
+
x |> bind("y")
|
|
175
|
+
x |> will_align("y") // harmonize intentions
|
|
176
|
+
x |> will_conflict("y") // detect and resolve tension
|
|
177
|
+
// also: 意志進化, 意志調律("y"), 意志衝突("y")
|
|
184
178
|
```
|
|
185
179
|
|
|
186
|
-
### Genesis Axiom System
|
|
180
|
+
### Genesis Axiom System — 生成公理系
|
|
187
181
|
|
|
188
|
-
|
|
182
|
+
Computational emergence from void:
|
|
189
183
|
|
|
190
184
|
```rei
|
|
191
|
-
let g = genesis()
|
|
192
|
-
g |> forward
|
|
193
|
-
g |> forward
|
|
194
|
-
g |> forward
|
|
195
|
-
g |> forward
|
|
196
|
-
g |> forward
|
|
197
|
-
g.omega // 1
|
|
185
|
+
let g = genesis() // void
|
|
186
|
+
g |> forward // void → dot
|
|
187
|
+
g |> forward // dot → line
|
|
188
|
+
g |> forward // line → surface
|
|
189
|
+
g |> forward // surface → solid
|
|
190
|
+
g |> forward // solid → omega (Ω)
|
|
198
191
|
```
|
|
199
192
|
|
|
200
|
-
###
|
|
193
|
+
### Compress — 関数定義
|
|
201
194
|
|
|
202
|
-
|
|
195
|
+
Functions are defined with `compress`, reflecting D-FUMT's compression philosophy:
|
|
203
196
|
|
|
204
197
|
```rei
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
¬⊤ // ⊥
|
|
211
|
-
⊤ ∧ ⊥ // ⊥
|
|
212
|
-
⊥ ∨ ⊤ // ⊤
|
|
198
|
+
compress energy(m) = m |> compute :weighted
|
|
199
|
+
compress karma(i, e, r) = i * e * r
|
|
200
|
+
|
|
201
|
+
energy(𝕄{0; 10, 20, 30}) // → 20
|
|
202
|
+
karma(0.8, 0.9, 0.7) // → 0.504
|
|
213
203
|
```
|
|
214
204
|
|
|
215
205
|
---
|
|
216
206
|
|
|
217
|
-
##
|
|
218
|
-
|
|
219
|
-
### EventBus (イベントバス)
|
|
207
|
+
## Benchmarks
|
|
220
208
|
|
|
221
|
-
|
|
209
|
+
### Code Reduction
|
|
222
210
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Subscribe to events
|
|
231
|
-
bus.on('entity:fuse', (event) => {
|
|
232
|
-
console.log('Fusion occurred:', event.data);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
// Subscribe with filter
|
|
236
|
-
bus.subscribe(
|
|
237
|
-
(e) => e.category === 'agent',
|
|
238
|
-
(e) => console.log(`Agent ${e.data.agentId}: ${e.action}`)
|
|
239
|
-
);
|
|
240
|
-
```
|
|
211
|
+
| Task | Conventional | Rei | Reduction |
|
|
212
|
+
|------|-------------|-----|-----------|
|
|
213
|
+
| Image kernel computation | 32 lines | 8 lines | **4×** |
|
|
214
|
+
| Multi-dimensional aggregation | 45 lines | 12 lines | **3.7×** |
|
|
215
|
+
| Graph structure transformation | 52 lines | 14 lines | **3.7×** |
|
|
216
|
+
| **Average** | | | **74%** |
|
|
241
217
|
|
|
242
|
-
|
|
218
|
+
See [`benchmarks/`](./benchmarks/) for runnable comparisons with equivalent Python code.
|
|
243
219
|
|
|
244
|
-
|
|
245
|
-
// Emit a custom event
|
|
246
|
-
"mySource" |> emit("entity:transform", "data")
|
|
220
|
+
### What Benchmarks Don't Capture
|
|
247
221
|
|
|
248
|
-
|
|
249
|
-
"entity:*" |> subscribe
|
|
222
|
+
The deeper advantage isn't line count — it's **what you don't have to build**. In Rei, dependency tracking, metadata propagation, and structural awareness are free. In other languages, they're projects.
|
|
250
223
|
|
|
251
|
-
|
|
252
|
-
0 |> flow_momentum // → { state: "expanding", rate: 12.5, ... }
|
|
253
|
-
```
|
|
224
|
+
---
|
|
254
225
|
|
|
255
|
-
|
|
226
|
+
## Agent Runtime (v0.5)
|
|
256
227
|
|
|
257
|
-
|
|
228
|
+
Rei includes a self-organizing agent system where entities perceive, decide, and act autonomously:
|
|
258
229
|
|
|
259
230
|
```rei
|
|
260
|
-
// Spawn
|
|
261
|
-
let a = 𝕄{10; 1, 2, 3} |>
|
|
262
|
-
|
|
263
|
-
// Agent lifecycle
|
|
264
|
-
a |> perceive // observe environment → Perception
|
|
265
|
-
a |> decide // choose action → Decision
|
|
266
|
-
a |> act // execute decision → ActionResult
|
|
267
|
-
|
|
268
|
-
// Agent introspection
|
|
269
|
-
a |> agent_sigma // σ metadata: state, step, memory, bindings
|
|
270
|
-
a |> 自律σ // 日本語版
|
|
231
|
+
// Spawn agents from values
|
|
232
|
+
let mut a = 𝕄{10; 1, 2, 3} |> agent
|
|
233
|
+
a |> agent_sigma // full agent state
|
|
271
234
|
|
|
272
|
-
//
|
|
273
|
-
|
|
235
|
+
// Puzzle solving: 81 cooperative agents solve sudoku
|
|
236
|
+
30 |> generate_sudoku(42) |> agent_solve
|
|
274
237
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
import { ReiAgent, AgentRegistry } from 'rei-lang';
|
|
278
|
-
|
|
279
|
-
const registry = new AgentRegistry();
|
|
280
|
-
const agent = registry.spawn(42, {
|
|
281
|
-
behavior: 'cooperative',
|
|
282
|
-
autonomyLevel: 0.8,
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
const perception = agent.perceive(registry);
|
|
286
|
-
const decision = agent.decide(perception);
|
|
287
|
-
const result = agent.act(registry, decision);
|
|
238
|
+
// Game playing: competitive match
|
|
239
|
+
"tic_tac_toe" |> game |> agent_match
|
|
288
240
|
```
|
|
289
241
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
The Mediator coordinates multiple agents running concurrently, detecting and resolving conflicts with configurable strategies.
|
|
293
|
-
|
|
294
|
-
```rei
|
|
295
|
-
// Concurrent execution — all agents perceive → decide → resolve conflicts → act
|
|
296
|
-
0 |> mediate // 1 round of concurrent execution
|
|
297
|
-
0 |> mediate(5) // 5 rounds with convergence detection
|
|
298
|
-
0 |> mediate(10, 0.8) // max 10 rounds, convergence threshold 0.8
|
|
299
|
-
|
|
300
|
-
// Strategies: priority / cooperative / sequential / cancel_both / mediator
|
|
301
|
-
0 |> mediate_strategy("cooperative") // 協調 — merge conflicting intentions
|
|
302
|
-
0 |> 調停戦略("協調") // 日本語版
|
|
303
|
-
|
|
304
|
-
// Inter-agent messaging
|
|
305
|
-
"agent_a" |> mediate_message("agent_b", "hello") // point-to-point
|
|
306
|
-
"agent_a" |> mediate_broadcast("共有データ") // broadcast to all
|
|
307
|
-
|
|
308
|
-
// Mediator σ — statistics and convergence history
|
|
309
|
-
0 |> mediator_sigma // → { totalRounds, conflicts, convergenceHistory, ... }
|
|
310
|
-
0 |> 調停σ // 日本語版
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Conflict types detected automatically: **target contention** (same target), **resource conflict** (shared resource), **mutual fuse** (A↔B fusion), **contradictory** (fuse vs separate).
|
|
314
|
-
|
|
315
|
-
Resolution strategies:
|
|
316
|
-
|
|
317
|
-
| Strategy | Japanese | Behavior |
|
|
318
|
-
|----------|----------|----------|
|
|
319
|
-
| `priority` | 優先 | Highest confidence × priority wins |
|
|
320
|
-
| `cooperative` | 協調 | Merge intentions into compromise |
|
|
321
|
-
| `sequential` | 順次 | Execute in priority order |
|
|
322
|
-
| `cancel_both` | 両方取消 | Cancel conflicting actions |
|
|
323
|
-
| `mediator` | 調停者 | Mediator's own judgment (中道) |
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
// Programmatic API
|
|
327
|
-
import { ReiMediator, AgentRegistry } from 'rei-lang';
|
|
328
|
-
|
|
329
|
-
const registry = new AgentRegistry();
|
|
330
|
-
const mediator = new ReiMediator(registry);
|
|
331
|
-
|
|
332
|
-
// Spawn agents
|
|
333
|
-
registry.spawn(10, { behavior: 'cooperative' });
|
|
334
|
-
registry.spawn(20, { behavior: 'competitive' });
|
|
335
|
-
|
|
336
|
-
// Run concurrent rounds with convergence detection
|
|
337
|
-
const result = mediator.run({
|
|
338
|
-
maxRounds: 10,
|
|
339
|
-
convergenceThreshold: 0.8,
|
|
340
|
-
});
|
|
341
|
-
console.log(result.converged, result.totalRounds);
|
|
342
|
-
```
|
|
242
|
+
Puzzles and games are the same abstraction — the only difference is agent behavior and mediator strategy.
|
|
343
243
|
|
|
344
244
|
---
|
|
345
245
|
|
|
346
|
-
##
|
|
347
|
-
|
|
348
|
-
Every entity in Rei carries six attributes from D-FUMT theory:
|
|
246
|
+
## Bilingual Support (日本語対応)
|
|
349
247
|
|
|
350
|
-
|
|
351
|
-
|-----------|----------|------|
|
|
352
|
-
| Field (場) | ば | Spatial context and neighbors |
|
|
353
|
-
| Flow (流れ) | ながれ | Temporal momentum and EventBus connection |
|
|
354
|
-
| Memory (記憶) | きおく | History of observations and actions |
|
|
355
|
-
| Layer (層) | そう | Hierarchical depth and nesting |
|
|
356
|
-
| Relation (関係) | かんけい | Bindings between entities |
|
|
357
|
-
| Will (意志) | いし | Intention-driven computation strategy |
|
|
248
|
+
All commands have Japanese aliases:
|
|
358
249
|
|
|
359
250
|
```rei
|
|
360
|
-
//
|
|
361
|
-
|
|
362
|
-
let y = 100
|
|
363
|
-
x |> bind(y, "collaborator") // create a relation
|
|
364
|
-
|
|
365
|
-
// Will-driven computation
|
|
366
|
-
let m = 𝕄{5; 1, 2, 3}
|
|
367
|
-
m |> intend("maximize") // set intention
|
|
368
|
-
m |> will_compute // compute guided by will
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
373
|
-
## RCT Compression (Rei Compression Theory)
|
|
251
|
+
𝕄{5; 1, 2, 3} |> sigma // English
|
|
252
|
+
𝕄{5; 1, 2, 3} |> 自律σ // 日本語
|
|
374
253
|
|
|
375
|
-
|
|
254
|
+
"b" |> bind("a") // English
|
|
255
|
+
"b" |> 結合("a") // 日本語
|
|
376
256
|
|
|
377
|
-
|
|
378
|
-
//
|
|
379
|
-
let data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
380
|
-
data |> compress // → compact θ representation
|
|
381
|
-
data |> compress |> decompress // → lossless round-trip
|
|
382
|
-
|
|
383
|
-
// Semantic compression (Direction 3)
|
|
384
|
-
"let x = 𝕄{5; 1, 2, 3}" |> semantic_compress // → θ parameters
|
|
385
|
-
"let x = 𝕄{5; 1, 2, 3}" |> 意味圧縮 // 日本語版
|
|
257
|
+
// trace → 追跡, influence → 影響, entangle → 縁起
|
|
258
|
+
// will_evolve → 意志進化, will_align → 意志調律
|
|
386
259
|
```
|
|
387
260
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
## Benchmarks
|
|
391
|
-
|
|
392
|
-
| Task | Conventional | Rei | Reduction |
|
|
393
|
-
|------|-------------|-----|-----------|
|
|
394
|
-
| Image kernel calculations | 32 lines | 8 lines | **4×** |
|
|
395
|
-
| Multi-dimensional data aggregation | 45 lines | 12 lines | **3.7×** |
|
|
396
|
-
| Graph structure transformation | 52 lines | 14 lines | **3.7×** |
|
|
397
|
-
| **Average** | | | **74%** |
|
|
261
|
+
See [full command reference](./docs/KANJI-README.md) for the complete bilingual table.
|
|
398
262
|
|
|
399
263
|
---
|
|
400
264
|
|
|
401
|
-
##
|
|
402
|
-
|
|
403
|
-
### `rei(code: string): ReiValue`
|
|
404
|
-
|
|
405
|
-
Evaluate a string of Rei code. State persists across calls.
|
|
406
|
-
|
|
407
|
-
### `rei.reset(): void`
|
|
408
|
-
|
|
409
|
-
Clear all variable and function bindings.
|
|
410
|
-
|
|
411
|
-
### `rei.evaluator(): Evaluator`
|
|
412
|
-
|
|
413
|
-
Access the underlying Evaluator instance (for EventBus, AgentRegistry, etc.).
|
|
414
|
-
|
|
415
|
-
### Classes
|
|
416
|
-
|
|
417
|
-
| Class | Description |
|
|
418
|
-
|-------|-------------|
|
|
419
|
-
| `Lexer` | Tokenizer |
|
|
420
|
-
| `Parser` | Recursive descent parser |
|
|
421
|
-
| `Evaluator` | AST evaluator with environment/scope chain |
|
|
422
|
-
| `ReiEventBus` | Type-safe event system with flow momentum |
|
|
423
|
-
| `ReiAgent` | Autonomous entity with six attributes |
|
|
424
|
-
| `AgentRegistry` | Agent lifecycle management |
|
|
425
|
-
| `ReiMediator` | Concurrent execution engine with conflict resolution |
|
|
426
|
-
|
|
427
|
-
### Types
|
|
265
|
+
## Documentation
|
|
428
266
|
|
|
429
|
-
|
|
|
430
|
-
|
|
431
|
-
|
|
|
432
|
-
|
|
|
433
|
-
|
|
|
434
|
-
|
|
|
435
|
-
|
|
|
436
|
-
|
|
|
437
|
-
|
|
|
438
|
-
|
|
|
439
|
-
|
|
440
|
-
---
|
|
441
|
-
|
|
442
|
-
## Bilingual Pipe Commands (日本語対応)
|
|
443
|
-
|
|
444
|
-
All pipe commands have Japanese aliases:
|
|
445
|
-
|
|
446
|
-
| English | 日本語 | Description |
|
|
447
|
-
|---------|--------|-------------|
|
|
448
|
-
| `spawn` | `生成` | Create agent from value |
|
|
449
|
-
| `perceive` | `知覚` | Agent observes environment |
|
|
450
|
-
| `decide` | `判断` | Agent chooses action |
|
|
451
|
-
| `act` | `行動` | Agent executes decision |
|
|
452
|
-
| `agent_sigma` | `自律σ` | Agent metadata |
|
|
453
|
-
| `mediate` | `調停` | Concurrent round execution |
|
|
454
|
-
| `mediate_run` | `調停実行` | Multi-round execution |
|
|
455
|
-
| `mediator_sigma` | `調停σ` | Mediator statistics |
|
|
456
|
-
| `mediate_strategy` | `調停戦略` | Set conflict strategy |
|
|
457
|
-
| `mediate_message` | `調停通信` | Point-to-point message |
|
|
458
|
-
| `mediate_broadcast` | `調停放送` | Broadcast to all agents |
|
|
459
|
-
| `emit` | `発火` | Emit event |
|
|
460
|
-
| `subscribe` | `購読` | Subscribe to events |
|
|
461
|
-
| `bind` | `結合` | Create relation binding |
|
|
462
|
-
| `intend` | `意図` | Set entity intention |
|
|
463
|
-
| `compress` | `圧縮` | RCT compression |
|
|
464
|
-
| `decompress` | `復元` | RCT decompression |
|
|
465
|
-
|
|
466
|
-
---
|
|
467
|
-
|
|
468
|
-
## BNF Specification
|
|
469
|
-
|
|
470
|
-
The complete BNF v0.3 specification is available in [`spec/`](./spec/).
|
|
267
|
+
| Document | Content |
|
|
268
|
+
|----------|---------|
|
|
269
|
+
| [TUTORIAL.md](./docs/TUTORIAL.md) | Getting started in 15 minutes |
|
|
270
|
+
| [API-STABILITY.md](./docs/API-STABILITY.md) | API stability levels (Stable/Provisional/Experimental) |
|
|
271
|
+
| [KANJI-README.md](./docs/KANJI-README.md) | Full bilingual command reference |
|
|
272
|
+
| [ROADMAP-v1.md](./docs/ROADMAP-v1.md) | Path to v1.0 |
|
|
273
|
+
| [PHASE4D-DESIGN.md](./PHASE4D-DESIGN.md) | Current development phase |
|
|
274
|
+
| [ARCH.md](./ARCH.md) | Architecture overview |
|
|
275
|
+
| [spec/](./spec/) | BNF specification (v0.3) |
|
|
276
|
+
| [theory/](./theory/) | D-FUMT theoretical foundation (66 theories) |
|
|
471
277
|
|
|
472
278
|
---
|
|
473
279
|
|
|
474
280
|
## Theoretical Foundation
|
|
475
281
|
|
|
476
|
-
Rei is grounded in **D-FUMT** (Dimensional Fujimoto Universal Mathematical Theory), a framework of 66 interconnected theories
|
|
282
|
+
Rei is grounded in **D-FUMT** (Dimensional Fujimoto Universal Mathematical Theory), a framework of 66 interconnected theories. The language's core innovation — center-periphery patterns and six-attribute metadata — derives from D-FUMT's multi-dimensional number system and consciousness mathematics.
|
|
477
283
|
|
|
478
|
-
|
|
284
|
+
Key theoretical concepts:
|
|
285
|
+
- **Extended Zero** (0₀, 0₀₀, 0owo) — dimensional extension of zero
|
|
286
|
+
- **Four-Valued Logic** (⊤, ⊥, ⊤π, ⊥π) — beyond true/false
|
|
287
|
+
- **Genesis Axioms** — computational emergence from void
|
|
288
|
+
- **RCT** (Rei Compression Theory) — generative compression
|
|
289
|
+
|
|
290
|
+
See [`theory/`](./theory/) for complete documentation.
|
|
479
291
|
|
|
480
292
|
---
|
|
481
293
|
|
|
482
|
-
## ☮️ Peace Use Clause
|
|
294
|
+
## ☮️ Peace Use Clause
|
|
483
295
|
|
|
484
|
-
Rei is licensed under Apache 2.0 with
|
|
485
|
-
Rei は Apache 2.0 ライセンスに加え、平和利用条項が適用されます。
|
|
296
|
+
Rei is licensed under Apache 2.0 with a Peace Use Clause. It is designed exclusively for the peaceful advancement of humanity.
|
|
486
297
|
|
|
487
|
-
|
|
488
|
-
|
|
298
|
+
🚫 Weapons, military systems, or autonomous lethal weapons
|
|
299
|
+
🚫 Human rights violations
|
|
300
|
+
🚫 Intentional environmental destruction
|
|
489
301
|
|
|
490
|
-
|
|
491
|
-
🚫 Human rights violations / 人権侵害
|
|
492
|
-
🚫 Intentional environmental destruction / 意図的な環境破壊
|
|
302
|
+
✅ Education, research, humanitarian aid, and creative endeavors
|
|
493
303
|
|
|
494
|
-
|
|
495
|
-
✅ 教育・研究・人道支援・創造的活動での使用を推奨します。
|
|
304
|
+
See [PEACE_USE_CLAUSE.md](./PEACE_USE_CLAUSE.md) for details.
|
|
496
305
|
|
|
497
|
-
|
|
306
|
+
---
|
|
498
307
|
|
|
499
308
|
Apache 2.0 © Nobuki Fujimoto
|