We implement extraction of Coq programs to functional languages based on MetaCoq's certified erasure. As part of this, we implement an optimisation pass removing unused arguments. We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. We apply this to two functional smart contract languages, Liquidity and Midlang, and to the functional language Elm. Our development is done in the context of the ConCert framework that enables smart contract verification. We contribute a verified boardroom voting smart contract featuring maximum voter privacy such that each vote is kept private except under collusion of all other parties. We also integrate property-based testing into ConCert using QuickChick and our development is the first to support testing properties of interacting smart contracts. We test several complex contracts such as a DAO-like contract, an escrow contract, an implementation of a Decentralized Finance (DeFi) contract which includes a custom token standard (Tezos FA2), and more. In total, this gives us a way to write dependent programs in Coq, test them semi-automatically, verify, and then extract to functional smart contract languages, while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.
翻译:我们根据MetaCoq的认证消化功能语言实施 Coq 程序。 我们根据MetaCoq的认证取消功能语言。 作为其中的一部分, 我们实施优化通行证去掉未使用的论点。 我们证明通行证正确, 这是功能语言的常规按价值排列的常规操作语义。 我们将此应用于两种功能智能合同语言, 流动性和Midlang, 以及功能语言 Elm。 我们的开发是在ConCert框架范围内完成的, 该框架允许智能合同的核查。 我们提供了一份经过核查的董事会投票智能合同, 包含选民最大隐私, 使每张选票都保持私人状态, 除非所有其他政党串通。 我们还将基于财产的测试纳入ConCert, 使用QuickChick, 我们的发展是第一个支持测试互动智能合同特性的测试。 我们测试了若干复杂的合同, 如DAO类合同、代管合同、实施分散化金融(DeFi)合同, 其中包括一种定制代号标准(Tezos FA2) 和更多的合同。 。 总的来说, 这使我们有一条在Coq 中写依赖程序的方法, 仅进行半自动测试, 校验, 然后提取智能合同基础, 并保留这些可信任的Co- chilly- milling- mind- drical- drical brical brical brikedal brikedaldaldaldaldal kedal kedaldaldaldaldaldaldal kedaldaldaldaldaldaldaldaldaldaldaldaldald ked keds。