neberu 0.0.0

Exact geometric algebra from the balanced ternary axiom. Governed rewriting, self-certifying canonicalization via the Kase Optimality Theorem.
Documentation
  • Coverage
  • 43.48%
    120 out of 276 items documented0 out of 186 items with examples
  • Size
  • Source code size: 200.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 13.11 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 14s Average build duration of successful builds.
  • all releases: 1m 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rickKase

Nēberu

Exact geometric algebra from the balanced ternary axiom.

Zero floats. Zero unsafe. Zero external dependencies.

cargo run

Runs the Kase Optimality Theorem self-certification proof: e1·e1 = -1 in Cl(1,0,0), traced, verified, and certified as a 7-byte exact integer.


What It Is

Nēberu builds geometric algebra from one primitive: the Trit — the balanced ternary value {N, Z, P} with multiplication. Five constructions derive from this axiom:

Trit                        — the axiom: {N=-1, Z=0, P=+1}
  ↓ packed into u128
Tern                        — 64-trit balanced ternary integer (exact, no i128 bridge)
  ├─► Rat                   — exact rational (Tern/Tern, reduced)
  ↓
Gen = (Trit, u32)           — a generator IS its square signature
  ↓ free monoid over Gen
Word                        — basis blade
  ↓ Rat-weighted linear combination
Expr                        — multivector
  ↓ governed by
Governance  (Word → Expr)   — directed rewrite rules
  ├─► Trace / TraceWalk     — canonicalization record as Wlk<TraceGen>
  ├─► KOT                   — optimality verdict as Trit
  └─► Geoit = (Governance, Expr) — every value lives in an algebra

Evaluation is canonicalization. There is no other mechanism.


Modules

Module What it provides
trit Trit — the axiom (N/Z/P/INV), mul table, encoding
tern Tern — 64-trit packed integer, exact arithmetic, GCD, content hash
rat Rat — exact rational, always reduced, Ord
gen Gen = (Trit, u32) — typed generator; signature() is one field access
word Word — basis blade, free monoid over Gen, grade, ordering
expr Expr — sparse multivector over Rat, grade projection, reverse
governance Governance — rewrite rules, canonicalize, canonicalize_traced, Clifford::cl
geoit Geoit = (Arc<Governance>, Expr) — value + algebra, inseparable
trace TraceWalk, KotResult, verify_kot, explore_confluence
encoding Trit-word packing; N₁/N₂/N₃ certificate bytes; q2_governance
size Trit-cost measurement of any object in the from-axiom encoding
inspect inspect() → full KOT report with N₁/N₂/N₃/Q₁/Q₂ display
loader .neb file parser — loads algebra definitions into Governance

The Encoding

Two bits per trit. Four states. Three valid. One sentinel.

00 = Z  (zero / annihilator)   — memset-safe, propagates via AND
01 = N  (negative / imaginary)
10 = P  (positive / hyperbolic)
11 = INV (invalid / NaN)       — propagates via OR

64 trits packed into a u128. Arithmetic is bitwise. Division is non-restoring balanced ternary — no i128 bridge.


Clifford Algebras

A generator's type is its Trit signature:

Gen::imaginary(0)   // sig = N, x*x = -1
Gen::degenerate(0)  // sig = Z, x*x =  0
Gen::hyperbolic(0)  // sig = P, x*x = +1

signature(gen) = gen.sig — O(1), one field access. The type IS the generator.

use neberu::governance::Governance;
use neberu::expr::Expr;
use neberu::gen::Gen;

let gov = Governance::cl(3, 0, 1);  // STA: 3 imaginary + 1 hyperbolic
let e1  = Expr::gen(Gen::imaginary(0));
let e2  = Expr::gen(Gen::imaginary(1));

assert_eq!(gov.mul(&e1, &e1), Expr::int(-1));   // imaginary squares to -1
assert_eq!(gov.mul(&e2, &e1),                   // anticommutativity
    gov.mul(&e1, &e2).neg());

To build algebras from typed generator slices directly:

let gens = vec![Gen::imaginary(0), Gen::degenerate(0), Gen::hyperbolic(0)];
let gov  = Governance::clifford(&gens);

The KOT — Kase Optimality Theorem

Every canonicalization is self-certified. Minimal — no redundant steps. Complete — terminal is irreducible. Consistent — no confluence failure. The verdict is a Trit.

use neberu::trace::{walk_from_trace, verify_kot};

let (result, trace) = gov.canonicalize_traced(&expr);
let walk    = walk_from_trace(&trace, &gov);
let verdict = verify_kot(&walk, &expr, &gov);

assert_eq!(verdict.as_trit(), neberu::trit::P);   // P = optimal

The inspect module runs the full pipeline and displays all five numbers:

╔════════════════════════════════════════════════════════╗
║                   NĒBERU INSPECT                       ║
║  source:  e1·e1          algebra: Cl(1,0,0)            ║
╠════════════════════════════════════════════════════════╣
║  N₁ — trace encoding (Magma<Trit>)                     ║
║    steps:        1                                     ║
║    trits:        4 t  (8 bits, 1 byte)                 ║
║  N₂ — KOT governance                                   ║
║    relations:    8                                     ║
║    trits:        40 t  (80 bits, 10 bytes)             ║
║  N₃ — certificate total  (N₁ + N₂)                    ║
║    trits:        44 t  (88 bits, 11 bytes)             ║
╠════════════════════════════════════════════════════════╣
║  Q₁ = P  ✓  OPTIMAL                                   ║
║    minimal:    ✓                                       ║
║    complete:   ✓                                       ║
║    consistent: ✓                                       ║
╠════════════════════════════════════════════════════════╣
║  Q₂ = P  ✓  certificate is correctly certified        ║
║  Q₁ = Q₂ = P  —  fixed point reached                  ║
║  the axiom describes itself.                           ║
╚════════════════════════════════════════════════════════╝

The .neb Language

Algebras are expressible as text. Two files ship in src/neb/:

src/neb/trit.neb — the Clifford axiom in its own language:

type imag = { x * x = -1 }
type dual = { x * x = 0  }
type hyp  = { x * x = 1  }

for x : imag  =>  x * x = -1
for x : dual  =>  x * x = 0
for x : hyp   =>  x * x = 1

for a : any, b : any where ordered(a, b)  =>  b * a = -a * b

src/neb/kot.neb — the KOT self-description (governance as text).

Loading .neb source:

use neberu::loader;
use neberu::governance::Governance;
use neberu::gen::Gen;

let gens = vec![Gen::imaginary(0), Gen::imaginary(1)];
let gov  = loader::load_standard(
    include_str!("neb/trit.neb"),
    Governance::free(),
    &gens,
)?;

load_standard registers the standard types (imag, dual, hyp, any) and the ordered bridge predicate. Custom types and bridges go through load.


Confluence Detection

use neberu::trace::explore_confluence;

let witnesses = explore_confluence(&gov, &expr);
// For contradictory governance:
// confluence failure:
//   source:  e1·e1
//   path A → -1
//   path B →  1
//   your governance is not confluent at this expression.

Standard Clifford algebras are confluent. explore_confluence is for governance constructed outside of Governance::cl / Governance::clifford.

use neberu::trace::explore_confluence;

let witnesses = explore_confluence(&gov, &expr);
// For contradictory governance:
// confluence failure:
//   source:  e1·e1
//   path A → -1
//   path B →  1
//   your governance is not confluent at this expression.

No Dependencies

[dependencies]
neberu = "0.0.0"

That's it. No nalgebra. No num. No ndarray. The axiom provides everything.


License

MIT — Enoch Automation