skip to main content
10.1145/1173706.1173723acmconferencesArticle/Chapter ViewAbstractPublication PagesgpceConference Proceedingsconference-collections
Article

Expressing heap-shape contracts in linear logic

Published:22 October 2006Publication History

ABSTRACT

Contracts (dynamically checked programmer assertions) are a widely accepted mechanism for specifying, checking and documenting properties of software components. Most, if not all, contract systems expect programmers to use the native programming language to express their program invariants. While this is most effective for many simple invariants, expressing properties of data structures and aliasing patterns can be extremely complicated. If written in the native language in an unstructured way, such contracts are bound to be unclear and ineffective as documentation. In this paper, we show how to use linear logic as a language of contracts for an imperative programming language. The high-level nature of our linear logical contracts makes specifying memory shape and aliasing properties of complex recursive data structures easy. Moreover, since we give our logic a clear, compositional semantics, the contracts serve as effective, executable documentation for programmer expectations. In order to evaluate the truth of our linear logical contracts at run time, we use a modified version of LolliMon, a linear logic programming language.

References

  1. A. Ahmed and D. Walker. The logical approach to stack typing. In ACM SIGPLAN Workshop on Types in Language Design and Implementation, New Orleans, Jan. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. W. Appel and D. A. McAllester. An indexed model of recursive types for foundational proof-carrying code. Programming Languages and Systems, 23(5):657--683, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. Birkedal, N. Torp-Smith, and J. Reynolds. Local reasoning about a copying garbage collector. In ACM Symposium on Principles of Programming Languages, pages 220--231, Venice, Italy, Jan. 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming, pages 48--59, New York, NY, USA, 2002. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Hastings and B. Joyce. Fast detection of memory leaks and access errors. In Proceedings of the Winter '92 USENIX conference, pages 125--136. USENIX Association, 1992.]]Google ScholarGoogle Scholar
  6. M. Hauswirth and T. M. Chilimbi. Low-overhead memory leak detection using adaptive statistical profiling. In ASPLOS, pages 156--164, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. J. S. Hodas and D. Miller. Logic programming in a fragment of intuitionistic linear logic. In Papers presented at the IEEE symposium on Logic in computer science, pages 327--365, Orlando, FL, USA, 1994. Academic Press, Inc.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. C. Holt and J. R. Cordy. The Turing programming language. Commun. ACM, 31(12):1410--1423, 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. Ishtiaq and P. O'Hearn. BI as an assertion language for mutable data structures. In Twenty-Eighth ACM Symposium on Principles of Programming Languages, pages 14--26, London, UK, Jan. 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. L. Jia, F. Spalding, D. Walker, and N. Glew. Certifying compilation for a language with stack allocation. In Proceedings of the Twentieth Annual IEEE Symp. on Logic in Computer Science, LICS 2005, 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. L. Jia and D. Walker. ILC: A foundation for automated reasoning about pointer programs. In European Symposium on Programming Languages, Apr. 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. López, F. Pfenning, J. Polakow, and K. Watkins. Monadic concurrent linear logic programming. In PPDP '05, pages 35--46, New York, NY, USA, 2005. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. P. López and J. Polakow. Implementing efficient resource management for linear logic programming. In Logic for Programming Artificial Intelligence and Reasoning (LPAR), pages 528--543, 2004.]]Google ScholarGoogle Scholar
  14. D. C. Luckham. Programming with Specifications: An Introduction to Anna, a Language for Specifying ADA Programs. Springer-Verlag New York, Inc., Secaucus, NJ, USA, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. B. Meyer. Eiffel: programming for reusability and extendibility. SIGPLAN Not., 22(2):85--94, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. B. Meyer. Eiffel: the language. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. G. Morrisett, A. Ahmed, and M. Fluet. L3: A linear language with locations. In Seventh International Conference on Typed Lambda Calculi and Applications, Apr. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. P. O'Hearn and D. Pym. The logic of bunched implications. Bulletin of Symbolic Logic, 5(2):215--244, 1999.]]Google ScholarGoogle ScholarCross RefCross Ref
  19. P. O'Hearn, J. Reynolds, and H. Yang. Local reasoning about programs that alter data structures. In Computer Science Logic, number 2142 in LNCS, pages 1--19, Paris, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. L. Parnas. A technique for software module specification with examples. Commun. ACM, 15(5):330--336, 1972.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Programming with assertions. http://java.sun.com/j2se/1.4.2/docs /guide/lang/assert.html.]]Google ScholarGoogle Scholar
  22. J. C. Reynolds. Separation logic: A logic for shared mutable data structures. In Proceedings of the 17th Annual IEEE Symposium on Logic in Computer Science, pages 55--74. 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Expressing heap-shape contracts in linear logic

          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
            GPCE '06: Proceedings of the 5th international conference on Generative programming and component engineering
            October 2006
            310 pages
            ISBN:1595932372
            DOI:10.1145/1173706

            Copyright © 2006 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: 22 October 2006

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            Overall Acceptance Rate56of180submissions,31%

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader