Skip to main content
QUICK REVIEW

[论文解读] Flexible Correct-by-Construction Programming

Tobias Runge, Tabea Bordis|arXiv (Cornell University)|Nov 28, 2022
Software Engineering Research参考文献 56被引用 1
一句话总结

本文提出了 CbC-Block 和 TraitCbC 作为 Correct-by-Construction(CbC)编程的灵活扩展,使程序开发更具适应性,同时保持正确性保证。CbC-Block 允许一次性细化多个语句块,减少严格的逐步细化过程;而 TraitCbC 则利用特质和方法组合,支持模块化、可重用的正确性保持设计。两种方法均保留了 CbC 的核心优势——结构化、增量式正确性——同时提升了可用性并降低了开发开销。

ABSTRACT

Abstract. Correctness-by-Construction (CbC) is an incremental program construction process to construct functionally correct programs. The programs are constructed stepwise along with a specification that is inherently guaranteed to be satisfied. CbC is complex to use without specialized tool support, since it needs a set of predefined refinement rules of fixed granularity which are additional rules on top of the programming language. Each refinement rule introduces a specific programming statement and developers cannot depart from these rules to construct programs. CbC allows to develop software in a structured and incremental way to ensure correctness, but the limited flexibility is a disadvantage of CbC. In this work, we compare classic CbC with CbC-Block and TraitCbC. Both approaches CbC-Block and TraitCbC, are related to CbC, but they have new language constructs that enable a more flexible software construction approach. We provide for both approaches a programming guideline, which similar to CbC, leads to well-structured programs. CbC-Block extends CbC by adding a refinement rule to insert any block of statements. Therefore, we introduce CbC-Block as an extension of CbC. TraitCbC implements correctness-by-construction on the basis of traits with specified methods. We formally introduce TraitCbC and prove soundness of the construction strategy. All three development approaches are qualitatively compared regarding their programming constructs, tool support, and usability to assess which is best suited for certain tasks and developers.

研究动机与目标

  • 为解决经典 Correct-by-Construction(CbC)编程的僵化性,该编程方法强制执行严格的细粒度细化规则,限制了开发者的灵活性。
  • 提出 CbC-Block,作为 CbC 的扩展,引入块级细化规则,将多个细化步骤合并为单一步骤,实现结构化细化。
  • 设计 TraitCbC,一种基于特质的方法,用方法组合和参数化规格替代基于规则的细化,以提升模块化和代码重用性。
  • 形式化定义并证明 TraitCbC 的正确性,确保通过组合保持正确性。
  • 从编程构造、工具支持和可用性等方面,定性比较经典 CbC、CbC-Block 和 TraitCbC,以根据开发情境指导采纳。

提出的方法

  • CbC-Block 通过引入新细化规则扩展经典 CbC,允许在单一步骤中引入多个语句(如赋值、条件语句、循环)的块。
  • CbC-Block 中的每个块均带有前置条件/后置条件规格说明,确保在一次性引入多个语句时仍能保持正确性。
  • TraitCbC 使用带有指定方法的特质来建模程序,每个方法均关联正式规格说明,支持模块化、可组合的正确性保证开发。
  • 该方法使用参数化规格语言表达特质的前置条件和后置条件,支持行为规格的灵活与可扩展表达。
  • 正式证明了 TraitCbC 构造策略的正确性,确保通过特质组合构建的任何程序均满足其规格。
  • 本文对三种方法——经典 CbC、CbC-Block 和 TraitCbC——进行了定性比较,评估其编程构造、工具需求和实际可用性。

实验结果

研究问题

  • RQ1如何在不牺牲正确性保证的前提下,降低经典 Correct-by-Construction(CbC)编程的僵化性?
  • RQ2CbC-Block 的设计与形式化基础是什么?它如何支持程序构建中更灵活的块级细化?
  • RQ3TraitCbC 如何通过基于特质的组合和方法规格实现正确性保证?
  • RQ4经典 CbC、CbC-Block 和 TraitCbC 在编程构造、工具支持和可用性方面的主要差异是什么?
  • RQ5三种方法中,哪一种最适合不同的软件开发任务和团队情境?

主要发现

  • CbC-Block 通过允许在单一步骤中引入语句块,成功减少了细化步骤的数量,提升了开发效率,同时保持了正确性。
  • CbC-Block 中引入的块细化规则在不损害 CbC 方法固有正确性保证的前提下,提升了灵活性。
  • TraitCbC 通过利用特质和方法组合,提供了一种模块化且可重用的正确性保证方法,支持更好的代码组织与重用。
  • TraitCbC 的形式化包含正确性证明,确保通过其规则构建的任何程序均满足其规格。
  • 定性比较显示,CbC-Block 和 TraitCbC 均在可用性方面优于经典 CbC,其中 CbC-Block 强调步骤压缩,而 TraitCbC 强调模块化与重用。
  • 作者结论认为,未来工作应包括用户研究,以实证评估三种方法在开发时间、错误率和开发者偏好方面的表现。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。