arXiv:2611.02843cs.LONov 2026

Manuscript Offprint

arXiv:2611.02843

Math Foundation Formalization Agent: A General-Purpose Approach to Formalizing Mathematical Foundations

Jiaxin Xie, Guowei Dou, Xiang Ji, Wensheng Yu

Jiaxin Xie, Guowei Dou, Xiang Ji, and Wensheng Yu

School of Electronic Engineering, Beijing University of Posts and Telecommunications, Beijing, China

xiejx@bupt.edu.cn, dgw@bupt.edu.cn, jxxxx2001@bupt.edu.cn, wsyu@bupt.edu.cn

Abstract. Mathematical formalization plays an important role in establishing rigorous and machine-verifiable foundations for mathematical reasoning. With the development of large language models (LLMs) and interactive theorem provers, intelligent agents offer a promising approach to automating the formalization of mathematical theories. This paper presents the Math Foundation Formalization Agent (MFF-Agent), a general-purpose intelligent agent designed to support formalization tasks across multiple mathematical domains. The agent integrates the reasoning capabilities of large language models with the formal verification capabilities of the Rocq proof assistant. It incorporates task classification, tool-assisted execution, verification feedback, and state-based task management to support the generation, refinement, and verification of formal proofs. Unlike an approach focused on a single mathematical theory, the agent is examined through case studies involving Morse-Kelley axiomatic set theory (MK), real numbers, propositional logic, and equivalences of the axiom of choice. These cases investigate its applicability across mathematical foundations and distinguish source-level completion, interactive verification, and reproducible compilation. The results demonstrate the feasibility of a unified operational framework for heterogeneous foundation-level tasks and clarify the gap between such a framework and a fully integrated mathematical foundation.

Keywords: Formalized mathematics · Autonomous agents · Mathematical foundations · Autoformalization.

1 Introduction

Formalized mathematics represents mathematical definitions, statements, and proofs in formal languages that can be mechanically verified by proof assistants, providing a rigorous foundation for reliable mathematical reasoning and computer-assisted mathematics [1]. Over the past decades, interactive theorem provers (i.e., proof assistants) such as Rocq (formerly Coq) [2], Isabelle [3], and Lean [4] have become important tools in formal verification and computational

J. Xie et al.

logic [5]. Landmark achievements, including the machine-verified proofs of the four color theorem [6] and the Feit–Thompson theorem [7], have demonstrated the potential of formal methods for establishing mathematical results. Recent advances in large language models (LLMs) have created new opportunities for automating mathematical reasoning and proof development. Integrating LLMs with proof assistants offers a promising approach to generating proof scripts, interpreting verification feedback, and refining formal proofs through iterative interaction [8–12]. However, the formalization of mathematical foundations raises requirements that are not captured by isolated proof generation. A useful agent must handle heterogeneous requests, maintain long-lived interactions with a proof assistant, reuse declarations across related files, and determine whether the requested task has actually been completed rather than merely whether some source file compiles.

Recent research has explored diverse agent-based approaches to formal mathematical reasoning and proof development. CoqPilot integrates large language models (LLMs) with Coq to generate proof candidates and refine them using feedback from the proof assistant [11], while Numina-Lean-Agent investigates the use of a general-purpose coding agent for a broad range of formal mathematics tasks [12]. Prover Agent further coordinates informal reasoning, formal proof construction, and feedback from Lean, using auxiliary lemma generation to facilitate the discovery of proof strategies for challenging problems [13]. In a complementary direction, LeanAgent adopts a lifelong learning framework to improve generalization across mathematical domains and accumulate knowledge from successive formalization tasks [14]. More recently, Formalizing Mathematics at Scale presents AutoformBot, a multi-agent system that coordinates large-scale formalization through formal verification tools, dependency-aware task scheduling, and collaborative version control [15]. Together, these systems demonstrate substantial progress in proof generation, iterative refinement, knowledge reuse, and large-scale formalization. Their primary emphasis, however, remains proof search performance, long-horizon proof development, or a particular formalization pipeline. In contrast, the present work does not aim primarily to increase the success rate on an isolated theorem benchmark. Its focus is the operational problem of supporting heterogeneous formalization tasks and cross-file foundation artifacts within one execution model, while deciding completion from evidence returned by the proof assistant and task-specific checks.

Research objective. We develop the Math Foundation Formalization Agent (MFF-Agent), a general-purpose agent for formalizing mathematical foundations in Rocq. MFF-Agent processes different formalization requests, invokes Rocq through persistent proof-state interaction, adapts its reasoning and context management to task progress, and determines task status from explicit verification conditions rather than from the LLM's self-report alone.

Main contributions. This paper makes the following contributions:

  1. Unified operational framework for foundation-level tasks. MFF-Agent supports heterogeneous tasks, including theorem proving, file creation, modification, analysis, and compilation, across different foundational topics.

  2. Adaptive formalization process. The agent combines dual-mode reasoning, dynamic interaction with Rocq, and context management to support iterative proof development and long-running formalization tasks.

  3. Reliable task completion verification. A state-based control mechanism and task-specific completion checks distinguish successful compilation from the actual completion of the requested formalization task.

The remainder of this paper is organized as follows. Section 2 defines the success criteria for formalization tasks and introduces the evaluation harness. Section 3 presents the MFF-Agent framework, including its overall workflow, dual-mode reasoning mechanism, dynamic Rocq session management, verification-driven task completion control, and context pruning. Section 4 reports the formalization results across the selected mathematical domains and discusses the available verification evidence and current limitations. Finally, Section 5 concludes the paper and outlines directions for future work.