在Move中对命令式一等函数的形式验证
Formal Verification of Imperative First-Class Functions in Move
AI总结:
本文研究了Move语言中命令式一等函数的形式验证,通过引入行为谓词和状态标签,实现了对函数值的高效表示与验证,支持Rust风格的引用和全局变量修改,并提升了SMT编码效率。
摘要:
Move Prover (MVP) 是一个用于验证Move编程语言智能合约的形式验证器。最近,Move在Aptos上扩展了高阶函数:作为一等值的命令式函数,可以传递、存储在数据结构中,并保留在持久存储中,从而实现动态调度。本文描述了Move规范语言中函数值的表示及其在MVP中的实现。我们引入了行为谓词,通过单状态或双状态谓词来表征Move函数(中止和前/后条件)。我们还引入了状态标签,用于命名表达式评估的中间内存状态,并允许通过组合行为谓词来描述状态转换序列。在SMT层面,函数值通过区分可能到达调用站点的函数值进行编码:当具体函数已知时,其效果直接计入;当未知(例如函数参数或从存储加载的闭包)时,其行为谓词描述效果。我们的方法超越了例如Dafny,支持可以通过Rust风格的引用和全局变量修改状态的命令式一等函数,并由于Move提供的静态内存分离而比分离逻辑更高效。我们进一步扩展了MVP的规范推断工具,使其能够处理函数值:给定任意的高阶Move代码,最弱前提出分析半自动地推导基于行为谓词的规范,减少注释负担,并为新的规范构造提供验证流程。
英文摘要:
The Move Prover (MVP) is a formal verifier for smart contracts written in the Move programming language. Recently, Move on Aptos was extended with higher-order functions: imperative functions as first-class values that can be passed around, stored in data structs, and kept in persistent storage, enabling dynamic dispatch. This paper describes the representation of function values in the Move specification language and their implementation in MVP. We introduce behavioral predicates which characterize Move functions (aborts and pre/post conditions) by single-state or two-state predicates. We also introduce state labels for naming intermediate memory states in which expressions are evaluated and which allow to compose behavioral predicates to describe sequences of state transitions. On SMT level, function values are encoded by discriminating over the possible function values reaching a call site: when the concrete function is known, its effect is accounted for directly; when it is unknown (for example, a function parameter, or a closure loaded from storage), its behavioral predicates describe the effect. Our approach goes beyond, for example, Dafny, by supporting imperative first-class functions which can modify state via Rust-style references and global variables, and leads to more efficient SMT encodings than separation logic because of the static separation of memory enabled by Move. We further extend MVP's specification inference tool to work with function values: given arbitrary higher-order Move code, weakest-precondition analysis semi-automatically derives behavioral-predicate-based specifications, reducing the annotation burden and providing a validation pipeline for the new specification constructs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。