The Peregrine Project provides a unified middle-end for code generation from proof assistants. It supports Agda, Lean, and Rocq and can generate code in C, WebAssembly, LLVM, OCaml, CakeML, Rust, Elm, and Lean.
It puts a focus on correct code extraction: The middle end is verified in the Rocq proof assistant, and some of the frontends and backends are. It is based on an intermediate language called lambda box. The middle end includes verified optimization passes, such as inlining, constant lifting, and unboxing.
Frontends
| Frontend | Based on | Verification | Repository |
|---|---|---|---|
| Rocq | MetaRocq, ConCert | verified | peregrine-tool |
| Agda | — | unverified | agda2lambox |
| Lean | — | partially verified | lean-to-lambdabox |
Backends
All backends are part of peregrine-tool.
| Backend | Based on | Verification |
|---|---|---|
| C | CertiRocq, then CompCert for x86, ARM, RISC-V | partially verified |
| Wasm | CertiRocq-wasm | verified |
| LLVM | Vellvm | verified |
| OCaml | Malfunction | verified |
| CakeML | CakeML compiler | verified |
| Rust | ConCert | partially verified |
| Elm | ConCert | partially verified |
| Lean, F#, Koka (experimental) | — | unverified |
Team Members:
- Yannick Forster (INRIA)
- Orestis Melkonian (Kodamai)
- Eske Hoy Nielsen (Aarhus University)
- Felix Sassus-Bourda (INRIA, ENS Paris Saclay)
- Alessandro Sosso (Aarhus University)
- Matthieu Sozeau (INRIA)
- Bas Spitters (Aarhus University)
- Théo Winterhalter (INRIA)
Contributors:
- James Chapman (IOHK)
- Simon Dima (INRIA, ENS Paris)
- Lucas Escot (TU Delft)
- Hugo Segoufin-Chollet (INRIA, ENS Lyon)
Supported by: INRIA, Aarhus University, IOG, Ethereum, AIforMath.
Last updated: November 23, 2026.