The spirit of ghost code

Jean Christophe Filliâtre, Léon Gondelman, Andrei Paskevich

Research output: Contribution to journalArticlepeer-review

Abstract

In the context of deductive program verification, ghost code is a part of the program that is added for the purpose of specification. Ghost code must not interfere with regular code, in the sense that it can be erased without observable difference in the program outcome. In particular, ghost data cannot participate in regular computations and ghost code cannot mutate regular data or diverge. The idea exists in the folklore since the early notion of auxiliary variables and is implemented in many state-of-the-art program verification tools. However, ghost code deserves rigorous definition and treatment, and few formalizations exist. In this article, we describe a simple ML-style programming language with mutable state and ghost code. Non-interference is ensured by a type system with effects, which allows, notably, the same data types and functions to be used in both regular and ghost code. We define the procedure of ghost code erasure and we prove its safety using bisimulation. A similar type system, with numerous extensions which we briefly discuss, is implemented in the program verification environment Why3.

Original languageEnglish
Pages (from-to)152-174
Number of pages23
JournalFormal Methods in System Design
Volume48
Issue number3
DOIs
Publication statusPublished - 1 Jun 2016
Externally publishedYes

Keywords

  • Deductive software verification
  • Ghost code
  • Why3

Fingerprint

Dive into the research topics of 'The spirit of ghost code'. Together they form a unique fingerprint.

Cite this