How Far Apart Are Two Proofs? Measuring Proof Dissimilarity in a Proof Kernel and in Lean/Mathlib
Organizations: University College London
Abstract
We now live in the age of machine-generated mathematics: AI systems produce research-level proofs faster than the human mathematical community can read them. Verification is only part of the challenge. We also need to know whether a "new proof" is indeed new, whether a thousand generated proofs contain one idea or many, and where each sits relative to human mathematics. All of these require measuring distances between proofs. Following Hilbert's 24th problem and the identity-of-proofs problem, we ask how far apart two proofs of one theorem are, and what shape the proof space they inhabit has. We define 19 dissimilarity measures in 6 families (syntactic, structural, dependency & resource, semantic, information-theoretic, higher-categorical) and 10 desirable properties, which we argue are the conditions for safely optimising a measure. In a Curry-Howard kernel, 5 machine-checked proofs that the primes are infinite show that raw syntax cannot tell a rewrite from a new argument, that dependency-based and structural measures reproduce the intuitive ordering (Euclid rewritten < Goldbach < Furstenberg), and that semantic measures invert it: Furstenberg's topological proof produces exactly Euclid's witness. A replication in Lean 4/Mathlib (3 theorems, 19 proofs, 18 measures) confirms that dependency-closure measures track intuition best, and shows that equality of normal forms never holds between differently written versions of the same argument, that proofs by citation look unlike the arguments they cite, and that proof irrelevance cannot distinguish any two proofs. We argue for reporting dissimilarity as a multi-level profile, extend the measures to proofs of different theorems, and discuss uses, from detecting duplicated AI proofs and orchestrating prover agents to interpreting AI proofs via their nearest human-understandable counterparts. Code, Lean sources and data are released.
Figures & tables
| Proof | steps | lemmas | deps | reducts | nominal strength | ||
|---|---|---|---|---|---|---|---|
| E | 74 | 78 | 7 | 5 | 13 | 128 | I +exp |
| E ′ | 94 | 78 | 7 | 5 | 13 | 10 | I +exp |
| E + | 119 | 121 | 8 | 7 | 15 | 256 | I +exp |
| G | 92 | 86 | 3 | 6 | 17 | 8 | I +exp |
| F | 101 | 94 | 7 | 10 | 23 | 128 | third-order |
| similarity | robustness | ||||
| Metric (Group) | (E,E ′ ) | (E,G) | (E,F) | order | (E,E + ) |
| same | similar | dissimilar | same | ||
| Raw TED (Syntactic) | 0.512 | 0.500 | 0.514 | ✗ | 0.756 |
| -TED (Syntactic) | 0.560 | 0.500 | 0.514 | 0.756 | |
| NF-TED (Syntactic) | 1.000 | 0.512 | 0.552 | 0.779 | |
| Rule-profile (Syntactic) | 1.000 | 0.729 | 0.643 | ✓ | 0.833 |
| Metric (Group) | P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Raw TED (Syntactic) | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✗ | ✓ | ✗ | 6 |
| -TED (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ | ✗ | 7.5 | |
| NF-TED (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | 8 | ||
| Rule-profile (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | 8.5 | |
| Flow-linking (Structural) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | 8.5 | |
| Hypothesis-usage (Structural) | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | 6.5 |
| Pair | text | text | term | term |
|---|---|---|---|---|
| (E,E ′ ) | 0.694 | 0.683 | 0.070 | 0.070 |
| (E,G) | 0.696 | 0.621 | 0.571 | 0.500 |
| (E,F) | 0.728 | 0.683 | 0.648 | 0.468 |
| (E,E + ) | 0.170 | 0.061 | 0.272 | 0.101 |
| Theorem | Proof | Role | Idea |
|---|---|---|---|
| Primes | E | base | Euclid: least prime factor of , by contradiction |
| no finite is | E ′ | same | Euclid as a lemma (“every finite set of primes misses one”) plus corollary |
| the set of primes | E + | finer | E with via and via |
| M | similar | Mathlib’s Nat.exists_infinite_primes (least prime factor of ) | |
| G | similar | Goldbach: Fermat numbers are pairwise coprime, plus pigeonhole | |
| F | dissimilar | Furstenberg: the arithmetic-progression topology on , built from scratch |
| Theorem | Proof (role) | tokens | premises | closure | axioms | ||
|---|---|---|---|---|---|---|---|
| primes | E (base) | 211 | 62 | 287 | 33 | 5435 | propext, choice, sound |
| primes | E’ (same) | 204 | 28 | 302 | 33 | 5435 | propext, choice, sound |
| primes | E+ (finer) | 348 | 107 | 609 | 38 | 3920 | propext, choice, sound |
| primes | M (similar) | 56 | 31 | 151 | 20 | 3667 | propext, choice, sound |
| primes | G (similar) | 184 | 104 | 226 | 39 | 6145 | propext, choice, sound |
| primes | F (dissimilar) | 869 | 116 | 122* | 88 | 5842 | propext, choice, sound |
| mean similarity to base | robustness | |||||
|---|---|---|---|---|---|---|
| Metric (Group) | same | similar | dissimilar | order | finer | |
| Source-edit (Syntactic) | 0.266 | 0.168 | 0.186 | 1 | 0.453 | |
| Term-TED † (Syntactic) | 0.479 | 0.341 | 0.236 | 1 | 0.429 | |
| NF-TED † (Syntactic) | 0.806 | 0.401 | 0.135 | ✓ | 3 | 0.463 |
| Rule-profile (Syntactic) | 0.758 | 0.523 | 0.129 | ✓ | 3 | 0.432 |
| Vocabulary (Structural) | 0.933 | 0.498 | 0.261 | 2 | 0.685 | |
| Metric (Group) | P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | P9 | P10 | score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Source-edit (Syntactic) | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ | ✓ | 7.5 | |
| Term-TED (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ | ✗ | 6 | ||
| NF-TED (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✗ | 7 | ||
| Rule-profile (Syntactic) | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ | 6.5 | |||
| Vocabulary (Structural) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 8 | ||||
| Typeclass-footprint (Structural) | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✓ | 6.5 |
| Theorem | Proof | role | Module-EMD | IDF-weighted | closure-based |
|---|---|---|---|---|---|
| primes | E ′ | same | 0.989 | 1.000 | 1.000 |
| primes | E + | finer | 0.940 | 0.960 | 0.843 |
| primes | M | similar | 0.844 | 0.720 | 0.865 |
| primes | G | similar | 0.792 | 0.828 | 0.959 |
| primes | F | dissimilar | 0.608 | 0.818 | 0.907 |
| primes | Eu | dissimilar | 0.532 | 0.639 | 0.840 |
| Measure | Primes | Gauss | Mean | Pooled | Pooled (no finer) | ||
| Source-edit | 0.016 | ||||||
| Term-TED | 0.138 | ||||||
| NF-TED | |||||||
| Rule-profile | 0.008 | ||||||
| Vocabulary | |||||||
| Typeclass-footprint | 0.050 |
| Theorem | Proof | role | library equivalent in closure | chain length |
|---|---|---|---|---|
| primes | E | base | – | – |
| primes | E ′ | same | – | – |
| primes | E + | finer | – | – |
| primes | M | similar | Nat.exists_infinite_primes | 0 |
| primes | G | similar | – | – |
| primes | F | dissimilar | – | – |
| Measure | within | across | most similar cross-theorem pair | |
|---|---|---|---|---|
| Dependency-Jaccard | 0.58 | 0.50 | M (Primes) – I + (Gauss) | 0.76 |
| Direct-premises | 0.26 | 0.11 | T ( ) – B (Gauss) | 0.37 |
| Vocabulary | 0.43 | 0.22 | G (Primes) – Gp (Gauss) | 0.43 |
| Rule-profile | 0.33 | 0.22 | E + (Primes) – Gp (Gauss) | 0.85 |
| Binder-profile | 0.28 | 0.17 | E ′ (Primes) – V ( ) | 0.81 |
| Module-EMD | 0.75 | 0.69 | G (Primes) – Gp (Gauss) | 0.88 |
| Use | Properties needed | Candidate measures (kernel study / Lean study) |
|---|---|---|
| Contamination / recall detection | P4, P5, P9 | Dependency-Jaccard/GED, Direct-premises; NF-TED within normal-form classes |
| Diversity of generated proofs (distinct-proof@ ) | P4, P5, P6, P7 | Dependency-GED, Module-EMD, Flow-linking; Identification-level as a coarse filter |
| Orchestrating prover agents for complementarity | P4–P7 | dependency and lemma-trajectory measures (Dependency-GED, Direct-premises); a profile for robustness |
| Interpreting AI proofs via nearest human proofs | P5, P7, P8 | Dependency-Jaccard, NF-TED; Module-EMD for area context |
| Triage of informal LLM proofs | P10, P7 | NCD-text (weak); MSC-/Module-EMD and dependency alignment after extracting cited results |
| Autoformalisation fidelity | P5, P7, P10 | dependency and vocabulary alignment between informal and formal proof |