This paper studies how to use relation algebras, which are useful for high-level specification and verification, for proving the correctness of lower-level array-based implementations of algorithms. We give a simple relation-algebraic semantics of read and write operations on associative arrays. The array operations seamlessly integrate with assignments in computation models supporting while-programs. As a result, relation algebras can be used for verifying programs with associative arrays. We verify the correctness of an array-based implementation of disjoint-set forests using the union-by-rank strategy and find operations with path compression, path splitting and path halving. All results are formally proved in Isabelle/HOL. This paper is an extended version of [1].
翻译:本文研究如何使用关系代数(一种适用于高层规范与验证的数学工具)来证明基于数组的低层算法实现的正确性。我们为关联数组的读写操作提供了一种简单的关系代数语义。这些数组操作与支持while程序的计算模型中的赋值操作无缝集成。因此,关系代数可用于验证包含关联数组的程序。我们验证了采用按秩合并策略的基于数组的不相交集合森林实现的正确性,并分析了路径压缩、路径分裂和路径对半查找操作。所有结果均在Isabelle/HOL中形式化证明。本文是文献[1]的扩展版本。