Manuscript Offprint

arXiv:2610.35269

MechAlign: Evaluating Semantic Alignment at the Project Level in Mathematical Formalization

Hao Shen, Ruichen Qiu, Lihong Zhi, Xiao-Shan Gao

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Lean verifies that a formal proof establishes its stated proposition under declared assumptions, but does not check whether that proposition faithfully expresses the mathematical claim in a manuscript. Assessing this correspondence requires interpreting the main theorem through its project dependencies, which may be scattered throughout a large development. We introduce MechAlign, a framework for project-level semantic alignment review that combines formal dependency extraction with LLM-based assessment. Its extraction tool, LeanTrace, constructs a statement dependency graph from elaborated declarations, retaining definition bodies and structure constraints while excluding proof bodies and stopping at an explicit library boundary. The reviewer uses this context to investigate alignment and report discrepancies with localized evidence. We conduct a preliminary review of 201 main results from 173 OpenAI Math projects, using supplied informal descriptions and available paper context. A hyperbolic-group case illustrates how dependency inspection localizes a missing dimensional constraint relative to the manuscript, consistent with the upstream declaration of formalization scope. We also construct LeanReviewBench, comprising 501 fixed claim-statement-context triples from OpenAI Math, Fermat's Last Theorem, and Kakeya, with description provenance recorded. The resource supports controlled comparisons of more project-level semantic alignment evaluations.

1 Introduction

Recent advances in large language models have enabled the generation of mathematical proofs at increasing scale [2, 7, 13, 20]. Lean formalization is also used to verify the stated results. For example, OpenAI's mathematical research collection includes Lean projects for 173 manuscripts [13]. Lean checks that a formal proof establishes its stated proposition under the declared assumptions [3], but it does not check whether that proposition faithfully expresses the mathematical claim in the manuscript. This leaves a semantic gap:

Does the statement proved in the Lean project faithfully express the mathematical claim made in the manuscript?

Answering this question requires establishing the mathematical meaning of the formal statement. In a Lean project, that meaning is determined not only by the main theorem declaration but also by the definitions and constraints it refers to.

For example, a theorem stated using a predicate defined within the project may appear to match the manuscript, even though the predicate encodes additional assumptions or a weaker conclusion. Interpreting the predicate may, in turn, require tracing its dependencies. We use project-level alignment review to mean assessing a selected formal result against its informal claim by examining the project declarations that determine the result's meaning.

Several methods can be used for project-level alignment review. A statement-only reviewer sees the main Lean declaration, but cannot inspect these supporting declarations. Providing full project access makes them available, but leaves the reviewer to locate and connect the relevant evidence. We therefore ask how to organize these declarations to support both evidence gathering and mathematical assessment.

1^{1}State Key Laboratory of Mathematical Sciences, Academy of Mathematics and Systems Science, Chinese Academy of Sciences, and University of Chinese Academy of Sciences.

∗^{*}Equal contribution.

We introduce MechAlign, a framework for project-level semantic alignment review. Its formal evidence extractor, LeanTrace, starts from a selected theorem's elaborated type and follows references through declaration types and non-proof definition bodies. It retains structural constraints and stops expansion at an explicit library boundary, producing a statement dependency graph that organizes formal evidence around the selected result. MechAlign's LLM-based reviewer inspects declarations and follows graph edges to assess alignment between the informal claim and the formal result, reporting discrepancies with supporting evidence. The extracted context supports this assessment but may not suffice to resolve every question of mathematical interpretation. Refer to Figure 1 for the structure of MechAlign.

Our primary application is OpenAI Math [13], where we inspect 201 selected main results from 173 projects and identify candidate discrepancies for further review. The HyperbolicObstruction case illustrates how inspecting a statement and its supporting structure reveals that the manuscript's two-dimensionality requirement is not explicitly retained, consistent with the upstream declaration of formalization scope. We extend the extracted contexts with 200 selected targets from Fermat's Last Theorem [1] and 100 from Kakeya [17] to construct LeanReviewBench, a resource of 501 fixed instances. Each instance pairs a supplied informal claim with a selected formal statement and includes the statement's extracted dependency context. This structure supports a controlled, reproducible comparison of statement-only, full-project, and dependency-guided review in terms of discrepancy detection, evidence localization, and review cost. Supplementary collections broaden coverage of mathematical topics and dependency structures. Because their descriptions are derived from Lean, they support consistency checks against the supplied text but do not independently establish fidelity to a manuscript. The comparative evaluation and human adjudication remain to be completed.

Our contributions are threefold:

• We formulate a project-level semantic alignment review in which a selected formal result is assessed against its informal claim through the declarations that determine its meaning.

• We introduce MechAlign, combining LeanTrace's extraction of statement dependencies with an LLM-based reviewer that inspects the resulting graph and reports localized semantic discrepancies.

• We construct LeanReviewBench, comprising 501 review instances from OpenAI Math, Fermat's Last Theorem, and Kakeya, and we define a controlled comparison of statement-only, full-project, and dependency-guided review.

References (17)