Grounding Computation and Ontology in Just 4 Axioms — The Design Philosophy of the Rei Language (0 -shiki)
Source: Dev.to
Numbers Are Not Points — They Are Fields
In conventional programming a number is a single point (a scalar value). When you write x = 5, a point called 5 is stored in a variable.
Rei overturns this assumption. Every value is a field with a “center” and a “periphery”.
import { mdnum, compute } from 'rei-lang';
// A multidimensional number: center = 5, periphery = [1, 2, 3, 4]
const md = mdnum(5, [1, 2, 3, 4]);
const result = compute(md);
console.log(result.value); // 7.5 (weighted average of center + periphery)
// center = 0, no periphery → degenerates to a scalar
const scalar = mdnum(0, []);
console.log(compute(scalar).value); // 0 (same as an ordinary number)
This is fundamentally different from “computing with arrays”. In Rei the structure of a number itself follows the center‑periphery pattern, and a scalar is merely the degenerate case where the periphery is empty.
The Four Irreducible Axioms
| Symbol | Meaning |
|---|---|
M = (c, N, μ, w) | A value |
c ∈ V | center |
N = (n₁,…,nₖ) | periphery |
μ ∈ Modes | computation mode |
w : N → ℝ⁺ | weight function |
Degeneracy: when k = 0, compute(c, ∅, μ, w) = c. Conventional programming can be viewed as handling only this degenerate case.
Every value can be extended or reduced along the depth axis:
⊕ : V × S → V(extension: add a subscript)⊖ : V → V(reduction: remove a subscript)
Chain: v₀ →⊕ v₀ₒ →⊕ v₀ₒₒ → …
Inverse: ⊖(⊕(v, s)) = v
import { subscript, extnum, extend, reduce, toNotation } from 'rei-lang';
// Create 0₀ₒₒ (triple extension of zero)
const sub = subscript(0, ['o', 'o', 'o']);
const en = extnum(sub);
// Extension and reduction operations
const extended = extend(en, 'x'); // 0ooo → 0ooox (⊕)
const reduced = reduce(extended); // 0ooox → 0ooo (⊖)
// 4‑layer notational equivalence
const notation = toNotation(sub);
console.log(notation.sensory); // "0ooo" (sensory layer)
console.log(notation.dialogue); // "0_o3" (dialogue layer)
console.log(notation.structural);// "0(o,3)" (structural layer)
console.log(notation.semantic); // JSON (semantic layer)
Answer to “What comes before zero?”
Normally,0is an irreducible atom, but in Rei an infinite structure unfolds inside0. Every transformation leaves a trace; a value retains its own history.
V̂ = V × Σ // value = raw value + metadata
Σ = (H, τ, n)
H – transformation history (memory)
τ – tendency (direction of change)
n – transformation count
Every function application is automatically recorded, so a value always knows what it is now and where it came from.
import { lang } from 'rei-lang';
// compress = function definition (the philosophy of compression)
lang.run('compress double(x) -> x * 2');
lang.run('compress inc(x) -> x + 1');
// Chain transformations with the pipe operator
lang.run('5 |> double |> inc |> double'); // → 22
// During this process the transformation history [5, 10, 11] is
// automatically accumulated in σ
Staged Existence
Existence arises from nothing in four stages; no stage can be skipped.
P = { void, ・, 0₀, 0, ℕ }
void → ・ // something can exist
・ → 0₀ // value and structure separate
0₀ → 0 // value solidifies and becomes computable
0 → ℕ // the natural number system arises
import { genesis } from 'rei-lang';
const { runFullGenesis, verifyTheoremS0, verifyTheoremS1 } = genesis;
// Run the full genesis process: void → ・ → 0₀ → 0 → ℕ
const state = runFullGenesis();
console.log(state.phase); // 'number'
// Verify uniqueness theorems
const s0 = verifyTheoremS0(state); // ・→0₀ transition is unique
const s1 = verifyTheoremS1(state); // 0₀→0 transition is unique
console.log(s0.valid, s1.valid); // true true
Blocking rule – you cannot jump directly from
voidto0. The transition must proceed one step at a time:void → ・ → 0₀ → 0. This is the principle that “there are no shortcuts to existence.”
The Four Axioms (Independent Axes)
| Axiom | Axis | Question it answers |
|---|---|---|
| A1 | Space (structure) | “What shape does a value have?” |
| A2 | Depth (nesting) | “How deep can you go inside a value?” |
| A3 | Time (history) | “How has a value changed?” |
| A4 | Origin (genesis) | “Where does a value come from?” |
Why Each Axiom Cannot Be Replaced by the Others
| Axiom | Reason it is indispensable |
|---|---|
| A1 | A2, A3, A4 do not define the structure of a value |
| A2 | A1, A3, A4 do not include the concept of depth |
| A3 | A1, A2, A4 do not imply retention of history |
| A4 | A1, A2, A3 do not address the origin of existence |
Comparative Overview
| System | # Axioms | Scope |
|---|---|---|
| λ‑calculus | 3 | Computation |
| Peano | 5 | Natural numbers |
| ZFC | 9 | Sets |
| Rei | 4 | Computation + Ontology |
Rei’s Syntax Mirrors Its Four Axioms
import { lang } from 'rei-lang';
// A1: Multidimensional number literal [center; periphery...]
lang.run('[5; 1, 2, 3, 4]');
// A2: Extension ⊕ / Reduction ⊖
lang.run('0oo ⊕ x'); // 0oo → 0oox
lang.run('0oox ⊖'); // 0oox → 0oo
// A3: Pipe (function composition with σ‑accumulation)
lang.run('compress inc(x) -> x + 1');
lang.run('41 |> inc'); // 42
// A4: bind (value fixation = solidification of existence)
lang.run('bind x = 42');
Syntax – Axiom Mapping
| Syntax | Axiom | Design Intent |
|---|---|---|
[c; n₁, n₂, …] | A1 | Directly express multidimensional numbers |
⊕ / ⊖ | A2 | Extension / Reduction as first‑class operators |
| ` | >` (pipe) | A3 |
bind | A4 | Value fixation = solidification of existence |
All code snippets assume the latest version of rei-lang is installed.
Rei‑lang Highlights
> (pipe) → A3
bind → A4
*Irreversibly fix the existence of a value*
compress → A1+A3
*Compress computation into a reusable form*
Real‑World Performance Advantages of the Center‑Periphery Pattern
| Task | vs. Conventional | Description |
|---|---|---|
| Image kernel ops | 4× reduction | Code volume for convolution |
| Multidim data aggregation | 3.7× improvement | Aggregation pipeline verbosity |
| Graph structure transforms | 3.7× improvement | Network structure manipulation |
| Average code reduction | 74 % | Overall expressiveness |
Phase 7 (v0.5.5+) Features
- σ‑attribute interactions (7a)
- Self‑repair (7b)
- Self‑generation (7c)
- Emergence (7d)
- Micro‑macro bi‑limit meta‑bridges (7e)
The language now spans seven domains—natural science, information engineering, humanities, art, music, economics, and linguistics—linked by 36‑direction bridges. Transformations among five alternative axiom systems are realized through compress/expand functors.
Resources
- GitHub:
- npm:
- Zenodo DOI:
- SSRN:
Feedback, issues, and stars are welcome!