Skip to content
AI.info

The Pulse

Emergence AI releases PastaLean for Python-to-Lean verification

PastaLean translates Python into Lean 4 using a fixed process rather than a language model. Emergence AI reports benchmark results alongside limitations in Python coverage and proof automation.

Emergence AI releases PastaLean for Python-to-Lean verification

PastaLean translates Python into Lean 4 using a fixed process designed to let developers verify code against a stated specification. Emergence AI introduced the open-source tool in a Nov. 24 post, reporting benchmark results for its translations and describing the work still needed to improve coverage and proof automation.

The translator produces the same output for the same input rather than asking a language model to write the Lean version. A developer can state what the Python code is meant to do, while Lean checks a proof of that specification against the translated program.

What the tests measured

The company reports that, across 3,229 programs and 232,346 test cases, 93.2% of programs elaborated and 97.2% of test cases agreed with CPython. Elaborating means the generated Lean type-checks; passing a problem requires its translated program to produce CPython's answer on every test case for that problem.

On HumanEval⁺, 151 of 164 programs elaborated, and all 7,007 test cases passed, according to the post. The corresponding LeetCode results were 2,391 of 2,589 programs elaborated and 208,736 of 215,126 test cases passed. On LiveCodeBench, 469 of 476 programs elaborated and all 10,213 test cases passed.

Emergence says the 13 HumanEval programs that did not elaborate contained type ambiguities, and that all 13 compiled once a single type hint was added at the ambiguous spot. The post describes agreement with CPython as empirical evidence for the translation, rather than a formal semantics of Python in Lean.

From source code to proof

The process starts with Python's own parser, then uses a type-inference engine called TypeInfer to infer types. Translation functions generate Lean code from the Python constructs, and Lean's compiler checks the result.

A preprint on PastaLean, posted on arXiv in October, describes two versions of each translated program: one suited to verification and another intended to run. Specifications can be written as contracts in the Python source and translated into Lean theorems alongside the program.

In the post's example, a contract specifies that, given a non-empty list of integers, a function returns an even number. A proof checks that statement for every list covered by the specification, rather than checking a selected set of inputs.

Limits and model comparison

The post also says a human still writes the tactic script that closes each proof, while work continues on object-model gaps, property-based testing and stronger automation.

A checked proof also depends on whether the translation preserves the meaning of the original Python.

In a separate comparison, Emergence ran Claude Opus 4.8 through the same evaluation harness, using five independent samples per problem. On LiveCodeBench, it reports that one model-generated translation worked in 52.5% of cases, while at least one of five worked in 74.9%; all five worked in 31.4%. The post contrasts those results with PastaLean's deterministic output, rather than treating a successful translation as a proof of the original program.

Sources

  1. Original source · Blog post Emergence AI “PastaLean: Deterministic Transpilation from Python to Lean for Verification” emergence.ai

Other pages read

  1. arXiv “PastaLean: Deterministic transpilation from Python to Lean for Verification” arxiv.org

Related stories

Explore

More articles