← Latest papers
🤖 machine learning

Theory-Scale Auto-Formalization of Logics for Computer Science

This paper introduces LCS-Bench, a comprehensive theory-scale benchmark featuring over 4,000 Lean declarations derived from 327 textbook items via a novel semi-automated agentic pipeline, which reveals that current state-of-the-art models struggle with coherent, large-scale auto-formalization, achieving only a 20.1% success rate.

Original authors: Yuming Feng, Frederick Pu, One An, Osbert Bastani, Li Zhang, Jiani Huang, Xujie Si, Ziyang Li

Published 2026-06-26
📖 5 min read🧠 Deep dive

Original authors: Yuming Feng, Frederick Pu, One An, Osbert Bastani, Li Zhang, Jiani Huang, Xujie Si, Ziyang Li

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a massive, complex instruction manual for building a sophisticated machine. The manual is written in human language, full of diagrams, cross-references, and subtle assumptions that a human expert understands intuitively. Now, imagine you want a robot to translate that entire manual into a strict, computer-readable programming language where every single step must be mathematically proven to work before the machine can run.

That is essentially what this paper, "Theory-Scale Auto-Formalization of Logics for Computer Science," is about. The researchers are trying to teach AI to translate a whole textbook of logic into a formal programming language called Lean, not just sentence by sentence, but as a complete, interconnected system.

Here is a breakdown of their work using simple analogies:

1. The Problem: The "Island" vs. The "Continent"

Previous attempts to teach AI this skill were like asking it to translate single, isolated islands. They would take one math theorem, translate it, and check if it worked. But real mathematics is a continent. Definitions depend on lemmas, which depend on other definitions. If you get one small piece wrong, the whole structure collapses.

The authors argue that existing AI benchmarks are too small. They are like testing a pilot on a single turn in a simulator, rather than asking them to fly a plane from New York to London while navigating storms and fuel limits. This new project, LCS-Bench, is the "flight from New York to London." It takes a whole textbook (Logics for Computer Science) and tries to formalize the entire thing—327 items, over 4,000 code declarations, and 85,000 lines of code.

2. The Solution: The "Architect and the Builder" Pipeline

To build this massive translation, the team didn't just ask an AI to "do it." They built a semi-automated pipeline that acts like a construction crew:

  • The Architect (Planning): First, an AI analyzes the textbook to draw a "concept map." It figures out how every idea connects to the next (e.g., "You can't understand 'proof trees' until you understand 'formulas'").
  • The Builder (Implementation): Another AI tries to write the actual code based on that map.
  • The Safety Inspector (Human Experts): This is crucial. Humans step in to fix the "hidden traps." For example, a textbook might say, "Assume X is true for the rest of this chapter," without explicitly writing it down. An AI might miss this and build a shaky foundation. Humans catch these missing assumptions.
  • The Counter-Example Hunter: If the AI gets stuck, the system tries to prove the opposite of what it's trying to prove. If it succeeds, it knows the AI's definition was wrong (like finding a crack in a bridge by trying to drive a heavy truck over it).

3. The Benchmark: The "Obstacle Course"

Once they built this massive library, they turned it into a test (a benchmark) for other AIs. They created five different "tracks" or obstacle courses:

  • Item-Level: Translate one specific definition or theorem.
  • Subsection-Level: Translate a whole section of the book at once.
  • The "Distractor" Test: Give the AI the right answer but hide it inside a pile of irrelevant, confusing code to see if it can find the signal in the noise.
  • Theorem Proving: Give the AI the code but leave the "proof" part empty (marked with a placeholder called sorry) and see if it can fill in the logic.

To grade the answers, they invented a DefEq Checker. Think of this as a super-precise ruler. It doesn't just check if the code compiles; it checks if the AI's translation is exactly the same meaning as the original textbook, even if the AI used different words or variable names.

4. The Results: The "Reality Check"

They tested 14 of the smartest AI models available (including top-tier models from OpenAI, Anthropic, and others) on this course. The results were sobering:

  • The Score: Even the best AI only got about 20% of the items correct.
  • The Difficulty: The models struggled most with things that require deep, abstract reasoning or dealing with "binder substitution" (a technical way of saying: "keeping track of which variable belongs to which rule").
  • The "Overthinking" Trap: Interestingly, when the models failed, they often spent more time and computing power than when they succeeded. They would "overthink," spinning in circles, rather than finding the solution quickly.
  • The Distractor Effect: When the AI was given extra, irrelevant information (distractors), its performance dropped significantly. This shows that current AIs struggle to filter out noise in a large context, which is essential for theory-scale work.

5. The Conclusion

The paper concludes that while AI is getting better at math, theory-scale auto-formalization (translating entire, coherent bodies of knowledge) is still a massive challenge. The current models are like students who can solve a single algebra problem but get lost when asked to write a whole textbook chapter where every sentence depends on the previous one.

The authors hope this benchmark (LCS-Bench) will serve as a "training ground" to help future AI models learn how to handle the complexity, consistency, and faithfulness required to truly understand and formalize computer science logic.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →