PastaLean: Deterministic transpilation from Python to Lean for Verification
Anirudh Gupta, Petros Markopoulos, Siddhartha Gadgil
Abstract
We present PastaLean, an extensible system for deterministic translation from Python to Lean via the Abstract Syntax Tree of Python. This allows for verification of Python code, especially auxiliary code used by AI. Every program is translated into a provable twin written in the form Lean's verification tooling can reason about, and a runnable twin that gives a fast and correct computation support. We also introduce our Type Inference engine TypeInfer which provides static typing support for untyped Python code. Our tool provides coverage of more than 92\% for LeetCode and HumanEval+ and more than 98\% for LiveCodeBench ground truth Python files. Further, at least 97\% of each dataset's (numerical) test cases pass, with 100\% on HumanEval+ and LiveCodeBench. The TypeInfer engine is the best-scoring tool on the TypeEvalPy static leaderboard, and on a repository-level TypyBench benchmark it scores above every competing repository-level inference tool.
Create a lesson
Related papers
Proving LLM-Generated GPU Kernels Correct and Safe: Floating-Point Verification in Lean and VerCors
Shared title terminology · Archibald Browne, Eugene Lee, Cristopher Salvi
Python Code Generation for Isabelle/HOL
Shared title terminology · Nikolaus Huber, Roly Perera, Dominic Orchard
CompCert4Lean: Porting a Verified C Compiler to Lean in Six Weeks with Parallel Coding Agents
Shared title terminology · Cong Wang, Zhiyang Chen, Fan Long et al.
Countable Nondeterminism in Weighted Programming with an Application to Mechanized Foundations for Probabilistic Program Verification
Shared title terminology · Sebastian Körner, Oliver Emil Bøving, Christoph Matheja
Automated Verification of Hamiltonian Simulation by Quantum Signal Processing
Shared title terminology · Min Lai, Yu-Fang Chen, Shih-Han Hung
Scenario Proofs for Verification of Distributed Protocols
Shared title terminology · Zhendong Ang, George Pîrlea, Umang Mathur