Python Code Generation for Isabelle/HOL
Nikolaus Huber, Roly Perera, Dominic Orchard
Abstract
The Isabelle theorem prover provides an environment for formalising mathematics and reasoning about programs. To make verified implementations practically usable, its code generator translates functions expressed in the executable fragment of its logic into conventional programming languages. Its targets have traditionally been functional languages (Standard ML, OCaml, Haskell, and Scala), recently joined by Go. Python, which is becoming the dominant language of scientific computing, data science, and education, has remained out of reach. In this work, we close this gap with a Python backend for Isabelle's code generator. This generator enables verified algorithms to be used in Python applications, or to serve as verified references against which established Python libraries can be differentially tested, without leaving the Python ecosystem. We validate the backend on regression suites covering large parts of the HOL library and by testing six verified data structures and algorithms against established Python libraries. The generated code is slower than hand-written libraries, but well suited as a verified reference.
Create a lesson
Related papers
OpenMP Meta-Lowering: A Declarative Approach to Performance Portable Parallel Code Generation
Shared title terminology · Luca Parigi, Giuseppe Tagliavini
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.
DeCompCert: A Verified Decompiler for CompCert-Generated AArch64
Shared title terminology · Swarn Priya, Basavesh Ammanaghatta Shivakumar, Thomas Gilray et al.
Crustify: Repository-Level Generation of Safe Rust Bindings with LLM Agents and Coverage-Guided Testing
Shared title terminology · Marius Momeu, Marius Arvinte, Cory Cornelius et al.
te-comp: A Complete MLIR Compiler Generating Self-Contained C Inference Engines for MCUs
Shared title terminology · Van Chan Ngo
PastaLean: Deterministic transpilation from Python to Lean for Verification
Shared title terminology · Anirudh Gupta, Petros Markopoulos, Siddhartha Gadgil