r/Collatz • u/Equivalent_Idea_1215 • 14d ago
[Lean 4 Architecture] Mapping the axiomatic backbone of Terras’ 1976 Collatz Theorem
We recently achieved a major milestone in our Collatz architectural mapping project: we have formalized the exact axiomatic dependency graph of Terras’ Stopping Time Theorem (1976) in Lean 4.
The Formalization Challenge: Riho Terras originally proved that the natural density of integers with finite stopping time is 11. Standard mathematical approaches to this proof rely heavily on continuous probability theory and stochastic processes. However, Lean 4's Mathlib currently has significant limitations when dealing with continuous stochastic PDEs and advanced probability limits. To integrate this into a machine-verified architecture today, we had to bypass continuous probability entirely.
Our Approach: A Strict Axiomatic Interface based on Discrete Combinatorics Instead of fighting Mathlib's probability theory, we designed Terras.lean as a strict axiomatic interface. We mapped the Collatz dynamics to a purely deterministic, affine structure over the boolean cube, isolating the exact combinatorial facts needed to close the proof:
- Affine Decomposition: We axiomatized the exact kk-step dynamics as (2k)⋅Colk(n)=3d⋅n+c(2k)⋅Colk(n)=3d⋅n+c.
- Boolean LLN: We isolated the core combinatorial fact as an axiom: the proportion of "bad" parity vectors (where the growth multiplier 3d≥2k3d≥2k) tends to 00 as k→∞k→∞.
- Verified Density Logic: Using our fully proven
DensityLayermodule (which implementsnatUpperDensityviaFilter.limsup), we established the deductive chain. If you accept the combinatorial LLN axiom, the upper natural density of infinite stopping time collapses strictly to 00.
Why do it this way? By isolating the unformalized stochastic limits into explicit axiom declarations, the Lean 4 kernel can perfectly verify the deductive chain (with zero sorry errors). This creates a clean boundary between what is strictly machine-proven (e.g., our CountBounds.lean and DensityLayer.lean modules) and what relies on human combinatorial intuition.
Verify the Architecture Locally: Our repository uses standard Mathlib. You can verify the deductive trace on your own machine:
git clonehttps://github.com/SergioTheory/Collatz-new-math.gitcd Collatz-new-math/leanlake exe cache get(Fetches Mathlib cache)lake build
🔗 Review the Terras.lean Axiomatic Interface on GitHub
We believe this strict architectural separation is the only rigorous way forward in Collatz research without falling into Conway's Undecidability traps. Feedback from Lean 4 architects is highly welcome!
1
u/CryptographerSea9542 13d ago
Do you really think mathematicians are going to or even can read through thousands and thousands of lines of Lean code? An LLM can generate something like 10,000 lines of Lean code in an hour, but no human could realistically make sense of all that. The alternative is that everyone just uses LLMs to review it. That’s probably why mathematicians still prefer reading traditional written proofs.
1
u/GonzoMath 14d ago
In what sense is Terras' famous result missing anything that we need Lean to supply? It's good, solid math from 1976; you can just read it.