arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2404.06477cs.PLcs.LO
收藏

关于结构化数据的机械化超安全性证明:扩展版

Mechanised Hypersafety Proofs about Structured Data: Extended Version

Vladimir Gladshtein, Qiyuan Zhao, Willow Ahrens, Saman Amarasinghe, Ilya Sergey

AI总结:

本文提出 Hoare 风格关系分离逻辑 LGTM,将结构化数据操作规范为参数化超安全性,并在 Coq 中机械化其理论与策略,验证了13个压缩数组和稀疏张量案例。

摘要:

数组是表示数据集合的一种基础抽象。通常可以利用存储在数组中的数据的结构特性(例如重复性或稀疏性)来开发一种针对空间效率进行优化的专用表示形式。对这类结构化数据操作的正确性进行形式化推理颇具挑战性,因为这些操作往往由多个具有非平凡不变式的循环组成。在本工作中,我们观察到结构化数据操作的规范可以表述为超安全性属性,即关联 $k$ 个程序轨迹的谓词。为将这一观察转化为有效的验证方法,我们开发了 Graceful Tensor Manipulation 逻辑(LGTM),这是一种新的 Hoare 风格关系分离逻辑,用于规范和验证结构化数据上的计算。LGTM 的关键使能思想是参数化超安全性规范,它允许程序组件的数量 $k$ 依赖于程序变量。我们将 LGTM 实现为 Coq 中的基础嵌入,机械化了其规则、元理论以及可靠性证明。此外,我们开发了一个领域特定策略库,用于自动化计算机辅助超安全性推理,从而产生简洁且具有高度复用性的证明脚本。我们通过规范并机械化证明 13 个案例研究的正确性,论证了在 LGTM 中对结构化数据进行关系推理的有效性,这些案例研究包括压缩数组上的计算以及多种稀疏张量上的高效操作。

英文摘要:

Arrays are a fundamental abstraction to represent collections of data. It is often possible to exploit structural properties of the data stored in an array (e.g., repetition or sparsity) to develop a specialised representation optimised for space efficiency. Formally reasoning about correctness of manipulations with such structured data is challenging, as they are often composed of multiple loops with non-trivial invariants. In this work, we observe that specifications for structured data manipulations can be phrased as hypersafety properties, i.e., predicates that relate traces of $k$ programs. To turn this observation into an effective verification methodology, we developed the Logic for Graceful Tensor Manipulation (LGTM), a new Hoare-style relational separation logic for specifying and verifying computations over structured data. The key enabling idea of LGTM is that of parametrised hypersafety specifications that allow the number $k$ of the program components to depend on the program variables. We implemented LGTM as a foundational embedding into Coq, mechanising its rules, meta-theory, and the proof of soundness. Furthermore, we developed a library of domain-specific tactics that automate computer-aided hypersafety reasoning, resulting in pleasantly short proof scripts that enjoy a high degree of reuse. We argue for the effectiveness of relational reasoning about structured data in LGTM by specifying and mechanically proving correctness of 13 case studies including computations on compressed arrays and efficient operations over multiple kinds of sparse tensors.

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

↑