验证一个真实的可变哈希表
Verifying a Realistic Mutable Hash Table
AI总结:
本研究使用Stainless程序验证器验证Scala标准库中的可变LongMap哈希表,引入新的引用交换结构以支持数组扩容验证,发现并修复了原实现的漏洞,且验证后版本性能在原版本的1.5倍以内。
摘要:
在本研究中,我们使用Stainless程序验证器对Scala标准库中的可变LongMap进行验证,这是一种在单个数组内采用开放寻址法的哈希表。作为参考实现,我们编写了一个基于元组列表的不可变映射,随后证明LongMap的操作与该关联列表的操作相对应。为了表达哈希表数组的扩容,我们在Stainless中引入了一种新的引用交换结构,这让我们能够在不引入别名的情况下应用装饰器模式。我们的验证工作还发现并修复了原始实现中一个仅在大型哈希表中显现的漏洞。性能分析显示,验证后的版本性能在原始数据结构的1.5倍以内。
英文摘要:
In this work, we verify the mutable LongMap from the Scala standard library, a hash table using open addressing within a single array, using the Stainless program verifier. As a reference implementation, we write an immutable map based on a list of tuples. We then show that LongMap's operations correspond to operations of this association list. To express the resizing of the hash table array, we introduce a new reference swapping construct in Stainless. This allows us to apply the decorator pattern without introducing aliasing. Our verification effort led us to find and fix a bug in the original implementation that manifests for large hash tables. Our performance analysis shows the verified version to be within a 1.5 factor of the original data structure.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。