An Assertional Proof of Red-Black Trees Using Dafny

被引:4
|
作者
Pena, Ricardo [1 ]
机构
[1] Univ Complutense Madrid, Comp Sci Sch, C Jose Garcia Santesmases 9, E-28040 Madrid, Spain
关键词
Data structures; Balanced trees; Verification platforms;
D O I
10.1007/s10817-019-09534-y
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Red-black trees are convenient data structures for inserting, searching, and deleting keys with logarithmic costs. However, keeping them balanced requires careful programming, and sometimes to deal with a high number of cases. In this paper, we present a functional version of a red-black tree variant called left-leaning, due to R. Sedgewick, which reduces the number of cases to be dealt with to a few ones. The code is rather concise, but reasoning about its correctness requires a rather large effort. We provide formal preconditions and postconditions for all the functions, prove their termination, and that the code satisfies its specifications. The proof is assertional, and consists of interspersing enough assertions among the code in order to help the verification tool to discharge the proof obligations. We have used the Dafny verification platform, which provides the programming language, the assertion language, and the verifier. To our knowledge, this is the first assertional proof of this data structure, and also one of the few ones including deletion.
引用
收藏
页码:767 / 791
页数:25
相关论文
共 50 条
  • [1] An Assertional Proof of Red–Black Trees Using Dafny
    Ricardo Peña
    [J]. Journal of Automated Reasoning, 2020, 64 : 767 - 791
  • [2] RED-BLACK TREES
    SCHNEIER, B
    [J]. DR DOBBS JOURNAL, 1992, 17 (04): : 42 - &
  • [3] Auto-Active Proof of Red-Black Trees in SPARK
    Dross, Claire
    Moy, Yannick
    [J]. NASA FORMAL METHODS (NFM 2017), 2017, 10227 : 68 - 83
  • [4] Relativistic red-black trees
    Howard, Philip W.
    Walpole, Jonathan
    [J]. CONCURRENCY AND COMPUTATION-PRACTICE & EXPERIENCE, 2014, 26 (16): : 2684 - 2712
  • [5] Red-black trees with types
    Kahrs, S
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2001, 11 : 425 - 432
  • [6] Relaxed balanced red-black trees
    Hanke, S
    Ottmann, T
    Soisalon-Soininen, E
    [J]. ALGORITHMS AND COMPLEXITY, 1997, 1203 : 193 - 204
  • [7] Group updates for red-black trees
    Hanke, S
    Soisalon-Soininen, E
    [J]. ALGORITHMS AND COMPLEXITY, 2000, 1767 : 253 - 262
  • [8] Parallel algorithms for red-black trees
    Park, H
    Park, K
    [J]. THEORETICAL COMPUTER SCIENCE, 2001, 262 (1-2) : 415 - 435
  • [9] STL's red-black trees
    Shankel, J
    [J]. DR DOBBS JOURNAL, 1998, 23 (04): : 54 - +
  • [10] Relaxed red-black trees with group updates
    Larsen, KS
    [J]. ACTA INFORMATICA, 2002, 38 (08) : 565 - 586