How Far Apart Are Two Proofs? Measuring Proof Dissimilarity in a Proof Kernel and in Lean/Mathlib
Author: Nikolaos Nikolaou (University College London)
Summary (Overview)
- The paper addresses Hilbert's 24th problem—"when are two proofs the same?"—by turning it into a graded question: rather than asking whether two proofs are identical, it asks how far apart they are, and what the shape of "proof space" looks like.
- The author defines 19 dissimilarity measures in 6 families (syntactic, structural, dependency & resource, semantic, information-theoretic, higher-categorical), 12 of which are new or adapted, along with 10 desirable properties that a measure should satisfy.
- In a controlled Curry–Howard kernel test bed with 5 proofs of the infinitude of primes, the study finds that dependency-based and structural measures reproduce intuitive orderings (Euclid rewritten < Goldbach < Furstenberg), while semantic measures invert intuition—Furstenberg's topological proof is revealed to compute exactly Euclid's witness.
- A replication in Lean 4/Mathlib (3 theorems, 19 proofs, 18 automatically extracted measures) confirms that dependency-closure measures track intuition best (full ordering on all theorems, 9/10 properties).
- The paper proposes reporting dissimilarity as a multi-level profile rather than a single number, with applications to detecting duplicated AI proofs, orchestrating prover agents, interpreting AI proofs, and mapping proof space.
Introduction and Theoretical Foundation
Motivation: The Age of Machine-Generated Mathematics
The paper opens with a survey of 2026 events that make proof dissimilarity urgent:
- August 2026: Alpöge and Furman publish a claimed proof (with Lean formalisation) that >67.25% of non-trivial Riemann zeta zeros are simple and on the critical line, discovered by an unreleased Anthropic Claude model.
- September 2026: OpenAI announces a swarm of ~10⁴ agents found a finite-time singularity for forced 3D Navier–Stokes in 88 hours, plus a disproof of regularity for unforced Euler equations—leading to a public priority dispute.
- October 2026: OpenAI releases 721 machine-generated mathematical manuscripts in 373 families; announces proofs of Sogge's local smoothing conjecture, a Lean-verified disproof of ETH, and existence proofs for 4D gauge theories.
These events raise questions a proof assistant's kernel cannot settle: Is it the same proof? How close is "close"? How many distinct arguments did agents find?
The Identity of Proofs Problem
The theoretical foundation draws on:
- Hilbert's 24th problem (drafted but excluded from his 1900 list): asking for criteria of simplicity and sameness of proofs.
- Prawitz's normalisation conjecture: two natural-deduction derivations represent the same proof if they have the same normal form.
- Categorical approaches: proofs as morphisms in free categories; identity as equality of morphisms.
- Proof nets, combinatorial proofs, atomic flows: for classical logic where cut elimination is not confluent.
- Homotopy type theory: identity of proofs as structured spaces of paths.
The key gap: all these proposals give equivalence relations (yes/no answers). None says how far apart two non-identified proofs are.
The Claim and Test Bed
All kernel proofs establish the same closed first-order sentence:
"no finite set is exactly the set of primes." The three conjuncts are called Fin, AllPrime, and Cover.
The five proofs are:
| Proof | Intuition | Description |
|---|---|---|
| E | base | Euclid: least prime factor of , by contradiction |
| E′ | same | Euclid as a lemma ("every finite set of primes misses one") plus corollary |
| E+ | same | E with finer granularity (expanded divisibility steps) |
| G | similar | Goldbach: Fermat numbers are pairwise coprime, plus pigeonhole |
| F | very dissimilar | Furstenberg: arithmetic-progression topology on |
Methodology
The Curry–Howard Kernel
The paper implements a small kernel (proofdist/logic.py) for intuitionistic first-order natural deduction with proof terms:
Reduction is and (let-unfolding). The system is simply typed, so normal forms exist and are unique up to α-equivalence.
Table 1 summarises the five proofs:
| Proof | |M| | |nf(M)| | steps | lemmas | deps | reducts | nominal strength |
|---|---|---|---|---|---|---|---|
| E | 74 | 78 | 7 | 5 | 13 | 128 | |
| E′ | 94 | 78 | 7 | 5 | 13 | 10 | |
| E+ | 119 | 121 | 8 | 7 | 15 | 256 | |
| G | 92 | 86 | 3 | 6 | 17 | 8 | |
| F | 101 | 94 | 7 | 10 | 23 | 128 | third-order |
The 19 Dissimilarity Measures (6 Families)
Group 1 — Syntactic:
- Raw TED: Zhang–Shasha tree edit distance between Curry-style proof trees
- α-TED: same after α-canonical renaming
- NF-TED⋆: α-TED between normal forms (quantitative analogue of "same normal form")
- Rule-profile⋆: weighted Jaccard distance between multisets of inference rules
Group 2 — Structural:
- Flow-linking⋆: Jaccard distance between sets of (goal atom, lemma, lemma atom) triples sharing a flow class
- Hypothesis-usage⋆: Jaccard distance between sets of conjuncts actually projected
- Signature⋆: Jaccard distance between non-logical vocabularies
Group 3 — Dependency & Resource:
- Dependency-Jaccard: Jaccard distance between transitive dependency closures
- Dependency-GED: graph edit distance between dependency DAGs
- Axiomatic-strength⋆: where is the strongest foundation level
- MSC-EMD⋆: earth mover's distance over MSC2020 subject codes
- Size-ratio:
Group 4 — Semantic:
- Herbrand-witness⋆: fraction of test inputs where two proofs yield different missing primes
- Query-trace⋆: mean normalised Levenshtein distance between query traces
- Witness-magnitude⋆: comparison of bounds yielded
Group 5 — Information-theoretic:
- NCD-term: normalised compression distance on serialised normal forms
- NCD-text: NCD between informal proof texts
Group 6 — Higher-categorical:
- Shortest 2-cell⋆: shortest "valley" zig-zag between proofs via reduction
- Identification-level⋆: an ultrametric ladder of identification criteria from α-equivalence to same conclusion
The 10 Desirable Properties
| Property | Definition |
|---|---|
| P1 Reflexivity | |
| P2 Symmetry | |
| P3 Triangle inequality | on all triples |
| P4 α-invariance | |
| P5 Bureaucracy invariance | |
| P6 Granularity robustness | |
| P7 Discrimination | and |
| P8 Intuitive ordering | |
| P9 Effective computability | decidable and feasible |
| P10 Informal applicability | applicable to proofs as mathematicians write them |
Empirical Validation / Results
Kernel Study Results (Table 2)
Key findings on similarity scores :
| Metric (Group) | (E,E′) same | (E,G) similar | (E,F) dissimilar | Order |
|---|---|---|---|---|
| Raw TED (Syntactic) | 0.512 | 0.500 | 0.514 | ✕ |
| NF-TED (Syntactic) | 1.000 | 0.512 | 0.552 | ∼ |
| Flow-linking (Structural) | 1.000 | 0.125 | 0.083 | ✓ |
| Dependency-Jaccard (Dep.) | 1.000 | 0.429 | 0.333 | ✓ |
| Dependency-GED (Dep.) | 1.000 | 0.500 | 0.405 | ✓ |
| MSC-EMD (Dep.) | 1.000 | 0.652 | 0.407 | ✓ |
| Herbrand-witness (Semantic) | 1.000 | 0.160 | 1.000 | ✕ |
| NCD-term (Info.) | 0.930 | 0.429 | 0.352 | ✓ |
| Identification-level (Higher-cat.) | 0.750 | 0.000 | 0.250 | ∼ |
Key findings:
- Raw syntax cannot tell a rewrite from a new argument: Raw TED scores (E,E′) at 0.512, essentially the same as (E,G) at 0.500 and (E,F) at 0.514.
- Normalisation identifies E and E′ exactly (NF-TED = 1), but then fails to separate G from F.
- Structural and dependency measures reproduce intuition: Flow-linking, Signature, Dependency-Jaccard, Dependency-GED, MSC-EMD, Rule-profile, Size-ratio, and NCD-term all give the full ordering.
- Every semantic measure inverts intuition: The Herbrand witness of F equals that of E on all 1024 test sets, .
Property Satisfaction (Table 3)
- No measure satisfies all ten properties.
- Best scores (9.5/10): Dependency-Jaccard, Dependency-GED, MSC-EMD
- Next (9): Signature
- NCD measures fail reflexivity, symmetry, and α-invariance.
- Granularity robustness (P6) is the most often violated property.
Lean 4/Mathlib Replication
Table 5 lists 19 proofs across 3 theorems:
| Theorem | Proofs (roles) |
|---|---|
| Primes infinite | E (base), E′ (same), E+ (finer), M (similar), G (similar), F (dissimilar), Eu (dissimilar) |
| irrational | P (base), P′ (same), P+ (finer), T (similar), V (similar), R (dissimilar) |
| Gauss's sum | I (base), I′ (same), I+ (finer), Gp (similar), H (dissimilar), B (dissimilar) |
Key replication results (Table 7):
- Five measures reproduce the full intuitive ordering on all three theorems: NF-TED (0.81/0.40/0.14), Rule-profile, Dependency-Jaccard (1.00/0.66/0.45), Dependency-GED (1.00/0.75/0.52), and NCD-term.
- Two measures score best on properties (9/10): Dependency-Jaccard and Dependency-GED.
- No "same" pair is convertible: equality of normal forms fails for tactic-written proofs.
- Proof by citation looks unlike the argument it cites: proofs delegating to library lemmas (M, Eu, R) appear far from the same argument spelled out.
- Kernel-defeq is degenerate: by proof irrelevance it is 0 for every pair.
- Axioms carry no information: every proof depends on propext, Classical.choice, and Quot.sound.
Post-Hoc Analysis
Spearman correlations (Table 10) with stipulated roles:
- NCD-term ranks within-theorem best (mean ), followed by NF-TED (0.83) and Dependency-Jaccard (0.82).
- Pooled across theorems, Vocabulary is best ().
Relative circularity check (Table 11):
- M cites
Nat.exists_infinite_primesdirectly. - Eu depends on it through a chain of 9 lemmas—the Euler/Erdős proof is not independent of Euclid in Mathlib.
Theoretical and Practical Implications
The Main Theoretical Findings
-
Different families measure different things: syntactic measures ignore nothing; structural measures ignore everything except wiring; dependency measures ignore everything except citations; semantic measures ignore everything except computation.
-
Granularity is the hard problem: the same argument written against a finer lemma library looks different. A satisfactory metric needs either a canonical library or invariance under lemma refinement.
-
Semantic identity can reveal "proofs in disguise": Furstenberg's topological proof computes exactly Euclid's witness (), confirming Mercer's observation that "Furstenberg's proof is Euclid's."
-
Equality of normal forms is too fine for proofs as actually written in a proof assistant with tactics.
Practical Applications (Section 9)
| Use | Properties needed | Candidate measures |
|---|---|---|
| Contamination/recall detection | P4, P5, P9 | Dependency-Jaccard/GED, Direct-premises |
| Diversity of generated proofs | P4–P7 | Dependency-GED, Module-EMD, Flow-linking |
| Orchestrating prover agents | P4–P7 | Dependency-GED, Direct-premises |
| Interpreting AI proofs | P5, P7, P8 | Dependency-Jaccard, NF-TED |
| Triage of informal LLM proofs | P10, P7 | NCD-text (weak) |
| Clustering proof families | P1–P3, P6, P8 | Dependency measures, MSC-EMD |
| Novelty-driven proof search | P4–P7 (all) | A profile; no single measure suffices |
Goodhart's Law Warning
As soon as a measure is used as an objective (e.g., novelty reward), it will be gamed:
- Failing α-invariance (P4) rewards renaming.
- Failing bureaucracy invariance (P5) rewards detours.
- Failing granularity robustness (P6) rewards splitting lemmas.
The properties are exactly the conditions under which a measure can be safely optimised. No single measure is safe on its own—this is a further argument for profiles.
Conclusion
The paper's central thesis: proof dissimilarity should be reported as a profile across levels of identification, not as a single number. The profile has three parts:
- Identification level at which two proofs meet (same term, same normal form, same premises, same computational content, same area, or only the same theorem).
- Within-level distance ranking pairs at that level (NF-TED, Dependency-GED).
- Orthogonal coordinates: area distance, semantic distance, dependency closure size, and an independence flag.
The recommended measures are Dependency-Jaccard and Dependency-GED, which score best on properties in both studies, reproduce intuitive orderings on every theorem, treat "same" proofs as identical, and are cheap to compute.
Future Work
- Human ground truth: a rating study with a panel of mathematicians (survey instrument already prepared).
- Scaling: to all of Mathlib, machine-generated corpora (openai/math), and theorems with many formal proofs.
- Granularity invariance: normalising through the library, treating lemmas and their proofs as interchangeable.
- Automatic independence checks: automating the detection of relative circularity.
- Cross-theorem similarity: anti-unification of abstracted proof terms to detect "the same idea across theorems."
- Semantics in real libraries: locating essential uses of choice, extracting witnesses by proof mining.
- AI-driven theorem proving: orchestration, distinct-proof@k evaluation, interpretability via nearest human proofs.
"Correctness, however, is not understanding. Deciding whether a proof is genuinely new, how many distinct ideas a batch of generated proofs contains, how much a machine added to what humans supplied, and how an unfamiliar argument relates to familiar ones are all questions about how far apart proofs are. Hilbert's long-neglected 24th problem has thus become a practical one, and this paper has tried to make it measurable."
Related papers
- Trustworthy Recursive Self-Improvement with Statistical Guarantees
TRUST introduces an online multiple hypothesis testing gate that provably bounds false evolution rate while achieving higher performance gains than greedy and existing statistical acceptance methods in recursive self-improvement.
- Stable Gated DeltaNet-2: Understanding and Mitigating Recurrent State Instability
Stable GDN-2 fixes Gated DeltaNet-2's training instability from non-normal erase operators via symmetric erasure and decay-regulated residual writing, boosting 128K RULER scores by 6.80 points.
- Hashing Theorems Modulo Rewrites and Binder Permutation Enables Equivalence Search over 200k Mathlib Theorems
A formally verified rewrite system detects 1,747 redundant Lean theorem proofs across 1,687 duplicate classes, outperforming existing linters by 58.6%.