Summary (Overview)

  • LeanReviewBench is a new benchmark for project-level semantic alignment review in Lean formalization projects, containing 197 versioned inputs from 18 real Lean projects, with 87 aligned and 110 misaligned reference judgments.
  • The benchmark evaluates whether selected Lean declarations, interpreted through their project dependencies, preserve the mathematical content of independently sourced informal targets—addressing the gap between Lean's kernel verification and faithful specification.
  • A novel construction pipeline combines development-history discovery, independent target binding, reconstruction under a common Lean 4.34.1 environment, and GPT-6 Astra annotation with human review of uncertain cases.
  • The collection includes 69 historical pairs (138 inputs) capturing real development changes, spanning diverse mathematical domains including analysis, number theory, geometry, probability, and applied modeling.
  • Baseline evaluations of six language models show GPT-6.1 Sol with Direct prompting achieves the highest accuracy (0.827) and misalignment-detection F1 (0.844); prompting effects vary significantly across models.

Introduction and Theoretical Foundation

Background and Motivation

The paper addresses a critical gap in formal verification: while Lean provides machine checking of formal proofs, proof correctness does not guarantee faithful specification. The authors highlight a concrete example from OpenAI's HyperbolicObstruction manuscript, where the informal source requires a two-dimensional simplicial complex, but the formalization omits this requirement.

The Semantic Alignment Problem

In large Lean projects, alignment becomes more difficult because:

  • A theorem's meaning can depend on project-defined predicates, structures, and quantitative expressions distributed across files.
  • A condition absent from the displayed theorem type may be encoded in a structure field.
  • A predicate with an appropriate name may omit a substantive requirement.

As the paper notes, for the Brownian Motion project's main theorem, Lean Atlas illustrates a dependency cone of 227 nodes, from which Lean Compass selects only 14 nodes for semantic verification.

Task Definition

Each review instance is a triple:

xt=(It,Ft,C)x_t = (I_t, F_t, \mathcal{C})

comprising:

  • ItI_t: an informal target (source-grounded mathematical claim with source definitions, notation, and standing assumptions)
  • FtF_t: one or more selected Lean declarations (roots) that jointly express the target
  • C\mathcal{C}: a formal dependency context supplying the dependencies needed to interpret the roots

The reviewer returns a binary prediction:

y^t∈{aligned, misaligned}\hat{y}_t \in \{\text{aligned, misaligned}\}

Aligned means FtF_t, interpreted through C\mathcal{C}, preserves the mathematical content of ItI_t, allowing equivalent reformulations. Misaligned identifies a substantive semantic discrepancy, including strict strengthening or weakening of the target.

Methodology

Data Source Selection

Three criteria guide repository selection:

  1. Recent mathematical development: Substantive formalization activity in 2026
  2. Traceable development history: Commits, issues, or PRs allowing location of mathematical changes
  3. Source-grounded project-level formalization: Coherent theory with identifiable mathematical source

Excluded repositories (OpenAI, Anthropic) lack traceable development history.

Construction Pipeline

The pipeline consists of five stages:

1. Historical Discovery: Inspect author reports, documentation, commits, issues, and PRs to identify candidate roots and recover relevant source revisions. Snapshots are linked as before/after pairs when possible.

2. Independent Target Binding: Each root is bound to an identifiable mathematical claim from a paper, blueprint, or specification. Historical records guide discovery, but alignment is judged against the mathematical target independently.

3. Historical Reconstruction: Reconstruct historical sources under Lean 4.34.1 with pinned dependencies. File-level selection reduces scope (e.g., FormalSLT: from 119 files to 9 files containing ~80 declarations).

4. Dependency Context Extraction: Using LeanTrace, extract roots and declaration dependencies from the compiled environment. The traversal:

  • Follows declaration dependencies from roots' elaborated types and defining values
  • Includes predicate definitions and constructor types exposing inductive, structure, and class constraints
  • Retains mathematical definitions while excluding proof bodies (replaced by sorry)
  • Retains external-library references with identities and types but does not expand recursively

5. Reference Review: GPT-6 Astra in Codex provides initial annotations; uncertain cases go to a human annotator. Misalignment judgments include mathematical explanations tied to the informal target.

Misalignment Classification

Discrepancies are classified into five categories:

  • O: Object and concept mismatch (identity or interpretation of mathematical objects)
  • A: Applicability mismatch (input domains or substantive premises)
  • Q: Quantification mismatch (quantifier structure or witness dependence)
  • F: Formula and quantitative mismatch (mathematical expressions or quantitative relations)
  • P: Property and coverage mismatch (required properties or conclusion coverage)

Empirical Validation / Results

Data Distribution

Table 2: Source repositories and mathematical categories (selected rows)

RepositoryCategoryRootsInputs
AlexKontorovich/PrimeNumberTheoremAndAnalytic number theory2140
nikhgarg/AppliedModelingLibApplied modeling and economics2630
teorth/pfrAdditive combinatorics1424
qinzlyang/differential-geometryDifferential geometry and topology1015
Verified-zkEVM/ArkLibCryptographic protocols712
frenzymath/Poincare-ConjectureRiemannian geometry1211
thefundamentaltheor3m/Sphere-Packing-LeanDiscrete geometry69

Key statistics:

  • 197 versioned inputs with 87 aligned and 110 misaligned labels
  • 69 historical pairs covering 138 inputs (70.1%)
  • Median formal context size: 10 project-local declaration nodes (range 1–425)
  • Applicability mismatch is most frequent (48 inputs), followed by formula/quantitative (30), property/coverage (26), object/concept (22), and quantification (8)

Model Evaluation

Table 3: Comparison of prompting strategies on 197 evaluation instances

ModelPromptAccuracyValid outputPrecisionRecallF1
GPT-6.1 SolDirect0.8271960.8810.8090.844
GPT-6.1 SolReForm0.7461940.7210.9270.811
Qwen3.8 MaxDirect0.6141930.8210.4260.561
Qwen3.8 MaxReForm0.6501910.8000.5560.656
Kimi K3.1 ProDirect0.7011960.8710.5550.678
Kimi K3.1 ProReForm0.7771920.8630.7590.808
Qwen3.8 27BDirect0.6091660.7950.6520.716
Qwen3.8 27BReForm0.5331410.7420.6970.719
Gemma 4 E4BDirect0.4921880.7100.2120.326
Gemma 4 E4BReForm0.137420.7890.5770.667
Jev 1.14Direct0.6451950.8280.4820.609
Jev 1.14ReForm0.6501900.6670.8190.735

Prompt Sensitivity Analysis

  • ReForm improves F1 for 5 of 6 models (GPT-6.1 Sol is the exception), particularly for Gemma 4 E4B (0.326 → 0.667)
  • ReForm produces fewer valid outputs than Direct for all six models
  • ReForm increases recall but reduces precision for GPT-6.1 Sol, Qwen3.8 Max, and Jev 1.14
  • The tradeoff matters: false negatives allow discrepancies to pass undetected; false positives incur review costs

Reliability of Judgment Reasons

The paper demonstrates that correct binary verdicts can coexist with explicit mathematical errors in explanations. In the arklib:sumcheck-full-rbr-after case, GPT-6.1 Sol predicts misaligned correctly but dismisses the algebraic mismatch with a false claim about finite commutative domain semirings admitting field structure.

The counterexample uses the Boolean semiring:

B={0,1},a+b:=a∨b,a⋅b:=a∧bB = \{0, 1\}, \quad a + b := a \vee b, \quad a \cdot b := a \wedge b

This is a finite commutative semiring satisfying cancellation (its only nonzero element is the multiplicative identity), yet 1+x=11 + x = 1 for every x∈Bx \in B, so 1 has no additive inverse—these operations cannot extend to a field structure.

Theoretical and Practical Implications

Contributions to Semantic Alignment Research

LeanReviewBench uniquely combines three features absent from prior benchmarks:

  1. Project interpretation context (dependency-based, not just root statements)
  2. Discovered errors from real formalization work (not constructed perturbations)
  3. Development-history-based construction under a fixed Lean 4.34.1 environment

Comparison with Prior Benchmarks

BenchmarkLeanContextDiscoveredHistoryPublic
FormalAlign4.7.0-rc2✕✕✕√
ProofNetVerif4.8.0✕√✕√
CriticLeanBenchN/S✕√✕√
ConsistencyCheckN/S✕√✕√
MA-Align4.24.0✕√✕√
FormalRx-Test4.24.0✕✕✕▲
DriftBenchN/S✕√✕✕
FaithAlignN/S√▲✕✕
LeanReviewBench4.34.1√√√√

Practical Applications

  • Screening workflows: Models predicting misalignment can trigger further human review; the precision/recall tradeoff informs deployment decisions
  • Version comparison: The 69 historical pairs support research on semantic change localization and repair review
  • Dependency-based review: Demonstrates that excluding proof bodies while retaining mathematical definitions provides sufficient context for semantic judgments

Conclusion

LeanReviewBench provides a testbed for reviewing semantic correspondence in existing mathematical formalization projects. The benchmark's key strengths are its grounding in real development history, independent target binding, and dependency-based interpretation context.

Limitations

  • Without a context ablation, the contribution of supplied dependencies is not established
  • Uneven project contributions (PrimeNumberTheoremAnd, AppliedModelingLib, and PFR contribute 94 of 197 inputs) limit generalization
  • Model-provided reasons may be unreliable even when labels are correct

Future Directions

  1. Context ablation studies to quantify the value of dependency context
  2. Project-by-project and case-group reporting for more nuanced evaluation
  3. Reason validity assessment alongside label correctness to evaluate whether automated judgments provide reliable mathematical evidence
  4. Version comparison tasks leveraging the 69 historical pairs for semantic change localization

The benchmark is publicly available at https://github.com/MechMath/LeanReviewBench.

Related papers