Skip to content

Repository files navigation

Spatial Arithmetic

E R A Craig, New Zealand - 24 July 2026

This project was edited by Aristotle 28 July 2026 - math Lean included.

To cite Aristotle:

  • Tag @Aristotle-Harmonic on GitHub PRs/issues
  • Add as co-author to commits:
Co-authored-by: Aristotle (Harmonic) <aristotle-harmonic@harmonic.fun>

Computing with 3D geometry — shapes are numbers, distances are operations.

Quick Start

# Run all tests
python3 spatial_arithmetic_final.py

# Evaluate an expression
python3 spatial_arithmetic_final.py --eval "3+4*5"
# Output: 3+4*5 = 23

# Build and decode a scene
python3 spatial_arithmetic_final.py --scene 7 ADD 3
# Output: 7 ADD 3 = 10  (decoded: a=7, b=3, op=ADD)

# Open interactive demo
# Open demo.html in a browser

How It Works

Operands (Numbers → Shapes)

A number is encoded as a 3D shape — a non-planar unit-distance cycle (a ring of points where each consecutive pair is exactly 1 unit apart).

Value Nodes Parity
+5 14 (2×5+4) Even → positive
-3 11 (2×3+5) Odd → negative
0 4 Even → zero

Decode: value = ±((nodes - 4) / 2), sign from even/odd parity.

Operators (Distances → Operations)

The distance between two shapes (measured as a ratio to their radius) encodes the operation:

Distance Ratio Operation Precedence
3× radius MULTIPLY Highest (closest)
4× radius ADD
5× radius SUBTRACT
6× radius DIVIDE Lowest (farthest)

Why closer = higher precedence: The Observer evaluates the closest shapes first. By placing MULTIPLY closer than ADD, 3 + 4 × 5 naturally evaluates as 3 + (4 × 5) = 23.

Observer (Geometry → Result)

The Observer is the active engine. It:

  1. Clusters points by unit-distance connectivity
  2. Decodes each cluster (node count → value)
  3. Reads operators (distance ratio → opcode)
  4. Evaluates with standard mathematical precedence

The Observer contains ALL logic. The geometry is purely passive data.

Division → Exact Fractions

Division returns Python Fraction objects — exact rational arithmetic with no floating-point error:

7 ÷ 3 = 7/3     (not 2.333...)
10 ÷ 4 = 5/2    (not 2.5)
1 ÷ 7 = 1/7     (not 0.142857...)

Architecture

GEOMETRY (passive data)          OBSERVER (active engine)
─────────────────────           ──────────────────────
Vertices, edges, positions      Clustering algorithm
No logic, no computation        Operator lookup tables
Like grooves on vinyl           Precedence evaluator
                                Like the needle on a turntable

Test Results

Test Scope Result
Parity Encoding 0–20 × ±1 42/42 = 100%
Signed Roundtrip 10 values × 50 seeds 100%
Full Pipeline 0–10, all ops 1452/1452 = 100%
Division 4 cases 100% (exact fractions)
Signed Pipeline ±5–±10, all ops 768/768 = 100%
Expressions 9 cases (incl. precedence) 9/9 = 100%

Multi-Operand Expressions

Expressions are evaluated with standard mathematical precedence:

3 + 4 × 5 = 23      (multiply first)
10 - 2 × 3 = 4      (multiply first)
1 + 2 × 3 + 4 = 11  (multiply first, then left-to-right)
-5 + 3 × (-2) = -11 (multiply first)
100 ÷ 10 - 3 = 7    (divide first)

Multi-Channel Operators (Future)

Two independent operator channels exist:

  1. Distance → operation (ADD, SUB, MUL, DIV)
  2. Dihedral angle → modifier (none, square, negate, reciprocal)

4 distance ratios × 5 angle bins = 20 distinct operations from a single shape pair.

Theoretical Foundation

  • Relational information theory: 87.5% of source entropy recoverable from bit-relationships alone
  • Relational computation: MAJORITY via equality graph, zero mismatches vs conventional
  • Cayley-Menger determinant: Centroid distance computable from pairwise distances only
  • Ultrametric bounds: Minimum operator gap = 1.0 × radius (safe for pure computation)

Files

File Description
spatial_arithmetic_final.py Absolute final script — tests + CLI
demo.html Interactive web visualization
STUDY.md Comprehensive study document
spatial_arithmetic_v4.py Previous version (parity encoding)
exp*.py Individual experiments

Known Limitations

  1. Minimum operand: 4 nodes (non-planarity requirement)
  2. Maximum practical operand: ~50 (shapes become large)
  3. No physical noise tolerance (pure computation framework)
  4. Angle channel not yet integrated (tested, working, future work)
  5. Fractional binding not yet integrated (designed, not built)

Citation

If you use this work, please cite:

Spatial Arithmetic: A framework for computing with 3D geometry where numbers are encoded as non-planar unit-distance cycles and operations are encoded as spatial relationships between shapes.

About

A computational framework in which arithmetic operations are performed through 3D geometric relationships

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages