Autoformalisation: Translation of Informal to Formal Mathematics
- * Autoformalisation involves translating informal mathematical content into formal representations where syntax, types, and proofs can be verified,
Autoformalisation is the automatic translation of informal or semi-formal mathematical content into a formal representation whose syntax, types, deductions, or proofs can be checked by a proof assistant, theorem prover, model checker, planner, ontology reasoner, or other formal system. In its narrower mathematical sense, it translates definitions, theorem statements, proofs, proof sketches, or conjectures into languages such as Lean, Coq/Rocq, Isabelle, Mizar, or Agda. Broader accounts include translation into first-order logic, temporal logics, PDDL, Prolog, Answer Set Programming, OWL, RDF, and domain-specific verification languages. The task is not equivalent to ordinary text-to-code generation: it requires recovering mathematical structure, resolving implicit types and dependencies, preserving semantic intent, and producing an artifact suitable for formal validation.
1. Scope and conceptual foundations
Informal mathematics is compact, context-dependent, and tolerant of omitted steps. It may leave variable domains, quantifier scopes, definitions, type information, or library dependencies implicit. Formal systems require these details to be made explicit. A formal theorem must specify its objects, assumptions, operations, quantifiers, dependencies, and conclusion in a language with formal syntax and semantics.
Autoformalisation therefore involves at least two distinct gaps. The semantic gap arises because natural-language expressions may be ambiguous, overloaded, or context-sensitive. The logical gap arises because informal proofs omit inferences that human readers regard as obvious. A sentence such as “the claim follows from the fact that the sum of even numbers is even” may require explicit variable introductions, intermediate assertions, rewrites, and applications of lemmas in Coq or Lean.
The relationship between autoformalisation and automated theorem proving is sequential but non-identical:
Autoformalisation produces the formal target; automated theorem proving searches for a derivation of that target. A formally valid proof can nevertheless establish the wrong theorem if the translation omitted a hypothesis, changed a type, weakened a conclusion, or otherwise introduced semantic drift. This distinction is emphasized across research-level formalisation work (Weng et al., 29 May 2025).
A common abstract framework specifies:
where is the relevant domain-specific subset of an informal language, is a formal reasoning language, is the intended semantic-equivalence criterion, and is a practical validation procedure approximating . Formal acceptance is therefore not automatically semantic equivalence. A Lean declaration may compile while failing to express the intended natural-language proposition.
The scope of the field has expanded beyond theorem statements. Formal outputs may include:
- theorem statements, proof scripts, and proof sketches;
- program specifications, Hoare triples, and loop invariants;
- first-order theories and logic programs;
- temporal-logic formulas;
- planning domains and action models;
- OWL ontologies, RDF graphs, and structured knowledge bases;
- scientific and engineering specifications.
This broader interpretation is proposed as a common framework for translating domain-specific informal language into formal reasoning languages (Mensfelt et al., 11 Sep 2025).
2. Formal targets, proof assistants, and verification
The principal mathematical target languages include Lean and Lean 4, Coq/Rocq, Isabelle/HOL, Mizar, and Agda. They provide formal syntax, elaboration or type checking, libraries, tactics, proof states, and trusted kernels or checkers. Lean and Mathlib4 are particularly prominent in recent work because they combine dependent type theory, extensive mathematical libraries, an interactive environment, and compiler feedback.
Coq-based autoformalisation experiments treat translation as a sequence-to-sequence semantic-parsing task:
The output contains both a formal theorem statement and a proof script intended to be accepted by Coq. The input may contain definitions, explanatory prose, intermediate claims, quantified variables, arithmetic expressions, references to earlier facts, programs, and Hoare triples. The generated script is submitted to Coq, which determines whether the formal proof is accepted (Cunningham et al., 2023).
In Hoare-logic formalisation, the relevant target is a program-correctness proposition. Sequential composition, assignment, and consequence rules become explicit formal proof steps. For example, a program consisting of sequential assignments can be formalized through applications of hoare_seq, hoare_asgn, and hoare_consequence_pre. Intermediate assertions are not merely explanatory: they are the formal interfaces linking successive commands.
Lean-based systems commonly distinguish:
- syntax checking, which determines whether a declaration parses;
- type checking, which checks identifiers, types, implicit arguments, and type-class constraints;
- compilation or elaboration, which validates the declaration in a specified environment;
- proof checking, which verifies that a proof term or tactic script closes the theorem;
- semantic evaluation, which assesses whether the formal statement matches the informal source.
This distinction is central to evaluation. Type checking is a useful and deterministic precursor to correct translation, but it does not ensure semantic equivalence. Sampling and filtering candidate Lean statements with the Lean checker improved GPT-4o’s ProofNet accuracy from to , an absolute gain of 0 percentage points, although the surviving statements still required semantic evaluation (Poiroux et al., 2024).
Recent systems integrate compiler feedback directly into generation. In process-supervised approaches, the first Lean error location labels earlier proof steps as correct and the erroneous step and subsequent steps as incorrect. This provides denser supervision than assigning the same success or failure label to every step of a candidate proof (Lu et al., 2024).
Other systems combine syntax checking with semantic-consistency judgments. Autoformalizer with Tool Feedback uses a Lean 4 compiler for syntax correction and multiple LLM judges for consistency validation. Its workflow requires syntax checking after every revision and permits semantic checking only after syntax succeeds. It distinguishes syntactic validity from semantic consistency and does not treat statements ending in by sorry as proved (Guo et al., 8 Oct 2025).
3. Data construction and representation
The scarcity of aligned informal–formal data is a central bottleneck. Human formalisation is expensive because it requires mathematical expertise and knowledge of the target proof assistant, library conventions, namespaces, coercions, and type systems. Several strategies have therefore been developed to expand training data.
Synthetic and grammar-based data
Early experiments used manually designed examples to construct grammars controlling theorem structure, proof structure, definitions, variable and constant placement, sublemmas, proof direction, coreference, additional conditions, and linguistic variation. Arithmetic examples covered parity, composite numbers, and powers; a separate dataset covered polynomial programs annotated with Hoare logic. These experiments generalized well to intermediate theorem and program lengths but failed beyond the largest lengths observed during training, and performance declined substantially on 45 human-written examples (Cunningham et al., 2023).
Reverse formal-to-informal generation
The MMA dataset reverses the usual direction. GPT-4 generated informal descriptions from formal statements drawn from the Archive of Formal Proofs and Mathlib4. The resulting corpus contains approximately 332K informal–formal pairs: 244,238 Isabelle statements and 88,536 Lean4 statements. A 33-billion-parameter LLaMA model fine-tuned on this multilingual corpus produced 1 of sampled miniF2F and ProofNet statements that were judged acceptable with no or minor corrections, compared with 2 for the base model (Jiang et al., 2023).
Reverse translation is attractive because formal statements contain explicit types, assumptions, and structural information that informal prose may omit. It is nevertheless noisy: generated descriptions may omit type constraints, alter assumptions, or misinterpret library-specific definitions. The resulting corpus is therefore a scalable approximation to a parallel corpus rather than a fully human-verified gold standard.
Research-level theorem data
arXiv2Formal contains 50 theorem statements sampled from arXiv mathematics papers and paired with Lean 3 formalizations. It targets unlinked formalisation, in which theorem statements may contain provisional names, unresolved definitions, or incomplete type information. The proposed decomposition separates:
- unlinked theorem formalisation;
- unlinked definition formalisation;
- entity linking;
- type adjustment;
- theorem proving as a later stage.
GPT-3.5 performance improved with in-context examples: BLEU increased from 3 without demonstrations to 4 with ten examples, while TER decreased from 5 to 6. The benchmark emphasizes that research mathematics depends on document-level context, definitions, library entities, and implicit types, rather than only on isolated theorem statements (Patel et al., 2023).
Lean 4 statement-and-proof corpora
FormL4 contains approximately 70,000 Mathlib 4 theorems with complete statements and proofs. GPT-4 generated natural-language problems and proof explanations from these formal developments. Filtering produced 14,510 training examples, 970 random-test examples, 981 basic-test examples, and a 1,000-example real test set. Unlike statement-only benchmarks, FormL4 evaluates complete question–answer, theorem-statement, and proof-generation chains (Lu et al., 2024).
Knowledge-retrieval corpora
CRAMF constructs a concept-definition knowledge base from Mathlib4, indexing more than 26,000 formal definitions and over 1,000 core mathematical concepts. It links informal concepts, natural-language explanations, and Mathlib declarations. Conceptual retrieval is used to reduce hallucinated predicates, incorrect namespaces, incompatible types, and version mismatches. Across miniF2F, ProofNet, and AdvancedMath, CRAMF improved formalization accuracy, with a reported maximum relative improvement of 7 on AdvancedMath for DeepSeek-V3 (Lu et al., 9 Aug 2025).
Scientific and cross-domain data
FormalPhysics contains 200 university-level physics problems and solutions, primarily in quantum mechanics and electromagnetism, paired with Lean4 formal representations. It includes natural-language statements, informal derivations, formal statements, and complete formal proofs. The corpus achieved 8 Lean formal validity, but its logical-preservation and mathematical-consistency scores were approximately 9 and 0, demonstrating that compilation does not guarantee preservation of scientific meaning (Meadows et al., 24 Apr 2026).
4. Architectures and methodological paradigms
Autoformalisation systems range from grammar-based parsers to LLMs with retrieval, self-refinement, process supervision, and reinforcement learning.
Grammar-based and semantic-parsing systems
Rule-based systems use controlled natural languages, explicit grammars, abstract syntax trees, semantic representations, and deterministic linearization into formal code. Their advantages include interpretability, controllable syntax, and predictable behavior. Their limitations include brittle coverage, high rule-engineering cost, and difficulty handling ordinary mathematical prose.
A Universal Transformer-style semantic parser for Coq used recurrent encoder and decoder passes, relative positional representations, and a copying mechanism for mathematical variables, constants, and user-defined terms. Indexed placeholders such as <var1> and <nat1> preserve coreference while supporting renaming generalization. Relative positional representations improved generalization to unseen intermediate lengths compared with absolute positional encodings (Cunningham et al., 2023).
Large-language-model generation
LLMs support few-shot prompting, supervised fine-tuning, synthetic data construction, back-translation, reinforcement learning with verifier feedback, retrieval, proof-state conditioning, and candidate sampling. They are effective at interpreting varied mathematical language and generating formal syntax, but they may invent definitions, select incorrect types, omit assumptions, or produce formally valid but semantically wrong statements.
The ThinkingF pipeline separates formal-language knowledge from informal-to-formal reasoning. It constructs a large formal-knowledge dataset and a smaller reasoning-trajectory dataset with expert-designed templates. StepFun-Formalizer-7B and StepFun-Formalizer-32B use supervised fine-tuning followed by reinforcement learning with BEq rewards. The 32B model achieved BEq@1 scores of 1 on FormalMATH-Lite and 2 on ProverBench (Wu et al., 6 Aug 2025).
Retrieval-augmented formalisation
Retrieval may target definitions, type structures, lemmas, theorem statements, namespaces, imports, or proof-state transitions. CRAMF emphasizes concept-level retrieval rather than only theorem retrieval. It uses contextual query augmentation, symbol-level matching, semantic similarity retrieval, and reranking. This addresses conceptual polymorphism: a phrase such as “neighborhood,” “group,” or “derivative” can correspond to different formal objects depending on domain and context (Lu et al., 9 Aug 2025).
Tool feedback and process supervision
Compiler diagnostics provide exact, version-specific information about syntax, names, imports, types, and tactic failures. Process-supervised verifiers learn from first-error locations rather than only final compilation outcomes. Tool-integrated systems can generate candidates, compile them, inspect errors, revise them, and repeat.
ATF combines a Lean syntax tool and a multi-LLM consistency tool. Its training pipeline consists of cold-start tool-protocol supervision, expert iteration, and Direct Preference Optimization. On CombiBench, consistency Pass@1 increased from 3 after cold start to 4 after expert iteration and 5 after DPO (Guo et al., 8 Oct 2025).
ReForm treats semantic self-validation as part of generation. The model alternates between a formal statement and a critique of its semantic fidelity, using Prospective Bounded Sequence Optimization to assign position-specific rewards to critiques and later corrections. ReForm-32B improved average semantic consistency by 6 percentage points over the strongest comparable baseline across miniF2F, ProofNet, PutnamBench, and AIME2025 (Chen et al., 28 Oct 2025).
Intermediate representations
Relaxed Natural Formal Language provides an intermediate representation closer to ordinary mathematical writing than Lean or Isabelle. It permits partially specified terms, overloaded notation, free variables, and unresolved scopes. A later elaboration stage transforms it into Core NFL, generates proof gaps, and uses a domain-specific tactic language and mathematical solvers to discharge those gaps. LoRA fine-tuning achieved 7 pass@1 and 8 pass@3 for Relaxed NFL generation, although full end-to-end theorem-prover certification was not reported (Hui et al., 23 Jun 2026).
Cross-domain structural transfer
TopoAlign reorganizes Python repositories into code autoformalisation examples consisting of a problem description, dependency functions, and a root function. This mirrors the structure of an informal mathematical problem, supporting lemmas, and a formal theorem statement. The method uses function-level dependency trees, generated descriptions, and aligned code–mathematics training. For DeepSeek-Math, TopoAlign improved MiniF2F validation BEq@10 from 9 with mathematics-only training to 0, and MiniF2F test BEq@10 from 1 to 2 (Li et al., 13 Oct 2025).
5. Evaluation, equivalence, and semantic fidelity
Evaluation is difficult because multiple formal representations can express the same mathematics, while a formally valid representation can still be semantically wrong.
Surface metrics
BLEU, TER, exact match, and token-level accuracy are easy to compute but primarily measure similarity to a reference string. They penalize legitimate alternative theorem statements and proofs. In theorem proving, two different Coq scripts may both be valid, and a generated theorem may be correct even when it differs textually from the reference.
Compilation and type checking
Compilation establishes that the formal artifact is accepted by a particular environment. It may certify syntax, elaboration, identifiers, imports, and types, or, depending on the experiment, a complete proof. It does not determine whether the theorem expresses the original informal content.
The distinction is especially visible in physics. A theorem involving quantum operators may be formalized as an identity over complex scalars. Lean then proves a valid algebraic proposition, but not the intended statement about Hilbert-space operators or non-commutative canonical commutation relations (Meadows et al., 24 Apr 2026).
Formal equivalence
BEq and BEq+ attempt to recognize semantic equivalence between generated and reference formal statements. Bidirectional equivalence requires proof of both directions, often with restricted tactics or Lean’s exact?. BEq@3 measures whether at least one of 4 generated candidates is equivalent to the reference.
These metrics are stronger than string matching but remain incomplete. A valid equivalence may be rejected because the checker cannot find the required proof, while two semantically distinct statements may be accepted if the allowed background theory proves both directions through overly permissive reasoning.
Human and LLM semantic judgments
Human experts assess whether a statement preserves the meaning of the informal source, including assumptions, variable domains, quantifier scope, conclusions, and intended mathematical structures. LLM judges are more scalable but introduce evaluator bias and imperfect reliability.
ConsistencyCheck contains 859 expert-annotated items for evaluating semantic judges. It found semantic errors in 5 of miniF2F human-written formal statements and 6 of ProofNet human-written formal statements. The best reported judge achieved 7 classification accuracy, showing both that semantic evaluation is difficult and that formalisation references may themselves contain errors (Chen et al., 28 Oct 2025).
Conjecture-sensitive evaluation
Many mathematical problems ask for an answer rather than state the full proposition to be formalized. Autoformalisation then requires a prior conjecturing stage: determining a numerical answer, extremal bound, set, function, or truth value. A proof assistant can verify an incomplete conjecture, such as one root of an equation, without establishing that it is the complete answer.
ConjectureBench separates seen evaluation, in which the correct conjecture is supplied, from unseen evaluation, in which the model must infer it. For GPT-4.1, ConJudge@1 fell from 8 in the seen setting to 9 in the unseen setting; Lean-FIRe increased unseen ConJudge@1 to 0. Standalone conjecture generation was substantially harder, with GPT-4.1 achieving only 1 equiv_rfl@1 overall (Sivakumar et al., 13 Oct 2025).
Semantic drift
Semantic drift denotes a mismatch between the source meaning and the proposition actually formalized. It includes:
- changing variable domains or types;
- omitting hypotheses or boundary conditions;
- altering quantifier scope;
- changing strict to non-strict inequalities;
- adding unsupported conclusions;
- formalizing only one part of a multi-part question;
- replacing domain-specific objects with simpler surrogates.
FormalScience identifies notational collapse, abstraction elevation, proof-strategy substitution, and implicit-premise selection as recurring categories. Notational collapse occurs when operators become scalars or state vectors become complex numbers. Abstraction elevation occurs when a line integral, differential operator, or physical law is replaced by an abstract algebraic identity. Proof-strategy substitution can be benign when it changes only the derivation while preserving the theorem. Implicit-premise selection may improve rigor when omitted assumptions are made explicit (Meadows et al., 24 Apr 2026).
6. Applications, theory-level formalisation, and future directions
Program correctness and software verification
Autoformalisation applies naturally to programs annotated with specifications, preconditions, postconditions, Hoare triples, and loop invariants. The natural-language reasoning is translated into formally checkable derivations. Similar methods are used for code contracts, static-analysis dependencies, assertion generation, and verified program repair (Cunningham et al., 2023).
Requirement verification provides another application. Natural-language requirements and LLM-generated Gherkin scenarios can be translated into Lean propositions and compared through a proof of biconditional equivalence. One experiment established equivalence between differently worded seatbelt requirements after manual variable grounding; another detected that a Gherkin scenario introduced additional conditions and behaviors absent from its source requirement. The approach remains preliminary because failed equivalence proofs do not distinguish true inconsistency from defective formalisation or failed proof search (Gupte et al., 14 Nov 2025).
Planning, temporal logic, and knowledge representation
Natural-language descriptions can be translated into LTL or CTL specifications, PDDL action models, Prolog programs, ASP programs, OWL ontologies, and RDF graphs. Validation may use model checking, planner execution, solver-confirmed entailment, ontology consistency, or behavioral testing.
The common pattern is:
2
In these settings, compilation or parsing is still insufficient. A PDDL action can be syntactically valid but encode the wrong transition behavior; an ontology can be consistent while omitting intended relations; a Prolog program can execute while returning incorrect payoffs (Mensfelt et al., 11 Sep 2025).
Theory-level autoformalisation
Theory-level autoformalisation extends the unit of formalisation from isolated statements to coherent formal libraries containing axioms, definitions, notation, examples, lemmas, theorems, proofs, tactics, and their interdependencies. A mature theory can be represented as a dependency graph or dependency DAG whose nodes include declarations and proof infrastructure.
This perspective reflects the actual structure of major formalisation projects. The Kepler conjecture, the Four Color Theorem, the Liquid Tensor Experiment, software-verification projects, and hardware-verification systems required extensive supporting theories rather than isolated theorem translations. A target theorem may be short while depending on large layers of primitives, definitions, notation, lemmas, and automation.
Theory-level formalisation introduces additional problems:
- dependency ordering and graph construction;
- globally consistent terminology and definitions;
- abstraction discovery;
- axiom and primitive-definition formalisation;
- conflict detection and versioning;
- premise selection;
- library organization and refactoring;
- semantic equivalence at the level of entire theories.
The proposal is explicitly a research agenda rather than a demonstrated end-to-end capability. It calls for theory-level benchmarks, sounder equivalence checking, general-purpose models trained across domains and formal languages, and common intermediate representations (Min et al., 14 Jul 2026).
Scientific formalisation
Scientific domains expose the limits of current systems because their notation and semantics are dense. Physics requires representation of Dirac notation, Hilbert spaces, non-commutative operators, vector calculus, differential operators, integrals, and boundary conditions. Formal validity alone is insufficient when these objects are replaced by simpler surrogates.
Human-in-the-loop pipelines therefore remain important. Domain experts can assess whether the formal representation preserves the intended scientific objects, while LLMs generate code and Lean checks syntax and proofs. The principal requirement is to report both what was formally proved and what domain-specific content was retained (Meadows et al., 24 Apr 2026).
Human–machine collaboration
Current systems are most reliable when responsibilities are divided:
- LLMs interpret natural language, propose formal structures, generate code, and revise candidates;
- retrieval systems provide definitions, theorems, types, and library conventions;
- deterministic elaborators resolve or constrain syntax and scopes;
- compilers and proof assistants provide formal diagnostics and certification;
- theorem provers and solvers discharge proof obligations;
- domain experts assess semantic fidelity and scientific adequacy.
This architecture does not eliminate expert work. It concentrates human effort on high-level interpretation, ambiguity resolution, ontology construction, and review of semantic drift.
The principal unresolved challenge is the gap between formal validity and intended meaning. Future systems are likely to combine retrieval, multi-candidate generation, compiler feedback, process supervision, semantic critics, conjecture generation, proof search, intermediate representations, and human review. They will also require contamination-resistant benchmarks, independent semantic evaluation, richer formal libraries, support for multiple proof assistants and domain-specific languages, and explicit accounting of conjecturing, statement construction, proof generation, and theory-level dependency reconstruction as separate capabilities.