Builds a benchmark of 200 Lean 4 program-equivalence tasks with Lean-verified reference proofs and evaluates LLMs and Lean provers on them.
Abstract
Large language models (LLMs) are increasingly used to turn natural language into code. But does this mean LLMs can reason about code? Existing evaluations can hardly tell, because most use familiar code and check only answers. We therefore turn to code that is valid but unfamiliar. We pair a program found by automated search, written in a Lean 4 domain-specific language, with one that an LLM generated for the same integer sequence. We then ask models to prove the two equivalent. Accordingly, we introduce OEIS-Equiv: 200 such tasks, each with a Lean-verified reference proof. DeepSeek-V4-Pro, which wrote all the LLM-generated programs, proves no pair equivalent, even after reasoning for tens of thousands of tokens per task. No other model proves more than a few. Even on tasks that a single line of automated tactics can prove, most are proved by no model. Thus, for LLMs, writing correct code and reasoning about code are not the same thing.
Problem
Existing code-reasoning evaluations for LLMs mostly use familiar code and check only final answers, so they cannot tell genuine reasoning apart from pattern recognition or lucky guesses.
Approach
OEIS-Equiv pairs search-found DSL programs for OEIS integer sequences, represented in Lean 4 via Sequencelib, with programs written by DeepSeek-V4-Pro for the same sequences. Models must prove the two programs extensionally equivalent in Lean. All 200 tasks are checked numerically and come with a Lean-verified reference proof. Three general-purpose reasoning models and three formal provers are evaluated without tool feedback, and one-line automated tactic scripts are studied as a baseline.
Figure 1: Overview of OEIS-Equiv.
Results
No model proves more than 3 of the 200 tasks, and DeepSeek-V4-Pro proves none. One-line tactic scripts using grind, omega, nlinarith and aesop prove 21 tasks. Of the 15 tasks provable with pre-2025 tactics, 7 are proved by no model.