arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2108.02995cs.PLcs.LO
收藏

从Coq中提取函数式程序,在Coq中

Extracting functional programs from Coq, in Coq

Danil Annenkov, Mikkel Milo, Jakob Botsch Nielsen, Bas Spitters

摘要:

我们实现了基于MetaCoq的认证擦除的Coq程序的函数式语言的提取。我们扩展了MetaCoq擦除输出语言的类型信息,并使用它作为一个中间表示,我们称之为$λ^T_\square$。我们用一个完整的管道来补充提取功能,其中包括以证明生成方式实现的几个标准转换(eta-expansion,inlining等),以及经过验证的优化通道,删除未使用的参数。我们证明了这个传递是正确的。函数式语言的传统按值调用操作语义。从优化的$λ^T_\square$表示中,我们获得了两种功能智能合约语言(Liquidity和CameLIGO)的代码,功能语言Elm和用于系统编程的多范式语言Rust的子集。Rust目前作为智能合约的语言越来越受欢迎,我们演示了如何使用我们的提取来提取Concordium网络的智能合约代码。开发是在支持智能合约验证的ConCert框架的背景下完成的。我们贡献了两个经过验证的真实世界智能合约(董事会投票和托管),我们使用这些合约来验证管道的适用性。此外,我们开发了一个经过验证的Web应用程序,并将其提取为功能齐全的Elm代码。总的来说,这给了我们一种方法来用Coq编写依赖类型的程序,验证,然后将它们提取到几种目标语言,同时保留一个小的可信计算基础,只有MetaCoq和这些语言的漂亮打印机。

英文摘要:

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 $λ^T_\square$. 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 $λ^T_\square$ 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 language for smart contracts, and we demonstrate how our extraction can be used to extract smart contract code for the Concordium network. The development is done in the context of the ConCert framework that enables smart contract verification. We contribute with two verified real-world smart contracts (boardroom voting and escrow), which we use, among other examples, to exemplify the applicability of the pipeline. In addition, we develop a verified web application and extract it to fully functional Elm code. In total, this gives us a way to write dependently typed programs in Coq, verify, and then extract them to several target languages while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑