Skip to main content
Article thumbnail
Location of Repository

Mechanical Verification of Refactorings

By Nik Sultana and Simon Thompson


In this paper we describe the formal verification of refactorings for untyped and typed lambda-calculi. This verification is performed in the proof assistant Isabelle/HOL. Refactorings are program transformations applied to improve the design of source code. Well-structured source code is easier and cheaper to maintain, and this motivates the use of refactoring. These transformations have been implemented as programmer tools and, as with other metaprogramming tools, it is desirable that implementations of refactorings are correct. For a refactoring to be correct the refactored program must be identical in behaviour to the original program. Since refactorings are source-to-source transformations, concrete program information matters: for example, names (of variables, procedures, etc) and program layout should also be preserved by refactoring. This is a particular characteristic of refactorings since general program transformations operate over machine representations of programs, rather than readable source code. The paper describes the formalisation adopted, and the alternatives explored. It also reflects on some of the difficulties of performing such formalisations, the interaction between refactoring and phases such as type-checking and parsing, and the generation of correct implementations from mechanised proofs

Topics: QA76
Publisher: Assoc of Computing Machinery
Year: 2008
OAI identifier:

Suggested articles


  1. (1997). Lambda Calculi Plus Letrec. Vrije Universiteit, Faculteit der Wiskunde en Informatica,
  2. (1984). The Lambda Calculus, its Syntax and Semantics. doi
  3. (2007). A Head-to-Head Comparison of de Bruijn Indices and Names. doi
  4. (2006). Formal Verification of a C Compiler Front-end. doi
  5. (2004). Refactorings as Formal Refinements.
  6. (1972). Lambda-calculus notation with nameless dummies: a tool for automatic formula manipulation with application to the ChurchRosser theorem. doi
  7. (2007). Refactoring via Program Slicing and Sliding. doi
  8. (2005). Program Refactoring in the Presence of Preprocessor Directives.
  9. (2006). Formal Specification and Verification of Java Refactorings. doi
  10. (2007). Coinductive Verification of Program Optimizations Using Similarity Relations. doi
  11. (1993). Introduction to HOL: a theorem proving environment for higher order logic. doi
  12. (2003). Haskell 98 language and libraries.
  13. (2007). Using CafeOBJ to Mechanise Refactoring Proofs and Application. doi
  14. (2006). Formal certification of a compiler back-end or: programming a compiler with a proof assistant. doi
  15. (2006). Refactoring Haskell Programs. doi
  16. (2008). Tool support for refactoring functional programs. doi
  17. (2006). Refactoring erlang programs.
  18. (2003). Verifying CPS transformations in Isabelle/HOL. doi
  19. (2002). Isabelle/HOL: A Proof Assistant for Higher-Order Logic, doi
  20. (1998). C formalised in HOL.
  21. (1977). LCF considered as a programming language. doi
  22. (1999). Practical Analysis for Refactoring.
  23. (2007). Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strnisˇa. Ott: Effective Tool Support for the Working Semanticist. doi
  24. (2007). Verification of refactorings in Isabelle/HOL. Master’s thesis,
  25. (2002). Isar-a Versatile Environment for Human Readable Formal Proof Documents.
  26. (2006). L´ aszl´ o L¨ ovei, Zolt´ an Horv´ ath, Tam´ as Kozsik, Anik´ o V´ ıg, and Tam´ as Nagy. Refactoring erlang programs.
  27. (2007). Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strniˇ sa. Ott: Effective Tool Support for the Working Semanticist. doi

To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.