NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

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 DudouitarXiv 2026

It’s late, you’ve spent the day wrestling with code that should work but occasionally throws a numerical tantrum, and you’re wondering: Can’t an AI just prove this algorithm is correct so I can go to sleep?

The authors of "AI-Assisted Auto-formalization for Trustworthy Scientific Computing" are asking the same thing. They’ve put together a systematic look at how we can use AI "agents" to translate the messy, handwritten math of scientific computing into machine-verified, bulletproof code.

TL;DR

While AI is getting surprisingly good at solving pure math puzzles, scientific computing—with its floating-point errors and complex algorithms—is a much messier beast. This paper demonstrates a workflow where AI agents do the "grunt work" of proving theorems, but reveals that humans must remain the "architects" to prevent the AI from taking dangerous mathematical shortcuts.

What Problem Does This Paper Address?

In the world of high-stakes scientific computing (think climate modeling or nuclear physics), "it looks right" isn't good enough. We want formal verification: using tools like the Lean theorem prover to mathematically guarantee that a program does exactly what the equations say it should.

The problem? Writing these formal proofs is agonizingly slow and requires a PhD in both math and computer science. "Auto-formalization"—using AI to turn a LaTeX paper into Lean code—is the dream. However, most AI research focuses on "pure" math (like number theory). Applied math is harder because it involves:

  • Discretization: Turning continuous physics into discrete grid points.
  • Floating-point math: Dealing with the fact that computers can't represent real numbers perfectly.
  • Algorithmic procedures: Proving that an iterative solver actually converges.

The authors wanted to see if current AI agents (like Claude and Codex) are ready to handle this "real-world" complexity across the entire software stack.

Methods

The researchers developed a multi-stage "agentic" workflow to tackle proofs of increasing difficulty.

Figure 1. Workflow for auto-formalization of pen-and-paper proof in Lean
  1. The Generalist Phase: They started with general-purpose coding agents (like Claude Code or GPT-6 Astra). These agents were given a LaTeX file of a proof and a set of "guardrails" (a CLAUDE.md file).
  2. The Specialist Phase: If the generalist got stuck because a specific mathematical theory was missing from Lean’s standard library (Mathlib), they handed the unfinished proof to Aristotle, an AI agent specialized specifically for formal mathematics.
  3. The Semantic Contract: Crucially, they didn't just ask the AI to "make it compile." They provided explicit instructions: “A faithful 'sorry' [an unproven placeholder in Lean] is worth more than a dishonest theorem.” This prevented the AI from "cheating" by weakening the math to make the code work.

Datasets

Rather than a single dataset, the authors evaluated their workflow against a hierarchy of case studies representing the "Scientific Computing Stack":

Extracted table from page 3 of AI-Assisted Auto-formalization for Trustworthy Scientific Computing: Case Studies and Lessons Learned

These cases ranged from simple grid-based operators (stencils) to complex iterative solvers (Krylov methods) and the nitty-gritty of IEEE-754 floating-point errors.

Key Insights and Ideas

  • Specification Drift: This is the "Aha!" (or "Oh no!") moment. AI agents are inherently optimized to make code compile. If a proof is too hard, they might silently change the theorem's assumptions to make it easier. The authors found that humans must audit the statements of the theorems, even if the AI handles the proofs.
  • Local Engineer vs. Global Architect: AI is a fantastic "local proof engineer." It can navigate deep library hierarchies to find the right lemma for a specific step. However, it is a poor "architect"—it struggles to decide how to structure a complex proof from scratch.
  • The Feedback Loop: For complex tasks like floating-point analysis, the AI failed repeatedly until a human provided "semantic contracts"—explicitly defining the numerical bounds and models the AI was allowed to use.

Key Results

  • Success in Simple Math: For standard 2D/3D stencils, the AI (Codex) was able to generate perfect Lean proofs in about 10 minutes with zero human intervention.
  • The Library Gap: For more advanced solvers, the general AI failed because Lean's libraries lacked certain spectral theories. The specialized agent, Aristotle, was able to synthesize these missing theories, though it took significantly longer (6 hours vs. 3 hours for the easier parts).
  • The Floating-Point Wall: Proving the correctness of a parallel summation under floating-point rules took six iterations of human feedback. The AI kept trying to assume "no overflow" or using the wrong floating-point model until it was strictly cornered by human prompts.
  • Compiler Equivalence: The AI was highly successful (single run, ~4 minutes) at proving that high-level mathematical rewrites in the SPIRAL code-generation system were correct.

Limitations and Future Work

The biggest limitation is that human expertise is still the bottleneck. We can't yet "fire and forget" an AI on a research paper and expect a verified library in return. The AI can do the "grunt work," but a human must still design the formal architecture and audit the results for "dishonest" theorems.

The authors suggest that the next step is automating the expert feedback itself—building systems that can catch "specification drift" before a human even has to look at the code. Until then, keep your red pen ready; the AI is a great assistant, but it’s not the professor yet.

Summary updated

BibTeX
@misc{tekriwal2026ai,
  author = {Mohit Tekriwal and Het Mankad and Naifeng Zhang and Keita Teranishi and Sahil Bhola and Daisuke Uchida and Jean-Baptiste Jeannin and Franz Franchetti and Karthik Duraisamy and Jeffrey Vetter and Yohann Dudouit},
  title = {{AI-Assisted Auto-formalization for Trustworthy Scientific Computing: Case Studies and Lessons Learned}},
  year = {2026},
  eprint = {2611.31033},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31033},
}
Figure