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:

CLAIM:¬∃S.Fin⁡(S)∧((∀p.p∈S→Prime⁡(p))∧(∀p.Prime⁡(p)→p∈S))\text{CLAIM}: \quad \neg \exists S. \operatorname{Fin}(S) \wedge ((\forall p. p \in S \to \operatorname{Prime}(p)) \wedge (\forall p. \operatorname{Prime}(p) \to p \in S))

"no finite set is exactly the set of primes." The three conjuncts are called Fin, AllPrime, and Cover.

The five proofs are:

ProofIntuitionDescription
EbaseEuclid: least prime factor of ∏S+1\prod S + 1, by contradiction
E′sameEuclid as a lemma ("every finite set of primes misses one") plus corollary
E+sameE with finer granularity (expanded divisibility steps)
GsimilarGoldbach: Fermat numbers Fi=22i+1F_i = 2^{2^i}+1 are pairwise coprime, plus pigeonhole
Fvery dissimilarFurstenberg: arithmetic-progression topology on Z\mathbb{Z}

Methodology

The Curry–Howard Kernel

The paper implements a small kernel (proofdist/logic.py) for intuitionistic first-order natural deduction with proof terms:

M:=h∣c∣λh:A.M∣MN∣Λx.M∣Mt∣⟨M,N⟩∣π1M∣π2M∣pack⁡(t,M)∣…M := h \mid c \mid \lambda h: A. M \mid M N \mid \Lambda x. M \mid M t \mid \langle M, N \rangle \mid \pi_1 M \mid \pi_2 M \mid \operatorname{pack}(t, M) \mid \ldots

Reduction is β,∀β,∧β,∃β\beta, \forall\beta, \wedge\beta, \exists\beta and ζ\zeta (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)|stepslemmasdepsreductsnominal strength
E74787513128IΔ0+expI\Delta_0+exp
E′9478751310IΔ0+expI\Delta_0+exp
E+1191218715256IΔ0+expI\Delta_0+exp
G928636178IΔ0+expI\Delta_0+exp
F1019471023128third-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⋆: d=∣σ(A)−σ(B)∣/6d = |\sigma(A) - \sigma(B)| / 6 where σ\sigma is the strongest foundation level
  • MSC-EMD⋆: earth mover's distance over MSC2020 subject codes
  • Size-ratio: 1−min⁡(∣nfA∣,∣nfB∣)/max⁡(∣nfA∣,∣nfB∣)1 - \min(|\text{nf}A|, |\text{nf}B|) / \max(|\text{nf}A|, |\text{nf}B|)

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

PropertyDefinition
P1 Reflexivityd(X,X)=0d(X,X) = 0
P2 Symmetryd(X,Y)=d(Y,X)d(X,Y) = d(Y,X)
P3 Triangle inequalityon all triples
P4 α-invarianced(E,αE)=0d(E, \alpha E) = 0
P5 Bureaucracy invarianced(E,E′)≤0.05d(E, E') \leq 0.05
P6 Granularity robustnessd(E,E+)<min⁡(d(E,G),d(E,F))d(E, E^+) < \min(d(E,G), d(E,F))
P7 Discriminationd(E,G)>0.05d(E,G) > 0.05 and d(E,F)>0.05d(E,F) > 0.05
P8 Intuitive orderingd(E,E′)<d(E,G)<d(E,F)d(E,E') < d(E,G) < d(E,F)
P9 Effective computabilitydecidable and feasible
P10 Informal applicabilityapplicable to proofs as mathematicians write them

Empirical Validation / Results

Kernel Study Results (Table 2)

Key findings on similarity scores s=1−ds = 1 - d:

Metric (Group)(E,E′) same(E,G) similar(E,F) dissimilarOrder
Raw TED (Syntactic)0.5120.5000.514✕
NF-TED (Syntactic)1.0000.5120.552∼
Flow-linking (Structural)1.0000.1250.083✓
Dependency-Jaccard (Dep.)1.0000.4290.333✓
Dependency-GED (Dep.)1.0000.5000.405✓
MSC-EMD (Dep.)1.0000.6520.407✓
Herbrand-witness (Semantic)1.0000.1601.000✕
NCD-term (Info.)0.9300.4290.352✓
Identification-level (Higher-cat.)0.7500.0000.250∼

Key findings:

  1. 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.
  2. Normalisation identifies E and E′ exactly (NF-TED = 1), but then fails to separate G from F.
  3. 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.
  4. Every semantic measure inverts intuition: The Herbrand witness of F equals that of E on all 1024 test sets, w(S)=lpf(1+ΠS)w(S) = \text{lpf}(1 + \Pi S).

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:

TheoremProofs (roles)
Primes infiniteE (base), E′ (same), E+ (finer), M (similar), G (similar), F (dissimilar), Eu (dissimilar)
2\sqrt{2} irrationalP (base), P′ (same), P+ (finer), T (similar), V (similar), R (dissimilar)
Gauss's sumI (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 ρ=0.91\rho = 0.91), followed by NF-TED (0.83) and Dependency-Jaccard (0.82).
  • Pooled across theorems, Vocabulary is best (ρ=0.81\rho = 0.81).

Relative circularity check (Table 11):

  • M cites Nat.exists_infinite_primes directly.
  • 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

  1. 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.

  2. 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.

  3. Semantic identity can reveal "proofs in disguise": Furstenberg's topological proof computes exactly Euclid's witness (lpf(1+ΠS)\text{lpf}(1 + \Pi S)), confirming Mercer's observation that "Furstenberg's proof is Euclid's."

  4. Equality of normal forms is too fine for proofs as actually written in a proof assistant with tactics.

Practical Applications (Section 9)

UseProperties neededCandidate measures
Contamination/recall detectionP4, P5, P9Dependency-Jaccard/GED, Direct-premises
Diversity of generated proofsP4–P7Dependency-GED, Module-EMD, Flow-linking
Orchestrating prover agentsP4–P7Dependency-GED, Direct-premises
Interpreting AI proofsP5, P7, P8Dependency-Jaccard, NF-TED
Triage of informal LLM proofsP10, P7NCD-text (weak)
Clustering proof familiesP1–P3, P6, P8Dependency measures, MSC-EMD
Novelty-driven proof searchP4–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:

  1. Identification level at which two proofs meet (same term, same normal form, same premises, same computational content, same area, or only the same theorem).
  2. Within-level distance ranking pairs at that level (NF-TED, Dependency-GED).
  3. 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