arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2112.05964cs.PLcs.LO
收藏

克服约束:用Cogent编写外来函数的验证

Overcoming Restraint: Composing Verification of Foreign Functions with Cogent

Louis Cheung, Liam O'Connor, Christine Rizkallah

摘要:

Cogent是一种受限制的函数式语言,旨在降低开发验证系统代码的成本。由于它有时会有一些繁琐的限制,例如缺乏对递归的支持和严格的唯一性类型系统,Cogent以外部函数接口(FFI)的形式为C代码提供了一个安全出口。这在验证Cogent程序时带来了一个问题,因为导入的C组件不享有与Cogent相同级别的静态保证。以前对Cogent中实现的文件系统的验证仅仅假设它们的C组件是正确的,并且它们保留了Cogent类型系统的不变量。在本文中,我们证明了这种义务。我们展示了他们如何顺利组成与现有的Cogent定理,并导致在整个Cogent-C系统的正确性定理。Cogent FFI约束确保即使在调用C代码时也能维护Cogent类型系统的关键不变量。我们验证了可重用的高阶和多态函数,包括一个通用的循环组合子和数组迭代器,并展示了他们的应用程序的几个例子,包括二进制搜索和BilbyFs文件系统。我们证明了混合Cogent-C系统的验证的可行性,并提供了一些洞察验证的软件组成的代码在多种语言中具有不同程度的静态保证。

英文摘要:

Cogent is a restricted functional language designed to reduce the cost of developing verified systems code. Because of its sometimes-onerous restrictions, such as the lack of support for recursion and its strict uniqueness type system, Cogent provides an escape hatch in the form of a foreign function interface (FFI) to C code. This poses a problem when verifying Cogent programs, as imported C components do not enjoy the same level of static guarantees that Cogent does. Previous verification of file systems implemented in Cogent merely assumed that their C components were correct and that they preserved the invariants of Cogent's type system. In this paper, we instead prove such obligations. We demonstrate how they smoothly compose with existing Cogent theorems, and result in a correctness theorem of the overall Cogent-C system. The Cogent FFI constraints ensure that key invariants of Cogent's type system are maintained even when calling C code. We verify reusable higher-order and polymorphic functions including a generic loop combinator and array iterators and demonstrate their application to several examples including binary search and the BilbyFs file system. We demonstrate the feasibility of verification of mixed Cogent-C systems, and provide some insight into verification of software comprised of code in multiple languages with differing levels of static guarantees.

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

↑