neberu 0.0.0

Exact geometric algebra from the balanced ternary axiom. Governed rewriting, self-certifying canonicalization via the Kase Optimality Theorem.
Documentation
# Nēberu v0.0.0 — Human Readability Report

*What was built, what it does, and what the numbers mean.*

---

## The One-Sentence Version

A computation system was built from a single three-valued primitive, and that system can now prove — in eleven bytes — that any computation it performs was done correctly.

---

## Background: The Problem With Numbers

Every computer in the world does arithmetic with approximations.

When your computer calculates `1/3`, it does not get `0.333...` forever. It gets `0.3333333333333333`, or some close variant, stored as a floating-point number — a standard format that trades exactness for speed. For most purposes this is fine. For geometry, physics simulations, and formal proofs, it is not. The approximation accumulates. The error compounds. Two independent calculations of the same thing may produce slightly different results. You cannot tell whether they disagree because one is wrong, or because floating-point arithmetic introduced a rounding error somewhere in the chain.

Nēberu does not use floating-point numbers anywhere. Not once. Every number in the system is exact.

---

## The Foundation: The Trit

The entire system is built from one primitive: the **Trit**.

A Trit is a three-valued type. It has exactly three valid states:

- **N** (negative, −1)
- **Z** (zero, 0)
- **P** (positive, +1)

And one invalid state:

- **INV** (invalid — an error sentinel)

The Trit has a multiplication rule. Nine entries, covering every pair of valid values:

```
N × N = P    (negative times negative is positive)
N × Z = Z    (anything times zero is zero)
N × P = N    (negative times positive is negative)
Z × N = Z
Z × Z = Z
Z × P = Z
P × N = N
P × Z = Z
P × P = P    (positive times positive is positive)
```

This table is called **the axiom**. It is the only thing the system assumes. Everything else is constructed from it.

The Trit maps to the three fundamental types of generator in Clifford algebra:

- **N** → imaginary (squares to −1, like the imaginary unit i)
- **Z** → degenerate (squares to 0, used in projective geometry)
- **P** → hyperbolic (squares to +1, used in relativistic geometry)

In other words: the multiplication table of the Trit *is* the type system of geometry. The same three values that govern arithmetic signs also govern the algebraic structure of spatial relationships. This is not a coincidence — it is the central design insight of the system.

---

## The Encoding

Each Trit is stored in two bits:

```
00 = Z   (zero)
01 = N   (negative)
10 = P   (positive)
11 = INV (invalid)
```

This encoding was chosen carefully:

- `Z = 00`: A memory region initialized to all zeros is automatically a region of zero Trits. Safe, predictable.
- `INV = 11`: If any Trit in a packed value is invalid, combining it with valid Trits via the OR operation propagates the invalidity. You cannot hide an error.
- The remaining two states, `01` and `10`, are the negative and positive values.

Sixty-four Trits are packed into a single 128-bit integer (a `u128` in Rust). This is called a `Tern` — a balanced ternary integer. It can represent any integer from approximately −1.7 × 10³⁰ to +1.7 × 10³⁰ exactly, with no approximation.

---

## What Gets Built From the Axiom

From the Trit, five constructions are derived:

**Tern**: Sixty-four Trits packed into a 128-bit integer. Exact arithmetic: addition, subtraction, multiplication, and division — all performed as bitwise operations on Trit sequences. Division is implemented as non-restoring balanced ternary division: an algorithm that produces exact quotients and remainders without borrowing from any external number system.

**Rat**: An exact rational number — a fraction where both numerator and denominator are Terns, always reduced to lowest terms. `1/3` is stored as exactly `1/3`. No approximation.

**Gen** (Generator): A single algebraic generator. The key property: a generator *is* its Trit type. A generator that squares to −1 carries the Trit `N` as part of its identity. There is no separate lookup table. The type is the thing. Asking what type a generator is takes exactly one memory access.

**Word**: A sequence of generators — what algebraists call a *basis blade*. The word `e1·e2` is a sequence of two generators. The word `e1·e2·e3` is a sequence of three. The grade of a word is its length.

**Expr** (Expression): A sum of words with rational coefficients. `2·e1 + 3·e1·e2 - e3` is an expression. This is the multivector — the fundamental object of geometric algebra.

**Governance**: A set of rewrite rules. Each rule says: when you see this word in an expression, replace it with this other expression. The square rule for imaginary generators says: when you see `e1·e1`, replace it with `−1`. The anticommutativity rule says: when you see `e2·e1`, replace it with `−e1·e2`.

**Geoit**: A value bound to an algebra. Every expression in the system lives inside a Geoit — a pair of (Governance, Expression). You cannot confuse which algebra a value belongs to, because the algebra is part of the value's identity.

---

## Evaluation Is Canonicalization

In most computer algebra systems, "evaluating" an expression means running a sequence of transformation rules until you get an answer. The question of whether the answer is *canonical* — the unique, simplest form — is separate, usually addressed by a normalization pass.

In Nēberu, **evaluation and canonicalization are the same thing**. There is no separate step. When you compute `e1·e1` in a Clifford algebra, the system applies rewrite rules until no more rules can fire. The result — `−1` — is not just *an* answer. It is *the* answer. The unique irreducible form under the given governance.

This works because Clifford algebras are *confluent*: no matter what order you apply the rules, you always reach the same terminal expression. The system can check this property — and does.

---

## The Computation

The specific computation demonstrated in Nēberu v0.0.0 is:

**Compute `e1·e1` in Cl(1,0,0).**

`Cl(1,0,0)` means "the Clifford algebra with one imaginary generator, zero degenerate generators, and zero hyperbolic generators." This is the simplest non-trivial Clifford algebra. It is also the algebra of the complex numbers: `e1` is the imaginary unit `i`, and `e1·e1 = i² = −1`.

The computation:

1. Start with the expression `1·(e1·e1)` — the product of two imaginary generators.
2. The governance has one rule: `e1·e1 → −1`.
3. The rule fires. The expression becomes `−1`.
4. No further rules apply. `−1` is a scalar. The computation is complete.

One step. Terminal: `−1`.

---

## The Trace

Every time the system performs a canonicalization, it records a **trace** — a complete log of what happened.

The trace for `e1·e1 → −1` contains one entry:

- **Which rule fired**: rule number 0 (the only rule in the governance)
- **Where it fired**: position 0 (the beginning of the expression)
- **What was matched**: the word `[N, N]` — two generators of type N (imaginary)

This trace entry is then encoded as a sequence of Trits:

```
[rule index as P-count] [INV separator] [position as P-count] [INV separator] [matched types]
```

For rule 0, position 0, matched `[N, N]`:

- Rule index 0 → zero P-trits (nothing, since the count is zero)
- INV separator
- Position 0 → zero P-trits (nothing)
- INV separator
- Matched types → N, N

The Trit sequence is: `INV, INV, N, N`

Packed into bits using the two-bit encoding: `11 11 01 01`

As a single byte (reading from least-significant bit): `01011111` = **95** = **0x5F**

The entire trace of the computation fits in one byte: **95**.

---

## The KOT — Kase Optimality Theorem

After computing, the system asks: was that computation *correct*?

"Correct" here means three things:

**Minimal**: No step in the trace was redundant. Removing any step would have produced a different result.

**Complete**: The terminal expression is irreducible. No rewrite rule applies to `−1`. It cannot be simplified further.

**Consistent**: The governance is confluent at this expression. There is no alternative derivation that produces a different terminal.

If all three hold, the computation is **optimal**. The system records this verdict as a single Trit: `P` (positive, optimal). If any condition fails, the verdict is `N` (negative, not optimal).

This three-property certification is the **Kase Optimality Theorem**.

---

## The KOT Governance

To check whether a computation was optimal, the system needs a second governance — the KOT governance — that operates on certificates rather than on algebraic expressions.

A certificate is a grade-3 Trit-word: three Trits representing the three properties.

```
[minimal-trit] · [complete-trit] · [consistent-trit]
```

For a passing computation, all three are P:

```
[P · P · P]
```

The KOT governance has eight rules — one for every possible combination of P and N across three positions:

```
[P·P·P] → +1   ← the only optimal certificate
[P·P·N] → −1
[P·N·P] → −1
[P·N·N] → −1
[N·P·P] → −1
[N·P·N] → −1
[N·N·P] → −1
[N·N·N] → −1
```

Each rule maps a certificate word to a scalar: `+1` if optimal, `−1` if not. The verdict is the sign of that scalar — and the sign is a Trit.

The eight source words have these exact decimal values:

```
[P·P·P] = 42    ← maps to +1
[P·P·N] = 26    ← maps to −1
[P·N·P] = 38    ← maps to −1
[P·N·N] = 22    ← maps to −1
[N·P·P] = 41    ← maps to −1
[N·P·N] = 25    ← maps to −1
[N·N·P] = 37    ← maps to −1
[N·N·N] = 21    ← maps to −1
```

Packed together as a single integer: **94,929,134,708,394**.

This six-byte number *is* the complete definition of what "correct" means for any canonicalization this system can produce.

---

## The Numbers

Everything computed above is exact. Here they are:

**N₁ = 95**

The trace of the computation, encoded as a Trit-word, packed as a single integer. One byte. This number encodes: rule 0 fired at position 0, matching two imaginary generators.

**N₂ = 94,929,134,708,394**

The KOT governance — the eight source words that define the space of all possible optimality verdicts. Six bytes. This number defines what "correct" means.

**N₃ = 24,301,858,485,348,959**

The complete certificate: N₁ concatenated with N₂. Seven bytes. This single integer contains both the record of what happened and the standard against which it is judged.

**Q₁ = 2**

The optimality verdict, encoded as a Trit. `P = 0b10 = 2`. The computation was optimal: minimal, complete, and consistent.

**Q₂ = 2**

The self-certification verdict. The system ran the KOT on its own certificate and the result is also `P = 2`. The proof checks out. The checker checks out.

---

## The Self-Reference

Q₂ is unusual enough to warrant its own explanation.

After the system computes Q₁ — the verdict on the original computation — it takes that verdict and asks: is the *verdict itself* correct?

It does this by encoding the KotResult (three boolean values: minimal, complete, consistent) as a grade-3 Trit-word `[P·P·P]`, then running the KOT governance on that word, then reading the output.

The output is `+1`. The sign is `P`. Q₂ = 2.

The certificate of the computation is itself a correctly-formed certificate. The proof of the proof is also a proof.

This is the fixed point: **Q₁ = Q₂ = 2 = P**.

Apply the KOT to the computation: P. Apply the KOT to that verdict: P. Apply it again: P. The system does not regress. It does not explode into infinite self-reference. It stabilizes at the positive Trit — the axiom's reinforcing value, the one where `P·P = P`.

This is not a coincidence. It is the design. The positive Trit is the fixed point of multiplication with itself. A correct computation, certified correctly, remains certified correctly under further inspection.

---

## Why This Matters

**Exactness.** Every number in the system is exact. There are no floating-point approximations, no rounding errors, no accumulated drift. The same computation run twice, or on two different machines, produces the same result — not approximately the same, but bit-for-bit identical.

**Self-certification.** The system proves its own work. The certificate is not generated by a separate verifier. It is a natural output of the same process that performed the computation. The governance that defines what "correct" means is itself a Geoit — a value in the system, subject to the same algebraic laws as everything else.

**Size.** The proof that `e1·e1 → −1` was correctly computed fits in eleven bytes. Eleven bytes contains: the trace of every step, the governance of optimality, the verdict, and the self-verification. Smaller than a tweet. Smaller than a TCP header. An exact, complete, independently verifiable certificate of correctness.

**Generality.** The system is not specialized to one algebra. The same infrastructure handles the complex numbers (Cl(1,0,0)), the quaternions (Cl(2,0,0)), the algebra of 3D Euclidean geometry (Cl(3,0,1)), the algebra of special relativity (Cl(3,1,0)), and every other Clifford algebra. The governance changes. The KOT does not. The Trit does not.

**Derivation.** Nothing in the system is assumed except the nine entries of the Trit multiplication table. Every type, every operation, every proof procedure is derived from that table by construction. The system does not appeal to external libraries, external number systems, or external verification tools. The axiom is sufficient.

---

## What the Numbers Mean at the Deepest Level

The verdict Q₁ = 2.

The number 2 in binary is `10`. In the two-bit Trit encoding, `10` is P — the positive Trit, the hyperbolic type, the self-reinforcing value.

The proof that a geometric computation was performed correctly is, at its core, the number **2** — the positive value in a three-valued arithmetic that was the only thing assumed at the beginning.

The axiom is: `P × P = P`.

The verdict is: P.

The system applied its own foundational rule to its own output and got the same thing back.

That is what the numbers mean.

---

*Nēberu v0.0.0 — Enoch Automation*
*Zero dependencies. Zero floats. Zero unsafe. 151 tests. One axiom.*