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