The Geometry Layer provides the mathematical foundation for all knowledge representation in AGISystem2. It implements a deterministic, high-dimensional vector space where concepts exist as geometric shapes and reasoning becomes distance computation. This layer contains no semantic knowledge—it only manipulates arrays of integers according to well-defined operations.

Specification: DS(/core/geometry) · DS(/core/vector_space) · DS(/core/math_engine)

Vector Space

The VectorSpace module manages allocation and basic operations on int8 arrays. All vectors have a fixed dimensionality determined by the configuration profile (typically 512, 1024, or 4096 dimensions). Using int8 instead of floating-point ensures deterministic arithmetic across platforms.

Ontology Dimensions Indices 0–255 (fixed) Axiology Dimensions Indices 256–383 (fixed) 0 255 256 383+ Int8 Vector (D dimensions)

Vector structure with fixed partitions. Ontology dimensions (0–255) encode factual properties like physical attributes, taxonomic relations, and spatial features. Axiology dimensions (256–383) encode values, preferences, and normative properties. These partitions never change, enabling consistent separation of facts from values.

Core Operations

OperationDescriptionComplexity
allocate(dim) Create new int8 array of given dimensionality O(D)
copy(src, dst) Copy vector contents O(D)
fill(vec, val) Set all dimensions to a value O(D)
clamp(vec) Ensure all values in [-127, 127] O(D)

Saturation Arithmetic

All arithmetic operations use saturation to prevent overflow. When a sum exceeds 127, it is clamped to 127; when it goes below -127, it is clamped to -127. This ensures that results are always valid int8 values and that operations are reversible up to saturation.

// Saturating addition
function addSaturate(a, b) {
  const sum = a + b;
  if (sum > 127) return 127;
  if (sum < -127) return -127;
  return sum;
}

Math Engine

The MathEngine module implements the geometric operations used throughout the system. All operations are pure functions with no side effects.

Masked L1 Distance

The primary similarity measure is masked L1 (Manhattan) distance. A relevance mask specifies which dimensions participate in the distance calculation. This allows comparing concepts along specific dimensions while ignoring others.

A = [ 10, -5, 20, 8, -12, 3, ... ] B = [ 12, -3, 18, 5, -10, 7, ... ] M = [ 1, 0, 1, 1, 0, 1, ... ] Masked L1 Distance |10-12|×1 = 2 |-5-(-3)|×0 = 0 (masked) |20-18|×1 = 2 ... d(A,B,M) = Σ|Aᵢ-Bᵢ|×Mᵢ

Masked L1 distance computation. Only dimensions where the mask is 1 contribute to the distance. This enables selective comparison—for example, comparing physical properties while ignoring value judgments, or vice versa.

function maskedL1Distance(a, b, mask) {
  let distance = 0;
  for (let i = 0; i < a.length; i++) {
    if (mask[i]) {
      distance += Math.abs(a[i] - b[i]);
    }
  }
  return distance;
}

Permutation

Permutation reorders vector dimensions according to a fixed mapping. Different relations use different permutations, which allows the same base concept to participate in multiple relationships while maintaining distinguishable representations.

function permute(vec, perm) {
  const result = new Int8Array(vec.length);
  for (let i = 0; i < vec.length; i++) {
    result[perm[i]] = vec[i];
  }
  return result;
}

Temporal Rotation

Temporal encoding uses rotation to shift vector dimensions cyclically. Each time step applies a fixed rotation, and time can be "rewound" by applying the inverse rotation. This enables reasoning about past and future states without separate storage structures.

function rotate(vec, steps, stride) {
  const result = new Int8Array(vec.length);
  const offset = (steps * stride) % vec.length;
  for (let i = 0; i < vec.length; i++) {
    result[(i + offset) % vec.length] = vec[i];
  }
  return result;
}

Bounded Diamond

A BoundedDiamond is the geometric representation of a concept. It defines a region in the vector space using L1 distance (which creates diamond-shaped regions in high dimensions). The structure stores:

center r min max Dimension i Dimension j Bounded Diamond (2D projection)

A bounded diamond in 2D projection. The L1 distance metric creates diamond-shaped regions. The min/max bounds provide per-dimension constraints that can further restrict the region. A point is inside the concept if it is within the radius of the center AND within all min/max bounds.

Inclusion Test

A point is inside a bounded diamond if:

  1. The masked L1 distance from point to center is ≤ radius
  2. Each dimension value is within [min, max] bounds
function isInside(point, diamond) {
  // Check L1 distance
  const dist = maskedL1Distance(point, diamond.center, diamond.mask);
  if (dist > diamond.radius) return false;

  // Check per-dimension bounds
  for (let i = 0; i < point.length; i++) {
    if (diamond.mask[i]) {
      if (point[i] < diamond.min[i] || point[i] > diamond.max[i]) {
        return false;
      }
    }
  }
  return true;
}

Concept Unions

When a concept has multiple distinct meanings (polysemy), it can be represented as a union of bounded diamonds. The concept "bank" might be a union of {financial institution diamond} and {river edge diamond}. A point is inside the concept if it is inside any constituent diamond.

Relation Permuter

The RelationPermuter module manages permutation tables for each relation type. When encoding a fact like "Dog IS_A Animal", the permuter provides the IS_A permutation to apply to the Animal vector before combining it with Dog.

Permutation Properties

RelationInverseSymmetric
IS_AHAS_INSTANCENo
PART_OFHAS_PARTNo
CAUSESCAUSED_BYNo
BEFOREAFTERNo
SIMILAR_TOSIMILAR_TOYes
PERMITSPERMITTED_BYNo
PROHIBITSPROHIBITED_BYNo

Configuration

Geometry Layer parameters are set through configuration profiles:

Parameterauto_testmanual_testprod
Dimensionality51210244096
Ontology range0–2550–2550–255
Axiology range256–383256–383256–511
Permutation seed4242configurable

Related Documentation