Table of Contents
Fetching ...

Flexible Correct-by-Construction Programming

Tobias Runge, Tabea Bordis, Alex Potanin, Thomas Thüm, Ina Schaefer

TL;DR

This work revisits Correctness-by-Construction (CbC) and identifies a rigidity barrier due to fixed refinement rules and tool dependencies. It introduces two flexible successors, CbC-Block and TraitCbC: CbC-Block lets a refiner replace an abstract statement with a verifiable block of code, while TraitCbC uses trait-based method composition to guarantee correctness without refinement steps. The paper formalizes TraitCbC with a core calculus (syntax, typing, reduction, flattening) and proves soundness, and it details a CorC-based implementation for both CbC-Block and TraitCbC, including a user study for CbC-Block and a feasibility evaluation for TraitCbC. Together, these approaches broaden the practical applicability of constructive program verification, enabling incremental development and reuse in more scalable or language-diverse settings, while preserving correctness guarantees through structured verification.

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.

Flexible Correct-by-Construction Programming

TL;DR

This work revisits Correctness-by-Construction (CbC) and identifies a rigidity barrier due to fixed refinement rules and tool dependencies. It introduces two flexible successors, CbC-Block and TraitCbC: CbC-Block lets a refiner replace an abstract statement with a verifiable block of code, while TraitCbC uses trait-based method composition to guarantee correctness without refinement steps. The paper formalizes TraitCbC with a core calculus (syntax, typing, reduction, flattening) and proves soundness, and it details a CorC-based implementation for both CbC-Block and TraitCbC, including a user study for CbC-Block and a feasibility evaluation for TraitCbC. Together, these approaches broaden the practical applicability of constructive program verification, enabling incremental development and reuse in more scalable or language-diverse settings, while preserving correctness guarantees through structured verification.

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.
Paper Structure (30 sections, 4 theorems, 1 equation, 4 figures, 1 table)

This paper contains 30 sections, 4 theorems, 1 equation, 4 figures, 1 table.

Key Result

Lemma 4.6

If $\mathit{Ds}(t1) = \mathit{Body}_1$, $\mathit{Ds}(t2) = \mathit{Body}_2$, $\mathit{Ds}(\mathit{Name}) = \mathit{Body}$, $\mathit{Ds}; t_1 \vdash \mathit{Body}_1 : \mathit{OK}$, ${}_{}\quad$$\mathit{Ds}; t_2 \vdash \mathit{Body}_2 : \mathit{OK}$, and $\mathit{Body}_1 + \mathit{Body}_2=\mathit{Body

Figures (4)

  • Figure 1: Syntax of the trait system
  • Figure 2: Expression typing rules of TraitCbC
  • Figure 3: Reduction rules of TraitCbC
  • Figure 4: Flattening rules of TraitCbC

Theorems & Definitions (13)

  • Definition 4.1: All Methods
  • Definition 4.2: Body Composition
  • Definition 4.3: Methods Composition
  • Definition 4.4: Method Composition
  • Definition 4.5: Body Abstraction
  • Lemma 4.6: Composition correct
  • proof
  • Lemma 4.7: MakeAbstract correct
  • proof
  • Theorem 4.8: General Soundness
  • ...and 3 more