ƒxyzƒxyz Docs
Algorithms

E8 → H4 Folding

The Moxness folding matrix, ring sub-lattice partition, and edge-norm classification — the math behind the Petrie mandala

The 240 root vectors of the E8 Lie algebra fit on the surface of a single 8D shell. Projecting that shell into 2D produces the Petrie projection — the 8-ring mandala used as the brand mark of ƒxyz. This page documents the algorithms that make the projection meaningful: the H4 folding matrix, the H4 / H4φ ring partition, and the edge-norm classification that recovers the eight ring colors directly from the geometry.

Implementation:

  • packages/design-system/src/math/e8-h4-fold.ts — folding matrix + foldE8To4D
  • packages/design-system/src/math/e8-edge-norms.ts — edge classification
  • packages/design-system/src/math/e8-constants.tsRING_PALETTE, RING_TO_SUBLATTICE, MOXNESS_RING_PALETTE
  • packages/design-system/src/backgrounds/mandala-buffers.ts — Petrie mandala consumer

Sources: J. G. Moxness, "The 3D Visualization of E8 using an H4 Folding Matrix" (2014), Eq. 1; "Unimodular rotation of E8 to H4 600-cells" (2019), Sec. III; "E8 Hulls" (2020), Eq. 5; "E8 and H4 in QM and QC" (preprint), Fig. 1.


The H4 folding matrix

Moxness 2014 specifies an explicit symmetric 8×8 matrix that rotates an E8 vertex into four 4D copies of the H4 600-cell:

H4_FOLD =
   ⎡ Φ    0    0    0    φ²   0    0    0  ⎤
   ⎢ 0    φ    1    0    0   −φ    1    0  ⎥
   ⎢ 0    1    0    φ    0    1    0   −φ  ⎥
   ⎢ 0    0    φ    1    0    0   −φ    1  ⎥
   ⎢ φ²   0    0    0    Φ    0    0    0  ⎥
   ⎢ 0   −φ    1    0    0    φ    1    0  ⎥
   ⎢ 0    1    0   −φ    0    1    0    φ  ⎥
   ⎣ 0    0   −φ    1    0    0    φ    1  ⎦

with Φ = (1 + √5)/2 ≈ 1.618 (big golden ratio) and φ = 1/Φ = Φ − 1 ≈ 0.618 (small golden ratio). The matrix is symmetric (H4_FOLD = H4_FOLDᵀ), encoding the quaternion-octonion Cayley-Dickson structure referenced in the paper.

Properties

  • Symmetry: H4_FOLD = H4_FOLDᵀ
  • Determinant: (2√φ)⁸ ≈ 37.349
  • Eigenvalues: 2{ST, φST}, where ST = (−1, 1, 1, 1) is the "space-time signature"
  • Allowed entries: {0, 1, ±φ, Φ, φ²}

Folding operation

Applied row-wise to an 8D E8 root, the first 4 rows fold into H4 (the L-half); the full 8 rows produce the 4-copy structure (1 ⊕ φ)(H4_L ⊕ H4_R) per Moxness 2019.

import { foldE8To4D } from "@repo/design-system/src/math";

const root = [1, 1, 0, 0, 0, 0, 0, 0];   // a D8-type E8 root, norm² = 2
const { left, right } = foldE8To4D(root);
// left  = [Φ,   φ,  1, 0]   → H4   sub-lattice (norm² = 4)
// right = [φ², −φ,  1, 0]   → H4φ  sub-lattice (norm² = 4·φ²)

The L:R norm² ratio is exactly Φ² ≈ 2.618 — the H4φ copy is the same H4 600-cell scaled by φ. This is the (1 ⊕ φ) structure of E8 = H4 ⊕ φH4 made concrete.

Unimodular form

Dividing by 2√φ produces the volume-preserving unimodular form:

H4_UNI = H4_FOLD / (2√φ)        Det(H4_UNI) = 1

per Moxness 2019 Eq. 2. Both forms are exposed as H4_FOLD_MATRIX and H4_UNI_MATRIX.

CNOT + SWAP + Fibonacci derivation

Moxness 2019 Sec. III shows that H4_FOLD can be reconstructed from quantum-computing primitives plus a Fibonacci recursion. The 4×4 CNOT (controlled-NOT) and SWAP gates in the qubit basis |00⟩, |01⟩, |10⟩, |11⟩ both appear as 4×4 sub-blocks of H4_FOLD. They are exported as CNOT and SWAP for callers that want to do the reconstruction.


Ring sub-lattice partition

The Petrie projection produces 8 concentric rings of 30 vertices each (240 roots total). Per Moxness QM/QC Fig. 1 caption, the rings split into two H4 600-cell copies based on the spectrum of edge norms in the projection:

Ring (0-indexed)Moxness 1-indexedSub-lattice
01H4
12H4φ
23H4
34H4
45H4
56H4φ
67H4φ
78H4φ

H4 = {0, 2, 3, 4}, H4φ = {1, 5, 6, 7}. Not an alternating even/odd parity — that was a folkloric simplification ƒxyz canon §10.6 carried until 2026-04-28. The actual partition is dictated by the edge-norm spectrum (Fig. 1 caption), not by ring parity.

import {
  classifyRingSubLattice,
  RING_TO_SUBLATTICE,
} from "@repo/design-system/src/math";

classifyRingSubLattice(0);  // "H4"
classifyRingSubLattice(1);  // "phiH4"
RING_TO_SUBLATTICE;
// ["H4","phiH4","H4","H4","H4","phiH4","phiH4","phiH4"]

Cross edges

Edges whose endpoints lie in different sub-lattices ("cross edges") encode the (1 ⊕ φ) structure of E8 = H4 ⊕ φH4, so they get emphasized differently in the mandala. The hot path in mandala-buffers.ts is:

const isCross = RING_TO_SUBLATTICE[ringA] !== RING_TO_SUBLATTICE[ringB];

This replaced an earlier ringA % 2 !== ringB % 2 parity check on 2026-04-28.


Edge-norm classification

The 6,720 unique edges of the Petrie projection split into 8 distinct classes when grouped by their 2D edge norms after the Coxeter projection. The algorithm:

  1. Compute dx² + dy² for each projected edge in the Petrie plane
  2. Run 1D k-means with k = 8 over the (norm², count) distribution
  3. Sort centroids ascending → assign class index 0..7
import {
  computePetrieEdgeNorms,
  classifyEdgesByNorm,
  generateMoxnessEdgeClasses,
} from "@repo/design-system/src/math";

const norms = computePetrieEdgeNorms(roots8D);    // EdgeNorm[]
const classes = classifyEdgesByNorm(norms);       // number[] of 0..7
const { palette } = generateMoxnessEdgeClasses(roots8D);

This is the algorithm in Moxness QM/QC Fig. 1 caption: the edge class drives the ring color in the paper's visualization.


Two palettes, two surfaces

RING_PALETTE — Stellar v3.0 (brand canonical)

Used on the landing mandala, deck, and app surfaces. Brand canonical per .claude/rules/decision-lock.md.

RingHexName
0#fbbc7aCore (Florin gold)
1#e87044Inner (Joule amber)
2#c83b2bFire
3#704ca5Crown
4#5c7ad3Deep
5#aec2f8Horizon
6#64be25Canopy
7#6f707dLiminal

MOXNESS_RING_PALETTE — paper-derived (technical surfaces)

Used on E8-explorer / research / technical pages that want the paper-faithful coloring per Moxness QM/QC Fig. 1.

RingHexName
0#FFD700Yellow
1#8A8A9AGray
2#FF8C42Orange
3#00E5CCCyan
4#FF3D9AMagenta
5#FF4136Red
6#2ECC40Green
7#0074D9Blue

Both palettes share the same 8-ring partition. The choice is which colors to assign — brand surface vs. paper surface. The ring sub-lattice membership (H4 vs H4φ) is a property of the geometry, identical in both palettes.


Status

Implementation: Math modules e8-h4-fold.ts and e8-edge-norms.ts live in packages/design-system/src/math/, with companion test suites covering the eight elementary roots, fold matrix correctness against Moxness QM/QC Fig. 1, and the rebuilt edge-norm spectrum. The brand mandala consumes RING_PALETTE + RING_TO_SUBLATTICE for canonical Stellar v3.0 colors; the Moxness-derived palette is exposed as MOXNESS_RING_PALETTE for technical surfaces and surfaced here as documentation. A live E8 explorer page that exercises foldE8To4D + MOXNESS_RING_PALETTE is roadmapped (see docs/canon/pending-decisions.md).

Recovery context: Canon §10.6 had carried "alternating even/odd ring parity" since the original Stellar v3.0 spec. A 2026-04-28 primary-source verification across all four Moxness papers found this was folkloric — the H4/H4φ partition is rings {0,2,3,4} vs {1,5,6,7}, dictated by the edge-norm spectrum (Fig. 1 caption), not by ring parity. Canon was corrected and the code switched from a ring%2 parity check to the explicit RING_TO_SUBLATTICE lookup. Full trace at docs/canon/analysis/recovery-h4-and-e8-palette-2026-04-28.md.

On this page