Extracting functional programs from Coq, in Coq
Danil Annenkov, Mikkel Milo, Jakob Botsch Nielsen, Bas Spitters

TL;DR
This paper presents a verified extraction pipeline from Coq to multiple functional languages, including smart contract languages, with correctness guarantees and real-world applications.
Contribution
It introduces a verified extraction process using MetaCoq, extending erasure with typing info, and demonstrates its application to smart contracts and web apps.
Findings
Verified extraction pipeline for Coq to multiple languages
Successfully extracted smart contracts for Concordium network
Developed verified real-world smart contracts and web applications
Abstract
We implement extraction of Coq programs to functional languages based on MetaCoq's certified erasure. We extend the MetaCoq erasure output language with typing information and use it as an intermediate representation, which we call . We complement the extraction functionality with a full pipeline that includes several standard transformations (eta-expansion, inlining, etc) implemented in a proof-generating manner along with a verified optimisation pass removing unused arguments. We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. From the optimised representation, we obtain code in two functional smart contract languages (Liquidity and CameLIGO), the functional language Elm, and a subset of the multi-paradigm language for systems programming Rust. Rust is currently gaining popularity as a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Security and Verification in Computing · Formal Methods in Verification
