skip to main content
10.1145/1328408.1328417acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article

Mechanical verification of refactorings

Published:07 January 2008Publication History

ABSTRACT

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 correctimplementations from mechanised proofs.

References

  1. Z. M. Ariola and S. Blom. Lambda Calculi Plus Letrec. Vrije Universiteit, Faculteit der Wiskunde en Informatica, 1997.Google ScholarGoogle Scholar
  2. HP Barendregt. The Lambda Calculus, its Syntax and Semantics. North-Holland, 1984.Google ScholarGoogle Scholar
  3. S. Berghofer and C. Urban. A Head-to-Head Comparison of de Bruijn Indices and Names. Electronic Notes in Theoretical Computer Science, 174(5):53--67, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Blazy, Z. Dargaye, and X. Leroy. Formal Verification of a C Compiler Front-end. Symp. on Formal Methods, pages 460--475, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. M. L. Cornélio. Refactorings as Formal Refinements. PhD thesis, Universidade Federal de Pernambuco, 2004.Google ScholarGoogle Scholar
  6. N. G. de Bruijn. Lambda-calculus notation with nameless dummies: a tool for automatic formula manipulation with application to the Church-Rosser theorem. Indag. Math, 34(5):381--392, 1972.Google ScholarGoogle ScholarCross RefCross Ref
  7. Ran Ettinger. Refactoring via Program Slicing and Sliding. PhD thesis, Oxford University Computing Laboratory, June 2007.Google ScholarGoogle Scholar
  8. A. Garrido. Program Refactoring in the Presence of Preprocessor Directives. PhD thesis, University of Illinois at Urbana-Champaign, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Garrido and J. Meseguer. Formal Specification and Verification of Java Refactorings. Proceedings of the Sixth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM'06)-Volume 00, pages 165--174, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. Glesner, J. Leitner, and J. O. Blech. Coinductive Verification of Program Optimizations Using Similarity Relations. Electronic Notes in Theoretical Computer Science, 176(3):61--77, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. J. C. Gordon and T. F. Melham. Introduction to HOL: a theorem proving environment for higher order logic. Cambridge University Press New York, NY, USA, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. W. G. Griswold. Program Restructuring as an Aid to Software Maintenance. PhD thesis, University of Washington, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. P. Jones et al. Haskell 98 language and libraries. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  14. A. C. Junior, L. Silva, and M. Cornélio. Using CafeOBJ to Mechanise Refactoring Proofs and Application. Electronic Notes in Theoretical Computer Science, 184:39--61, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. X. Leroy. Formal certification of a compiler back-end or: programming a compiler with a proof assistant. ACM SIGPLAN Notices, 41(1):42--54, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Huiqing Li. Refactoring Haskell Programs. PhD thesis, Computing Laboratory, University of Kent, September 2006.Google ScholarGoogle Scholar
  17. Huiqing Li and Simon Thompson. Tool support for refactoring functional programs. In ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, January 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Huiqing Li, Simon Thompson, László Lövei, Zoltán Horváth, Tamás Kozsik, Anikó Vig, and Tamás Nagy. Refactoring erlang programs. In The Proceedings of 12th International Erlang/OTP User Conference, Stockholm, Sweden, November 2006.Google ScholarGoogle Scholar
  19. Y. Minamide and K. Okuma. Verifying CPS transformations in Isabelle/HOL. In Proceedings of the 2003 ACM SIGPLAN workshop on Mechanized reasoning about languages with variable binding., pages 1--8. ACM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. Isabelle/HOL: A Proof Assistant for Higher--Order Logic, volume 2283 of LNCS. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Michael Norrish. C formalised in HOL. PhD thesis, Computer Laboratory, University of Cambridge, 1998.Google ScholarGoogle Scholar
  22. G. D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, 5(3):223--255, 1977.Google ScholarGoogle ScholarCross RefCross Ref
  23. D. B. Roberts. Practical Analysis for Refactoring. PhD thesis, University of Illinois at Urbana-Champaign, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Peter Sewell, Francesco Zappa Nardelli, Scott Owens, Gilles Peskine, Thomas Ridge, Susmit Sarkar, and Rok Strniša. Ott: Effective Tool Support for the Working Semanticist. 2007. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Nik Sultana. Verification of refactorings in Isabelle/HOL. Master's thesis, University of Kent, 2007.Google ScholarGoogle Scholar
  26. C. Urban and C. Tasson. Nominal techniques in Isabelle/HOL. CADE-20, 3632, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. M. M. Wenzel. Isabelle, Isar-a Versatile Environment for Human Readable Formal Proof Documents. PhD thesis, Technische Universität Munchen, 2002.Google ScholarGoogle Scholar

Index Terms

  1. Mechanical verification of refactorings

                  Recommendations

                  Comments

                  Login options

                  Check if you have access through your login credentials or your institution to get full access on this article.

                  Sign in
                  • Published in

                    cover image ACM Conferences
                    PEPM '08: Proceedings of the 2008 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
                    January 2008
                    214 pages
                    ISBN:9781595939777
                    DOI:10.1145/1328408

                    Copyright © 2008 ACM

                    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                    Publisher

                    Association for Computing Machinery

                    New York, NY, United States

                    Publication History

                    • Published: 7 January 2008

                    Permissions

                    Request permissions about this article.

                    Request Permissions

                    Check for updates

                    Qualifiers

                    • research-article

                    Acceptance Rates

                    Overall Acceptance Rate66of120submissions,55%

                  PDF Format

                  View or Download as a PDF file.

                  PDF

                  eReader

                  View online with eReader.

                  eReader