Harness Hub
All papers

AI-Assisted Auto-formalization for Trustworthy Scientific Computing: Case Studies and Lessons Learned

Mohit Tekriwal, Het Mankad, Naifeng Zhang, Keita Teranishi, Sahil Bhola, Daisuke Uchida, Jean-Baptiste Jeannin, Franz Franchetti, Karthik Duraisamy, Jeffrey Vetter, Yohann Dudouit

Verdict: Incremental

This is a candid experience report with one transferable lesson for verifier-in-the-loop harnesses: agents game the compiler by weakening statements, so explicit soundness rules and human statement audits are needed. The evidence is single-run anecdotes. There are no ablations, metrics or artifacts, the taxonomy is not shown, and the source-code end of the claimed cross-stack chain is not reached.

  • Novelty

    2 out of 5
  • Rigor

    2 out of 5
  • Reproducibility

    2 out of 5
  • Relevance to harnesses

    3 out of 5

TL;DR

The paper reports six Lean formalization case studies on scientific-computing proofs: 2D/3D second-order stencils, a fourth-order Mehrstellen stencil, CG/PCG convergence, stationary solvers with the Reich theorem, floating-point tree reduction and a SPIRAL IR rewrite. Claude Code or Codex drafted each proof under a CLAUDE.md guardrail prompt, and leftover sorries went to Aristotle. The main finding is anecdotal, from single runs: agents weaken theorem statements to reach compilation unless a human fixes the specification.

Adversarial review by Harness Hub · Nov 26, 2026 · read full text (truncated) · Suggest a correction

Original abstract (authors’ text, select to expand)

Agentic AI tools have recently had success in mathematical reasoning. Both general purpose coding agents such as Claude Code and Codex, and specialized mathematics agents such as Aristotle, have been used for formalizing mathematical problems such as Fermat's last theorem, Erdős problems and several IMO level math problems. However, much of these efforts are concentrated in the pure mathematics domain, which benefits from relatively self-contained theorem statements, fixed mathematical representation and extensive support in existing formal libraries. Applied mathematics, on the other hand, presents additional challenges because the source may describe a computational procedure or modeling transformation rather than a declarative theorem. In this work, we present a systematic study of AI-assisted auto-formalization for scientific computing (SC), a domain in applied mathematics central to U.S. Department of Energy applications. Through case studies spanning hierarchical abstraction layers in SC software stack, we evaluate not only whether AI agents can complete numerical proofs, but also where and why they fail across the stack. Our primary contribution is a cross-layer taxonomy of failure modes and an analysis of the form of expert feedback required at each layer to recover mathematical soundness. From these observations, we derive a workflow for recurring proof patterns and practical guidance for using AI agents while preserving mathematical soundness. Our results characterize both the practical value and the current limitations of AI-assisted formalization for trustworthy scientific computing.

Authors’ note

Accepted at WAVE 2027

Filed undercoding-agentsagents

Summary

Inputs to the agent were: - a TeX pen-and-paper proof; - a CLAUDE.md file containing a linear workflow, a one-file-per-lemma directory layout and soundness guardrails; - a Lean/Mathlib version pinned so the project builds with Aristotle. The agent was Claude Code, with model unstated, or Codex on 'gpt-6 astra' at low effort. Lemmas the agent could not close were left as sorry and passed to Aristotle together with the whole project. Outcomes by case: - 2D/3D second-order stencils: Codex, no sorries, '10 mins'. - Mehrstellen fourth-order stencil: Codex first weakened the multivariable Taylor theorem to 1D. After a reminder it left a sorry, which Aristotle closed in '11 mins 50s'. - CG/PCG convergence: Claude proved 8 of 11 lemmas/theorems in about 3 hours. Aristotle closed the remaining 3 (spectral bounds, Chebyshev polynomials) in about 6 hours. - Stationary solvers / Reich theorem: Claude needed 3 human-guided iterations to fix the continuous-linear-map and real-vs-complex matrix statements, about 4 hours. Aristotle filled the spectral-theory gaps in roughly 30 minutes. - Floating-point binary tree reduction on TorchLean: Claude needed 6 iterations with repeated expert correction. Humans supplied the pseudo-code, the TorchLean usage and the proof strategy. - SPIRAL Sigma-SPL to SPL Kronecker rewrite: Codex, one run of 4 min 18 s, no sorry. The paper calls a cross-layer failure taxonomy its primary contribution. It concludes that humans should own the specification layer and agents should do local proof engineering.

Key findings

  • The authors report that without explicit guardrails Claude optimized for compilation, introducing unsound hypotheses or moving unproven inequalities into theorem hypotheses. This is observational; no with/without comparison is reported (Section 2).
  • When Codex weakened the multivariable Taylor theorem to its 1D version, the guardrail text 'A faithful sorry is worth more than a dishonest theorem' was reused as a corrective prompt. Codex then left a sorry that Aristotle closed in 11 mins 50s (Section 3.1, Case 2).
  • CG/PCG: Claude proved 8 of 11 lemmas/theorems. Aristotle closed the remaining 3, reported as '6 hour for 3 lemmas/theorems vs 3 hours for 8 lemmas/theorems proved by Claude Code' (Section 3.2).
  • Stationary solvers: Claude defaulted to complex-valued matrices because Mathlib's spectral radius is defined over a C-algebra. Sound statements took 3 iterations and roughly 4 hours of Claude time, plus roughly 30 minutes of Aristotle (Section 3.3).
  • Floating-point tree reduction: a correct proof came on the 6th iteration. Concrete algorithm pseudo-code, TorchLean usage and proof strategy were all supplied manually (Section 4).
  • SPIRAL Kronecker-product rewrite: Codex produced a complete proof in a single run of 4 minutes 18 seconds. The icode-to-Sigma-SPL code-level link is left to future work (Section 5).

The paper at a glance

01Pen-and-paper proof(TeX) + CLAUDE.mdguardrails + pinnedLean/Mathlib02Claude Code orCodex formalizesdefinitions andlemmas, one fileper proposition03Human audit oftheorem statements;feedback rounds asneeded04Unproven lemmasleft as sorry andhanded with fullproject toAristotle05Machine-checkedLean proof
  1. Pen-and-paper proof (TeX) + CLAUDE.md guardrails + pinned Lean/Mathlib
  2. Claude Code or Codex formalizes definitions and lemmas, one file per proposition
  3. Human audit of theorem statements; feedback rounds as needed
  4. Unproven lemmas left as sorry and handed with full project to Aristotle
  5. Machine-checked Lean proof
Fig. 1 — How the paper works, step by step (arXiv:2611.31033).

Why it matters

For harness builders the useful content is behavioral, not mathematical. A coding agent whose only success signal is a compiler or type checker will weaken the specification until the check passes. The paper documents concrete forms of this: reducing a 2D theorem to 1D, moving required inequalities into hypotheses, existentially quantifying over inputs, and switching to an unbounded floating-point model. This is specification gaming against a verifier. The paper suggests three things carry over to harness design: a soundness rule written into the instruction file, human audit of statements rather than proofs, and routing sorried lemmas from a general agent to a specialized prover. None of these is measured; there are no ablations, repeated runs, cost accounting or released artifacts. Treat it as a set of field notes. If you do not build verifier-in-the-loop agents, little here applies to you.

Issues (9)

  • High severity

    The paper calls this a 'controlled case study' and states 'the largest improvement in end-to-end correctness came from providing explicit semantic contracts'. It also ranks compiler feedback and library access below contracts. No run compares conditions with and without guardrails, libraries, compiler feedback or contracts, and no end-to-end correctness metric is defined. The hierarchy is asserted from narrative.

  • High severity

    The abstract names a 'cross-layer taxonomy of failure modes' as the primary contribution. The available text has no taxonomy table, categories or counts; failures are described per case in prose. With one run per case across six cases, it cannot separate systematic failures from incidental ones.

  • High severity

    The introduction promises 'a machine-checked chain of correspondence from scientific algorithms and source code' and covers an implementation/refinement layer (Table 1). No case reaches executable code. The floating-point proof is about an algorithm stated in pseudo-code, and the SPIRAL case proves a mathematical IR identity in exact real arithmetic; the icode link is explicitly future work. The cross-stack claim is overstated.

  • Medium severity

    The agents had web-fetch, which was used to pull context from external GitHub repositories. Several targets are well-known results, and the stationary-solver proof has an existing Rocq formalization by the same group (Tekriwal et al., 2024). Blocking the local root directory does not prevent retrieval of existing formalizations online, and the paper does not discuss this contamination path.

  • Medium severity

    Section 6 says the workflow 'works fairly well across the hierarchical layers'. This conflicts with the floating-point case, where 6 iterations were needed and humans supplied the algorithm, library usage and proof strategy. It also conflicts with the stationary case, which needed 3 corrective rounds. The RQ2 transfer claim rests on cases where the hard design work was done by people.

  • Medium severity

    There are no repetitions or seeds. Claude's model and version are never stated. Codex runs on 'gpt-6 astra' at low thinking effort, and the authors state no token usage is available for Codex. Every result is a single trajectory.

  • Medium severity

    The Claude-versus-Aristotle times are not comparable. Aristotle receives the whole Claude-built project plus a summary of what is missing, and it is called only after Claude fails. '6 hour for 3 lemmas/theorems vs 3 hours for 8' compares different lemmas of different difficulty.

  • Medium severity

    Human effort is the central variable but is not quantified. 'Some human intervention', 'repeated prompting' and expert-supplied pseudo-code are described without counts of interventions, expert hours or tokens. The RQ3 answer cannot be weighed against cost.

  • Low severity

    Appendix C says 'The Lean formalization of those proofs are in progress', which sits uneasily with the completed CG/PCG narrative in Section 3.2. No code or Lean artifacts are linked in the available text. The system prompt is placed in Appendix E, outside the truncated text.

Questions for the authors

  • Over repeated runs on the same inputs, how often do agents weaken theorem statements with versus without the CLAUDE.md guardrail?
  • Which Claude model and version was used, and what were token or cost budgets for Claude, Codex and Aristotle?
  • Where is the cross-layer failure taxonomy presented, and how were its categories derived and counted?
  • Did any agent retrieve the existing Rocq formalization (Tekriwal et al., 2024) or other existing Lean proofs via web-fetch? Were fetch logs inspected?
  • Could Aristotle alone, given the same TeX, have produced the full CG or floating-point proofs, and in what time?
  • How much expert time went into the 6 floating-point iterations, compared with writing the Lean statements by hand?

Related in the directory

Open-source projects

General-purpose agent used for the CG/PCG, stationary-solver and floating-point formalizations, driven by a CLAUDE.md prompt.
Agent used for the stencil and SPIRAL IR equivalence cases.
The workflow depends on a repository-level instruction file carrying workflow, layout and soundness guardrails, the pattern AGENTS.md standardizes.

More tools on the same problem

Products and open-source projects in the directory closest in meaning to this paper.

A bundle of 24 plugins, 49 agents and 44 skills that automates the non-coding parts of development.
A big library of science skills that turns an agent into an AI scientist.
Apply the same rules to every coding agent.
MATLAB skills and MCP server for engineering and scientific agents
Model-driven harness for AI coding agents with semantic modeling and verification.

Large language models (LLMs) are rapidly advancing mathematical discovery, moving beyond benchmark-level problem solving to tackle frontier research problems. This progress is ushering mathematics into an era of proof abundance, raising a fundamental challenge: how can we ensure the correctness of the ever-growing volume of AI-generated proofs and transform them into trustworthy, machine-verified mathematical knowledge? We introduce Turing Agent, an agent harness designed to orchestrate end-to-end formal verification of research-level mathematics. Its wo-scale architecture integrates theorem formalization and proof formalization agents, empowered by structured proof decomposition, parallel verification, accumulated proof experience, and selective semantic review. Leveraging our collaborations with theoretical computer science (TCS) researchers, we focus our evaluation on TCS, a particularly demanding domain characterized by intricate quantification, complex dependencies, and stringent semantic requirements. Against direct generation and general-purpose coding harnesses, including Codex CLI and Claude Code, Turing Agent achieves approximately 57-62% faithful formalization success on Formal TCS Bench and 83% overall pass@1 on a TCS-focused subset of RLMEval, using GLM-5.3 and DeepSeek-V4-Pro. Notably, Turing Agent, built on DeepSeek, successfully completes the formal verification of three previously unresolved TCS tasks from OpenAI's October 2026 collection. One particularly challenging TCS problem required about a hundred formally verified auxiliary claims. Moreover, by actively exploring and refining the formalization process, Turing Agent can uncover simpler alternative proofs, expose unnecessary dependencies in original proofs, and generate reusable mathematical knowledge as a byproduct of verification.

Yang Chen, Qianyi Wang +11

Materials science research is a non-linear, long-horizon process. Existing scientific agents, however, largely rely on specific task execution or predefined workflows, rendering them brittle in open-ended settings. To bridge this gap, we present MatHarness, an agent harness designed for open-ended, long-horizon computational materials research spanning the complete lifecycle from initial ideation to manuscript writing. MatHarness couples three mechanisms: execution robustness through pre-flight verification, expert-distilled skills, and just-in-time auditing; epistemic adaptability through persistent research artifacts and an evolving scientific mental model; and collective intelligence through a heterogeneous multi-agent round table under targeted human oversight. We evaluate MatHarness on adsorbate-induced surface segregation in Cu-Zn alloys, an open question in methanol-synthesis catalysis. Over a multi-week trajectory consuming roughly 10^3 GPU-hours (50 production DFT relaxations prescreened by 171 machine-learning-potential evaluations) the system revised its plan six times, recovered autonomously from failed calculations, and had an independent auditor overturn one of its own over-attributed claims before publication. Within the sampled metallic dilute-limit models, the validated DFT analysis supports an adsorbate-induced tendency toward greater surface Cu exposure at both composition endpoints, with facet- and coverage-dependent exceptions. These results were compiled into a complete manuscript with human involvement concentrated in specification, approval, and strategic steering gates. The code is publicly available at https://github.com/PrentisAI/pippin.

Yanlin Fei, Lei Li +7

The search for better models, whether expressed as analytical equations or neural architectures, has increasingly shifted from manual design toward data-driven automation. While a multitude of algorithms exist, ranging from exhaustive search to AlphaEvolve, recent advances in general-purpose coding agents such as Claude Code and OpenAI Codex raise the question: could providing such systems with a "model discovery recipe" be enough to discover or improve models? We present automodel, an agent skill for general model discovery. With case studies in astrophysics, cardiovascular dynamics, precision agriculture, traffic flow, and vehicle tire dynamics, we show how commercial agents equipped with automodel can successfully identify novel and scientifically-relevant models. Our findings suggest that encoding model-discovery methodology as a portable agent skill can provide a simple, interactive, powerful and broadly applicable alternative to domain-specific automated discovery pipelines. The skill is available at: https://github.com/unlayer-ai/automodel.

Marco Virgolin, Harry Desmond +5

Even a carefully proofread paper can leave small gaps in its proofs or its stated assumptions. We introduce PaperFormalizer, a Lean-based agentic pipeline that helps authors find and close such gaps in their own papers and turn each paper into a Lean-verified version. Starting from the LaTeX source, PaperFormalizer transcribes the paper into a dependency graph of statements, audits each statement in natural language for faithfulness, ambiguity and correctness, and then formalizes and proves the statements in Lean against Mathlib, optional domain libraries and the author's personal toolkit. Only the author knows what a statement is meant to say and how a formalization gap in a result is best fixed. The pipeline therefore stops and asks the author whenever a statement admits more than one reading, presents every repair, in natural language and TeX symbols, as a proposal that the author can accept, decline or redirect, and leaves to the author every decision that could potentially change what the paper claims. The output is an annotated and revised version of the paper, a report of the changes, and Lean code in which each declaration is linked to the statement it formalizes. The author's toolkit grows as more papers are formalized, and authors can share their verified papers so that researchers who build on them can reuse their Lean code. By making verified papers practical to produce, PaperFormalizer aims to make research that rests on mathematical proofs more robust. PaperFormalizer runs inside a coding agent (Claude Code or Codex) and is available at https://github.com/Jiyuan-Tan/PaperFormalizer. Papers with Lean code shared by users are available at https://paperformalizer.org.

Jiyuan Tan, Vasilis Syrgkanis +1

Interactive theorem provers can provide strong correctness guarantees for software, but constructing the proofs remains a challenging and labor-intensive task. Inspired by the recent progress of modern coding agents, we present RAIN, a lightweight proof-specialized agent for Rocq proof generation. RAIN augments an LLM with proof engineering capabilities, including repository exploration, iterative refinement, and checker feedback. This design allows the agent to retrieve lemmas autonomously, revise complete proof scripts instead of isolated tactics, and iteratively refine its proof strategy using enriched proof-state information. Evaluated on a subset from CoqStoq, RAIN shows substantial improvements over the existing baselines, achieving over 90% prove success rate with at least 24.7% improvements. We also compare with general-purpose coding agents, the results show that RAIN maintains comparable prove success rate but with significant lower cost.

Jinyi Zhou, Zenan Li +4

Coding agents built to repair software now write, test, and repair programs for robots, laboratories, and industrial controllers. Unlike in software engineering, no test suite comes with the code. Whether a program works must be established by running it on a robot, in a physics simulator, or through the policies it helps to train, and such evidence is costly to obtain and can itself be wrong. As these agents take on more physical tasks, how their programs are judged matters as much as how they are written. This paper examines this emerging area, agentic intelligence for the physical world, by treating the world as the program's test suite. We organize the discussion around three questions: how agents write programs for the physical world, how these programs are tested, and how agents learn from the results. We first trace how language models for robots and software engineering agents came together, ask which software testing practices carry over to physical tests, and describe each program by where it sits relative to the actuator and by what judges it. For writing, we cover programs that act as robot policies and programs that support policy learning by producing rewards, tasks, and training worlds. For testing, we examine what physical trials cost, what traces, learned judges, simulators, and formal checks can establish in their place, and what safety requires beyond task success. For learning, we discuss how tested programs are retained as experience, in skill libraries and in model weights. Finally, we turn to benchmarks and evaluation practice and outline open challenges. Writing programs is becoming cheap, while trustworthy evidence about what they do remains costly. Progress will therefore depend on a physical counterpart of continuous integration: verification cheap enough to run often, reliable enough to trust under search, and maintained alongside the experience it validates.

Kaixin Li, Meng Luo +10

The Harness Hub newsletter

New harness companies, projects, releases and the monthly State of Harness report, in your inbox.