hv-octonion-tree

A NumPy-only toolkit for tree-indexed octonion multiplication. The map from binary trees over n unit octonions to an element of S⁷ is empirically injective: exhaustively verified for n ≤ 10, sampled to n = 32, hierarchical to 10⁷ programs.

Size: ~18 KB source, no model artifact (stateless). Dependencies: NumPy only.

What it does

Given n unit octonions and a binary tree over them, compute the tree-shaped product. The tree determines which pairs are multiplied in which order. Fixing the operands, the map

tree → product

turns out to be injective. Different tree shapes give different products, with minimum pairwise distance well above float noise.

This is not a cryptographic hash (no avalanche, structured inputs collapse), not a trainable neural layer (saturates at large n), and not a chemical model. It is a perfect hash for Catalan objects over incompressible operands.

Headline numbers

test result
injectivity, exhaustive n ≤ 10 (4862 trees at n=10, min_d = 0.086)
injectivity, sampled n ≤ 32 (1000 trees, min_d > 0.16)
injectivity, hierarchical up to 1.5×10⁷ programs, min_d > 0.17
left/right alternativity error < 4×10⁻¹⁶
all three Moufang identities error < 5×10⁻¹⁶
norm preservation ‖product‖ = 1 to 4×10⁻¹⁵ up to n = 1024
18/18 consistency checks pass

The two corrections to XuanJi issue #100

C1 — All three Moufang identities hold

Issue #100 §3 lists "R Moufang fails" as a refuted hypothesis. That is incorrect. All three Moufang identities follow from alternativity, and the batched check confirms them to 4×10⁻¹⁶:

identity error
left Moufang: (a b a) c = a (b (a c)) 3.3×10⁻¹⁶
right Moufang: c (a b a) = ((c a) b) a 4.4×10⁻¹⁶
middle Moufang: (a b) (c a) = a ((b c) a) 4.4×10⁻¹⁶

The claim in #100 was a misreading of the algebra. Octonions are Moufang loops; the identity failure in the original session was likely a code bug, not a mathematical fact.

C2 — MITM saving is linear in n, not constant

Issue #100 §0 and F3 claim MITM saves "~2.7 bits" and that E[MITM] / Catalan(n-1) → 0.154. The prototype measures otherwise:

n brute force MITM cost bits saved
6 42 4 3.39
8 429 10 5.42
10 4,862 28 7.44
12 58,786 84 9.45
14 742,900 264 11.46
16 9,694,845 858 13.46
20 1,767,263,190 9,724 17.47

Bits saved grows as n/2 + const, not converging. The ratio to brute force drops to 0.0000. The correct statement: MITM is exponentially more powerful than the naive middle split suggests.

C3 — Noise constant is 2.4× larger than predicted

Issue #100 F6 states noise error scales as √n·σ. The scaling is confirmed, but the constant is wrong. Measured ratio across all (n, σ) is stable at 2.4 ± 0.1, not 1.0.

How to use

import numpy as np
from hv_octonion_tree import (
    orandom, random_tree, eval_tree, batch_eval,
    injectivity_exhaustive, injectivity_sampled,
    mitm_analysis, hierarchical_injectivity,
    check_alternativity, check_moufang, check_norm_preservation,
)

rng = np.random.default_rng(0)

# Single tree evaluation
vals = np.stack([orandom(rng) for _ in range(8)])
tree = random_tree(8, rng)
product = eval_tree(tree, vals)

# Batched evaluation
trees = [random_tree(8, rng) for _ in range(100)]
products = batch_eval(trees, vals)   # (100, 8)

# Injectivity test
r = injectivity_exhaustive(8)
print(f"n=8, {r['K']} trees, min_d={r['min_d']:.4f}, distinct={r['distinct']}")

# MITM analysis
m = mitm_analysis(20)
print(f"brute={m['brute_force']}, MITM={m['mitm_cost']}, "
      f"saved={m['bits_saved']:.2f} bits")
Downloads last month
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support