Formalized Mathematics: Proofs and Reusable Libraries

How mechanically checked mathematics grew from individual texts and landmark proofs into shared infrastructure for further mathematical work.

Modern logic · Part 25Historical questions · mathematical ideas

How did isolated machine-checked results become reusable mathematical infrastructure?

Understand reflection, shared definitions, dependency graphs, and the different contributions of landmark formalizations.

Selected landmarksSeries timeline ↗

Van Benthem Jutting formalizes Landau's Grundlagen der Analysis, an early substantial mathematical development.

Source: History of Interactive Theorem Proving

A checked theorem is useful on its own. A library of compatible definitions and theorems changes what can be built next.

Formalized mathematics therefore has two intertwined histories: the completion of demanding individual proofs and the construction of reusable mathematical infrastructure. The second history explains why later projects become possible without rebuilding every foundation.

Before the famous milestones

Automath's formalization of Landau's analysis text and Mizar's sustained library development established substantial precedents in the 1970s and afterward.

Other assistants accumulated developments in arithmetic, algebra, analysis, and computer science. The field did not begin when a well-known theorem first received a widely publicized formal proof.

These earlier projects encountered recurring problems: representing mathematical structures, handling implicit arguments, choosing convenient definitions, and making a lemma usable outside the proof for which it was first written.

An account centered only on record-setting theorem names misses much of the work that made formalization sustainable.

The ambition of a shared mathematical archive

The QED Manifesto, circulated in 1994, proposed a large, collaboratively organized body of formally checked mathematics. It treated trusted foundations, readable presentation, library construction, and cooperation between systems as collective infrastructure problems.

The document was a proposal, not an announcement that such a universal archive had been completed. Its importance is that it made the social and architectural scale of the project explicit. A hundred isolated proofs with incompatible representations are much less useful than a connected development whose definitions and lemmas can be reused.

This ambition helps explain why later projects invested heavily in algebraic hierarchies, notation, automated inference of implicit arguments, and library review. Each of these choices determines how formal mathematics can grow beyond the authors who first wrote it.

Computer assistance and formal checking

Kenneth Appel and Wolfgang Haken's 1976 proof of the Four Color Theorem relied on substantial computer calculations. John Koch contributed to the computational work.

Portrait of Kenneth Appel
Kenneth Appel (1932–2013)
Sources and credit for Kenneth Appel

ActiviaYogurt. Via Wikimedia Commons. Image source · CC0 · Biographical dates

Portrait of Wolfgang Haken
Wolfgang Haken (1928–2022)
Sources and credit for Wolfgang Haken

Aehaken. Via Wikimedia Commons. Image source · CC BY-SA 4.0 · Biographical dates

The proof became a focal point for questions about what it means to inspect a mathematical argument when some calculations are too extensive to check by hand.

Georges Gonthier's later formalization, developed with Benjamin Werner and completed in 2005, provided a different assurance structure in Coq. It used a formal combinatorial treatment and checked the connection between the theorem and the computational reasoning.

This was not simply running the 1976 program again. Formal verification required proving that the encoded objects, reductions, and checking procedures established the stated mathematical result. Gonthier's 2008 account, “Formal Proof—The Four-Color Theorem,” explains the mathematical organization.

The distinction remains useful: a computer-assisted proof and a proof checked within an explicit formal system can share substantial computational work while making different claims about how that work is justified.

Reflection and verified computation

Suppose an expression language represents polynomial identities. A normalization program computes a canonical form, and a theorem proves that normalization preserves the expression's mathematical meaning.

To prove

(x+1)2=x2+2x+1,(x+1)^2=x^2+2x+1,

the system can normalize both sides and establish that the resulting representations agree.

The logical justification has two components: the correctness theorem for normalization and the specific calculation on these expressions.

This is the principle of proof by reflection. Instead of constructing a long sequence of low-level rewrites afresh, the proof invokes a verified computational procedure.

The trust boundary depends on how computation is performed and checked. Kernel reduction, verified certificates, and externally executed code accepted through additional mechanisms do not automatically provide identical guarantees.

Reflection helped make some large formal developments practical. It also illustrates how proof theory, computation, and implementation design meet inside a single proof.

The theorem behind a computational proof

Reflection needs a bridge from syntax to meaning. Let EE be an expression datatype, let ⟦e⟧ρ\llbracket e\rrbracket_\rho interpret an expression under a variable assignment ρ\rho, and let N:E→EN:E\to E compute a normal form. The crucial correctness theorem has the form

∀e,ρ,⟦N(e)⟧ρ=⟦e⟧ρ.\forall e,\rho,\quad \llbracket N(e)\rrbracket_\rho=\llbracket e\rrbracket_\rho.

If normalization produces the same expression for ee and ff, their interpretations agree by this theorem. The program computing NN and the theorem justifying NN have different roles. A fast unverified simplifier returning “equal” does not itself supply this bridge.

For polynomial identities, the theorem must specify the algebraic structures in which the rules are valid. Commuting xyxy to yxyx is justified in a commutative ring; it is not valid for arbitrary matrices. In a formal development, the algebraic hypothesis is part of the normalizer's specification, not a convention hidden in notation.

This turns large computation into an application of a general mathematical result. It also explains how one verified procedure can support many later proofs.

The Odd Order Theorem

The Feit–Thompson theorem states that every finite group of odd order is solvable.

Gonthier and a substantial team formalized a proof in Coq, completing the development in 2012 and publishing the main account in 2013. The project paper records a collaborative effort involving algebraic infrastructure, proof methodology, and extensive mathematical development.

The theorem's importance here is not only its length or fame. Its formalization required coherent representations of finite groups, algebraic structures, character theory, and many supporting constructions.

The Mathematical Components approach, including small-scale reflection, made those structures and reasoning patterns reusable. Contributors such as Assia Mahboubi, Enrico Tassi, Cyril Cohen, Laurent Théry, and the other coauthors belong in the account alongside the project's lead.

A library architecture is itself a mathematical achievement when it lets independently developed results fit together without repeated translation.

The prime number theorem: two routes through analysis

The prime number theorem states

π(x)∼xlog⁡x,\pi(x)\sim\frac{x}{\log x},

where π(x)\pi(x) counts primes up to xx and ∼\sim means that the ratio tends to one. Formalizing it requires precise accounts of counting, logarithms, limits, and asymptotic comparison.

Jeremy Avigad, Kevin Donnelly, David Gray, and Paul Raff formalized an elementary proof in Isabelle, reporting it in a 2005 preprint, with journal publication in 2007. “Elementary” here means avoiding complex-analytic methods; it does not mean that the proof is short or easy. The development followed a Selberg-style route.

John Harrison's 2009 HOL Light formalization instead developed the complex analysis needed for an analytic proof. These are two formal proofs of the same asymptotic theorem with substantially different supporting infrastructure.

The comparison exposes a historical change in the unit of accomplishment. Completing a landmark theorem also creates or reorganizes a body of reusable mathematics. Once that infrastructure exists, later proofs can take a route that would have been impractical in an earlier library. Counting only final theorem statements misses this contribution.

Flyspeck and the Kepler conjecture

Thomas Hales and Samuel Ferguson announced a computer-assisted proof of the Kepler conjecture in 1998, combining mathematical reasoning with extensive computation. The Flyspeck project sought a formal verification of the argument.

Portrait of Thomas Hales
Thomas Hales (b. 1958)
Sources and credit for Thomas Hales

Slawekb. Via Wikimedia Commons. Image source · CC BY-SA 3.0 · Biographical dates

The collaborative formalization was completed in 2014. Its paper appeared as a preprint in 2015 and in final journal form in 2017, dates that refer to different stages of the same project.

The development used HOL Light and Isabelle for different parts, with computational checks and mathematical reductions linked through formally justified arguments. The project paper documents the result and its many contributors.

Flyspeck illustrates the need to coordinate several kinds of evidence: continuous mathematics, discrete classification, inequalities, and extensive computation. It also demonstrates why a formalization's architecture can differ from the organization of an informal published proof.

Hales's critical retrospective, written in 2020 and posted to arXiv in 2024, discusses the project's costs and lessons. Formalization can improve assurance while still imposing substantial work in representation, tooling, and maintenance.

What an ordinary theorem depends on

Consider the elementary statement that a group has a unique identity element.

Let ee and e′e' each satisfy the appropriate identity laws. Then

e=e⋅e′=e′.e=e\cdot e'=e'.

The proof is short. Its formal setting still needs a carrier type, a multiplication operation, equality, and the relevant identity hypotheses.

If the theorem is stated for an existing group structure, the library must determine which multiplication is intended and which identity laws are available. Implicit arguments or type-class inference may fill in that information.

If one proof treats a group as a bundled object and another treats the carrier and operations separately, a bridge may be needed before their lemmas compose conveniently.

The kernel ultimately sees explicit mathematical data. The surface notation's convenience depends on a carefully designed elaboration and library layer.

This small example explains why a library's usefulness cannot be measured simply by counting theorems. Compatibility and discoverability affect whether a result can be reused.

Mathlib and community infrastructure

The Lean mathematical library, Mathlib, developed as a community project with a shared collection of definitions, proofs, and supporting tools.

The community-authored library paper describes its aims and organization. A separate maintenance study examines technical and social challenges as the library grows.

Contributors do more than add theorem statements. They review definitions, generalize lemmas, maintain naming conventions, improve automation, update dependencies, and repair proofs after changes.

A more general theorem can make many later proofs shorter, but excessive abstraction can make a library harder to use. Those are mathematical design choices made through collaboration and review.

The same lesson applies beyond Mathlib. Mizar, Isabelle's Archive of Formal Proofs, Mathematical Components, HOL libraries, and other collections provide different models of organizing shared formal knowledge.

Dependencies, portability, and maintenance

A formal theorem is supported by a directed dependency structure: its proof uses earlier lemmas, those lemmas use definitions and axioms, and their expressions depend on the logical environment. A small source file can therefore depend on a large mathematical development.

Suppose a library generalizes a theorem from groups to monoids. That can remove unnecessary assumptions from downstream results, but changes to names, implicit arguments, or normalization behavior may still break proof scripts. Repairing those scripts is not evidence that the mathematical statement became false; it may reflect a changed interface to the same or stronger mathematics.

Moving a theorem between assistants is harder. One library may represent quotient objects by quotient types, another by equivalence classes of sets, and another by representatives with compatibility proofs. The printed proposition may be similar while the underlying declarations differ. Translation must preserve both the statement's intended meaning and its admitted foundation.

This is why reproducible releases record toolchain and library versions, and why reviewed definitions matter as much as successful proof commands. Shared formal knowledge grows through mathematical choices and continuing maintenance, not merely by accumulating files that once compiled.

Checking the statement

Mechanical checking establishes a derivation of the formal statement. It does not by itself establish that the statement captures the intended theorem.

Suppose an informal theorem concerns all continuous functions on a compact interval. A formal version might accidentally quantify only over polynomials, omit a nonempty-domain condition, or use a topology different from the intended one.

The resulting proof could be completely correct for that different statement.

Review must therefore inspect definitions, hypotheses, quantifier order, and the relationship between informal and formal formulations. An axiom report can reveal additional assumptions, but understanding whether those assumptions are appropriate remains mathematical work.

Proof, explanation, and social review

Richard De Millo, Richard Lipton, and Alan Perlis's 1979 critique emphasized the social processes through which mathematical proofs gain acceptance and questioned ambitious claims about program verification.

Portrait of Richard DeMillo
Richard DeMillo (b. 1947)
Sources and credit for Richard DeMillo

Georgia Tech College of Computing. Via Wikimedia Commons. Image source · CC BY 2.5 · Biographical dates

Later formalization achievements answer some practical doubts about scale. They do not make explanation, communal understanding, or specification review unnecessary.

A machine-checked proof can offer highly detailed evidence of derivability while remaining difficult for a person to understand. A clear mathematical exposition can explain the idea while leaving routine inferences implicit.

These forms of evidence can support one another. The strongest practice connects the formal artifact with an intelligible statement, an explanation of the argument, and a record of its assumptions and dependencies.

Formalization and discovery

Formalizing a known theorem can discover missing hypotheses, new abstractions, or alternative arguments. It does not automatically constitute the first discovery of the theorem itself.

A library can also support new mathematics by making a body of results precisely searchable and composable. This possibility depends on the quality of the library and the methods used to explore it.

Before examining learned proof search, one further foundational development deserves its own explanation: the interpretation of equality as higher-dimensional structure.

Check your understanding: what makes a computation into a proof?

A normalization program prints the same output for two expressions. What additional evidence is needed to conclude that the expressions denote the same mathematical value?

A correctness connection between the computation and the interpretation. For reflection, a proved theorem shows that normalization preserves meaning in the stated domain. The concrete computation must then be accepted through the chosen checking mechanism. If the theorem assumes commutative multiplication, it cannot justify the same rewrite for arbitrary matrices. The output, the correctness theorem, and its hypotheses all matter.

Sources and further reading