Apoth3osis
<_RESEARCH/RULIOLOGY

Magnitude Homology Program

VERIFIED6 PHASES90+ THEOREMS0 SORRY6/6 AUDITS CLEANLean 4 + Mathlib
>THE_QUESTION

How many genuinely different points does a space have?

Count the points in a metric space and you get cardinality. But cardinality ignores geometry: two points on top of each other shouldn't count as two. Magnitude is Leinster's answer—a single number measuring the “effective size” of a metric space, where nearby points partially cancel.

But a single number is lossy. Magnitude homology lifts that number into a graded sequence of groups MHn,ℓ(X) that detect genuine metric-geometric structure the bare magnitude cannot see. Chains are consecutively-distinct tuples, graded by degree and metric length. The differential squares to zero, giving cycles, boundaries, and homology.

This project formalizes the entire theory in Lean 4: from the chain complex through Künneth decomposition, Mayer-Vietoris gluing, diagonal concentration, persistent/VR bridges, LLM-enriched magnitude with Tsallis entropy, to iterated spectral convergence. Every theorem is machine-checked. Zero sorry. Six hostile audit rounds, all clean.

>RULIOLOGY_CONTEXT

Why this is Ruliology

Magnitude homology is a universal detector for metric space structure. It applies to any finite metric space whatsoever—any rule that produces pairwise distances generates a magnitude homology. The program doesn't study one rule; it studies what all rules with metric structure have in common.

The Noneist commitment: we prove theorems about spaces we never construct. The unit-edge diagonality theorem holds for every finite metric space with unit distances, without enumerating them. The Mayer-Vietoris exactness holds for every finite cover. These are properties of the Platonic state potential, not of any computed instance.

The formal verification commitment: the type checker is the arbiter. Not “we believe d² = 0” but “Lean has verified d² = 0 for the alternating face-map differential on consecutively-distinct tuples in any decidably-equal finite type.”

>ARCHITECTURE
Basic (cardinality)
  │
Homology (chains, d, d²=0)
  │
HomologyGroups (Z/B, Betti, F₂ matrices)
  │                    │                    │
Weighting           KünnethMV            Diagonality
(similarity,        (products,           (bigrading,
 fixed-point)        covers, MV)          unit-edge)
  │                    │                    │
EnrichedMagnitude   BlurredPersistent    IteratedMH
(LLM, Tsallis)     (persistence, VR)    (nerve, spectral)
>PHASES
PHASE 1

Chain Complex & Homology Groups

VERIFIED25 thms

Foundation: magnitude chains as consecutively-distinct tuples, alternating differential via face maps, d² = 0, cycles Zₙ = ker(d), boundaries Bₙ = im(d), homology MHₙ = Z/B, Betti numbers over F₂ via boundary matrices and rank-nullity.

Basic.leanHomology.leanHomologyGroups.lean
KEY RESULTS
  • magnitudeDifferential_squared (d² = 0)
  • boundary_subset_cycles (B ⊆ Z)
  • magnitudeHomologyGroupAdd (Z/B as additive group)
  • Betti numbers via F₂ matrix rank
PHASE 2

Künneth Formula & Mayer-Vietoris

VERIFIED15 thms

Product decomposition: chain-level Künneth map (multiplicative separation), Betti convolution, tensor-product complex over F₂ via Kronecker products. Cover gluing: Mayer-Vietoris exactness at direct sums, cardinality identity |U|+|V| = |X|+|U∩V|.

KunnethMV.lean
KEY RESULTS
  • kunnethMap_mul (multiplicative separability)
  • Künneth verified computationally for Bool × Fin 3
  • mv_exact_at_direct_sum (MV exactness)
  • mv_cover_cardinality
PHASE 3

Diagonality

VERIFIED10 thms

Metric magnitude spaces with chain length grading. Diagonal concentration: all chains live on the n = ℓ diagonal. Unit-edge metric spaces are diagonal. Diagonality descends along metric retracts.

Diagonality.lean
KEY RESULTS
  • unitEdge_implies_diagonal
  • median_implies_diagonal
  • diagonal_retract (descent along retracts)
  • chainLength_eq_degree_of_unitEdge
PHASE 4

Blurred Persistent & Vietoris-Rips Bridge

VERIFIED20 thms

Threshold-bounded chains with persistence functoriality. Blurred differential with d² = 0 under support conditions. Vietoris-Rips chains, ℓₚ families, ℓ∞ chains. VR ↔ blurred bridges including hypothesis-free degree-1 equivalence.

BlurredPersistent.lean
KEY RESULTS
  • blurredDifferential_squared
  • blurred_persistence_commutes
  • blurred_eq_vr_l1_degreeOne (unconditional VR bridge)
  • vrToBlurredScaled / vrToLpScaled
PHASE 5

LLM-Enriched Magnitude & Tsallis Entropy

VERIFIED10 thms

Enriched similarity spaces with [0,1]-valued kernels. LLM enrichment: sim(p₁,p₂) = Σ nextToken(p₁,v)·nextToken(p₂,v). Tsallis q-entropy bridge: enriched magnitude decomposes as |Vocab| + Σ H₂(nextToken(p,·)) under shape hypothesis.

EnrichedMagnitude.lean
KEY RESULTS
  • llmEnrichment (all axioms proved)
  • tsallisEntropy_two (closed form at q=2)
  • magnitude_eq_tsallis_sum_of_magnitude_shape
  • llm_similarity_pos_for_distinct_with_overlap
PHASE 6

Iterated MH & Spectral Convergence

VERIFIED10 thms

k-layered nerve vertices, Moore complex via iterated alternating differential, simplicial law for face maps. Iterated homology Z/B with cycle subtype. k=1 bridge recovers bar simplices. Spectral convergence via ratchet stabilization.

IteratedMH.lean
KEY RESULTS
  • nerveFace_comp (simplicial identity)
  • iteratedMH (Z/B quotient)
  • magnitudeNerveOneEquivBarSimplex (k=1 bridge)
  • iteratedMH_paged_converges
>RESEARCH_DIRECTIONS

Three Branches from One Foundation

Information Theory

EnrichedMagnitude connects Leinster magnitude to LLM next-token distributions via Tsallis entropy. The “effective size” of prompt space depends on output diversity.

Applied Topology (TDA)

BlurredPersistent bridges magnitude homology to Vietoris-Rips complexes—the standard tool in topological data analysis. Degree-1 equivalence is unconditional.

Homotopy Theory

IteratedMH generalizes to k-layered nerve vertices with spectral convergence. At k=1, recovers classical magnitude homology via bar simplices.

>AUDIT_TRAIL

Hostile Audit History

RoundScopeFindingsStatus
1Phase 4 initialP1–P6CLOSED
2P1–P6 remediationN1–N3CLOSED
3N1–N3 remediationF1–F2CLOSED
4F1–F2 remediationG1–G2 (cosmetic)CLOSED
5Phase 5+6 new contentH1–H4CLOSED
6H1–H4 remediationNoneCLEAN
>_MENTAT.CERTIFICATES

Contribution Certificates

Immutable contribution records per MENTAT-CA-001. Each certificate is a cryptographically anchored MCR documenting authorship, contribution level, and provenance chain. Artifacts are content-addressed and pinned to IPFS.

MENTAT-CA-001|MCR-MAGNITUDE-001
2017-06-01

MENTAT Contribution Record

IDEA

Conceptual Contribution

CONTRIBUTION LEVEL: IDEA

Ontological Engineer

Magnitude as Effective Size of Metric Spaces

Contributor

Tom Leinster

University of Edinburgh

Conceptual insight that the Euler-characteristic-like magnitude of enriched categories can be lifted into a graded homology theory for metric spaces. Key idea: consecutively-distinct tuples form chains graded by degree and metric length, with an alternating face-map differential. This 'effective number of points' captures genuine geometric structure that bare cardinality and even magnitude itself cannot see.

MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof
MENTAT-CA-001|MCR-MAGNITUDE-002
2017-06-01

MENTAT Contribution Record

THEORY

Mathematical Foundation

CONTRIBUTION LEVEL: THEORY

Ontological Engineer

Magnitude Homology of Metric Spaces

Contributor

Tom Leinster

University of Edinburgh

Complete mathematical framework: magnitude homology groups MH_{n,ℓ}(X), Künneth decomposition for metric products, Mayer-Vietoris exactness for covers, diagonal concentration for unit-edge spaces, and the relationship between magnitude homology and classical magnitude via Euler characteristic.

Builds Upon

MCR-MAGNITUDE-001
MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof
MENTAT-CA-001|MCR-MAGNITUDE-003
2017-06-01

MENTAT Contribution Record

APPLICATION

Applied Contribution

CONTRIBUTION LEVEL: APPLICATION

Ontological Engineer

Magnitude Homology Applications to TDA and Information Theory

Contributor

Tom Leinster

University of Edinburgh

Applied connections from magnitude homology to three production domains: (1) Vietoris-Rips complexes in topological data analysis via blurred persistence. (2) LLM next-token distributions via Tsallis entropy enrichment — the 'effective size' of prompt space depends on output diversity. (3) Iterated nerve structures with spectral convergence for hierarchical metric decomposition.

Builds Upon

MCR-MAGNITUDE-001MCR-MAGNITUDE-002
MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof
MENTAT-CA-001|MCR-MAGNITUDE-004
2026-03-05

MENTAT Contribution Record

PROOF

Formally Verified

CONTRIBUTION LEVEL: PROOF

Lean 4 Formalization of Magnitude Homology Program

Contributor

Apoth3osis Labs

R&D Division

Machine-checked Lean 4 formalization of the complete magnitude homology theory. 11 modules (Basic, Homology, HomologyGroups, KunnethMV, Diagonality, BlurredPersistent, EnrichedMagnitude, IteratedMH, Weighting, Bridge, README), 2242 lines of proof code, 90+ theorems. Covers chain complexes through spectral convergence. Zero sorry/admit. Built on Mathlib.

Builds Upon

MCR-MAGNITUDE-001MCR-MAGNITUDE-002MCR-MAGNITUDE-003
MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof
MENTAT-CA-001|MCR-MAGNITUDE-005
2026-03-06

MENTAT Contribution Record

KERNEL

Computationally Verified

CONTRIBUTION LEVEL: KERNEL

Magnitude Homology Verified Kernel — 6-Round Hostile Audit

Contributor

Apoth3osis Labs

R&D Division

Complete formal verification through six rounds of adversarial hostile audit. R1: P1–P6. R2: N1–N3. R3: F1–F2. R4: G1–G2 (cosmetic). R5: H1–H4 (Phases 5+6). R6: CLEAN. All findings resolved. Final round produced zero findings. 90+ theorems kernel-checked by Lean 4.

Builds Upon

MCR-MAGNITUDE-004
MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof
MENTAT-CA-001|MCR-MAGNITUDE-006
2026-03-08

MENTAT Contribution Record

BRIDGE

Cross-Level Connection

CONTRIBUTION LEVEL: BRIDGE

Magnitude Homology → LLM Enrichment & TDA Bridge

Contributor

Apoth3osis Labs

R&D Division

Three production bridges from pure magnitude homology: (1) EnrichedMagnitude connects to LLM next-token distributions via Tsallis entropy — the 'effective size' of prompt space depends on output diversity. (2) BlurredPersistent bridges to Vietoris-Rips complexes — the standard TDA tool — with unconditional degree-1 equivalence. (3) IteratedMH generalizes to k-layered nerve vertices with spectral convergence, recovering classical magnitude homology at k=1.

Builds Upon

MCR-MAGNITUDE-004MCR-MAGNITUDE-005
MENTAT · Mesh-Encrypted Network for Trusted Autonomous TransactionsImmutable · Content-Addressed · Tamper-Proof

Governed by MENTAT-CA-001 v1.0 · March 2026