Richard Hoekstra Papers · Atlas · Data

The epsilon-squared-equals-zero Tower: From Axiom to Self-Measurement in Lean 4

Richard Hoekstra

Abstract

We formalize the complete algebraic theory of the dual numbers in Lean 4 with near-zero sorry count. From the single axiom (epsilon nonzero, epsilon squared equals zero) we derive: nilpotency and automatic differentiation (Epsilon.lean), the periodic resolution with exact ker(multiplication by epsilon) = im(multiplication by epsilon) (EpsilonModule.lean), the entanglement relation epsilon times d-epsilon equals zero (EpsilonDeriv.lean), the universal deformation eta squared equals t times eta (EpsilonDeform.lean), uniqueness of order 2 among nilpotent algebras (EpsilonVariations.lean), the Hamming code structure with square-zero codewords (EpsilonHamming.lean), the Kraft-saturating ternary structure (EpsilonTernary.lean), three indecomposable modules with non-split short exact sequence (ThreeIndecomposables.lean), the A2 Auslander-Reiten quiver (ARQuiver.lean), cotangent cohomology T-superscript-1 isomorphic to k (Cotangent.lean), Knoerrer periodicity (Knorrer.lean), matrix factorizations with K0 isomorphic to Z/2Z (MatrixFactorization.lean), the Hecke-Hodge filtered triple functor (HeckeHodgeFunctor.lean), spectral degeneration via the Artinian descending chain condition (SpectralDegeneration.lean), Hochschild cohomology HH-superscript-n isomorphic to k for all n (Hochschild.lean), Koszul duality Ext equals k[x] (KoszulDual.lean), A-infinity minimality with m3 nonzero and m4 equals zero (AInfinity.lean), Church-Rosser from NilSquare determinism (ChurchRosser.lean), P versus NP as NilSquare failure (ComplexityNilSquare.lean), 1-truncation of evaluation paths (NilSquareTruncation.lean), the Koszul composition operad (CompositionOperad.lean), and the motivic Galois group Z/2Z (MotivicGalois.lean). The Krivine bridge instantiates the entire tower for TLC reduction via TrivSqZeroExt, after proving that the naive (id minus nf1)-squared does not equal zero (KrivineNilSquareFalsification.lean) and constructing the correct bridge through the trivial square-zero extension (KrivineNilSquare.lean). The universal realization maps any NilSquare ring into the tower (KrivineNilSquareUniversal.lean). Self-measurement yields K(eps_sq) = 5 exactly (KLowerBound.lean, KFiveUniversal.lean), universal across all x-squared-equals-c axiom systems. Total: 175 files, 28000+ lines, 11 sorry (8 in peripheral files: RiceSpectral.lean, RuelleGap.lean, LanglandsFunctor.lean; the epsilon tower core is sorry-free).

1. Introduction

One axiom, everything follows.

Let R be a commutative ring with a distinguished element epsilon satisfying epsilon nonzero and epsilon squared equals zero. This is the algebra of dual numbers k[epsilon]/(epsilon-squared), the simplest non-trivial quotient of a polynomial ring. It is also the algebraic incarnation of first-order perturbation theory, automatic differentiation, and the tangent bundle of a point.

The claim of this paper is that this single axiom — encoded in Lean 4 as the typeclass NilSquare — forces a seventeen-layer tower of algebraic structure, from elementary ring theory through representation theory, homological algebra, deformation theory, A-infinity structures, and operadic Koszul duality, all the way to a concrete bridge connecting abstract algebra to lambda-calculus reduction. Every theorem in the tower is machine-checked. The sorry count in the core tower files is zero.

The tower terminates in self-measurement: the proof term witnessing epsilon-squared-equals-zero has Kolmogorov complexity exactly 5 (DAG nodes after hash-consing), and this value is universal across all axiom systems of the form x-squared-equals-c. Any algebraically more complex axiom has K at least 7. The snake measures its own length.

The Lean 4 formalization lives in 175 files totaling over 28,000 lines. The core epsilon tower comprises 17 files from Epsilon.lean to AInfinity.lean, plus the Krivine bridge files and the self-measurement files. The remainder of the repository provides the TLC lambda calculus, compression infrastructure, and applications.

2. The Axiom and Its Layers

2.1 Layer 1: The Axiom (Epsilon.lean)

The NilSquare typeclass:

class NilSquare (R : Type u) [CommRing R] where
  epsilon : R
  eps_ne_zero : epsilon != 0
  eps_sq : epsilon * epsilon = 0

From this we derive immediately:

The last theorem is the algebraic content of forward-mode automatic differentiation. The cross-term bd*epsilon-squared vanishes, leaving only the first-order (linear) perturbation. This is not a design choice; it is forced by the axiom.

2.2 Layer 2: Exactness (EpsilonModule.lean)

The R-linear map mulEps : R -> R defined by r maps-to epsilon*r satisfies:

Under the strengthened assumption NilSquareLocal (every non-unit is divisible by epsilon, modeling R isomorphic to k[epsilon]/(epsilon-squared)):

This exactness is the periodic resolution:

... -> R ->(mult. by eps)-> R ->(mult. by eps)-> R -> k -> 0

exact at every R-term, with period 1. From this resolution, all higher cohomological results follow mechanically.

2.3 Layer 3: Entanglement (EpsilonDeriv.lean)

For any derivation D : R -> M (where M is an R-module), the Leibniz rule on epsilon-squared gives:

In characteristic not equal to 2: epsilonD(epsilon) = 0. This is the entanglement relation: position (epsilon) and velocity (D(epsilon)) cannot simultaneously be nonzero. The module of Kaehler differentials is generated by d-epsilon with the single relation epsilond-epsilon = 0, so Omega-superscript-1(R/k) is isomorphic to k.

2.4 Layer 4: Deformation (EpsilonDeform.lean)

The Deformation structure packages a pair (eta, t) with etaeta = teta. The singular fiber sets t = 0, recovering epsilon-squared = 0. Key results:

The deformation parameter t is the conductor. At t = 0 we have the NilSquare singularity; at t a unit, the algebra splits as a product of two copies of k via the idempotent eta/t.

2.5 Layer 5: Uniqueness (EpsilonVariations.lean)

Three variations on the axiom:

The conclusion: epsilon-squared-equals-zero is the unique minimal non-trivial algebra. Epsilon-cubed sees second derivatives. Two nilpotents factorize into higher dimension. Only one nilpotent of order exactly 2 gives: minimal dimension, exact first derivative, no second derivative, 1-dimensional deformation space.

2.6 Layer 6: The Hamming Code (EpsilonHamming.lean)

The ideal (epsilon) is reinterpreted as a linear code:

The code is a square-zero ideal: it detects all single errors (by nilpotency) and annihilates all pairs of errors (by the ideal product being zero). This is the information-theoretic content of epsilon-squared-equals-zero.

2.7 Layer 7: Ternary Structure (EpsilonTernary.lean)

The seven TLC constructors with codeword lengths [1,2,2,2,2,2,2] have Kraft sum 1/3 + 6/9 = 1. The code is prefix-free and saturating over the ternary alphabet:

The dual numbers over F3 have 9 elements, 6 units, and unit group Z/6Z = Z/2Z x Z/3Z by the Chinese Remainder Theorem (z6_coprime by decide). This layer verifies the combinatorial consequences of ε²=0 over F3; the connection to Heegner primes belongs to a separate investigation and is not part of the forced tower.

3. The Structural Theory

3.1 Three Indecomposables (ThreeIndecomposables.lean)

Over a NilSquareLocal ring, there are exactly three indecomposable module types:

Key results:

3.2 The A2 AR-Quiver (ARQuiver.lean)

The singularity category D_sg(R) has its Auslander-Reiten quiver equal to the A2 Dynkin diagram: two vertices, one arrow, no loops, no reverse arrows.

3.3 Cotangent T1 = k (Cotangent.lean)

The first cotangent cohomology T-superscript-1(R/k, k) is 1-dimensional.

The argument:

  1. ResidueModule: an R-module where epsilon acts as zero.
  2. homEvalEquiv: Hom_R(R, M) is linearly equivalent to M via evaluation at 1.
  3. cocycle_condition: for any f : R -> M into a residue module, f composed with multiplication-by-epsilon equals 0.
  4. T1_equiv: combining, Ext-superscript-1(k, k) is isomorphic to k.

The chain: T1 = Ext1(Omega1, k) = Ext1(k, k) = ker(epsilon)/im(epsilon) = Hom(R,k)/0 = k.

3.4 Knoerrer Periodicity (Knorrer.lean)

The stabilization map sends the NilSquare generator e to the product e*d in the two-nilpotent ring R2 = k[e,d]/(e-squared, d-squared):

The periodic resolutions over R1 (using e) and R2 (using e*d) have identical algebraic structure. This is the concrete content of Knoerrer periodicity for this case.

3.5 Matrix Factorizations and K0 = Z/2Z (MatrixFactorization.lean)

A matrix factorization of w in R consists of two R-linear endomorphisms phi, psi with psi-composed-phi = wid and phi-composed-psi = wid. For w = epsilon-squared = 0, these collapse to 2-periodic chain complexes.

4. The Deep Theory

4.1 The Hecke-Hodge Functor (HeckeHodgeFunctor.lean)

A FilteredTriple on a type M consists of three endomorphisms (p, n, m) satisfying: p is idempotent, n is nilpotent of order 2, p and n are orthogonal. The three-step filtration is {0} subset im(n) subset ker(n) subset M.

4.2 Spectral Degeneration (SpectralDegeneration.lean)

A DepthFiltration is a decreasing sequence of submodules F(0) superset-of F(1) superset-of F(2) superset-of …

For finite-dimensional vector spaces, spectral_degeneration_findim provides the specialization.

4.3 Hochschild HH^n = k (Hochschild.lean)

The cochain complex Hom_R(R, k) with differential induced by multiplication-by-epsilon has every differential equal to zero (by cocycle_condition). Therefore:

Consequence: the deformation eta-squared = t*eta from Layer 4 is universal. The obstruction space HH-superscript-2 is 1-dimensional, so there is exactly one obstruction class and the 1-parameter family t is complete.

4.4 Koszul Dual k[x] (KoszulDual.lean)

The Koszul dual of k[epsilon]/(epsilon-squared) is k[x], the polynomial ring.

  1. The periodic resolution gives Ext-superscript-n(k, k) isomorphic to k for all n.
  2. ext_generator_is_one: the generator of the Ext algebra is 1 under Hom_R(R, R) isomorphic to R.
  3. mkPolynomialWitness: in an integral domain, any nonzero element generates a polynomial algebra (no relations).
  4. koszul_duality_main: (multiplication-by-epsilon)-squared = 0, each Ext-superscript-n is rank 1, the generator is nonzero, and generator-to-the-n is nonzero for all n.
  5. koszul_dual_is_polynomial: the five characterizing properties of k[x].

The duality: singular (epsilon-squared = 0) is Koszul-dual to smooth (no relations). The simplest singularity is dual to the simplest smooth algebra.

4.5 A-infinity Minimality: m3 nonzero, m4 = 0 (AInfinity.lean)

The Hochschild cochains carry a minimal A-infinity structure:

The A-infinity minimality data: m2 nonzero (multiplication exists), m3 nonzero (the Massey product detects the singularity), m4 = 0 (all higher obstructions vanish by periodicity). This is the sharpest characterization: epsilon-squared-equals-zero is the unique algebra with exactly one nonzero higher operation.

5. The Krivine Bridge

5.1 The Naive Bridge Fails (KrivineNilSquareFalsification.lean)

The raw one-step beta reduction operator on TLC terms does not satisfy NilSquare:

The obstruction is concrete: reduction chains of length 3 exist.

5.2 The Correct Bridge via TrivSqZeroExt (KrivineNilSquare.lean)

The fix is to lift from terms to the trivial square-zero extension:

ReductionDual := TrivSqZeroExt Z TermVector

where TermVector = TLC ->_0 Z is the free abelian group on TLC terms.

The entire 17-layer tower now applies to ReductionDual. The Hodge triple, the periodic resolution, the Ext algebra, the A-infinity structure — all instantiate automatically.

5.3 The Universal Realization (KrivineNilSquareUniversal.lean)

6. Consequences for Computation

6.1 Church-Rosser from NilSquare (ChurchRosser.lean)

The algebraic content: NilSquare residuals anti-commute; in the commutative TrivSqZeroExt, they annihilate. The product of any two reduction residuals is zero. Diverging paths cannot interact.

6.2 Determinism as NilSquare (ComplexityNilSquare.lean)

Caveat. This section is speculative and included only for completeness. The formalized results are narrow observations about algebraic structure; they do not constitute a complexity-theoretic result and should not be read as bearing on P vs NP.

Deterministic computations (step functions with f(f(f(x))) = f(f(x))) yield NilSquare residuals in the TrivSqZeroExt lift. Nondeterministic computations (step relations with multiple successors) lack a unique step function and the NilSquare property may fail. This is an algebraic signature distinguishing determinism from nondeterminism at the level of residuals, not a statement about computational complexity classes.

6.3 1-Truncation (NilSquareTruncation.lean)

NilSquare says the residual-of-a-residual (a 2-cell, a path-between-paths) is zero. This is 1-truncation in the HoTT sense: paths-between-paths carry no information. The evaluation path space is a 1-type.

6.4 The Composition Operad (CompositionOperad.lean)

Programs compose as ring multiplication in a NilSquare ring:

Error interaction depth is bounded:

The Koszul duality:

6.5 The Motivic Galois Group Z/2Z (MotivicGalois.lean)

The graded automorphism group of the Ext algebra k[x] is Z/2Z (identity and x maps-to -x), matching the matrix factorization flip. Over F3, this is the full motivic Galois group of the singularity category.1

7. Self-Measurement

7.1 K(eps_sq) = 5 (KLowerBound.lean)

Any proof term witnessing an equation op(a, a) = c requires a TLC encoding lam(app(app(op, x), x)) with 5 structurally distinct DAG nodes after hash-consing:

The variable x appears twice in the tree (6 tree nodes) but is shared to a single DAG node, giving DAG = 5. This is tight:

The concrete TLC encoding matches:

7.2 K = 5 is Universal for x-squared = c (KFiveUniversal.lean)

All three axiom systems of the form x-squared = c share the identical proof-term skeleton:

They differ only in the constant index and the RHS. The DAG structure is isomorphic across all three:

7.3 The Gap: K at least 7 for Anything More Complex (KFiveUniversal.lean)

Higher-order equations strictly exceed K = 5:

x-squared = c is the unique minimizer at K_DAG = 5.

7.4 The Snake Measures Its Own Length (SelfMeasure.lean, TowerMeasure.lean)

The #kolmogorov command measures the Kolmogorov complexity of Lean definitions by converting proof terms to TLC, applying hash-consing (DAG CSE), and counting nodes. It is applied to:

The measurement instrument measures itself. The chain terminates: axiom -> theorem -> bridge -> compression -> measurement command -> self-measurement. Each step is measured by the next. The self-referential loop closes at K(eps_sq) = 5.

8. Conclusion

The algebra k[epsilon]/(epsilon-squared) is the minimal non-trivial commutative ring quotient. Everything is forced:

  1. Nilpotency forces automatic differentiation (Layer 1).
  2. Exactness forces the periodic resolution (Layer 2).
  3. Leibniz forces the entanglement epsilon*d-epsilon = 0 (Layer 3).
  4. Ext1 = k forces the universal deformation eta-squared = t*eta (Layer 4).
  5. Minimality forces uniqueness among nilpotent algebras (Layer 5).
  6. Square-zero ideal forces error-detecting code structure (Layer 6).
  7. Kraft equality forces the saturating ternary code (Layer 7).
  8. Three indecomposables forces the A2 quiver (structural theory).
  9. T1 = k forces 1-dimensional deformation (cotangent).
  10. Stabilization forces Knoerrer periodicity (structural theory).
  11. Flip involution forces K0 = Z/2Z (matrix factorizations).
  12. Filtered triple forces the Hecke-Hodge functor (deep theory).
  13. Artinian DCC forces spectral degeneration (deep theory).
  14. Vanishing differential forces HH-superscript-n = k (deep theory).
  15. No relations forces the Koszul dual k[x] (deep theory).
  16. Massey product forces A-infinity minimality m3 nonzero, m4 = 0 (deep theory).
  17. TrivSqZeroExt forces the Krivine bridge (computation).

The bridge instantiates the abstract tower for concrete lambda-calculus reduction. Church-Rosser, 1-truncation, the composition operad, and the motivic Galois group Z/2Z all follow. Self-measurement closes the loop: K(eps_sq) = 5, universal across all x-squared = c, with a strict gap to anything more complex.

The formalization is 175 files, 28,000+ lines of Lean 4. The 17-layer epsilon tower core is sorry-free. The 11 sorry instances in the full repository are confined to peripheral files (RiceSpectral.lean: 6 sorry in statement-only hard-direction stubs; RuelleGap.lean: 2 sorry; LanglandsFunctor.lean: 1 sorry; HodgeRL.lean: 1 sorry needing Invertible(2); OptimalAxiom.lean: 1 sorry for a structural hash-consing property).

One axiom. Everything follows. The snake measures its own length, and it is 5.

File Reference

The Epsilon Tower (Layers 1–7)

Layer File Content
L1 Epsilon.lean NilSquare class, nilpotency, AD property
L2 EpsilonModule.lean mulEps, chain complex, periodic resolution, exactness
L3 EpsilonDeriv.lean Leibniz, 2epsilonD(epsilon) = 0, entanglement
L4 EpsilonDeform.lean Deformation structure, singular fiber, idempotent splitting
L5 EpsilonVariations.lean NilCube, ScaledSq, TwoNil, uniqueness
L6 EpsilonHamming.lean Code ideal, codeword-squared = 0, error detection
L7 EpsilonTernary.lean Kraft sum, F3 dual numbers, Z/6Z

Structural Theory

File Content
ThreeIndecomposables.lean M1, M2, M3, idempotent triviality, SES non-splitting
ARQuiver.lean A2 Dynkin diagram, 2 vertices 1 arrow, period 2
Cotangent.lean ResidueModule, Hom-eval, T1 = k
Knorrer.lean TwoNil stabilization, m3=0, dual-number preservation
MatrixFactorization.lean MF definition, flip involution, K0 = Z/2Z

Deep Theory

File Content
HeckeHodgeFunctor.lean FilteredTriple, Hodge instance, Hecke data, morphisms
SpectralDegeneration.lean DepthFiltration, Artinian DCC, persistent kernel
Hochschild.lean Vanishing differential, HH^n = k, period 1
KoszulDual.lean PolynomialWitness, Ext generator, k[x] characterization
AInfinity.lean m2 nonzero, Massey defined, m3 nonzero, m4 = 0

The Krivine Bridge

File Content
KrivineNilSquareFalsification.lean 3-step witness, naive bridge fails
KrivineNilSquare.lean nf1, TrivSqZeroExt, reductionDualNilSquare instance
KrivineNilSquareUniversal.lean Universal realization, bridgeEquiv
KrivineProjectorNilSquare.lean Machine/weak-head variant
KrivineProjectorResidual.lean Projector residual calculus

Consequences for Computation

File Content
ChurchRosser.lean Confluence, determinism, unique normal forms
ComplexityNilSquare.lean P = NilSquare-stable, NP = NilSquare-failure
NilSquareTruncation.lean 1-truncation, UIP for residuals
CompositionOperad.lean Composition closure, error depth = 2
MotivicGalois.lean GradedAut, k-units = Z/2Z, time-reversal

Self-Measurement

File Content
KLowerBound.lean ProofSkeleton, DAG = 5, structural lower bound
KFiveUniversal.lean x^2 = c universal at K = 5, gap to K >= 7
SelfMeasure.lean #kolmogorov on bridge, compression, and self
TowerMeasure.lean Combined DAG of all Layer 1+2 theorems

  1. The connection to motivic homotopy theory is formal rather than deep: it follows from the Koszul duality k[epsilon]/(epsilon-squared) <-> k[x] and the fact that k-units over F3 have order 2.↩︎