Skip to content

Instantly share code, notes, and snippets.

@afflom
Created July 3, 2025 17:55
Show Gist options
  • Save afflom/b89c6c88aae0dc3ae66539aa8741442e to your computer and use it in GitHub Desktop.
Save afflom/b89c6c88aae0dc3ae66539aa8741442e to your computer and use it in GitHub Desktop.
PrimeOS Addressing Specification

PrimeOS Addressing Specification v1.0

Overview

The PrimeOS Addressing system assigns every possible bit pattern a unique coordinate in mathematical space. Objects of different bit-lengths exist in different coordinate spaces within a 12,288-element mathematical universe.

Core Principles

  1. Every bit pattern is a unique object with a deterministic coordinate
  2. Objects of different bit-lengths inhabit different coordinate spaces
  3. Digests are compact representations of mathematical coordinates
  4. Digest length scales with object bit-length and mathematical properties
  5. The system is bijective: every object has exactly one address

Mathematical Foundation

Base Space

  • 12,288 Elements: The fundamental space (48 × 256)
  • 64-Dimensional Structure: 48 observable + 16 compactified
  • 768-Element Cycle: Decomposes as 12 × 64D hypercubes

Coordinate Spaces by Bit-Length

interface CoordinateSpace {
  bitLength: number;          // Length of objects in this space
  objectCount: bigint;        // 2^bitLength possible objects
  coordinateDimension: number; // Dimension of coordinate representation
  minDigestBits: number;      // Minimum bits to address this space
}

// Examples:
BitLength   Objects    Min Digest Bits
1          2          32 (minimum)
8          256        32
16         65,536     32
20         1,048,576  32-35
32         2^32       40-48
1024       2^1024     200+

Addressing Model

Object-to-Coordinate Mapping

interface AddressEncoder {
  // Map any bit pattern to its coordinate
  encode(bitPattern: Uint8Array): Digest;
  
  // Reconstruct bit pattern from coordinate
  decode(digest: Digest): Uint8Array;
}

interface Digest {
  version: 1;
  data: Uint8Array;  // Variable length, min 32 bits
  metadata: {
    bitLength: number;      // Object size in bits
    coordinateSpace: number; // Which space this object inhabits
  };
}

Digest Length Calculation

The digest length for an object depends on:

  1. Bit-length of object - Determines coordinate space size
  2. Mathematical patterns - Symmetries reduce digest size
  3. Entropy - Random data requires longer digests
function calculateDigestLength(bitLength: number, entropy: number): number {
  const baseLength = Math.ceil(Math.log2(Math.pow(2, bitLength)));
  const patternReduction = calculatePatternReduction(entropy);
  const minLength = 32; // Minimum digest size in bits
  
  return Math.max(minLength, baseLength - patternReduction);
}

Address Properties

Uniqueness

Every distinct bit pattern has a unique coordinate:

encode([0,1])  encode([1,0])
encode([1,0,1])  encode([1,0,1,0])

Determinism

Same input always produces same coordinate:

encode(data) === encode(data) // Always true

Stratification

Objects cannot have coordinates outside their bit-length space:

// 20-bit objects exist only in 20-bit coordinate space
// They cannot have coordinates in 21-bit space

Practical Examples

Small Objects (≤256 bits)

// 1 byte (8 bits)
const byte = new Uint8Array([0xFF]);
const digest = encode(byte); // 32-bit digest

// 32 bytes (256 bits)  
const key = crypto.randomBytes(32);
const digest = encode(key); // 32-40 bit digest

Medium Objects (256-8192 bits)

// 1KB data
const data = new Uint8Array(1024);
const digest = encode(data); // ~100-200 bit digest

Large Objects (>8192 bits)

// 1MB file
const file = await readFile('document.pdf');
const digest = encode(file); // Digest scales with content

Implementation Requirements

Encoder Properties

  1. Must be deterministic
  2. Must be bijective within each coordinate space
  3. Must respect bit-length boundaries
  4. Must produce minimum 32-bit digests

Decoder Properties

  1. Must perfectly reconstruct original bit pattern
  2. Must validate coordinate space membership
  3. Must handle all possible digest sizes

Storage Considerations

  • Only digests are stored
  • Original data computed from digests
  • Digest size varies with object size
  • Minimum storage: 4 bytes per object

Mathematical Guarantees

Collision Freedom

Within each bit-length coordinate space:

∀ objects A,B where bitLength(A) = bitLength(B):
  A ≠ B ⟹ coordinate(A) ≠ coordinate(B)

Information Preservation

decode(encode(object)) = object  // Always true

Space Efficiency

size(digest) << size(object)     // For patterned data
size(digest) ≤ size(object) + C  // For random data

Address Space Navigation

Finding Similar Objects

Objects with similar bit patterns have related coordinates:

// These have nearby coordinates
encode([1,0,0,0]) ~ encode([1,0,0,1])

// These have distant coordinates  
encode([1,0,0,0]) ≠≠ encode([0,1,1,1])

Pattern Recognition

The mathematical structure enables:

  • Identifying objects with similar patterns
  • Grouping related objects by coordinate proximity
  • Efficient search through coordinate space

Security Properties

Pre-image Resistance

Given only a digest, cannot determine:

  • Original bit pattern (without decoding)
  • Properties of the data
  • Relationships to other objects

Verification

Can verify object identity by:

verify(object, digest) {
  return encode(object) === digest;
}

Version History

  • v1.0 (2025-01-03): Initial specification
    • Bit-length stratified coordinate spaces
    • 32-bit minimum digest size
    • Variable digest length scaling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment